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).
This commit is contained in:
parent
a1a8fc3617
commit
98ff4b5f9f
@ -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;
|
||||
|
@ -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 ifnet *p)
|
||||
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 ifnet *p)
|
||||
ifv->ifv_mtufudge = ifv->ifv_encaplen;
|
||||
}
|
||||
}
|
||||
ec->ec_nvlans++;
|
||||
|
||||
/*
|
||||
* If the parent interface can do hardware-assisted
|
||||
|
Loading…
Reference in New Issue
Block a user