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 the parent interface's callback wasn'...



details:   https://anonhg.NetBSD.org/src/rev/5a6ce6d30d54
branches:  trunk
changeset: 820661:5a6ce6d30d54
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Jan 13 06:11:56 2017 +0000

description:
Fix a bug that the parent interface's callback wasn't called when the vlan
interface is configured. A callback function uses VLAN_ATTACHED() function
which check ec->ec_nvlans, the value should be incremented before calling the
callback. This bug was added in if_vlan.c rev. 1.83 (2015/11/19).

diffstat:

 sys/net/if_ethersubr.c |   8 ++------
 sys/net/if_vlan.c      |  11 ++++++-----
 2 files changed, 8 insertions(+), 11 deletions(-)

diffs (70 lines):

diff -r c8562b285176 -r 5a6ce6d30d54 sys/net/if_ethersubr.c
--- a/sys/net/if_ethersubr.c    Fri Jan 13 06:11:27 2017 +0000
+++ b/sys/net/if_ethersubr.c    Fri Jan 13 06:11:56 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ethersubr.c,v 1.234 2017/01/10 05:42:34 ozaki-r Exp $       */
+/*     $NetBSD: if_ethersubr.c,v 1.235 2017/01/13 06:11:56 msaitoh Exp $       */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.234 2017/01/10 05:42:34 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.235 2017/01/13 06:11:56 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1475,10 +1475,6 @@
        int error;
        struct ethercom *ec = (void *)ifp;
 
-       /* Already have VLAN's do nothing. */
-       if (ec->ec_nvlans != 0)
-               return 0;
-
        /* Parent does not support VLAN's */
        if ((ec->ec_capabilities & ETHERCAP_VLAN_MTU) == 0)
                return -1;
diff -r c8562b285176 -r 5a6ce6d30d54 sys/net/if_vlan.c
--- a/sys/net/if_vlan.c Fri Jan 13 06:11:27 2017 +0000
+++ b/sys/net/if_vlan.c Fri Jan 13 06:11:56 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vlan.c,v 1.93 2016/12/15 09:28:06 ozaki-r Exp $     */
+/*     $NetBSD: if_vlan.c,v 1.94 2017/01/13 06:11:56 msaitoh Exp $     */
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.93 2016/12/15 09:28:06 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.94 2017/01/13 06:11:56 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -313,10 +313,12 @@
                ifv->ifv_encaplen = ETHER_VLAN_ENCAP_LEN;
                ifv->ifv_mintu = ETHERMIN;
 
-               if (ec->ec_nvlans == 0) {
+               if (ec->ec_nvlans++ == 0) {
                        if ((error = ether_enable_vlan_mtu(p)) >= 0) {
-                               if (error)
+                               if (error) {
+                                       ec->ec_nvlans--;
                                        return error;
+                               }
                                ifv->ifv_mtufudge = 0;
                        } else {
                                /*
@@ -329,7 +331,6 @@
                                ifv->ifv_mtufudge = ifv->ifv_encaplen;
                        }
                }
-               ec->ec_nvlans++;
 
                /*
                 * If the parent interface can do hardware-assisted



Home | Main Index | Thread Index | Old Index