summaryrefslogtreecommitdiff
path: root/usr.sbin/ndp/ndp.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2013-03-11 14:02:38 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2013-03-11 14:02:38 +0000
commitd6c8fae289ba69ecc48c91067f13c92146c715a8 (patch)
tree685a0ebd0e2d4a53b7d4a7f1021dddc59d721ccf /usr.sbin/ndp/ndp.c
parent31742b5e0ca36c9a3dab4878348b0d485021bf4a (diff)
Remove the -I option, even if the ioctls for manipulating a default
interface are defined, nothing use it in the kernel since the on-link assumption behavior removal back in 2004. ok mikeb@, bluhm@, florian@
Diffstat (limited to 'usr.sbin/ndp/ndp.c')
-rw-r--r--usr.sbin/ndp/ndp.c84
1 files changed, 2 insertions, 82 deletions
diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c
index 965c6559ee0..5fb2db7cd29 100644
--- a/usr.sbin/ndp/ndp.c
+++ b/usr.sbin/ndp/ndp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ndp.c,v 1.45 2009/06/25 15:44:43 claudio Exp $ */
+/* $OpenBSD: ndp.c,v 1.46 2013/03/11 14:02:37 mpi Exp $ */
/* $KAME: ndp.c,v 1.101 2002/07/17 08:46:33 itojun Exp $ */
/*
@@ -141,10 +141,6 @@ void pfx_flush(void);
void rtrlist(void);
void rtr_flush(void);
void harmonize_rtr(void);
-#ifdef SIOCSDEFIFACE_IN6 /* XXX: check SIOCGDEFIFACE_IN6 as well? */
-static void getdefif(void);
-static void setdefif(char *);
-#endif
static char *sec2str(time_t);
static char *ether_str(struct sockaddr_dl *);
static void ts_print(const struct timeval *);
@@ -168,7 +164,7 @@ main(int argc, char *argv[])
pid = getpid();
thiszone = gmt2local(0);
- while ((ch = getopt(argc, argv, "acd:f:Ii:nprstA:HPR")) != -1)
+ while ((ch = getopt(argc, argv, "acd:f:i:nprstA:HPR")) != -1)
switch (ch) {
case 'a':
case 'c':
@@ -178,7 +174,6 @@ main(int argc, char *argv[])
case 'P':
case 'R':
case 's':
- case 'I':
if (mode) {
usage();
/*NOTREACHED*/
@@ -237,24 +232,6 @@ main(int argc, char *argv[])
}
delete(arg);
break;
- case 'I':
-#ifdef SIOCSDEFIFACE_IN6 /* XXX: check SIOCGDEFIFACE_IN6 as well? */
- if (argc > 1) {
- usage();
- /*NOTREACHED*/
- } else if (argc == 1) {
- if (strcmp(*argv, "delete") == 0 ||
- if_nametoindex(*argv))
- setdefif(*argv);
- else
- errx(1, "invalid interface %s", *argv);
- }
- getdefif(); /* always call it to print the result */
- break;
-#else
- errx(1, "not supported yet");
- /*NOTREACHED*/
-#endif
case 'p':
if (argc != 0) {
usage();
@@ -829,9 +806,6 @@ usage(void)
printf("usage: ndp [-nrt] [-a | -c | -p] [-H | -P | -R] ");
printf("[-A wait] [-d hostname]\n");
printf("\t[-f filename] ");
-#ifdef SIOCSDEFIFACE_IN6
- printf("[-I [interface | delete]] ");
-#endif
printf("[-i interface [flag ...]]\n");
printf("\t[-s nodename etheraddr [temp] [proxy]] [hostname]\n");
exit(1);
@@ -1447,60 +1421,6 @@ harmonize_rtr(void)
close(s);
}
-#ifdef SIOCSDEFIFACE_IN6 /* XXX: check SIOCGDEFIFACE_IN6 as well? */
-static void
-setdefif(char *ifname)
-{
- struct in6_ndifreq ndifreq;
- unsigned int ifindex;
-
- if (strcasecmp(ifname, "delete") == 0)
- ifindex = 0;
- else {
- if ((ifindex = if_nametoindex(ifname)) == 0)
- err(1, "failed to resolve i/f index for %s", ifname);
- }
-
- if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
- err(1, "socket");
-
- strlcpy(ndifreq.ifname, "lo0", sizeof(ndifreq.ifname)); /* dummy */
- ndifreq.ifindex = ifindex;
-
- if (ioctl(s, SIOCSDEFIFACE_IN6, (caddr_t)&ndifreq) < 0)
- err(1, "ioctl(SIOCSDEFIFACE_IN6)");
-
- close(s);
-}
-
-static void
-getdefif(void)
-{
- struct in6_ndifreq ndifreq;
- char ifname[IFNAMSIZ+8];
-
- if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
- err(1, "socket");
-
- memset(&ndifreq, 0, sizeof(ndifreq));
- strlcpy(ndifreq.ifname, "lo0", sizeof(ndifreq.ifname)); /* dummy */
-
- if (ioctl(s, SIOCGDEFIFACE_IN6, (caddr_t)&ndifreq) < 0)
- err(1, "ioctl(SIOCGDEFIFACE_IN6)");
-
- if (ndifreq.ifindex == 0)
- printf("No default interface.\n");
- else {
- if ((if_indextoname(ndifreq.ifindex, ifname)) == NULL)
- err(1, "failed to resolve ifname for index %lu",
- ndifreq.ifindex);
- printf("ND default interface = %s\n", ifname);
- }
-
- close(s);
-}
-#endif
-
static char *
sec2str(time_t total)
{