Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/net Pull up following revision(s) (requested by msait...



details:   https://anonhg.NetBSD.org/src/rev/d33ae9185a49
branches:  netbsd-8
changeset: 852025:d33ae9185a49
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Oct 03 17:57:39 2018 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #1046):

        sys/net/if_bridge.c: revision 1.157
        sys/net/if_bridge.c: revision 1.158
        sys/net/if_bridge.c: revision 1.159

  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]

- Fix bridge_enqueue() which was broken by last commit. Use correct mbuf
   pointer.
- Modify comment.

Micro optimization. m_copym(M_COPYALL) -> m_copypacket().

diffstat:

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

diffs (91 lines):

diff -r 0251a9c8212b -r d33ae9185a49 sys/net/if_bridge.c
--- a/sys/net/if_bridge.c       Wed Oct 03 17:53:56 2018 +0000
+++ b/sys/net/if_bridge.c       Wed Oct 03 17:57:39 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bridge.c,v 1.134.6.11 2018/06/07 17:42:25 martin Exp $      */
+/*     $NetBSD: if_bridge.c,v 1.134.6.12 2018/10/03 17:57:39 martin Exp $      */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.134.6.11 2018/06/07 17:42:25 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.134.6.12 2018/10/03 17:57:39 martin 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) {
@@ -1545,7 +1540,7 @@
                                used = true;
                                mc = m;
                        } else {
-                               mc = m_copym(m, 0, M_COPYALL, M_NOWAIT);
+                               mc = m_copypacket(m, M_DONTWAIT);
                                if (mc == NULL) {
                                        sc->sc_if.if_oerrors++;
                                        goto next;
@@ -1563,8 +1558,7 @@
                                        used = true;
                                        mc = m;
                                } else {
-                                       mc = m_copym(m, 0, M_COPYALL,
-                                           M_DONTWAIT);
+                                       mc = m_copypacket(m, M_DONTWAIT);
                                        if (mc == NULL) {
                                                sc->sc_if.if_oerrors++;
                                                goto next;
@@ -1768,6 +1762,13 @@
 
        bridge_release_member(sc, bif, &psref);
 
+       /*
+        * Before enqueueing this packet to the destination interface,
+        * clear any in-bound checksum flags to prevent them from being
+        * misused as out-bound flags.
+        */
+       m->m_pkthdr.csum_flags = 0;
+
        ACQUIRE_GLOBAL_LOCKS();
        bridge_enqueue(sc, dst_if, m, 1);
        RELEASE_GLOBAL_LOCKS();
@@ -1973,18 +1974,25 @@
                        goto next;
 
                if (dst_if != src_if) {
-                       mc = m_copym(m, 0, M_COPYALL, M_DONTWAIT);
+                       mc = m_copypacket(m, M_DONTWAIT);
                        if (mc == NULL) {
                                sc->sc_if.if_oerrors++;
                                goto next;
                        }
+                       /*
+                        * Before enqueueing this packet to the destination
+                        * interface, clear any in-bound checksum flags to
+                        * prevent them from being misused as out-bound flags.
+                        */
+                       mc->m_pkthdr.csum_flags = 0;
+
                        ACQUIRE_GLOBAL_LOCKS();
                        bridge_enqueue(sc, dst_if, mc, 1);
                        RELEASE_GLOBAL_LOCKS();
                }
 
                if (bmcast) {
-                       mc = m_copym(m, 0, M_COPYALL, M_DONTWAIT);
+                       mc = m_copypacket(m, M_DONTWAIT);
                        if (mc == NULL) {
                                sc->sc_if.if_oerrors++;
                                goto next;



Home | Main Index | Thread Index | Old Index