Module Name:    src
Committed By:   yamaguchi
Date:           Mon Dec  6 05:50:39 UTC 2021

Modified Files:
        src/sys/net: if_vlan.c

Log Message:
decrease the MTU of vlan(4)
only when ETHERCAP_VLAN_MTU of the parent interface is enabled

This fixed the bug that the MTU of a vlan interface is decreased
when the parent interface already has another vlan interface.
pointed out by tnn@n.o, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.166 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_vlan.c
diff -u src/sys/net/if_vlan.c:1.165 src/sys/net/if_vlan.c:1.166
--- src/sys/net/if_vlan.c:1.165	Mon Nov 15 07:07:05 2021
+++ src/sys/net/if_vlan.c	Mon Dec  6 05:50:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.165 2021/11/15 07:07:05 yamaguchi Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.166 2021/12/06 05:50:39 yamaguchi 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.165 2021/11/15 07:07:05 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.166 2021/12/06 05:50:39 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -434,17 +434,16 @@ vlan_config(struct ifvlan *ifv, struct i
 	case IFT_ETHER:
 	    {
 		struct ethercom *ec = (void *)p;
-		bool vlanmtu_enabled;
 
 		nmib->ifvm_msw = &vlan_ether_multisw;
 		nmib->ifvm_encaplen = ETHER_VLAN_ENCAP_LEN;
 		nmib->ifvm_mintu = ETHERMIN;
 
-		error = ether_add_vlantag(p, tag, &vlanmtu_enabled);
+		error = ether_add_vlantag(p, tag, NULL);
 		if (error != 0)
 			goto done;
 
-		if (vlanmtu_enabled) {
+		if (ec->ec_capenable & ETHERCAP_VLAN_MTU) {
 			nmib->ifvm_mtufudge = 0;
 		} else {
 			/*

Reply via email to