[quagga-dev 3066] bugs related to length of interface names

Andrew J. Schorr aschorr at telemetry-investments.com
Fri Apr 1 01:12:08 BST 2005


The current code is sloppy with respect to the way it manages
interface name length issues and whether they are NUL-terminated
or implicitly terminated at INTERFACE_NAMSIZ characters.

For example, this seems bad:

ti58-quagga# config term
ti58-quagga(config)# interface reallylonginterfacename0
ti58-quagga(config-if)# desc test

ti58-quagga# show interface
...
Interface reallylonginterfacen is down
  Description: test
  index -1 inactive interface

The name is being silently truncated.  The API makes the mistake of
having lots of functions that make assumptions about string lengths,
instead of just taking explicit length arguments.

In practice this may not matter much, but the current coding style
is not robust at all.  One possible fix is to change the
if_lookup_by_name and if_get_by_name functions (and any other functions
that take interface names as arguments) to take additional
explicit length arguments that will force calling code to expose
their assumptions.  Or we could try to make sure that all interface
names are passed around with a terminating NUL character...

Regards,
Andy



More information about the Quagga-dev mailing list