Bug 15290

Summary: vlan fails to maintain IFF_RUNNING
Product: Base System Reporter: csg <csg>
Component: kernAssignee: Garrett Wollman <wollman>
Status: Closed FIXED    
Severity: Affects Only Me CC: ajk
Priority: Normal    
Version: 3.3-STABLE   
Hardware: Any   
OS: Any   

Description csg 1999-12-06 00:50:00 UTC
sys/net/if_vlan.c fails to maintain the IFF_RUNNING flag on the
vlan interfaces it manages.  This prevents the interface from
actually sending or receiving data.

The handling of SIOCSETVLAN also incorrectly sets the device flags
to zero, instead of clearing the IFF_RUNNING and IFF_UP flags.  Just
because the device isn't configured doesn't mean it still isn't
IFF_MULTICAST (or its friends) any more.

Fix: The following patch will maintain IFF_RUNNING when the vlan
device is associated/disassociated with a parent ethernet device
via the SIOCSETVLAN ioctl call:

- BEGIN PATCH -----------------------------------------------------------------



case SIOCGETVLAN:


- END PATCH ---------------------------------------------------------------------KqdyYQvN5huu38EP7hImXIkHj4SILoG2OcudOhonaCneOw57
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

Index: if_vlan.c
===================================================================
RCS file: /usr/local/share/cvs/FreeBSD/src/sys/net/if_vlan.c,v
retrieving revision 1.10
diff -u -r1.10 if_vlan.c
--- if_vlan.c   1999/09/25 12:05:57     1.10
+++ if_vlan.c   1999/12/05 21:41:50
@@ -509,7 +509,7 @@
                if (vlr.vlr_parent[0] == '\0') {
                        vlan_unconfig(ifp);
                        if_down(ifp);
-                       ifp->if_flags = 0;
+                       ifp->if_flags &= ~(IFF_UP|IFF_RUNNING);
                        break;
                }
                p = ifunit(vlr.vlr_parent);
@@ -521,6 +521,7 @@
                if (error)
                        break;
                ifv->ifv_tag = vlr.vlr_tag;
+               ifp->if_flags |= IFF_RUNNING;
                break;
How-To-Repeat: 
On FreeBSD 3-STABLE, or FreeBSD-CURRENT:

1. configure a vlan device/parent device

 # ifconfig <parent-device> up
 # ifconfig vlan0 vlandev <parent-device> vlan <vlan-tag>

2. ifconfig vlan0, notice that IFF_RUNNING isn't set, but the
   interface is not up.

3. watch most protocols not work since if_ethersubr.c checks
   for (IFF_UP|IFF_RUNNING), and returns ENETDOWN if they're
   not both set.
Comment 1 Sheldon Hearn freebsd_committer freebsd_triage 1999-12-06 16:27:25 UTC
Responsible Changed
From-To: freebsd-bugs->wollman

Over to the maintainer. 
Comment 2 jkh freebsd_committer freebsd_triage 1999-12-13 01:36:42 UTC
State Changed
From-To: open->closed

Fix brought into both affected branches, thanks!