# VLAN status of ifconfig



## mirnshi (Aug 23, 2013)

I'm writing a virtual interface driver, and use SIOCGIFGENERIC/SIOCSIFGENERIC to control this interface. But I ran `ifconfig`, and got 


```
vif0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 00:01:01:e4:10:06
        inet 10.10.10.1 netmask 0xffffff00 broadcast 10.10.10.255
        vlan: 0 parent interface:
```

This virtual interface is not a VLAN, it is just using SIOCGIFGENERIC/SIOCSIFGENERIC. I think ifconfig should check the name or the type of the interface before printing 'parent interface'.

The new vlan_status:


```
static void
vlan_status(int s)
{
        struct vlanreq          vreq;

        if (getvlan(s, &ifr, &vreq) != -1 && !strncmp(ifr.ifr_name, "vlan", 4))
                printf("\tvlan: %d parent interface: %s\n",
                    vreq.vlr_tag, vreq.vlr_parent[0] == '\0' ?
                    "<none>" : vreq.vlr_parent);
}
```

Regards,
Paul


----------

