Re: ifconfig vlan tag range

2011-02-15 Thread Claudio Jeker
On Thu, Feb 10, 2011 at 12:08:24PM +0100, Henning Brauer wrote:
 * Camiel Dobbelaar c...@sentia.nl [2011-02-09 20:34]:
  The valid range for vlan tags in OpenBSD is 0-4095 (inclusive).
 
 not only in openbsd - that's what you can fit in the 12 bits ;)
 
  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 -   1.242
  +++ ifconfig.c  5 Feb 2011 14:28:56 -
  @@ -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;
  
 
 ok.
 
... and OK claudio@

This seems to be still pending. What is the holdup? Camiel please commit
:)

-- 
:wq Claudio



Re: ifconfig vlan tag range

2011-02-10 Thread Henning Brauer
* Camiel Dobbelaar c...@sentia.nl [2011-02-09 20:34]:
 The valid range for vlan tags in OpenBSD is 0-4095 (inclusive).

not only in openbsd - that's what you can fit in the 12 bits ;)

 Index: ifconfig.c
 ===
 RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
 retrieving revision 1.242
 diff -u -r1.242 ifconfig.c
 --- ifconfig.c9 Nov 2010 21:14:47 -   1.242
 +++ ifconfig.c5 Feb 2011 14:28:56 -
 @@ -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;
 

ok.

-- 
Henning Brauer, h...@bsws.de, henn...@openbsd.org
BS Web Services, http://bsws.de
Full-Service ISP - Secure Hosting, Mail and DNS Services
Dedicated Servers, Rootservers, Application Hosting



Re: ifconfig vlan tag range

2011-02-10 Thread Erik

Op 10-2-2011 12:08, Henning Brauer schreef:

not only in openbsd - that's what you can fit in the 12 bits;)
Time to implement half bits next April 1. ;) Also solves the ip address 
range problem, and numerous other things.


Erik



ifconfig vlan tag range

2011-02-09 Thread Camiel Dobbelaar
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 -   1.242
+++ ifconfig.c  5 Feb 2011 14:28:56 -
@@ -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;