Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/mld6query sync with recent KAME.



details:   https://anonhg.NetBSD.org/src/rev/6ab424b49f5e
branches:  trunk
changeset: 476008:6ab424b49f5e
user:      itojun <itojun%NetBSD.org@localhost>
date:      Fri Sep 03 04:34:34 1999 +0000

description:
sync with recent KAME.

diffstat:

 usr.sbin/mld6query/mld6.c      |  37 +++++++++++++++++++++++++++++--------
 usr.sbin/mld6query/mld6query.8 |  17 ++++++++++++++---
 2 files changed, 43 insertions(+), 11 deletions(-)

diffs (132 lines):

diff -r 9f8bb62320f2 -r 6ab424b49f5e usr.sbin/mld6query/mld6.c
--- a/usr.sbin/mld6query/mld6.c Fri Sep 03 04:31:48 1999 +0000
+++ b/usr.sbin/mld6query/mld6.c Fri Sep 03 04:34:34 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mld6.c,v 1.1 1999/07/06 13:32:01 itojun Exp $  */
+/*     $NetBSD: mld6.c,v 1.2 1999/09/03 04:34:34 itojun Exp $  */
 
 /*
  * Copyright (C) 1998 WIDE Project.
@@ -62,7 +62,7 @@
 
 #define QUERY_RESPONSE_INTERVAL 10000
 
-void make_msg(int index, struct in6_addr *addr);
+void make_msg(int index, struct in6_addr *addr, u_int type);
 void usage(void);
 void dump(int);
 void quit(int);
@@ -75,14 +75,35 @@
        u_int hlim = 1;
        fd_set fdset;
        struct itimerval itimer;
+       u_int type;
+       int ch;
+       extern int optind;
 
-       if (argc != 2 && argc != 3)
+       type = MLD6_LISTENER_QUERY;
+       while ((ch = getopt(argc, argv, "d")) != EOF) {
+               switch (ch) {
+               case 'd':
+                       type = MLD6_LISTENER_DONE;
+                       break;
+               case 'r':
+                       type = MLD6_LISTENER_REPORT;
+                       break;
+               default:
+                       usage();
+                       /*NOTREACHED*/
+               }
+       }
+
+       argv += optind;
+       argc -= optind;
+       
+       if (argc != 1 && argc != 2)
                usage();
 
-       ifindex = (u_short)if_nametoindex(argv[1]);
+       ifindex = (u_short)if_nametoindex(argv[0]);
        if (ifindex == 0)
                usage();
-       if (argc == 3 && inet_pton(AF_INET6, argv[2], &maddr) != 1)
+       if (argc == 3 && inet_pton(AF_INET6, argv[1], &maddr) != 1)
                usage();
 
        if ((s = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) < 0)
@@ -106,7 +127,7 @@
                        sizeof(filt)) < 0)
                err(1, "setsockopt(ICMP6_FILTER)");
 
-       make_msg(ifindex, &maddr);
+       make_msg(ifindex, &maddr, type);
 
        if (sendmsg(s, &m, 0) < 0)
                err(1, "sendmsg");
@@ -132,7 +153,7 @@
 }
 
 void
-make_msg(int index, struct in6_addr *addr)
+make_msg(int index, struct in6_addr *addr, u_int type)
 {
        static struct iovec iov[2];
        static u_char *cmsgbuf;
@@ -158,7 +179,7 @@
        m.msg_iovlen = 1;
 
        bzero(&mldh, sizeof(mldh));
-       mldh.mld6_type = MLD6_LISTENER_QUERY;
+       mldh.mld6_type = type & 0xff;
        mldh.mld6_maxdelay = htons(QUERY_RESPONSE_INTERVAL);
        mldh.mld6_addr = *addr;
 
diff -r 9f8bb62320f2 -r 6ab424b49f5e usr.sbin/mld6query/mld6query.8
--- a/usr.sbin/mld6query/mld6query.8    Fri Sep 03 04:31:48 1999 +0000
+++ b/usr.sbin/mld6query/mld6query.8    Fri Sep 03 04:34:34 1999 +0000
@@ -25,8 +25,8 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\"    $NetBSD: mld6query.8,v 1.1 1999/07/06 13:32:01 itojun Exp $
-.\"     KAME Id: mld6query.8,v 1.1.2.6 1998/12/03 01:54:41 itojun Exp
+.\"    $NetBSD: mld6query.8,v 1.2 1999/09/03 04:34:34 itojun Exp $
+.\"    KAME Id: mld6query.8,v 1.3 1999/08/20 10:00:06 itojun Exp
 .\"
 .Dd May 17, 1998
 .Dt MLD6QUERY 8
@@ -38,6 +38,7 @@
 .\"
 .Sh SYNOPSIS
 .Nm
+.Op Fl dr
 .Ar intface
 .Op Ar maddr
 .\"
@@ -50,7 +51,7 @@
 .Ar intface .
 If you omit
 .Ar maddr ,
-linklocal multicast address(ff02::1) is used.
+linklocal all nodes multicast address(ff02::1) is used.
 .Pp
 After sending a query,
 .Nm
@@ -61,6 +62,16 @@
 .Pp
 This program is provided only for debugging.
 It is not necessary for normal use.
+.Pp
+With
+.Fl d ,
+.Nm
+will transmit MLD done packet instead of MLD query packet.
+With
+.Fl r ,
+similarly, MLD report packet will be transmitted.
+.Fl dr
+options are for debugging purposes only.
 .\"
 .Sh RETURN VALUES
 The program exits with 0 on success, non-zero on failures.



Home | Main Index | Thread Index | Old Index