Source-Changes-HG archive

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

[src/trunk]: src better conformance to draft-ietf-ipngwg-icmp-name-lookups-05.



details:   https://anonhg.NetBSD.org/src/rev/9d3cb54ce886
branches:  trunk
changeset: 487758:9d3cb54ce886
user:      itojun <itojun%NetBSD.org@localhost>
date:      Mon Jun 12 16:21:02 2000 +0000

description:
better conformance to draft-ietf-ipngwg-icmp-name-lookups-05.
the old code was chimera of 03 and 05 draft.

-n by default, since IPv6 reverse lookup takes too much time.
use -H to enable reverse name lookup.

diffstat:

 sbin/ping6/ping6.8   |   68 +++++-
 sbin/ping6/ping6.c   |  299 +++++++++++++++++++++++--------
 sys/netinet/icmp6.h  |   15 +-
 sys/netinet6/icmp6.c |  490 ++++++++++++++++++++++++++++++++++++++++++--------
 4 files changed, 697 insertions(+), 175 deletions(-)

diffs (truncated from 1370 to 300 lines):

diff -r 512821a703c2 -r 9d3cb54ce886 sbin/ping6/ping6.8
--- a/sbin/ping6/ping6.8        Mon Jun 12 15:40:35 2000 +0000
+++ b/sbin/ping6/ping6.8        Mon Jun 12 16:21:02 2000 +0000
@@ -1,7 +1,7 @@
+.\"     $NetBSD: ping6.8,v 1.8 2000/06/12 16:21:04 itojun Exp $
+.\"     $KAME: ping6.8,v 1.23 2000/06/12 16:16:09 itojun Exp $
+.\"
 .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
-.\"     $NetBSD: ping6.8,v 1.7 2000/05/18 13:21:49 itojun Exp $
-.\"     $KAME: ping6.8,v 1.19 2000/05/18 13:19:09 itojun Exp $
-.\"
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -37,25 +37,51 @@
 .Tn ICMPv6 ECHO_REQUEST
 packets to network hosts
 .Sh SYNOPSIS
-.Nm
+.Nm ping6
 .\" without ipsec, or new ipsec
-.Op Fl dfnqRvw
+.Op Fl dfHnNqRvw
 .\" old ipsec
-.\" .Op Fl AdEfnqRvw
+.\" .Op Fl AdEfnNqRvw
+.Bk -words
 .Op Fl a Ar addrtype
+.Ek
+.Bk -words
 .Op Fl b Ar bufsiz
+.Ek
+.Bk -words
 .Op Fl c Ar count
+.Ek
+.Bk -words
 .Op Fl h Ar hoplimit
+.Ek
+.Bk -words
 .Op Fl I Ar interface
+.Ek
+.Bk -words
 .Op Fl i Ar wait
+.Ek
+.Bk -words
 .Op Fl l Ar preload
+.Ek
+.Bk -words
 .Op Fl p Ar pattern
+.Ek
+.Bk -words
 .\" new ipsec
 .Op Fl P Ar policy
+.Ek
+.Bk -words
 .Op Fl S Ar sourceaddr
+.Ek
+.Bk -words
 .Op Fl s Ar packetsize
+.Ek
+.Bk -words
 .Op Ar hops...
+.Ek
+.Bk -words
 .Ar host
+.Ek
 .Sh DESCRIPTION
 .Nm
 uses the
@@ -133,6 +159,11 @@
 .Bf -emphasis
 This can be very hard on a network and should be used with caution.
 .Ef
+.It Fl H
+Specifies to try reverse-lookup of IPv6 addresses.
+The
+.Nm
+command does not try reverse-lookup unless the option is specified.
 .It Fl h Ar hoplimit
 Set the IPv6 hoplimit.
 .It Fl I Ar interface
@@ -159,6 +190,19 @@
 .It Fl n
 Numeric output only.
 No attempt will be made to lookup symbolic names for host addresses.
+.It Fl N
+Probe node information multicast group
+.Pq Li ff02::2:xxxx:xxxx .
+.Ar host
+must be string hostname of the target
+.Pq must not be a numeric IPv6 address .
+Node information multicast group will be computed based on given
+.Ar host ,
+and will be used as the final destination.
+Since node information multicast group is a link-local multicast group,
+destination link needs to be specified by
+.Fl I
+option.
 .It Fl p Ar pattern
 You may specify up to 16
 .Dq pad
@@ -197,11 +241,12 @@
 is a neighbor.
 .It Fl S Ar sourceaddr
 Specifies the source address of request packets.
-The source address must be one of the unicast addresses of the sending
-node.
+The source address must be one of the unicast addresses of the sending node.
 If the outgoing interface is specified by the
 .Fl I
-option as well, the address must be assinged to the specified interface.
+option as well,
+.Ar sourceaddr
+needs to be an address assigned to the specified interface.
 .It Fl s Ar packetsize
 Specifies the number of data bytes to be sent.
 The default is 56, which translates into 64
@@ -227,8 +272,9 @@
 is specified.
 .It Fl W
 Same as
-.Fl w .
-This option was remained for backward compatibility.
+.Fl w ,
+but with old packet format based on 03 draft.
+This option is present for backward compatibility.
 .Fl s
 has no effect if
 .Fl w
diff -r 512821a703c2 -r 9d3cb54ce886 sbin/ping6/ping6.c
--- a/sbin/ping6/ping6.c        Mon Jun 12 15:40:35 2000 +0000
+++ b/sbin/ping6/ping6.c        Mon Jun 12 16:21:02 2000 +0000
@@ -1,9 +1,10 @@
-/*     $NetBSD: ping6.c,v 1.14 2000/06/08 13:56:22 itojun Exp $        */
+/*     $NetBSD: ping6.c,v 1.15 2000/06/12 16:21:04 itojun Exp $        */
+/*     $KAME: ping6.c,v 1.55 2000/06/12 16:18:32 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:
@@ -15,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
@@ -80,7 +81,7 @@
 #else
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ping6.c,v 1.14 2000/06/08 13:56:22 itojun Exp $");
+__RCSID("$NetBSD: ping6.c,v 1.15 2000/06/12 16:21:04 itojun Exp $");
 #endif
 #endif
 
@@ -139,6 +140,8 @@
 #include <netinet6/ipsec.h>
 #endif
 
+#include <md5.h>
+
 #define MAXPACKETLEN   131072
 #define        IP6LEN          40
 #define ICMP6ECHOLEN   8       /* icmp echo header len excluding time */
@@ -179,6 +182,9 @@
 #ifdef IPV6_REACHCONF
 #define F_REACHCONF    0x8000
 #endif
+#define F_HOSTNAME     0x10000
+#define F_FQDNOLD      0x20000
+#define F_NIGROUP      0x40000
 u_int options;
 
 #define IN6LEN         sizeof(struct in6_addr)
@@ -196,7 +202,7 @@
 int mx_dup_ck = MAX_DUP_CHK;
 char rcvd_tbl[MAX_DUP_CHK / 8];
 
-struct addrinfo *res;          
+struct addrinfo *res;  
 struct sockaddr_in6 dst;        /* who to ping6 */
 struct sockaddr_in6 src;        /* src addr of this packet */
 int datalen = DEFDATALEN;
@@ -250,6 +256,7 @@
 void    summary __P((void));
 void    tvsub __P((struct timeval *, struct timeval *));
 int     setpolicy __P((int, char *));
+char   *nigroup __P((char *));
 void    usage __P((void));
 
 int
@@ -273,7 +280,7 @@
        struct in6_pktinfo *pktinfo = NULL;
 #ifdef USE_RFC2292BIS
        struct ip6_rthdr *rthdr = NULL;
-#endif 
+#endif
 #ifdef IPSEC_POLICY_IPSEC
        char *policy_in = NULL;
        char *policy_out = NULL;
@@ -286,14 +293,15 @@
        preload = 0;
        datap = &outpack[ICMP6ECHOLEN + ICMP6ECHOTMLEN];
 #ifndef IPSEC
-       while ((ch = getopt(argc, argv, "a:b:c:dfh:I:i:l:np:qRS:s:vwW")) != EOF)
+       while ((ch = getopt(argc, argv, "a:b:c:dfHh:I:i:l:nNp:qRS:s:vwW")) != EOF)
 #else
 #ifdef IPSEC_POLICY_IPSEC
-       while ((ch = getopt(argc, argv, "a:b:c:dfh:I:i:l:np:qRS:s:vwWP:")) != EOF)
+       while ((ch = getopt(argc, argv, "a:b:c:dfHh:I:i:l:nNp:qRS:s:vwWP:")) != EOF)
 #else
-       while ((ch = getopt(argc, argv, "a:b:c:dfh:I:i:l:np:qRS:s:vwWAE")) != EOF)
+       while ((ch = getopt(argc, argv, "a:b:c:dfHh:I:i:l:nNp:qRS:s:vwWAE")) != EOF)
 #endif /*IPSEC_POLICY_IPSEC*/
 #endif
+       {
                switch(ch) {
                 case 'a':
                 {
@@ -327,6 +335,7 @@
                                         break;
                                 default:
                                         usage();
+                                        /*NOTREACHED*/
                                 }
                         }
                         break;
@@ -356,6 +365,9 @@
                        options |= F_FLOOD;
                        setbuf(stdout, (char *)NULL);
                        break;
+               case 'H':
+                       options |= F_HOSTNAME;
+                       break;
                case 'h':               /* hoplimit */
                        hoplimit = strtol(optarg, &e, 10);
                        if (255 < hoplimit || hoplimit < -1)
@@ -388,6 +400,9 @@
                case 'n':
                        options |= F_NUMERIC;
                        break;
+               case 'N':
+                       options |= F_NIGROUP;
+                       break;
                case 'p':               /* fill buffer with user pattern */
                        options |= F_PINGFILLED;
                        fill((char *)datap, optarg);
@@ -422,8 +437,10 @@
                        options |= F_VERBOSE;
                        break;
                case 'w':
+                       options |= F_FQDN;
+                       break;
                case 'W':
-                       options |= F_FQDN;
+                       options |= F_FQDNOLD;
                        break;
 #ifdef IPSEC
 #ifdef IPSEC_POLICY_IPSEC
@@ -447,12 +464,16 @@
 #endif /*IPSEC*/
                default:
                        usage();
+                       /*NOTREACHED*/
                }
+       }
        argc -= optind;
        argv += optind;
 
-       if (argc < 1)
+       if (argc < 1) {
                usage();
+               /*NOTREACHED*/
+       }
 
        if (argc > 1) {
 #ifdef USE_SIN6_SCOPE_ID
@@ -462,11 +483,18 @@
 #endif
        }
 
-       target = argv[argc - 1];
+       if (options & F_NIGROUP) {
+               target = nigroup(argv[argc - 1]);
+               if (target == NULL) {
+                       usage();
+                       /*NOTREACHED*/
+               }
+       } else
+               target = argv[argc - 1];
 
        /* getaddrinfo */



Home | Main Index | Thread Index | Old Index