From f474754a2dee2f0b53435b79800611eebcdff2ac Mon Sep 17 00:00:00 2001 From: Olaf Kirch Date: Tue, 20 Aug 2013 11:43:51 +0200 Subject: [PATCH 05/24] Remove obsolete function in6_fillscopeid This seems to be an old remnant from the very early days of IPv6 when the kernel would include the ifindex in the link-local addresses returned by getifaddrs(). This is no longer the case on Linux, so the code is a no-op. A no-op that makes gcc throw warnings about illegal type-punning. Signed-off-by: Olaf Kirch --- src/util.c | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/src/util.c b/src/util.c index 9a5fb69..a6c835b 100644 --- a/src/util.c +++ b/src/util.c @@ -71,9 +71,6 @@ static struct sockaddr_in6 *local_in6; #endif static int bitmaskcmp __P((void *, void *, void *, int)); -#ifdef INET6 -static void in6_fillscopeid __P((struct sockaddr_in6 *)); -#endif /* * For all bits set in "mask", compare the corresponding bits in @@ -93,26 +90,6 @@ bitmaskcmp(void *dst, void *src, void *mask, int bytelen) } /* - * Similar to code in ifconfig.c. Fill in the scope ID for link-local - * addresses returned by getifaddrs(). - */ -#ifdef INET6 -static void -in6_fillscopeid(struct sockaddr_in6 *sin6) -{ - u_int16_t ifindex; - - if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { - ifindex = ntohs(*(u_int16_t *)&sin6->sin6_addr.s6_addr[2]); - if (sin6->sin6_scope_id == 0 && ifindex != 0) { - sin6->sin6_scope_id = ifindex; - *(u_int16_t *)&sin6->sin6_addr.s6_addr[2] = 0; - } - } -} -#endif - -/* * Find a server address that can be used by `caller' to contact * the local service specified by `serv_uaddr'. If `clnt_uaddr' is * non-NULL, it is used instead of `caller' as a hint suggesting @@ -209,7 +186,6 @@ addrmerge(struct netbuf *caller, char *serv_uaddr, char *clnt_uaddr, * a link-local address then use the scope id to see * which one. */ - in6_fillscopeid(SA2SIN6(ifsa)); if (IN6_IS_ADDR_LINKLOCAL(&SA2SIN6ADDR(ifsa)) && IN6_IS_ADDR_LINKLOCAL(&SA2SIN6ADDR(caller_sa)) && IN6_IS_ADDR_LINKLOCAL(&SA2SIN6ADDR(hint_sa))) { -- 1.7.12.4