aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ndp
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>2013-02-08 16:10:16 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>2013-02-08 16:10:16 +0000
commitd9a447559bc04121f7c6682e64abe67efa154864 (patch)
treeb2f038222ff8a70f687652441df00d2b564c8abe /usr.sbin/ndp
parent3cbf5f97aafc2b249c509ee1162c47c9b28e591e (diff)
parentfbda3d5daeeb730a49d025b614b35a32f0319718 (diff)
downloadsrc-d9a447559bc04121f7c6682e64abe67efa154864.tar.gz
src-d9a447559bc04121f7c6682e64abe67efa154864.zip
Sync with HEAD.
Notes
Notes: svn path=/projects/bmake/; revision=246555
Diffstat (limited to 'usr.sbin/ndp')
-rw-r--r--usr.sbin/ndp/ndp.815
-rw-r--r--usr.sbin/ndp/ndp.c67
2 files changed, 25 insertions, 57 deletions
diff --git a/usr.sbin/ndp/ndp.8 b/usr.sbin/ndp/ndp.8
index 1fb63f815af7..223cfba492f6 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 be21d0fc24a3..0449c123841d 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),