Re: remove vlan(4) specific ifconfig output

2017-05-31 Thread Sebastian Benoit
ok

David Gwynne(da...@gwynne.id.au) on 2017.05.31 15:34:53 +1000:
> the vlan specific output is redundant because vlan supports the
> generic vnetid and parent ioctls now.
> 
> this leaves the code for setting vlan specific stuff because there's
> a slight semantic change i want to discuss separately.
> 
> ifconfig output on a vlan interface changes a little like this:
> 
>  vlan8: flags=8843 mtu 1500
>   lladdr 00:1b:21:bc:25:e7
>   index 6 priority 0 llprio 3
> - vlan: 8 parent interface: ix1
>   encap: vnetid 8 parent ix1
>   groups: vlan
>   status: active
>   inet 192.168.1.1 netmask 0xff00 broadcast 192.168.1.255
>  vlan77: flags=8002 mtu 1500
>   lladdr 00:1b:21:bc:25:e6
>   index 8 priority 0 llprio 3
> - vlan: 0 parent interface: ix0
>   encap: vnetid none parent ix0
>   groups: vlan
>   status: no carrier
> 
> ok?
> 
> Index: ifconfig.c
> ===
> RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
> retrieving revision 1.341
> diff -u -p -r1.341 ifconfig.c
> --- ifconfig.c31 May 2017 05:25:12 -  1.341
> +++ ifconfig.c31 May 2017 05:26:37 -
> @@ -221,7 +221,6 @@ void  setvlandev(const char *, int);
>  void unsetvlandev(const char *, int);
>  void mpe_status(void);
>  void mpw_status(void);
> -void vlan_status(void);
>  void setrdomain(const char *, int);
>  int  prefix(void *val, int);
>  void getifgroups(void);
> @@ -3001,7 +3000,6 @@ status(int link, struct sockaddr_dl *sdl
>   if_indextoname(ifrdesc.ifr_index, ifname) != NULL)
>   printf("\tpatch: %s\n", ifname);
>  #endif
> - vlan_status();
>   getencap();
>  #ifndef SMALL
>   carp_status();
> @@ -3774,23 +3772,6 @@ getencap(void)
>  
>  static int __tag = 0;
>  static int __have_tag = 0;
> -
> -void
> -vlan_status(void)
> -{
> - struct vlanreq vreq;
> -
> - bzero((char *)&vreq, sizeof(struct vlanreq));
> - ifr.ifr_data = (caddr_t)&vreq;
> -
> - if (ioctl(s, SIOCGETVLAN, (caddr_t)&ifr) == -1)
> - return;
> -
> - if (vreq.vlr_tag || (vreq.vlr_parent[0] != '\0'))
> - printf("\tvlan: %d parent interface: %s\n",
> - vreq.vlr_tag, vreq.vlr_parent[0] == '\0' ?
> - "" : vreq.vlr_parent);
> -}
>  
>  /* ARGSUSED */
>  void
> 



remove vlan(4) specific ifconfig output

2017-05-30 Thread David Gwynne
the vlan specific output is redundant because vlan supports the
generic vnetid and parent ioctls now.

this leaves the code for setting vlan specific stuff because there's
a slight semantic change i want to discuss separately.

ifconfig output on a vlan interface changes a little like this:

 vlan8: flags=8843 mtu 1500
lladdr 00:1b:21:bc:25:e7
index 6 priority 0 llprio 3
-   vlan: 8 parent interface: ix1
encap: vnetid 8 parent ix1
groups: vlan
status: active
inet 192.168.1.1 netmask 0xff00 broadcast 192.168.1.255
 vlan77: flags=8002 mtu 1500
lladdr 00:1b:21:bc:25:e6
index 8 priority 0 llprio 3
-   vlan: 0 parent interface: ix0
encap: vnetid none parent ix0
groups: vlan
status: no carrier

ok?

Index: ifconfig.c
===
RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.341
diff -u -p -r1.341 ifconfig.c
--- ifconfig.c  31 May 2017 05:25:12 -  1.341
+++ ifconfig.c  31 May 2017 05:26:37 -
@@ -221,7 +221,6 @@ voidsetvlandev(const char *, int);
 void   unsetvlandev(const char *, int);
 void   mpe_status(void);
 void   mpw_status(void);
-void   vlan_status(void);
 void   setrdomain(const char *, int);
 intprefix(void *val, int);
 void   getifgroups(void);
@@ -3001,7 +3000,6 @@ status(int link, struct sockaddr_dl *sdl
if_indextoname(ifrdesc.ifr_index, ifname) != NULL)
printf("\tpatch: %s\n", ifname);
 #endif
-   vlan_status();
getencap();
 #ifndef SMALL
carp_status();
@@ -3774,23 +3772,6 @@ getencap(void)
 
 static int __tag = 0;
 static int __have_tag = 0;
-
-void
-vlan_status(void)
-{
-   struct vlanreq vreq;
-
-   bzero((char *)&vreq, sizeof(struct vlanreq));
-   ifr.ifr_data = (caddr_t)&vreq;
-
-   if (ioctl(s, SIOCGETVLAN, (caddr_t)&ifr) == -1)
-   return;
-
-   if (vreq.vlr_tag || (vreq.vlr_parent[0] != '\0'))
-   printf("\tvlan: %d parent interface: %s\n",
-   vreq.vlr_tag, vreq.vlr_parent[0] == '\0' ?
-   "" : vreq.vlr_parent);
-}
 
 /* ARGSUSED */
 void