Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/usr.sbin/ndp support scoped address notation.
details: https://anonhg.NetBSD.org/src/rev/61141aa3f2e8
branches: netbsd-1-5
changeset: 488207:61141aa3f2e8
user: itojun <itojun%NetBSD.org@localhost>
date: Wed Jun 21 08:23:10 2000 +0000
description:
support scoped address notation.
(pullup from main trunc)
diffstat:
usr.sbin/ndp/ndp.8 | 22 ++++++++++++----------
usr.sbin/ndp/ndp.c | 51 +++++++++++++++++++++++++++++++++++++++++----------
2 files changed, 53 insertions(+), 20 deletions(-)
diffs (236 lines):
diff -r 448aff6d2b3a -r 61141aa3f2e8 usr.sbin/ndp/ndp.8
--- a/usr.sbin/ndp/ndp.8 Wed Jun 21 07:15:32 2000 +0000
+++ b/usr.sbin/ndp/ndp.8 Wed Jun 21 08:23:10 2000 +0000
@@ -1,6 +1,9 @@
+.\" $NetBSD: ndp.8,v 1.7.4.1 2000/06/21 08:23:10 itojun Exp $
+.\" $KAME: ndp.8,v 1.12 2000/06/20 21:50:17 itojun Exp $
+.\"
.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
.\" All rights reserved.
-.\"
+.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
@@ -12,7 +15,7 @@
.\" 3. Neither the name of the project nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
-.\"
+.\"
.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -25,16 +28,13 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $NetBSD: ndp.8,v 1.7 2000/04/16 15:28:01 itojun Exp $
-.\" KAME Id: ndp.8,v 1.9 2000/04/16 15:17:33 itojun Exp
-.\"
.Dd May 17, 1998
.Dt NDP 8
.Os
.\"
.Sh NAME
.Nm ndp
-.Nd control/diagnose IPv6 neighbor discovery protocol
+.Nd control/diagnose IPv6 neighbor discovery protocol
.\"
.Sh SYNOPSIS
.Nm ndp
@@ -80,6 +80,7 @@
.Op Li proxy
.\"
.Sh DESCRIPTION
+The
.Nm
command manipulates the address mapping table
used by Neighbor Discovery Protocol (NDP).
@@ -148,11 +149,11 @@
Register a NDP entry for a node.
The entry will be permanent unless the word
.Li temp
-is given in the command.
+is given in the command.
If the word
.Li proxy
is given, this system will act as an proxy NDP server,
-responding to requests for
+responding to requests for
.Ar hostname
even though the host address is not its own.
.It Fl t
@@ -164,8 +165,9 @@
.El
.\"
.Sh RETURN VALUES
-.Nm Ndp
-will exit with 0 on success, and non-zero on errors.
+The
+.Nm
+command will exit with 0 on success, and non-zero on errors.
.\"
.Sh SEE ALSO
.Xr arp 8
diff -r 448aff6d2b3a -r 61141aa3f2e8 usr.sbin/ndp/ndp.c
--- a/usr.sbin/ndp/ndp.c Wed Jun 21 07:15:32 2000 +0000
+++ b/usr.sbin/ndp/ndp.c Wed Jun 21 08:23:10 2000 +0000
@@ -1,7 +1,10 @@
+/* $NetBSD: ndp.c,v 1.8.4.1 2000/06/21 08:23:11 itojun Exp $ */
+/* $KAME: ndp.c,v 1.40 2000/06/20 21:50:17 itojun Exp $ */
+
/*
* Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +16,7 @@
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -152,6 +155,7 @@
void rtrlist __P((void));
void plist __P((void));
void pfx_flush __P((void));
+void rtrlist __P((void));
void rtr_flush __P((void));
void harmonize_rtr __P((void));
#ifdef SIOCSDEFIFACE_IN6 /* XXX: check SIOCGDEFIFACE_IN6 as well? */
@@ -255,6 +259,7 @@
if (argc != 1)
usage();
delete(argv[0]);
+ exit(0);
}
if (pflag) {
plist();
@@ -376,6 +381,12 @@
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
ea = (u_char *)LLADDR(&sdl_m);
if (ndp_ether_aton(eaddr, ea) == 0)
sdl_m.sdl_alen = 6;
@@ -389,7 +400,6 @@
flags |= RTF_ANNOUNCE;
argv++;
}
-tryagain:
if (rtmsg(RTM_GET) < 0) {
perror(host);
return (1);
@@ -404,8 +414,13 @@
case IFT_ISO88024: case IFT_ISO88025:
goto overwrite;
}
- goto tryagain;
+ /*
+ * IPv4 arp command retries with sin_other = SIN_PROXY here.
+ */
+ fprintf(stderr, "set: cannot configure a new entry\n");
+ return 1;
}
+
overwrite:
if (sdl->sdl_family != AF_LINK) {
printf("cannot intuit interface index and type for %s\n", host);
@@ -437,6 +452,12 @@
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);
if (found_entry == 0) {
getnameinfo((struct sockaddr *)sin, sin->sin6_len, host_buf,
@@ -472,7 +493,12 @@
return 1;
}
sin->sin6_addr = ((struct sockaddr_in6 *)res->ai_addr)->sin6_addr;
-/*tryagain:*/
+#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
if (rtmsg(RTM_GET) < 0) {
perror(host);
return (1);
@@ -489,8 +515,12 @@
goto delete;
}
}
+ /*
+ * IPv4 arp command retries with sin_other = SIN_PROXY here.
+ */
+ fprintf(stderr, "delete: cannot delete non-NDP entry\n");
+ return 1;
}
- return 0;
delete:
if (sdl->sdl_family != AF_LINK) {
@@ -498,7 +528,7 @@
return (1);
}
if (rtmsg(RTM_DELETE) == 0) {
- getnameinfo((struct sockaddr *)sin,
+ getnameinfo((struct sockaddr *)sin,
sin->sin6_len, host_buf,
sizeof(host_buf), NULL, 0,
NI_WITHSCOPEID | (nflag ? NI_NUMERICHOST : 0));
@@ -521,6 +551,7 @@
struct rt_msghdr *rtm;
struct sockaddr_in6 *sin;
struct sockaddr_dl *sdl;
+ extern int h_errno;
struct in6_nbrinfo *nbi;
struct timeval time;
int addrwidth;
@@ -1038,7 +1069,7 @@
printf(" (reachable)\n");
break;
default:
- printf(" (unreachable)\n");
+ printf(" (unreachable)\n");
}
}
else
@@ -1112,7 +1143,7 @@
err(1, "failed to resolve i/f index for %s", ifname);
}
- if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
+ if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
err(1, "socket");
strcpy(ndifreq.ifname, "lo0"); /* dummy */
@@ -1130,7 +1161,7 @@
struct in6_ndifreq ndifreq;
char ifname[IFNAMSIZ+8];
- if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
+ if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
err(1, "socket");
memset(&ndifreq, 0, sizeof(ndifreq));
Home |
Main Index |
Thread Index |
Old Index