summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2015-09-28 08:24:53 +0000
committermpi <mpi@openbsd.org>2015-09-28 08:24:53 +0000
commitd1b1f37344e64c660afda742f37f32df2b8ddc01 (patch)
tree478b8c1a6029a3491258da434d9952b1af49a62d
parentRemove the "Quanta Transcode" device from the list of supported hardware. (diff)
downloadwireguard-openbsd-d1b1f37344e64c660afda742f37f32df2b8ddc01.tar.xz
wireguard-openbsd-d1b1f37344e64c660afda742f37f32df2b8ddc01.zip
Remove "if_tp" from the "struct ifnet".
Instead of violating a layer of abstraction by keeping per pseudo-driver informations in "struct ifnet", the port trunk is now passed as a cookie to the interface input handler (ifih). The time of per pseudo-driver hack in the network stack is over! ok mikeb@
-rw-r--r--sys/net/if_trunk.c10
-rw-r--r--sys/net/if_var.h3
2 files changed, 5 insertions, 8 deletions
diff --git a/sys/net/if_trunk.c b/sys/net/if_trunk.c
index 44550c77556..29f9327f288 100644
--- a/sys/net/if_trunk.c
+++ b/sys/net/if_trunk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_trunk.c,v 1.116 2015/09/24 14:46:22 mikeb Exp $ */
+/* $OpenBSD: if_trunk.c,v 1.117 2015/09/28 08:24:53 mpi Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -343,7 +343,6 @@ trunk_port_create(struct trunk_softc *tr, struct ifnet *ifp)
tp->tp_iftype = ifp->if_type;
ifp->if_type = IFT_IEEE8023ADLAG;
- ifp->if_tp = (caddr_t)tp;
tp->tp_ioctl = ifp->if_ioctl;
ifp->if_ioctl = trunk_port_ioctl;
@@ -437,7 +436,6 @@ trunk_port_destroy(struct trunk_port *tp)
ifp->if_ioctl = tp->tp_ioctl;
ifp->if_output = tp->tp_output;
- ifp->if_tp = NULL;
hook_disestablish(ifp->if_linkstatehooks, tp->lh_cookie);
hook_disestablish(ifp->if_detachhooks, tp->dh_cookie);
@@ -488,7 +486,7 @@ trunk_port_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
/* Should be checked by the caller */
if (ifp->if_type != IFT_IEEE8023ADLAG ||
- (tp = (struct trunk_port *)ifp->if_tp) == NULL ||
+ (tp = trunk_port_get(NULL, ifp)) == NULL ||
(tr = (struct trunk_softc *)tp->tp_trunk) == NULL) {
error = EINVAL;
goto fallback;
@@ -1070,8 +1068,8 @@ trunk_input(struct ifnet *ifp, struct mbuf *m, void *cookie)
if (ifp->if_type != IFT_IEEE8023ADLAG)
goto bad;
- if ((tp = (struct trunk_port *)ifp->if_tp) == NULL ||
- (tr = (struct trunk_softc *)tp->tp_trunk) == NULL)
+ tp = (struct trunk_port *)cookie;
+ if ((tr = (struct trunk_softc *)tp->tp_trunk) == NULL)
goto bad;
trifp = &tr->tr_ac.ac_if;
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index 8395a70ccd5..3e921c3f7e7 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_var.h,v 1.44 2015/09/27 05:23:50 dlg Exp $ */
+/* $OpenBSD: if_var.h,v 1.45 2015/09/28 08:24:53 mpi Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
@@ -132,7 +132,6 @@ struct ifnet { /* and the entries */
int if_pcount; /* number of promiscuous listeners */
caddr_t if_bpf; /* packet filter structure */
caddr_t if_bridgeport; /* used by bridge ports */
- caddr_t if_tp; /* used by trunk ports */
caddr_t if_pf_kif; /* pf interface abstraction */
union {
caddr_t carp_s; /* carp structure (used by !carp ifs) */