iputils/iputils-ss021109-locallinksyntax.diff

51 lines
933 B
Diff

This patch for iputils allows to use the standard
ping6 link-local-addr%interface
syntax instead of ping6 -I interface link-local-addr. This matches
BSD ping.
Please apply.
-Andi
diff -u iputils/ping6.c-o iputils/ping6.c
--- iputils/ping6.c-o 2005-07-08 02:21:34.000000000 +0200
+++ iputils/ping6.c 2005-07-08 02:51:47.000000000 +0200
@@ -268,6 +268,14 @@
target = *argv;
+ if (!device) {
+ char *s = strchr(target, '%');
+ if (s) {
+ device = s+1;
+ *s = 0;
+ }
+ }
+
if (inet_pton(AF_INET6, target, &addr) <= 0) {
struct hostent *hp;
@@ -296,6 +304,14 @@
memset(&whereto, 0, sizeof(struct sockaddr_in6));
whereto.sin6_family = AF_INET6;
whereto.sin6_port = htons(IPPROTO_ICMPV6);
+
+ if (!device) {
+ char *s = strchr(target, '%');
+ if (s) {
+ device = s+1;
+ *s = 0;
+ }
+ }
if (inet_pton(AF_INET6, target, &whereto.sin6_addr) <= 0) {
struct hostent *hp;
--