[quagga-dev 3097] Re: bugs related to length of interface names

Andrew J. Schorr aschorr at telemetry-investments.com
Sun Apr 3 04:45:53 BST 2005


On Sat, Apr 02, 2005 at 06:30:53PM -0500, Andrew J. Schorr wrote:
> OK, I think I may have fixed everything outside of the zebra daemon.  But
> I am uncertain about the following lines of code:
> 
> ./zebra/if_ioctl.c:105:      ifp = if_get_by_name (ifreq->ifr_name);
> ./zebra/if_ioctl.c:116:      ifp = if_get_by_name (ifreq->ifr_name);
> ./zebra/if_ioctl.c:227:      ifp = if_lookup_by_name (ifap->ifa_name);
> ./zebra/if_proc.c:161:      ifp = if_get_by_name (name);
> ./zebra/if_proc.c:195:      ifp = if_get_by_name (name);
> ./zebra/if_proc.c:237:      ifp = if_get_by_name (ifname);
> ./zebra/kernel_socket.c:204:      ifp = if_get_by_name (ifan->ifan_name);
> ./zebra/rt_netlink.c:533:  ifp = if_get_by_name (name);
> ./zebra/rt_netlink.c:1003:      ifp = if_lookup_by_name (name);
> ./zebra/rt_netlink.c:1008:            ifp = if_get_by_name (name);
> ./zebra/rt_netlink.c:1045:      ifp = if_lookup_by_name (name);

Based on some googling and studying of header files, I made guesses
at all of these and committed some patches.  But if somebody gets motivated
to review this stuff, that would be great.

It seems to me like the rt_netlink interface names should be NUL-terminated
(based on a quick scan of the linux kernel source code).  And ifreq->ifr_name
seems clearly to be a fixed-size buffer, as is the case (I believe)
with ifan->ifan_name.  I had trouble finding documentation on getifaddrs
ifa_name, but I'm guessing that it's NUL-terminated.

Regards,
Andy



More information about the Quagga-dev mailing list