Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Oct 2023 02:17:35 +0800
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        Justin Hibbits <jhibbits@freebsd.org>
Cc:        "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
Subject:   Re: git: c81dd8e5fe72 - main - bpf: Add IfAPI analogue for bpf_peers_present()
Message-ID:  <7C71BC94-FEBF-49C9-90B3-FA326BB75EA8@FreeBSD.org>
In-Reply-To: <C96636F5-D9B4-49EF-B526-A7A99455AFCB@FreeBSD.org>
References:  <202310131722.39DHM2b6077203@gitrepo.freebsd.org> <C96636F5-D9B4-49EF-B526-A7A99455AFCB@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_FB5A6B15-3D1D-44D2-8F02-E792D8D70297
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii



> On Oct 14, 2023, at 2:13 AM, Zhenlei Huang <zlei@FreeBSD.org> wrote:
>=20
>=20
>=20
>> On Oct 14, 2023, at 1:22 AM, Justin Hibbits <jhibbits@freebsd.org> =
wrote:
>>=20
>> The branch main has been updated by jhibbits:
>>=20
>> URL: =
https://cgit.FreeBSD.org/src/commit/?id=3Dc81dd8e5fe72d0c7ec055c8621bb2da3=
a3627abf
>>=20
>> commit c81dd8e5fe72d0c7ec055c8621bb2da3a3627abf
>> Author:     Justin Hibbits <jhibbits@FreeBSD.org>
>> AuthorDate: 2023-10-04 20:56:52 +0000
>> Commit:     Justin Hibbits <jhibbits@FreeBSD.org>
>> CommitDate: 2023-10-13 17:12:44 +0000
>>=20
>>   bpf: Add IfAPI analogue for bpf_peers_present()
>>=20
>>   An interface's bpf could feasibly not exist, in which case
>>   bpf_peers_present() would panic from a NULL pointer dereference.  =
Solve
>>   this by adding a new IfAPI that includes a NULL check.  Since this =
API
>=20
> The initial version DOES have NULL check. But that is redundant and =
removed
> from the committed version.

See https://reviews.freebsd.org/D42082 =
<https://reviews.freebsd.org/D42082>; .

>=20
>>   is used in only a handful of locations, it reduces the the NULL =
check
>>   scope over inserting the check into bpf_peers_present().
>>=20
>>   Sponsored by:   Juniper Networks, Inc.
>>   MFC after:      1 week
>> ---
>> sys/dev/firewire/if_fwip.c    |  4 ++--
>> sys/dev/hyperv/netvsc/if_hn.c |  4 ++--
>> sys/dev/my/if_my.c            |  2 +-
>> sys/dev/usb/usb_pf.c          |  4 +---
>> sys/net/bpf.c                 | 14 ++++++++++++++
>> sys/net/bpf.h                 |  1 +
>> 6 files changed, 21 insertions(+), 8 deletions(-)
>>=20
>> diff --git a/sys/dev/firewire/if_fwip.c b/sys/dev/firewire/if_fwip.c
>> index 5237c555d999..b698db6c9620 100644
>> --- a/sys/dev/firewire/if_fwip.c
>> +++ b/sys/dev/firewire/if_fwip.c
>> @@ -780,7 +780,7 @@ fwip_stream_input(struct fw_xferq *xferq)
>> 		 * Record the sender ID for possible BPF usage.
>> 		 */
>> 		src =3D ntohl(p[1]) >> 16;
>> -		if (bpf_peers_present(if_getbpf(ifp))) {
>> +		if (bpf_peers_present_if(ifp)) {
>> 			mtag =3D m_tag_alloc(MTAG_FIREWIRE,
>> 			    MTAG_FIREWIRE_SENDER_EUID,
>> 			    2*sizeof(uint32_t), M_NOWAIT);
>> @@ -880,7 +880,7 @@ fwip_unicast_input(struct fw_xfer *xfer)
>> 		goto done;
>> 	}
>>=20
>> -	if (bpf_peers_present(if_getbpf(ifp))) {
>> +	if (bpf_peers_present_if(ifp)) {
>> 		/*
>> 		 * Record the sender ID for possible BPF usage.
>> 		 */
>> diff --git a/sys/dev/hyperv/netvsc/if_hn.c =
b/sys/dev/hyperv/netvsc/if_hn.c
>> index 7d8e1914163e..f6f885873a79 100644
>> --- a/sys/dev/hyperv/netvsc/if_hn.c
>> +++ b/sys/dev/hyperv/netvsc/if_hn.c
>> @@ -3262,7 +3262,7 @@ hn_txpkt(if_t ifp, struct hn_tx_ring *txr, =
struct hn_txdesc *txd)
>> 	int error, send_failed =3D 0, has_bpf;
>>=20
>> again:
>> -	has_bpf =3D bpf_peers_present(if_getbpf(ifp));
>> +	has_bpf =3D bpf_peers_present_if(ifp);
>> 	if (has_bpf) {
>> 		/*
>> 		 * Make sure that this txd and any aggregated txds are =
not
>> @@ -5972,7 +5972,7 @@ hn_transmit(if_t ifp, struct mbuf *m)
>> 			omcast =3D (m->m_flags & M_MCAST) !=3D 0;
>>=20
>> 			if (sc->hn_xvf_flags & HN_XVFFLAG_ACCBPF) {
>> -				if (bpf_peers_present(if_getbpf(ifp))) {
>> +				if (bpf_peers_present_if(ifp)) {
>> 					m_bpf =3D m_copypacket(m, =
M_NOWAIT);
>> 					if (m_bpf =3D=3D NULL) {
>> 						/*
>> diff --git a/sys/dev/my/if_my.c b/sys/dev/my/if_my.c
>> index 2bf4573d337b..631c38df9dca 100644
>> --- a/sys/dev/my/if_my.c
>> +++ b/sys/dev/my/if_my.c
>> @@ -1152,7 +1152,7 @@ my_rxeof(struct my_softc * sc)
>> 		 * broadcast packet, multicast packet, matches our =
ethernet
>> 		 * address or the interface is in promiscuous mode.
>> 		 */
>> -		if (bpf_peers_present(if_getbpf(ifp))) {
>> +		if (bpf_peers_present_if(ifp)) {
>> 			bpf_mtap_if(ifp, m);
>> 			if (if_getflags(ifp) & IFF_PROMISC &&
>> 			    (bcmp(eh->ether_dhost, =
if_getlladdr(sc->my_ifp),
>> diff --git a/sys/dev/usb/usb_pf.c b/sys/dev/usb/usb_pf.c
>> index 43e819684857..4da59419a7c6 100644
>> --- a/sys/dev/usb/usb_pf.c
>> +++ b/sys/dev/usb/usb_pf.c
>> @@ -408,9 +408,7 @@ usbpf_xfertap(struct usb_xfer *xfer, int type)
>> 	bus =3D xfer->xroot->bus;
>>=20
>> 	/* sanity checks */
>> -	if (bus->ifp =3D=3D NULL || if_getbpf(bus->ifp) =3D=3D NULL)
>> -		return;
>> -	if (!bpf_peers_present(if_getbpf(bus->ifp)))
>> +	if (bus->ifp =3D=3D NULL || !bpf_peers_present_if(bus->ifp))
>> 		return;
>>=20
>> 	totlen =3D usbpf_xfer_precompute_size(xfer, type);
>> diff --git a/sys/net/bpf.c b/sys/net/bpf.c
>> index 8ca6e941e646..96420b709911 100644
>> --- a/sys/net/bpf.c
>> +++ b/sys/net/bpf.c
>> @@ -2879,6 +2879,14 @@ bpfdetach(struct ifnet *ifp)
>> 	BPF_UNLOCK();
>> }
>>=20
>> +bool
>> +bpf_peers_present_if(struct ifnet *ifp)
>> +{
>> +	struct bpf_if *bp =3D ifp->if_bpf;
>> +
>> +	return (bpf_peers_present(bp) > 0);
>> +}
>> +
>> /*
>> * Get a list of available data link type of the interface.
>> */
>> @@ -3162,6 +3170,12 @@ bpfdetach(struct ifnet *ifp)
>> {
>> }
>>=20
>> +bool
>> +bpf_peers_present_if(struct ifnet *ifp)
>> +{
>> +	return (false);
>> +}
>> +
>> u_int
>> bpf_filter(const struct bpf_insn *pc, u_char *p, u_int wirelen, u_int =
buflen)
>> {
>> diff --git a/sys/net/bpf.h b/sys/net/bpf.h
>> index 924dea5fc9f4..31968445aac1 100644
>> --- a/sys/net/bpf.h
>> +++ b/sys/net/bpf.h
>> @@ -428,6 +428,7 @@ void	 bpf_mtap2_if(struct ifnet *, void *, =
u_int, struct mbuf *);
>> void	 bpfattach(struct ifnet *, u_int, u_int);
>> void	 bpfattach2(struct ifnet *, u_int, u_int, struct bpf_if **);
>> void	 bpfdetach(struct ifnet *);
>> +bool	 bpf_peers_present_if(struct ifnet *);
>> #ifdef VIMAGE
>> int	 bpf_get_bp_params(struct bpf_if *, u_int *, u_int *);
>> #endif

Best regards,
Zhenlei


--Apple-Mail=_FB5A6B15-3D1D-44D2-8F02-E792D8D70297
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=us-ascii

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;" class=3D""><br =
class=3D""><div><br class=3D""><blockquote type=3D"cite" class=3D""><div =
class=3D"">On Oct 14, 2023, at 2:13 AM, Zhenlei Huang &lt;<a =
href=3D"mailto:zlei@FreeBSD.org" class=3D"">zlei@FreeBSD.org</a>&gt; =
wrote:</div><br class=3D"Apple-interchange-newline"><div class=3D""><meta =
charset=3D"UTF-8" class=3D""><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: Menlo-Regular; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><br style=3D"caret-color: rgb(0, 0, =
0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><blockquote type=3D"cite" =
style=3D"font-family: Menlo-Regular; font-size: 13px; font-style: =
normal; font-variant-caps: normal; font-weight: 400; letter-spacing: =
normal; orphans: auto; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; widows: auto; word-spacing: =
0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D"">On Oct 14, 2023, at 1:22 AM, Justin =
Hibbits &lt;<a href=3D"mailto:jhibbits@freebsd.org" =
class=3D"">jhibbits@freebsd.org</a>&gt; wrote:<br class=3D""><br =
class=3D"">The branch main has been updated by jhibbits:<br class=3D""><br=
 class=3D"">URL: <a =
href=3D"https://cgit.FreeBSD.org/src/commit/?id=3Dc81dd8e5fe72d0c7ec055c86=
21bb2da3a3627abf" =
class=3D"">https://cgit.FreeBSD.org/src/commit/?id=3Dc81dd8e5fe72d0c7ec055=
c8621bb2da3a3627abf</a><br class=3D""><br class=3D"">commit =
c81dd8e5fe72d0c7ec055c8621bb2da3a3627abf<br class=3D"">Author: =
&nbsp;&nbsp;&nbsp;&nbsp;Justin Hibbits &lt;<a =
href=3D"mailto:jhibbits@FreeBSD.org" =
class=3D"">jhibbits@FreeBSD.org</a>&gt;<br class=3D"">AuthorDate: =
2023-10-04 20:56:52 +0000<br class=3D"">Commit: =
&nbsp;&nbsp;&nbsp;&nbsp;Justin Hibbits &lt;<a =
href=3D"mailto:jhibbits@FreeBSD.org" =
class=3D"">jhibbits@FreeBSD.org</a>&gt;<br class=3D"">CommitDate: =
2023-10-13 17:12:44 +0000<br class=3D""><br class=3D"">&nbsp;&nbsp;bpf: =
Add IfAPI analogue for bpf_peers_present()<br class=3D""><br =
class=3D"">&nbsp;&nbsp;An interface's bpf could feasibly not exist, in =
which case<br class=3D"">&nbsp;&nbsp;bpf_peers_present() would panic =
from a NULL pointer dereference. &nbsp;Solve<br =
class=3D"">&nbsp;&nbsp;this by adding a new IfAPI that includes a NULL =
check. &nbsp;Since this API<br class=3D""></blockquote><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; =
font-size: 13px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;" class=3D"">The initial =
version DOES have NULL check. But that is redundant and =
removed</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;" class=3D"">from the =
committed version.</span><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: Menlo-Regular; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""></div></blockquote><div><br =
class=3D""></div><div>See&nbsp;<a =
href=3D"https://reviews.freebsd.org/D42082" =
class=3D"">https://reviews.freebsd.org/D42082</a>&nbsp;.</div><br =
class=3D""><blockquote type=3D"cite" class=3D""><div class=3D""><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; =
font-size: 13px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""><blockquote type=3D"cite" style=3D"font-family: =
Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; orphans: auto; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; =
-webkit-text-stroke-width: 0px; text-decoration: none;" =
class=3D"">&nbsp;&nbsp;is used in only a handful of locations, it =
reduces the the NULL check<br class=3D"">&nbsp;&nbsp;scope over =
inserting the check into bpf_peers_present().<br class=3D""><br =
class=3D"">&nbsp;&nbsp;Sponsored by: &nbsp;&nbsp;Juniper Networks, =
Inc.<br class=3D"">&nbsp;&nbsp;MFC after: =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 week<br class=3D"">---<br =
class=3D"">sys/dev/firewire/if_fwip.c &nbsp;&nbsp;&nbsp;| &nbsp;4 =
++--<br class=3D"">sys/dev/hyperv/netvsc/if_hn.c | &nbsp;4 ++--<br =
class=3D"">sys/dev/my/if_my.c =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| =
&nbsp;2 +-<br class=3D"">sys/dev/usb/usb_pf.c =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| &nbsp;4 +---<br =
class=3D"">sys/net/bpf.c =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;| 14 ++++++++++++++<br class=3D"">sys/net/bpf.h =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;| &nbsp;1 +<br class=3D"">6 files changed, 21 =
insertions(+), 8 deletions(-)<br class=3D""><br class=3D"">diff --git =
a/sys/dev/firewire/if_fwip.c b/sys/dev/firewire/if_fwip.c<br =
class=3D"">index 5237c555d999..b698db6c9620 100644<br class=3D"">--- =
a/sys/dev/firewire/if_fwip.c<br class=3D"">+++ =
b/sys/dev/firewire/if_fwip.c<br class=3D"">@@ -780,7 +780,7 @@ =
fwip_stream_input(struct fw_xferq *xferq)<br class=3D""><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>* Record the sender ID for =
possible BPF usage.<br class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>*/<br class=3D""><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>src =3D =
ntohl(p[1]) &gt;&gt; 16;<br class=3D"">-<span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span>if =
(bpf_peers_present(if_getbpf(ifp))) {<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>if =
(bpf_peers_present_if(ifp)) {<br class=3D""><span class=3D"Apple-tab-span"=
 style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span>mtag =3D =
m_tag_alloc(MTAG_FIREWIRE,<br class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>&nbsp;&nbsp;&nbsp;MTAG_FIREWI=
RE_SENDER_EUID,<br class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>&nbsp;&nbsp;&nbsp;2*sizeof(ui=
nt32_t), M_NOWAIT);<br class=3D"">@@ -880,7 +880,7 @@ =
fwip_unicast_input(struct fw_xfer *xfer)<br class=3D""><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>goto =
done;<br class=3D""><span class=3D"Apple-tab-span" style=3D"white-space: =
pre;">	</span>}<br class=3D""><br class=3D"">-<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>if =
(bpf_peers_present(if_getbpf(ifp))) {<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>if =
(bpf_peers_present_if(ifp)) {<br class=3D""><span class=3D"Apple-tab-span"=
 style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span>/*<br class=3D""><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>* Record the sender ID for =
possible BPF usage.<br class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>*/<br class=3D"">diff --git =
a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c<br =
class=3D"">index 7d8e1914163e..f6f885873a79 100644<br class=3D"">--- =
a/sys/dev/hyperv/netvsc/if_hn.c<br class=3D"">+++ =
b/sys/dev/hyperv/netvsc/if_hn.c<br class=3D"">@@ -3262,7 +3262,7 @@ =
hn_txpkt(if_t ifp, struct hn_tx_ring *txr, struct hn_txdesc *txd)<br =
class=3D""><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span>int error, send_failed =3D 0, has_bpf;<br class=3D""><br =
class=3D"">again:<br class=3D"">-<span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span>has_bpf =3D =
bpf_peers_present(if_getbpf(ifp));<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>has_bpf =3D=
 bpf_peers_present_if(ifp);<br class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span>if (has_bpf) {<br class=3D""><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>/*<br =
class=3D""><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span><span class=3D"Apple-converted-space">&nbsp;</span>* Make sure =
that this txd and any aggregated txds are not<br class=3D"">@@ -5972,7 =
+5972,7 @@ hn_transmit(if_t ifp, struct mbuf *m)<br class=3D""><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>omcast =3D =
(m-&gt;m_flags &amp; M_MCAST) !=3D 0;<br class=3D""><br class=3D""><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>if =
(sc-&gt;hn_xvf_flags &amp; HN_XVFFLAG_ACCBPF) {<br class=3D"">-<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>if =
(bpf_peers_present(if_getbpf(ifp))) {<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>if =
(bpf_peers_present_if(ifp)) {<br class=3D""><span class=3D"Apple-tab-span"=
 style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span>m_bpf =3D m_copypacket(m, =
M_NOWAIT);<br class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span>if (m_bpf =3D=3D NULL) {<br =
class=3D""><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span>/*<br class=3D"">diff --git a/sys/dev/my/if_my.c =
b/sys/dev/my/if_my.c<br class=3D"">index 2bf4573d337b..631c38df9dca =
100644<br class=3D"">--- a/sys/dev/my/if_my.c<br class=3D"">+++ =
b/sys/dev/my/if_my.c<br class=3D"">@@ -1152,7 +1152,7 @@ my_rxeof(struct =
my_softc * sc)<br class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>* broadcast packet, =
multicast packet, matches our ethernet<br class=3D""><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>* address or the interface =
is in promiscuous mode.<br class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>*/<br class=3D"">-<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>if =
(bpf_peers_present(if_getbpf(ifp))) {<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>if =
(bpf_peers_present_if(ifp)) {<br class=3D""><span class=3D"Apple-tab-span"=
 style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span>bpf_mtap_if(ifp, m);<br =
class=3D""><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span>if (if_getflags(ifp) &amp; IFF_PROMISC &amp;&amp;<br =
class=3D""><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span><span =
class=3D"Apple-converted-space">&nbsp;</span>&nbsp;&nbsp;&nbsp;(bcmp(eh-&g=
t;ether_dhost, if_getlladdr(sc-&gt;my_ifp),<br class=3D"">diff --git =
a/sys/dev/usb/usb_pf.c b/sys/dev/usb/usb_pf.c<br class=3D"">index =
43e819684857..4da59419a7c6 100644<br class=3D"">--- =
a/sys/dev/usb/usb_pf.c<br class=3D"">+++ b/sys/dev/usb/usb_pf.c<br =
class=3D"">@@ -408,9 +408,7 @@ usbpf_xfertap(struct usb_xfer *xfer, int =
type)<br class=3D""><span class=3D"Apple-tab-span" style=3D"white-space: =
pre;">	</span>bus =3D xfer-&gt;xroot-&gt;bus;<br class=3D""><br =
class=3D""><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span>/* sanity checks */<br class=3D"">-<span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span>if (bus-&gt;ifp =3D=3D NULL || =
if_getbpf(bus-&gt;ifp) =3D=3D NULL)<br class=3D"">-<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span>return;<br class=3D"">-<span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span>if =
(!bpf_peers_present(if_getbpf(bus-&gt;ifp)))<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>if =
(bus-&gt;ifp =3D=3D NULL || !bpf_peers_present_if(bus-&gt;ifp))<br =
class=3D""><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span>return;<br class=3D""><br class=3D""><span class=3D"Apple-tab-span"=
 style=3D"white-space: pre;">	</span>totlen =3D =
usbpf_xfer_precompute_size(xfer, type);<br class=3D"">diff --git =
a/sys/net/bpf.c b/sys/net/bpf.c<br class=3D"">index =
8ca6e941e646..96420b709911 100644<br class=3D"">--- a/sys/net/bpf.c<br =
class=3D"">+++ b/sys/net/bpf.c<br class=3D"">@@ -2879,6 +2879,14 @@ =
bpfdetach(struct ifnet *ifp)<br class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span>BPF_UNLOCK();<br class=3D"">}<br =
class=3D""><br class=3D"">+bool<br class=3D"">+bpf_peers_present_if(struct=
 ifnet *ifp)<br class=3D"">+{<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>struct =
bpf_if *bp =3D ifp-&gt;if_bpf;<br class=3D"">+<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>return =
(bpf_peers_present(bp) &gt; 0);<br class=3D"">+}<br class=3D"">+<br =
class=3D"">/*<br class=3D"">* Get a list of available data link type of =
the interface.<br class=3D"">*/<br class=3D"">@@ -3162,6 +3170,12 @@ =
bpfdetach(struct ifnet *ifp)<br class=3D"">{<br class=3D"">}<br =
class=3D""><br class=3D"">+bool<br class=3D"">+bpf_peers_present_if(struct=
 ifnet *ifp)<br class=3D"">+{<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span>return =
(false);<br class=3D"">+}<br class=3D"">+<br class=3D"">u_int<br =
class=3D"">bpf_filter(const struct bpf_insn *pc, u_char *p, u_int =
wirelen, u_int buflen)<br class=3D"">{<br class=3D"">diff --git =
a/sys/net/bpf.h b/sys/net/bpf.h<br class=3D"">index =
924dea5fc9f4..31968445aac1 100644<br class=3D"">--- a/sys/net/bpf.h<br =
class=3D"">+++ b/sys/net/bpf.h<br class=3D"">@@ -428,6 +428,7 @@ =
void<span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span><span =
class=3D"Apple-converted-space">&nbsp;</span>bpf_mtap2_if(struct ifnet =
*, void *, u_int, struct mbuf *);<br class=3D"">void<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>bpfattach(struct ifnet *, =
u_int, u_int);<br class=3D"">void<span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>bpfattach2(struct ifnet *, =
u_int, u_int, struct bpf_if **);<br class=3D"">void<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>bpfdetach(struct ifnet =
*);<br class=3D"">+bool<span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>bpf_peers_present_if(struct =
ifnet *);<br class=3D"">#ifdef VIMAGE<br class=3D"">int<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>bpf_get_bp_params(struct =
bpf_if *, u_int *, u_int *);<br =
class=3D"">#endif</blockquote></div></blockquote></div><br class=3D""><div=
 class=3D"">
<div>Best regards,</div><div>Zhenlei</div>

</div>
<br class=3D""></body></html>=

--Apple-Mail=_FB5A6B15-3D1D-44D2-8F02-E792D8D70297--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7C71BC94-FEBF-49C9-90B3-FA326BB75EA8>