Module Name: src
Committed By: msaitoh
Date: Fri Jan 13 06:11:56 UTC 2017
Modified Files:
src/sys/net: if_ethersubr.c if_vlan.c
Log Message:
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).
To generate a diff of this commit:
cvs rdiff -u -r1.234 -r1.235 src/sys/net/if_ethersubr.c
cvs rdiff -u -r1.93 -r1.94 src/sys/net/if_vlan.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.234 src/sys/net/if_ethersubr.c:1.235
--- src/sys/net/if_ethersubr.c:1.234 Tue Jan 10 05:42:34 2017
+++ src/sys/net/if_ethersubr.c Fri Jan 13 06:11:56 2017
@@ -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 @@ ether_enable_vlan_mtu(struct ifnet *ifp)
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;
Index: src/sys/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.93 src/sys/net/if_vlan.c:1.94
--- src/sys/net/if_vlan.c:1.93 Thu Dec 15 09:28:06 2016
+++ src/sys/net/if_vlan.c Fri Jan 13 06:11:56 2017
@@ -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 @@ vlan_config(struct ifvlan *ifv, struct i
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 @@ vlan_config(struct ifvlan *ifv, struct i
ifv->ifv_mtufudge = ifv->ifv_encaplen;
}
}
- ec->ec_nvlans++;
/*
* If the parent interface can do hardware-assisted