Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 May 2007 17:26:44 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 119918 for review
Message-ID:  <200705161726.l4GHQiC6041462@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=119918

Change 119918 by jhb@jhb_mutex on 2007/05/16 17:26:36

	Make BPF_CHECK_DIRECTION not contain if, but just test the condition.
	Also, invert it's sense so it reads better (it returns true if the
	direction is ok and false if the packet should be skipped).

Affected files ...

.. //depot/projects/smpng/sys/net/bpf.c#68 edit

Differences ...

==== //depot/projects/smpng/sys/net/bpf.c#68 (text+ko) ====

@@ -1321,8 +1321,8 @@
 }
 
 #define	BPF_CHECK_DIRECTION(d, m) \
-	if (((d)->bd_direction == BPF_D_IN && (m)->m_pkthdr.rcvif == NULL) || \
-	    ((d)->bd_direction == BPF_D_OUT && (m)->m_pkthdr.rcvif != NULL))
+	(((d)->bd_direction == BPF_D_IN && (m)->m_pkthdr.rcvif != NULL) || \
+	 ((d)->bd_direction == BPF_D_OUT && (m)->m_pkthdr.rcvif == NULL))
 
 /*
  * Incoming linkage from device drivers, when packet is in an mbuf chain.
@@ -1346,7 +1346,7 @@
 
 	BPFIF_LOCK(bp);
 	LIST_FOREACH(d, &bp->bif_dlist, bd_next) {
-		BPF_CHECK_DIRECTION(d, m)
+		if (!BPF_CHECK_DIRECTION(d, m))
 			continue;
 		BPFD_LOCK(d);
 		++d->bd_rcount;
@@ -1409,7 +1409,7 @@
 
 	BPFIF_LOCK(bp);
 	LIST_FOREACH(d, &bp->bif_dlist, bd_next) {
-		BPF_CHECK_DIRECTION(d, m)
+		if (!BPF_CHECK_DIRECTION(d, m))
 			continue;
 		BPFD_LOCK(d);
 		++d->bd_rcount;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705161726.l4GHQiC6041462>