Source-Changes-HG archive

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

[src/trunk]: src/sys/net Fix a bug that bridge_enqueue() incorrectly cleared ...



details:   https://anonhg.NetBSD.org/src/rev/c49f1314b863
branches:  trunk
changeset: 993487:c49f1314b863
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Sep 14 11:05:09 2018 +0000

description:
Fix a bug that bridge_enqueue() incorrectly cleared outgoing packet's offload
flags. bridge_enqueue() is called from bridge_output() when a packet is
spontaneous. Clear csum_flags before calling brige_enqueue() in
bridge_forward() or bridge_broadcast() instead of in the beginning of
bridge_enqueue().

Note that this change doesn't fix a problem on the following configuration:

        A bridge has two or more interfaces.

        An address is assigned to an bridge member interface and
        some offload flags are set.

        Another interface has no address and has no any offload flag.

XXX pullup-[78]

diffstat:

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

diffs (55 lines):

diff -r dbeca8654799 -r c49f1314b863 sys/net/if_bridge.c
--- a/sys/net/if_bridge.c       Fri Sep 14 10:13:02 2018 +0000
+++ b/sys/net/if_bridge.c       Fri Sep 14 11:05:09 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bridge.c,v 1.156 2018/05/25 04:40:27 ozaki-r Exp $  */
+/*     $NetBSD: if_bridge.c,v 1.157 2018/09/14 11:05:09 msaitoh Exp $  */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.156 2018/05/25 04:40:27 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.157 2018/09/14 11:05:09 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -1395,11 +1395,6 @@
        int len, error;
        short mflags;
 
-       /*
-        * Clear any in-bound checksum flags for this packet.
-        */
-       m->m_pkthdr.csum_flags = 0;
-
        if (runfilt) {
                if (pfil_run_hooks(sc->sc_if.if_pfil, &m,
                    dst_ifp, PFIL_OUT) != 0) {
@@ -1768,6 +1763,11 @@
 
        bridge_release_member(sc, bif, &psref);
 
+       /*
+        * Clear any in-bound checksum flags for this packet.
+        */
+       m->m_pkthdr.csum_flags = 0;
+
        ACQUIRE_GLOBAL_LOCKS();
        bridge_enqueue(sc, dst_if, m, 1);
        RELEASE_GLOBAL_LOCKS();
@@ -1978,6 +1978,12 @@
                                sc->sc_if.if_oerrors++;
                                goto next;
                        }
+
+                       /*
+                        * Clear any in-bound checksum flags for this packet.
+                        */
+                       m->m_pkthdr.csum_flags = 0;
+
                        ACQUIRE_GLOBAL_LOCKS();
                        bridge_enqueue(sc, dst_if, mc, 1);
                        RELEASE_GLOBAL_LOCKS();



Home | Main Index | Thread Index | Old Index