[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: [BusyBox] Add interface selection to ping6
From: Bart Visscher <magick () Linux-Fan ! com>
Date: 2002-04-28 9:09:04
[Download RAW message or body]
Changelog:
* Add interface selection to ping6
Remark:
It is sometimes usefull to specify the interface when the routes aren't setup
correctly.
["11-ping6-interface-select.patch" (text/x-patch)]
diff -ru -X exclude -P busybox-new-2/networking/ping6.c busybox-new-0/networking/ping6.c
--- busybox-new-2/networking/ping6.c Thu Apr 25 21:15:14 2002
+++ busybox-new-0/networking/ping6.c Thu Apr 25 21:27:13 2002
@@ -146,6 +146,7 @@
static struct sockaddr_in6 pingaddr;
static int pingsock = -1;
static int datalen; /* intentionally uninitialized to work around gcc bug */
+static char* ifname;
static long ntransmitted, nreceived, nrepeats, pingcount;
static int myid, options;
@@ -364,6 +365,11 @@
setsockopt(pingsock, SOL_IPV6, IPV6_HOPLIMIT, (char *) &sockopt,
sizeof(sockopt));
+ if (ifname) {
+ if ((pingaddr.sin6_scope_id = if_nametoindex(ifname)) == 0)
+ error_msg_and_die("%s: invalid interface name", ifname);
+ }
+
printf("PING %s (%s): %d data bytes\n",
hostent->h_name,
inet_ntop(AF_INET6, (struct in_addr6 *) &pingaddr.sin6_addr,
@@ -442,6 +448,12 @@
show_usage();
argv++;
datalen = atoi(*argv);
+ break;
+ case 'I':
+ if (--argc <= 0)
+ show_usage();
+ argv++;
+ ifname = *argv;
break;
default:
show_usage();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic