The valid range for vlan tags in OpenBSD is 0-4095 (inclusive). Fix both checks.
Makes vlan0 autoconfig work (obj/ifconfig has the diff): # ifconfig vlan0 vlandev fxp0 ifconfig: invalid vlan tag and device specification # obj/ifconfig vlan0 vlandev fxp0 and gives a better error message on tags > 4095: # ifconfig vlan1 vlan 5000 vlandev fxp0 ifconfig: SIOCSETVLAN: Invalid argument # obj/ifconfig vlan1 vlan 5000 vlandev fxp0 ifconfig: vlan tag 5000: too large -- Cam Index: ifconfig.c =================================================================== RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v retrieving revision 1.242 diff -u -r1.242 ifconfig.c --- ifconfig.c 9 Nov 2010 21:14:47 -0000 1.242 +++ ifconfig.c 5 Feb 2011 14:28:56 -0000 @@ -3351,7 +3351,7 @@ struct vlanreq vreq; const char *errmsg = NULL; - __tag = tag = strtonum(val, 0, 65535, &errmsg); + __tag = tag = strtonum(val, 0, 4095, &errmsg); if (errmsg) errx(1, "vlan tag %s: %s", val, errmsg); __have_tag = 1; @@ -3411,7 +3411,7 @@ if (!__have_tag && vreq.vlr_tag == 0) { skip = strcspn(ifr.ifr_name, "0123456789"); - tag = strtonum(ifr.ifr_name + skip, 1, 4095, &estr); + tag = strtonum(ifr.ifr_name + skip, 0, 4095, &estr); if (estr != NULL) errx(1, "invalid vlan tag and device specification"); vreq.vlr_tag = tag;