Module Name:    src
Committed By:   martin
Date:           Mon Sep 22 10:44:37 UTC 2014

Modified Files:
        src/sbin/ifconfig [netbsd-7]: ifconfig.8 vlan.c
        src/sys/net [netbsd-7]: if_vlan.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #108):
        sbin/ifconfig/vlan.c: revision 1.14
        sbin/ifconfig/ifconfig.8: revision 1.108
        sys/net/if_vlan.c: revision 1.71-1.74

Document -vlanif in ifconfig.8 and in usage measseg (PR 49114).
Leave promiscuous mode when detaching a parent (PR 49196) and
delete link local addresses (49197).
Restore vlan_ioctl overwritten by ether_ifdetach in vlan_unconfig
(PR 49112).
Call if_input of vlan interface itself, not parent one.
This allows bridging vlan interfaces again.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.106.4.1 src/sbin/ifconfig/ifconfig.8
cvs rdiff -u -r1.13 -r1.13.24.1 src/sbin/ifconfig/vlan.c
cvs rdiff -u -r1.70 -r1.70.2.1 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/sbin/ifconfig/ifconfig.8
diff -u src/sbin/ifconfig/ifconfig.8:1.106 src/sbin/ifconfig/ifconfig.8:1.106.4.1
--- src/sbin/ifconfig/ifconfig.8:1.106	Tue Jan  7 20:25:24 2014
+++ src/sbin/ifconfig/ifconfig.8	Mon Sep 22 10:44:37 2014
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ifconfig.8,v 1.106 2014/01/07 20:25:24 degroote Exp $
+.\"	$NetBSD: ifconfig.8,v 1.106.4.1 2014/09/22 10:44:37 martin Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"     @(#)ifconfig.8	8.4 (Berkeley) 6/1/94
 .\"
-.Dd January 28, 2012
+.Dd September 15, 2014
 .Dt IFCONFIG 8
 .Os
 .Sh NAME
@@ -634,6 +634,12 @@ Note that
 and
 .Cm vlan
 must be set at the same time.
+.It Cm -vlanif Ar iface
+Dissociate
+.Ar iface
+from the
+.Xr vlan 4
+interface.
 .It Cm agrport Ar iface
 Add
 .Ar iface

Index: src/sbin/ifconfig/vlan.c
diff -u src/sbin/ifconfig/vlan.c:1.13 src/sbin/ifconfig/vlan.c:1.13.24.1
--- src/sbin/ifconfig/vlan.c:1.13	Tue Jul 28 18:22:33 2009
+++ src/sbin/ifconfig/vlan.c	Mon Sep 22 10:44:37 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: vlan.c,v 1.13 2009/07/28 18:22:33 dyoung Exp $	*/
+/*	$NetBSD: vlan.c,v 1.13.24.1 2014/09/22 10:44:37 martin Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: vlan.c,v 1.13 2009/07/28 18:22:33 dyoung Exp $");
+__RCSID("$NetBSD: vlan.c,v 1.13.24.1 2014/09/22 10:44:37 martin Exp $");
 #endif /* not lint */
 
 #include <sys/param.h> 
@@ -175,7 +175,7 @@ vlan_status(prop_dictionary_t env, prop_
 static void
 vlan_usage(prop_dictionary_t env)
 {
-	fprintf(stderr, "\t[ vlan n vlanif i ]\n");
+	fprintf(stderr, "\t[ vlan n vlanif i ] [ -vlanif i ]\n");
 }
 
 static void

Index: src/sys/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.70 src/sys/net/if_vlan.c:1.70.2.1
--- src/sys/net/if_vlan.c:1.70	Tue May 13 19:36:16 2014
+++ src/sys/net/if_vlan.c	Mon Sep 22 10:44:37 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.70 2014/05/13 19:36:16 bouyer Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.70.2.1 2014/09/22 10:44:37 martin 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.70 2014/05/13 19:36:16 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.70.2.1 2014/09/22 10:44:37 martin Exp $");
 
 #include "opt_inet.h"
 
@@ -103,6 +103,9 @@ __KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 
 #include <netinet/in.h>
 #include <netinet/if_inarp.h>
 #endif
+#ifdef INET6
+#include <netinet6/in6_ifattach.h>
+#endif
 
 struct vlan_mc_entry {
 	LIST_ENTRY(vlan_mc_entry)	mc_entries;
@@ -384,6 +387,8 @@ vlan_unconfig(struct ifnet *ifp)
 		}
 
 		ether_ifdetach(ifp);
+		/* Restore vlan_ioctl overwritten by ether_ifdetach */
+		ifp->if_ioctl = vlan_ioctl;
 		vlan_reset_linkname(ifp);
 		break;
 	    }
@@ -398,6 +403,12 @@ vlan_unconfig(struct ifnet *ifp)
 	ifv->ifv_if.if_mtu = 0;
 	ifv->ifv_flags = 0;
 
+#ifdef INET6
+	/* To delete v6 link local addresses */
+	in6_ifdetach(ifp);
+#endif
+	if ((ifp->if_flags & IFF_PROMISC) != 0)
+		ifpromisc(ifp, 0);
 	if_down(ifp);
 	ifp->if_flags &= ~(IFF_UP|IFF_RUNNING);
 	ifp->if_capabilities = 0;
@@ -482,6 +493,9 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd
 		if ((error = copyin(ifr->ifr_data, &vlr, sizeof(vlr))) != 0)
 			break;
 		if (vlr.vlr_parent[0] == '\0') {
+			if (ifv->ifv_p != NULL &&
+			    (ifp->if_flags & IFF_PROMISC) != 0)
+				error = ifpromisc(ifv->ifv_p, 0);
 			vlan_unconfig(ifp);
 			break;
 		}
@@ -893,6 +907,6 @@ vlan_input(struct ifnet *ifp, struct mbu
 
 	bpf_mtap(&ifv->ifv_if, m);
 
-	/* Pass it back through the parent's input routine. */
-	(*ifp->if_input)(&ifv->ifv_if, m);
+	m->m_flags &= ~M_PROMISC;
+	ifv->ifv_if.if_input(&ifv->ifv_if, m);
 }

Reply via email to