summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-06-29 18:54:12 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-06-29 18:54:12 +0000
commitcf33d69c641c5a5686bb7f1cd4a5d230de07ec47 (patch)
tree52a2d24c6a5828e8439e5f951ab44da4394c6c5a /sys
parentd422819a886769c2894bc215462b41c8a8e1aad5 (diff)
provide if_attachhead(), and make if_loop use it
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if.c33
-rw-r--r--sys/net/if.h3
-rw-r--r--sys/net/if_loop.c4
3 files changed, 30 insertions, 10 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index b3da97849c1..04828b533e8 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.9 1996/05/10 12:31:07 deraadt Exp $ */
+/* $OpenBSD: if.c,v 1.10 1996/06/29 18:54:08 deraadt Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -78,8 +78,8 @@ struct ifaddr **ifnet_addrs;
* Attach an interface to the
* list of "active" interfaces.
*/
-void
-if_attach(ifp)
+static void
+if_attachsetup(ifp)
struct ifnet *ifp;
{
unsigned socksize, ifasize;
@@ -88,10 +88,6 @@ if_attach(ifp)
register struct ifaddr *ifa;
static int if_indexlim = 8;
- if (if_index == 0)
- TAILQ_INIT(&ifnet);
- TAILQ_INIT(&ifp->if_addrlist);
- TAILQ_INSERT_TAIL(&ifnet, ifp, if_list);
ifp->if_index = ++if_index;
if (ifnet_addrs == 0 || if_index >= if_indexlim) {
unsigned n = (if_indexlim <<= 1) * sizeof(ifa);
@@ -135,6 +131,29 @@ if_attach(ifp)
while (namelen != 0)
sdl->sdl_data[--namelen] = 0xff;
}
+
+void
+if_attachhead(ifp)
+ struct ifnet *ifp;
+{
+ if (if_index == 0)
+ TAILQ_INIT(&ifnet);
+ TAILQ_INIT(&ifp->if_addrlist);
+ TAILQ_INSERT_HEAD(&ifnet, ifp, if_list);
+ if_attachsetup(ifp);
+}
+
+void
+if_attach(ifp)
+ struct ifnet *ifp;
+{
+ if (if_index == 0)
+ TAILQ_INIT(&ifnet);
+ TAILQ_INIT(&ifp->if_addrlist);
+ TAILQ_INSERT_TAIL(&ifnet, ifp, if_list);
+ if_attachsetup(ifp);
+}
+
/*
* Locate an interface based on a complete address.
*/
diff --git a/sys/net/if.h b/sys/net/if.h
index db86882d94d..94dc4f9b932 100644
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.h,v 1.5 1996/05/10 12:31:07 deraadt Exp $ */
+/* $OpenBSD: if.h,v 1.6 1996/06/29 18:54:10 deraadt Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
@@ -337,6 +337,7 @@ int ether_output __P((struct ifnet *,
char *ether_sprintf __P((u_char *));
void if_attach __P((struct ifnet *));
+void if_attachtail __P((struct ifnet *));
void if_down __P((struct ifnet *));
void if_qflush __P((struct ifqueue *));
void if_slowtimo __P((void *));
diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c
index a15519e3242..d1e36af3962 100644
--- a/sys/net/if_loop.c
+++ b/sys/net/if_loop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_loop.c,v 1.5 1996/05/10 12:31:09 deraadt Exp $ */
+/* $OpenBSD: if_loop.c,v 1.6 1996/06/29 18:54:11 deraadt Exp $ */
/* $NetBSD: if_loop.c,v 1.15 1996/05/07 02:40:33 thorpej Exp $ */
/*
@@ -107,7 +107,7 @@ loopattach(n)
ifp->if_type = IFT_LOOP;
ifp->if_hdrlen = 0;
ifp->if_addrlen = 0;
- if_attach(ifp);
+ if_attachhead(ifp);
#if NBPFILTER > 0
bpfattach(&ifp->if_bpf, ifp, DLT_NULL, sizeof(u_int));
#endif