Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/ndp recover backward compatibility in -I behavior. ...



details:   https://anonhg.NetBSD.org/src/rev/7aff12974e72
branches:  trunk
changeset: 532253:7aff12974e72
user:      itojun <itojun%NetBSD.org@localhost>
date:      Mon Jun 03 19:27:39 2002 +0000

description:
recover backward compatibility in -I behavior.  sync w/kame

diffstat:

 usr.sbin/ndp/ndp.8 |  21 +++++++++------------
 usr.sbin/ndp/ndp.c |  21 ++++++++++++---------
 2 files changed, 21 insertions(+), 21 deletions(-)

diffs (111 lines):

diff -r 39e51dcb43ca -r 7aff12974e72 usr.sbin/ndp/ndp.8
--- a/usr.sbin/ndp/ndp.8        Mon Jun 03 18:31:12 2002 +0000
+++ b/usr.sbin/ndp/ndp.8        Mon Jun 03 19:27:39 2002 +0000
@@ -1,5 +1,5 @@
-.\"    $NetBSD: ndp.8,v 1.17 2002/06/03 04:41:34 itojun Exp $
-.\"    $KAME: ndp.8,v 1.26 2002/06/03 04:39:03 itojun Exp $
+.\"    $NetBSD: ndp.8,v 1.18 2002/06/03 19:27:39 itojun Exp $
+.\"    $KAME: ndp.8,v 1.27 2002/06/03 19:25:27 itojun Exp $
 .\"
 .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
 .\" All rights reserved.
@@ -65,10 +65,7 @@
 .Op Ar flags ...
 .Nm ndp
 .Op Fl nt
-.Fl I Ar interface
-.Nm ndp
-.Op Fl nt
-.Fl I Li delete
+.Fl I Op Ar interface | Li delete
 .Nm ndp
 .Op Fl nt
 .Fl s Ar nodename etheraddr
@@ -144,15 +141,15 @@
 .It Fl H
 Harmonize consistency between the routing table and the default router
 list; install the top entry of the list into the kernel routing table.
+.It Fl I
+Shows the default interface used as the default route when
+there is no default router.
 .It Fl I Ar interface
-Shows or specifies the default interface used as the default route when
+Specifies the default interface used as the default route when
 there is no default router.
-If a valid
+The 
 .Ar interface
-is specified, the interface will be used as the default.
-If
-.Ar interface
-is not a valid interface name, the current setting will be presented.
+will be used as the default.
 .It Fl I Li delete
 The current default interface will be deleted from the kernel.
 .It Fl i Ar interface Op Ar flags ...
diff -r 39e51dcb43ca -r 7aff12974e72 usr.sbin/ndp/ndp.c
--- a/usr.sbin/ndp/ndp.c        Mon Jun 03 18:31:12 2002 +0000
+++ b/usr.sbin/ndp/ndp.c        Mon Jun 03 19:27:39 2002 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: ndp.c,v 1.24 2002/06/03 04:41:34 itojun Exp $  */
-/*     $KAME: ndp.c,v 1.99 2002/06/03 04:39:03 itojun Exp $    */
+/*     $NetBSD: ndp.c,v 1.25 2002/06/03 19:27:40 itojun Exp $  */
+/*     $KAME: ndp.c,v 1.100 2002/06/03 19:25:27 itojun Exp $   */
 
 /*
  * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
@@ -175,7 +175,7 @@
 
        pid = getpid();
        thiszone = gmt2local(0);
-       while ((ch = getopt(argc, argv, "acd:f:I:i:nprstA:HPR")) != -1)
+       while ((ch = getopt(argc, argv, "acd:f:Ii:nprstA:HPR")) != -1)
                switch (ch) {
                case 'a':
                case 'c':
@@ -185,6 +185,7 @@
                case 'P':
                case 'R':
                case 's':
+               case 'I':
                        if (mode) {
                                usage();
                                /*NOTREACHED*/
@@ -194,7 +195,6 @@
                        break;
                case 'd':
                case 'f':
-               case 'I':
                case 'i' :
                        if (mode) {
                                usage();
@@ -246,12 +246,16 @@
                break;
        case 'I':
 #ifdef SIOCSDEFIFACE_IN6       /* XXX: check SIOCGDEFIFACE_IN6 as well? */
-               if (argc != 0) {
+               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);
                }
-               if (strcmp(arg, "default") == 0 || if_nametoindex(arg))
-                       setdefif(arg);
                getdefif(); /* always call it to print the result */
                break;
 #else
@@ -846,8 +850,7 @@
        printf("       ndp [-nt] -f filename\n");
        printf("       ndp [-nt] -i interface [flags...]\n");
 #ifdef SIOCSDEFIFACE_IN6
-       printf("       ndp [-nt] -I interface\n");
-       printf("       ndp [-nt] -I delete\n");
+       printf("       ndp [-nt] -I [interface|delete]\n");
 #endif
        printf("       ndp [-nt] -s nodename etheraddr [temp] [proxy]\n");
        exit(1);



Home | Main Index | Thread Index | Old Index