Date: Tue, 1 May 2012 17:10:12 GMT From: Ed Maste <emaste@freebsd.org> To: freebsd-net@FreeBSD.org Subject: kern/138620 [patch] Sysctl for direct BPF writes to lagg child ports Message-ID: <201205011710.q41HACc2077075@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/138620; it has been noted by GNATS. From: Ed Maste <emaste@freebsd.org> To: <bug-followup@freebsd.org>, <sten@blinkenlights.nl> Cc: Subject: kern/138620 [patch] Sysctl for direct BPF writes to lagg child ports Date: Tue, 1 May 2012 13:08:01 -0400 --jRHKVT23PllUwdXP Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline The attached patch adds a sysctl to enable or disable the behaviour you're looking for (direct BPF writes to the underlying lagg child ports). I intend to commit it shortly after review / test. --jRHKVT23PllUwdXP Content-Type: text/plain; charset="us-ascii" Content-Disposition: attachment; filename="if_lagg.c.diff" Index: if_lagg.c =================================================================== --- if_lagg.c (revision 234896) +++ if_lagg.c (working copy) @@ -177,6 +177,10 @@ SYSCTL_INT(_net_link_lagg, OID_AUTO, default_use_flowid, CTLFLAG_RW, &def_use_flowid, 0, "Default setting for using flow id for load sharing"); +static int lagg_tx_child = 0; /* Direct tx to child interface */ +SYSCTL_INT(_net_link_lagg, OID_AUTO, lagg_tx_child, CTLFLAG_RW, + &lagg_tx_child, 0, + "Allow direct writes to child ports (e.g. via BPF)"); static int lagg_modevent(module_t mod, int type, void *data) @@ -764,6 +768,9 @@ return (EINVAL); } +/* + * For direct output to child ports. + */ static int lagg_port_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, struct route *ro) @@ -775,6 +782,8 @@ switch (dst->sa_family) { case pseudo_AF_HDRCMPLT: case AF_UNSPEC: + if (lagg_tx_child) + goto sendit; eh = (struct ether_header *)dst->sa_data; type = eh->ether_type; break; @@ -786,12 +795,15 @@ */ switch (ntohs(type)) { case ETHERTYPE_PAE: /* EAPOL PAE/802.1x */ - return ((*lp->lp_output)(ifp, m, dst, ro)); + goto sendit; } /* drop any other frames */ m_freem(m); return (EBUSY); + +sendit: + return ((*lp->lp_output)(ifp, m, dst, ro)); } static void --jRHKVT23PllUwdXP--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205011710.q41HACc2077075>