[Xorp-hackers] ifa_index is 'int', not u16
Pavlin Radoslavov
pavlin at ICSI.Berkeley.EDU
Thu Mar 27 14:11:10 PDT 2008
Ben Greear <greearb at candelatech.com> wrote:
> I noticed that fea is using u_short to store ifaddrmsg->ifa_index
> in this method:
>
> nlm_cond_newdeladdr_to_fea_cfg
>
> According to Linux man pages, the ifa_index is an integer.
You are right that we shouldn't be using u_short (the type was
probably mixed up when the code was ported from FreeBSD which itself
is using u_short).
However, the Linux manual page is wrong. I just checked the header
files for a number of Linux distributions (Fedora, Debian, Ubuntu,
Gentoo 2006.1 and Gentoo 2007.?).
Only in the older Gentoo distribution the ifa_index type is int; in
all other the type is u32. Also, by definition the interface index
shouldn't be a negative number.
Hence I changed the local if_index variable in all leftover places
from u_short to uint32_t:
Revision Changes Path
1.17 +2 -2; commitid: 1011747ec0c5d41a7; xorp/fea/data_plane/control_socket/routing_socket_utilities.cc
1.21 +3 -3; commitid: 1011747ec0c5d41a7; xorp/fea/data_plane/ifconfig/ifconfig_get_proc_linux.cc
1.16 +3 -3; commitid: 1011747ec0c5d41a7; xorp/fea/data_plane/ifconfig/ifconfig_parse_getifaddrs.cc
1.15 +3 -3; commitid: 1011747ec0c5d41a7; xorp/fea/data_plane/ifconfig/ifconfig_parse_ioctl.cc
1.18 +5 -5; commitid: 1011747ec0c5d41a7; xorp/fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.cc
1.21 +15 -15; commitid: 1011747ec0c5d41a7; xorp/fea/data_plane/ifconfig/ifconfig_parse_routing_socket.cc
Thanks,
Pavlin
More information about the Xorp-hackers
mailing list