diff options
author | marcel <marcel@FreeBSD.org> | 2012-05-19 02:39:43 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2012-05-19 02:39:43 +0000 |
commit | 434c53cbc31ab5ad90ba5119cb80f658a52345a1 (patch) | |
tree | 07ca34fb7f517054627aaba05428f1a326f84c4c /lib | |
parent | 5374cd448cdcfb007709e244eeb204d8d1644807 (diff) | |
download | FreeBSD-src-434c53cbc31ab5ad90ba5119cb80f658a52345a1.zip FreeBSD-src-434c53cbc31ab5ad90ba5119cb80f658a52345a1.tar.gz |
Use the LLINDEX macro to access the link-level I/F index. This makes
it possible to work with a different type for the sdl_index field --
it only requires a recompile.
Obtained from: Juniper Networks, Inc.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/net/if_indextoname.c | 2 | ||||
-rw-r--r-- | lib/libc/net/if_nameindex.c | 2 | ||||
-rw-r--r-- | lib/libc/net/if_nametoindex.c | 2 | ||||
-rw-r--r-- | lib/libc/net/sourcefilter.c | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/lib/libc/net/if_indextoname.c b/lib/libc/net/if_indextoname.c index 4dadce3..4b16433 100644 --- a/lib/libc/net/if_indextoname.c +++ b/lib/libc/net/if_indextoname.c @@ -70,7 +70,7 @@ if_indextoname(unsigned int ifindex, char *ifname) for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) { if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_LINK && - ifindex == ((struct sockaddr_dl*)ifa->ifa_addr)->sdl_index) + ifindex == LLINDEX((struct sockaddr_dl*)ifa->ifa_addr)) break; } diff --git a/lib/libc/net/if_nameindex.c b/lib/libc/net/if_nameindex.c index 7a12d34..138289c 100644 --- a/lib/libc/net/if_nameindex.c +++ b/lib/libc/net/if_nameindex.c @@ -123,7 +123,7 @@ if_nameindex(void) if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_LINK) { ifni2->if_index = - ((struct sockaddr_dl*)ifa->ifa_addr)->sdl_index; + LLINDEX((struct sockaddr_dl*)ifa->ifa_addr); ifni2->if_name = cp; strcpy(cp, ifa->ifa_name); ifni2++; diff --git a/lib/libc/net/if_nametoindex.c b/lib/libc/net/if_nametoindex.c index 9d47089..89076c0 100644 --- a/lib/libc/net/if_nametoindex.c +++ b/lib/libc/net/if_nametoindex.c @@ -90,7 +90,7 @@ if_nametoindex(const char *ifname) if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_LINK && strcmp(ifa->ifa_name, ifname) == 0) { - ni = ((struct sockaddr_dl*)ifa->ifa_addr)->sdl_index; + ni = LLINDEX((struct sockaddr_dl*)ifa->ifa_addr); break; } } diff --git a/lib/libc/net/sourcefilter.c b/lib/libc/net/sourcefilter.c index cc0f1b9..4d29d9f 100644 --- a/lib/libc/net/sourcefilter.c +++ b/lib/libc/net/sourcefilter.c @@ -120,7 +120,7 @@ __inaddr_to_index(in_addr_t ifaddr) psu = (sockunion_t *)ifa->ifa_addr; if (psu && psu->ss.ss_family == AF_LINK && strcmp(ifa->ifa_name, ifname) == 0) { - ifindex = psu->sdl.sdl_index; + ifindex = LLINDEX(&psu->sdl); break; } } |