diff options
author | obrien <obrien@FreeBSD.org> | 2013-02-08 16:10:16 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2013-02-08 16:10:16 +0000 |
commit | 3028e3f8aba938dfd0bf9fda987b8a72140b8027 (patch) | |
tree | b2f038222ff8a70f687652441df00d2b564c8abe /usr.sbin/ndp | |
parent | 952a6d5a7cd3d3f9007acfa06805262fc04a105f (diff) | |
parent | 1d08d5f677c1dfa810e381073590adbae19cc69f (diff) | |
download | FreeBSD-src-3028e3f8aba938dfd0bf9fda987b8a72140b8027.zip FreeBSD-src-3028e3f8aba938dfd0bf9fda987b8a72140b8027.tar.gz |
Sync with HEAD.
Diffstat (limited to 'usr.sbin/ndp')
-rw-r--r-- | usr.sbin/ndp/ndp.8 | 15 | ||||
-rw-r--r-- | usr.sbin/ndp/ndp.c | 67 |
2 files changed, 25 insertions, 57 deletions
diff --git a/usr.sbin/ndp/ndp.8 b/usr.sbin/ndp/ndp.8 index 1fb63f81..223cfba 100644 --- a/usr.sbin/ndp/ndp.8 +++ b/usr.sbin/ndp/ndp.8 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 9, 2012 +.Dd Jan 10, 2013 .Dt NDP 8 .Os .\" @@ -192,6 +192,15 @@ on This flag is set by .Va net.inet6.ip6.auto_linklocal sysctl variable. +.It Ic no_prefer_iface +The address on the outgoing interface is preferred by source addess +selection rule. +If this flag is set, stop treating the address on the +.Ar interface +as special even when the +.Ar interface +is outgoing interface. +The default value of this flag is off. .It Ic disabled Disable IPv6 operation on the interface. When disabled, the interface discards any IPv6 packets @@ -231,8 +240,8 @@ responding to requests for .Ar hostname even though the host address is not its own. .It Fl t -Print timestamp on each entry, -making it possible to merge output with +Print timestamp for each entry, +to make it possible to merge the output with .Xr tcpdump 1 . Most useful when used with .Fl A . diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c index be21d0f..0449c12 100644 --- a/usr.sbin/ndp/ndp.c +++ b/usr.sbin/ndp/ndp.c @@ -404,12 +404,8 @@ set(argc, argv) return 1; } sin->sin6_addr = ((struct sockaddr_in6 *)res->ai_addr)->sin6_addr; -#ifdef __KAME__ - if (IN6_IS_ADDR_LINKLOCAL(&sin->sin6_addr)) { - *(u_int16_t *)&sin->sin6_addr.s6_addr[2] = - htons(((struct sockaddr_in6 *)res->ai_addr)->sin6_scope_id); - } -#endif + sin->sin6_scope_id = + ((struct sockaddr_in6 *)res->ai_addr)->sin6_scope_id; ea = (u_char *)LLADDR(&sdl_m); if (ndp_ether_aton(eaddr, ea) == 0) sdl_m.sdl_alen = 6; @@ -440,9 +436,6 @@ set(argc, argv) goto overwrite; } } - /* - * IPv4 arp command retries with sin_other = SIN_PROXY here. - */ fprintf(stderr, "set: cannot configure a new entry\n"); return 1; } @@ -478,12 +471,6 @@ get(host) return; } sin->sin6_addr = ((struct sockaddr_in6 *)res->ai_addr)->sin6_addr; -#ifdef __KAME__ - if (IN6_IS_ADDR_LINKLOCAL(&sin->sin6_addr)) { - *(u_int16_t *)&sin->sin6_addr.s6_addr[2] = - htons(((struct sockaddr_in6 *)res->ai_addr)->sin6_scope_id); - } -#endif dump(&sin->sin6_addr, 0); if (found_entry == 0) { getnameinfo((struct sockaddr *)sin, sin->sin6_len, host_buf, @@ -520,12 +507,8 @@ delete(host) return 1; } sin->sin6_addr = ((struct sockaddr_in6 *)res->ai_addr)->sin6_addr; -#ifdef __KAME__ - if (IN6_IS_ADDR_LINKLOCAL(&sin->sin6_addr)) { - *(u_int16_t *)&sin->sin6_addr.s6_addr[2] = - htons(((struct sockaddr_in6 *)res->ai_addr)->sin6_scope_id); - } -#endif + sin->sin6_scope_id = + ((struct sockaddr_in6 *)res->ai_addr)->sin6_scope_id; if (rtmsg(RTM_GET) < 0) { errx(1, "RTM_GET(%s) failed", host); /* NOTREACHED */ @@ -537,9 +520,6 @@ delete(host) !(rtm->rtm_flags & RTF_GATEWAY)) { goto delete; } - /* - * IPv4 arp command retries with sin_other = SIN_PROXY here. - */ fprintf(stderr, "delete: cannot delete non-NDP entry\n"); return 1; } @@ -556,16 +536,8 @@ delete: NEXTADDR(RTA_DST, sin_m); rtm->rtm_flags |= RTF_LLDATA; if (rtmsg(RTM_DELETE) == 0) { - struct sockaddr_in6 s6 = *sin; /* XXX: for safety */ - -#ifdef __KAME__ - if (IN6_IS_ADDR_LINKLOCAL(&s6.sin6_addr)) { - s6.sin6_scope_id = ntohs(*(u_int16_t *)&s6.sin6_addr.s6_addr[2]); - *(u_int16_t *)&s6.sin6_addr.s6_addr[2] = 0; - } -#endif - getnameinfo((struct sockaddr *)&s6, - s6.sin6_len, host_buf, + getnameinfo((struct sockaddr *)sin, + sin->sin6_len, host_buf, sizeof(host_buf), NULL, 0, (nflag ? NI_NUMERICHOST : 0)); printf("%s (%s) deleted\n", host, host_buf); @@ -666,10 +638,6 @@ again:; /* XXX: should scope id be filled in the kernel? */ if (sin->sin6_scope_id == 0) sin->sin6_scope_id = sdl->sdl_index; -#ifdef __KAME__ - /* KAME specific hack; removed the embedded id */ - *(u_int16_t *)&sin->sin6_addr.s6_addr[2] = 0; -#endif } getnameinfo((struct sockaddr *)sin, sin->sin6_len, host_buf, sizeof(host_buf), NULL, 0, (nflag ? NI_NUMERICHOST : 0)); @@ -1008,6 +976,9 @@ ifinfo(ifname, argc, argv) #ifdef ND6_IFF_AUTO_LINKLOCAL SETFLAG("auto_linklocal", ND6_IFF_AUTO_LINKLOCAL); #endif +#ifdef ND6_IFF_NO_PREFER_IFACE + SETFLAG("no_prefer_iface", ND6_IFF_NO_PREFER_IFACE); +#endif SETVALUE("basereachable", ND.basereachable); SETVALUE("retrans", ND.retrans); SETVALUE("curhlim", ND.chlim); @@ -1081,6 +1052,10 @@ ifinfo(ifname, argc, argv) if ((ND.flags & ND6_IFF_AUTO_LINKLOCAL)) printf("auto_linklocal "); #endif +#ifdef ND6_IFF_NO_PREFER_IFACE + if ((ND.flags & ND6_IFF_NO_PREFER_IFACE)) + printf("no_prefer_iface "); +#endif } putc('\n', stdout); #undef ND @@ -1331,22 +1306,6 @@ plist() p6.sin6_len = sizeof(p6); p6.sin6_addr = PR.prefix; #endif - - /* - * copy link index to sin6_scope_id field. - * XXX: KAME specific. - */ - if (IN6_IS_ADDR_LINKLOCAL(&p6.sin6_addr)) { - u_int16_t linkid; - - memcpy(&linkid, &p6.sin6_addr.s6_addr[2], - sizeof(linkid)); - linkid = ntohs(linkid); - p6.sin6_scope_id = linkid; - p6.sin6_addr.s6_addr[2] = 0; - p6.sin6_addr.s6_addr[3] = 0; - } - niflags = NI_NUMERICHOST; if (getnameinfo((struct sockaddr *)&p6, sizeof(p6), namebuf, sizeof(namebuf), |