svn commit: r232014 - head/sys/net

Andrew Thompson thompsa at FreeBSD.org
Thu Feb 23 00:59:22 UTC 2012


Author: thompsa
Date: Thu Feb 23 00:59:21 2012
New Revision: 232014
URL: http://svn.freebsd.org/changeset/base/232014

Log:
  bstp_input() always consumes the packet so remove the mbuf handling dance
  around it.
  
  Obtained from:	OpenBSD (r1.37)

Modified:
  head/sys/net/bridgestp.c
  head/sys/net/bridgestp.h
  head/sys/net/if_bridge.c

Modified: head/sys/net/bridgestp.c
==============================================================================
--- head/sys/net/bridgestp.c	Thu Feb 23 00:52:27 2012	(r232013)
+++ head/sys/net/bridgestp.c	Thu Feb 23 00:59:21 2012	(r232014)
@@ -446,7 +446,7 @@ bstp_pdu_flags(struct bstp_port *bp)
 	return (flags);
 }
 
-struct mbuf *
+void
 bstp_input(struct bstp_port *bp, struct ifnet *ifp, struct mbuf *m)
 {
 	struct bstp_state *bs = bp->bp_bs;
@@ -456,7 +456,7 @@ bstp_input(struct bstp_port *bp, struct 
 
 	if (bp->bp_active == 0) {
 		m_freem(m);
-		return (NULL);
+		return;
 	}
 
 	BSTP_LOCK(bs);
@@ -521,7 +521,6 @@ out:
 	BSTP_UNLOCK(bs);
 	if (m)
 		m_freem(m);
-	return (NULL);
 }
 
 static void

Modified: head/sys/net/bridgestp.h
==============================================================================
--- head/sys/net/bridgestp.h	Thu Feb 23 00:52:27 2012	(r232013)
+++ head/sys/net/bridgestp.h	Thu Feb 23 00:59:21 2012	(r232014)
@@ -392,6 +392,6 @@ int	bstp_set_edge(struct bstp_port *, in
 int	bstp_set_autoedge(struct bstp_port *, int);
 int	bstp_set_ptp(struct bstp_port *, int);
 int	bstp_set_autoptp(struct bstp_port *, int);
-struct mbuf *bstp_input(struct bstp_port *, struct ifnet *, struct mbuf *);
+void	bstp_input(struct bstp_port *, struct ifnet *, struct mbuf *);
 
 #endif /* _KERNEL */

Modified: head/sys/net/if_bridge.c
==============================================================================
--- head/sys/net/if_bridge.c	Thu Feb 23 00:52:27 2012	(r232013)
+++ head/sys/net/if_bridge.c	Thu Feb 23 00:59:21 2012	(r232014)
@@ -2215,11 +2215,9 @@ bridge_input(struct ifnet *ifp, struct m
 		/* Tap off 802.1D packets; they do not get forwarded. */
 		if (memcmp(eh->ether_dhost, bstp_etheraddr,
 		    ETHER_ADDR_LEN) == 0) {
-			m = bstp_input(&bif->bif_stp, ifp, m);
-			if (m == NULL) {
-				BRIDGE_UNLOCK(sc);
-				return (NULL);
-			}
+			bstp_input(&bif->bif_stp, ifp, m); /* consumes mbuf */
+			BRIDGE_UNLOCK(sc);
+			return (NULL);
 		}
 
 		if ((bif->bif_flags & IFBIF_STP) &&


More information about the svn-src-all mailing list