Source-Changes-HG archive

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

[src/trunk]: src correct typo in #define. ICMP6_NI_SUCESS -> SUCCESS (notice...



details:   https://anonhg.NetBSD.org/src/rev/b50e7a6b87be
branches:  trunk
changeset: 495722:b50e7a6b87be
user:      itojun <itojun%NetBSD.org@localhost>
date:      Thu Aug 03 14:31:04 2000 +0000

description:
correct typo in #define.  ICMP6_NI_SUCESS -> SUCCESS (notice missing C).
sync with kame.

diffstat:

 sys/netinet/icmp6.h            |   9 +++--
 sys/netinet6/icmp6.c           |  60 +++++++++++++++++------------------------
 usr.sbin/tcpdump/print-icmp6.c |   8 ++--
 3 files changed, 34 insertions(+), 43 deletions(-)

diffs (216 lines):

diff -r 265364a84148 -r b50e7a6b87be sys/netinet/icmp6.h
--- a/sys/netinet/icmp6.h       Thu Aug 03 14:01:31 2000 +0000
+++ b/sys/netinet/icmp6.h       Thu Aug 03 14:31:04 2000 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: icmp6.h,v 1.11 2000/07/28 04:06:52 itojun Exp $        */
-/*     $KAME: icmp6.h,v 1.18 2000/07/03 02:51:08 itojun Exp $  */
+/*     $NetBSD: icmp6.h,v 1.12 2000/08/03 14:31:04 itojun Exp $        */
+/*     $KAME: icmp6.h,v 1.21 2000/08/03 14:22:09 itojun Exp $  */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -146,7 +146,7 @@
 #define ICMP6_NI_SUBJ_FQDN     1       /* Query Subject is a Domain name */
 #define ICMP6_NI_SUBJ_IPV4     2       /* Query Subject is an IPv4 address */
 
-#define ICMP6_NI_SUCESS                0       /* node information successful reply */
+#define ICMP6_NI_SUCCESS       0       /* node information successful reply */
 #define ICMP6_NI_REFUSED       1       /* node information request is refused */
 #define ICMP6_NI_UNKNOWN       2       /* unknown Qtype */
 
@@ -321,7 +321,8 @@
 #define NI_QTYPE_NOOP          0 /* NOOP  */
 #define NI_QTYPE_SUPTYPES      1 /* Supported Qtypes */
 #define NI_QTYPE_FQDN          2 /* FQDN */
-#define NI_QTYPE_NODEADDR      3 /* Node Addresses. XXX: spec says 2, but it may be a typo... */
+#define NI_QTYPE_NODEADDR      3 /* Node Addresses */
+#define NI_QTYPE_IPV4ADDR      4 /* IPv4 Addresses */
 
 #if BYTE_ORDER == BIG_ENDIAN
 #define NI_SUPTYPE_FLAG_COMPRESS       0x1
diff -r 265364a84148 -r b50e7a6b87be sys/netinet6/icmp6.c
--- a/sys/netinet6/icmp6.c      Thu Aug 03 14:01:31 2000 +0000
+++ b/sys/netinet6/icmp6.c      Thu Aug 03 14:31:04 2000 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: icmp6.c,v 1.39 2000/07/30 05:30:37 itojun Exp $        */
-/*     $KAME: icmp6.c,v 1.120 2000/07/06 11:47:20 itojun Exp $ */
+/*     $NetBSD: icmp6.c,v 1.40 2000/08/03 14:31:05 itojun Exp $        */
+/*     $KAME: icmp6.c,v 1.130 2000/08/03 14:22:10 itojun Exp $ */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -1042,14 +1042,13 @@
 }
 
 /*
- * Process a Node Information Query packet, (roughly) based on
- * draft-ietf-ipngwg-icmp-name-lookups-05.
+ * Process a Node Information Query packet, based on
+ * draft-ietf-ipngwg-icmp-name-lookups-06.
  * 
  * Spec incompatibilities:
  * - IPv6 Subject address handling
  * - IPv4 Subject address handling support missing
  * - Proxy reply (answer even if it's not for me)
- * - "Supported Qtypes" support missing
  * - joins NI group address at in6_ifattach() time only, does not cope
  *   with hostname changes by sethostname(3)
  */
@@ -1089,24 +1088,8 @@
         * Validate IPv6 destination address.
         *
         * We accept packets with the following IPv6 destination address:
-        * - Responder's unicast/anycast address,
-        * - link-local multicast address
-        * This is a violation to last paragraph in icmp-name-lookups-05
-        * page 4, which restricts IPv6 destination address of a query to:
-        * - Responder's unicast/anycast address,
-        * - NI group address for a name belongs to the Responder, or
-        * - NI group address for a name for which the Responder is providing
-        *   proxy service.
-        * (note: NI group address is a link-local multicast address)
-        *
-        * We allow any link-local multicast address, since "ping6 -w ff02::1"
-        * has been really useful for us debugging our network.  Also this is
-        * still questionable if the restriction in spec buy us security at all,
-        * since RFC2463 permits echo packet to multicast destination.
-        * Even if we forbid NI query to ff02::1, we can effectively get the
-        * same result as "ping6 -w ff02::1" by the following steps:
-        * - run "ping6 ff02::1", then
-        * - run "ping6 -w" for all addresses replied.
+        * - Responder's unicast/anycast address, and
+        * - link-local multicast address (including NI group address)
         */
        bzero(&sin6, sizeof(sin6));
        sin6.sin6_family = AF_INET6;
@@ -1126,7 +1109,7 @@
        case NI_QTYPE_NOOP:
                break;          /* no reply data */
        case NI_QTYPE_SUPTYPES:
-               goto bad;       /* xxx: to be implemented */
+               replylen += sizeof(u_int32_t);
                break;
        case NI_QTYPE_FQDN:
                /* XXX will append a mbuf */
@@ -1159,10 +1142,10 @@
        switch (qtype) {
        case NI_QTYPE_NOOP:
        case NI_QTYPE_SUPTYPES:
-               if (subjlen != 0)
-                       goto bad;
-               break;
-
+               /* 06 draft */
+               if (ni6->ni_code == ICMP6_NI_SUBJ_FQDN && subjlen == 0)
+                       break;
+               /*FALLTHROUGH*/
        case NI_QTYPE_FQDN:
        case NI_QTYPE_NODEADDR:
                switch (ni6->ni_code) {
@@ -1174,10 +1157,15 @@
                         * backward compatibility - try to accept 03 draft
                         * format, where no Subject is present.
                         */
-                       if (subjlen == 0) {
+                       if (qtype == NI_QTYPE_FQDN && ni6->ni_code == 0 &&
+                           subjlen == 0) {
                                oldfqdn++;
                                break;
                        }
+#if ICMP6_NI_SUBJ_IPV6 != 0
+                       if (ni6->ni_code != ICMP6_NI_SUBJ_IPV6)
+                               goto bad;
+#endif
 
                        if (subjlen != sizeof(sin6.sin6_addr))
                                goto bad;
@@ -1258,10 +1246,6 @@
                        goto bad;
                }
                break;
-
-       default:
-               /* should never be here due to "switch (qtype)" above */
-               goto bad;
        }
 
        /* allocate a mbuf to reply. */
@@ -1294,12 +1278,17 @@
        /* qtype dependent procedure */
        switch (qtype) {
        case NI_QTYPE_NOOP:
+               nni6->ni_code = ICMP6_NI_SUCCESS;
                nni6->ni_flags = 0;
                break;
        case NI_QTYPE_SUPTYPES:
-               goto bad;       /* xxx: to be implemented */
+               nni6->ni_code = ICMP6_NI_SUCCESS;
+               nni6->ni_flags = htons(0x0000); /* raw bitmap */
+               /* supports NOOP, SUPTYPES, FQDN, and NODEADDR */
+               *(u_int32_t *)(nni6 + 1) = htonl(0x000f);
                break;
        case NI_QTYPE_FQDN:
+               nni6->ni_code = ICMP6_NI_SUCCESS;
                fqdn = (struct ni_reply_fqdn *)(mtod(n, caddr_t) +
                                                sizeof(struct ip6_hdr) +
                                                sizeof(struct icmp6_nodeinfo));
@@ -1320,6 +1309,7 @@
        {
                int lenlim, copied;
 
+               nni6->ni_code = ICMP6_NI_SUCCESS;
                if (n->m_flags & M_EXT)
                        lenlim = MCLBYTES - sizeof(struct ip6_hdr) -
                                sizeof(struct icmp6_nodeinfo);
@@ -1337,7 +1327,6 @@
        }
 
        nni6->ni_type = ICMP6_NI_REPLY;
-       nni6->ni_code = ICMP6_NI_SUCESS;
        m_freem(m);
        return(n);
 
@@ -1449,6 +1438,7 @@
 /*
  * check if two DNS-encoded string matches.  takes care of truncated
  * form (with \0\0 at the end).  no compression support.
+ * XXX upper/lowercase match (see RFC2065)
  */
 static int
 ni6_dnsmatch(a, alen, b, blen)
diff -r 265364a84148 -r b50e7a6b87be usr.sbin/tcpdump/print-icmp6.c
--- a/usr.sbin/tcpdump/print-icmp6.c    Thu Aug 03 14:01:31 2000 +0000
+++ b/usr.sbin/tcpdump/print-icmp6.c    Thu Aug 03 14:31:04 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: print-icmp6.c,v 1.8 2000/08/01 17:29:48 itojun Exp $   */
+/*     $NetBSD: print-icmp6.c,v 1.9 2000/08/03 14:31:04 itojun Exp $   */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994
@@ -27,7 +27,7 @@
     "@(#) /master/usr.sbin/tcpdump/tcpdump/print-icmp.c,v 2.1 1995/02/03 18:14:42 polk Exp (LBL)";
 #else
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: print-icmp6.c,v 1.8 2000/08/01 17:29:48 itojun Exp $");
+__RCSID("$NetBSD: print-icmp6.c,v 1.9 2000/08/03 14:31:04 itojun Exp $");
 #endif
 #endif
 
@@ -689,7 +689,7 @@
                printf("icmp6: node information query");
                printf(" (");   /*)*/
                switch (ni6->ni_code) {
-               case ICMP6_NI_SUCESS:
+               case ICMP6_NI_SUCCESS:
                        if (vflag) {
                                printf("success");
                                needcomma++;
@@ -711,7 +711,7 @@
                        break;
                }
 
-               if (ni6->ni_code != ICMP6_NI_SUCESS) {
+               if (ni6->ni_code != ICMP6_NI_SUCCESS) {
                        /*(*/
                        printf(")");
                        break;



Home | Main Index | Thread Index | Old Index