Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net replace the conditional m_pullup() on start of bridg...



details:   https://anonhg.NetBSD.org/src/rev/cbd35b11fcd5
branches:  trunk
changeset: 970551:cbd35b11fcd5
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Fri Mar 27 16:47:00 2020 +0000

description:
replace the conditional m_pullup() on start of bridge_output() with
a KASSERT(), to make it clear no mbuf manipulation is ever done here

the condition should never trigger, this always runs after ether_output()
M_PREPEND()s ether_header

diffstat:

 sys/net/if_bridge.c |  10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diffs (31 lines):

diff -r 24b38720b823 -r cbd35b11fcd5 sys/net/if_bridge.c
--- a/sys/net/if_bridge.c       Fri Mar 27 16:34:58 2020 +0000
+++ b/sys/net/if_bridge.c       Fri Mar 27 16:47:00 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bridge.c,v 1.169 2020/03/24 13:30:54 jdolecek Exp $ */
+/*     $NetBSD: if_bridge.c,v 1.170 2020/03/27 16:47:00 jdolecek Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.169 2020/03/24 13:30:54 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.170 2020/03/27 16:47:00 jdolecek Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -1496,11 +1496,7 @@
         * IFEF_MPSAFE here.
         */
 
-       if (m->m_len < ETHER_HDR_LEN) {
-               m = m_pullup(m, ETHER_HDR_LEN);
-               if (m == NULL)
-                       return 0;
-       }
+       KASSERT(m->m_len >= ETHER_HDR_LEN);
 
        eh = mtod(m, struct ether_header *);
        sc = ifp->if_bridge;



Home | Main Index | Thread Index | Old Index