raw interfaces brought up to date
[unix-history] / usr / src / sys / net / if.c
index c09068a..e0b3422 100644 (file)
@@ -1,4 +1,4 @@
-/*     if.c    4.3     81/11/26        */
+/*     if.c    4.6     81/12/07        */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -6,6 +6,34 @@
 #include "../net/in_systm.h"
 #include "../net/if.h"
 
 #include "../net/in_systm.h"
 #include "../net/if.h"
 
+ifinit()
+{
+       register struct ifnet *ifp;
+
+       for (ifp = ifnet; ifp; ifp = ifp->if_next)
+               if (ifp->if_init)
+                       (*ifp->if_init)();
+}
+
+ifubareset(uban)
+       int uban;
+{
+       register struct ifnet *ifp;
+
+       for (ifp = ifnet; ifp; ifp = ifp->if_next)
+               if (ifp->if_ubareset)
+                       (*ifp->if_ubareset)(uban);
+}
+
+if_attach(ifp)
+       struct ifnet *ifp;
+{
+
+COUNT(IF_ATTACH);
+       ifp->if_next = ifnet;
+       ifnet = ifp;
+}
+
 /*ARGSUSED*/
 struct ifnet *
 if_ifwithaddr(in)
 /*ARGSUSED*/
 struct ifnet *
 if_ifwithaddr(in)
@@ -36,6 +64,7 @@ COUNT(IF_IFONNETOF);
        return (ifp);
 }
 
        return (ifp);
 }
 
+/*ARGSUSED*/
 struct ifnet *
 if_gatewayfor(addr)
        struct in_addr addr;
 struct ifnet *
 if_gatewayfor(addr)
        struct in_addr addr;
@@ -44,3 +73,19 @@ if_gatewayfor(addr)
 COUNT(IF_GATEWAYFOR);
        return (0);
 }
 COUNT(IF_GATEWAYFOR);
        return (0);
 }
+
+struct in_addr
+if_makeaddr(net, host)
+       int net, host;
+{
+       u_long addr;
+
+       if (net < 128)
+               addr = (net << 24) | host;
+       else if (net < 65536)
+               addr = (net << 16) | host;
+       else
+               addr = (net << 8) | host;
+       addr = htonl(addr);
+       return (*(struct in_addr *)&addr);
+}