[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: highest interface number



On Fri, 21 May 2004 16:14:56 +0300
"Alexey E. Suslikov" <cruel_(_at_)_texnika_(_dot_)_com_(_dot_)_ua> wrote:

> Dear misc_(_at_)_openbsd_(_dot_)_org,
> 
>   what is the highest interface number configurable
>   from ifconfig (supported by kernel)?

Did you try and find out?  Create a simple shell loop. :)
Then again, looking through the source is probably faster.

/sys/net/if.c:
   712          while (cp - name < IFNAMSIZ && *cp) {
   713                  if (*cp < '0' || *cp > '9' ||
   714                      unit > (INT_MAX - (*cp - '0')) / 10) {
   715                          /* Bogus unit number. */
   716                          return (NULL);
   717                  }
   718                  unit = (unit * 10) + (*cp++ - '0');
   719          }

It is bounded by INT_MAX, which is the following on my i386 box:

# ifconfig lo2147483647 create
# ifconfig lo2147483648 create
ifconfig: SIOCIFCREATE: Invalid argument



Visit your host, monkey.org