[<prev] [next>] [day] [month] [year] [list]
Message-ID: <a60ec8830809181000s928a4drbd0b166be23abcee@mail.gmail.com>
Date: Thu, 18 Sep 2008 20:00:39 +0300
From: "Nadav Shemer" <nadav.shemer@...il.com>
To: netdev@...r.kernel.org
Subject: iputils: ping.c - using -I for both interface and address
When I use 'ping 1.2.3.4 -I eth1 -I 2.3.4.5' the packets come out with
eth1's address anyway.
It seems to me that IP_PKTINFO is set for every packet, with
ipi_spec_dst set to 0. This overrides the inet->saddr set by bind.
Here's a fix:
--- ping.c 2007-11-27 02:57:27.000000000 +0200
+++ ping.c.patched 2008-09-18 19:59:45.000000000 +0300
@@ -350,6 +350,8 @@
fprintf(stderr, "ping: unknown iface %s\n", device);
exit(2);
}
+ if (options & F_STRICTSOURCE)
+ cmsg.ipi.ipi_spec_dst.s_addr = source.sin_addr.s_addr;
cmsg.ipi.ipi_ifindex = ifr.ifr_ifindex;
cmsg_len = sizeof(cmsg);
}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists