Repository : ssh://git@open-mesh.org/batctl
On branch : next
commit 7e53633a2bef322fb23c42e7f272913c843d6b4a Author: Sven Eckelmann sven@narfation.org Date: Sat May 24 14:16:43 2014 +0200
batctl: Initialize complete ping packet before write
The data structure for ping packets is not completely initialized by the userspace because the kernel sets the originator address of the packet. This is not only a bad practice but also irritate tools like valgrind.
Signed-off-by: Sven Eckelmann sven@narfation.org Signed-off-by: Marek Lindner mareklindner@neomailbox.ch
7e53633a2bef322fb23c42e7f272913c843d6b4a ping.c | 1 + traceroute.c | 1 + 2 files changed, 2 insertions(+)
diff --git a/ping.c b/ping.c index 6642188..bdca222 100644 --- a/ping.c +++ b/ping.c @@ -176,6 +176,7 @@ int ping(char *mesh_iface, int argc, char **argv)
packet_len = sizeof(struct batadv_icmp_packet);
+ memset(&icmp_packet_out, 0, sizeof(icmp_packet_out)); memcpy(&icmp_packet_out.dst, dst_mac, ETH_ALEN); icmp_packet_out.packet_type = BATADV_ICMP; icmp_packet_out.version = BATADV_COMPAT_VERSION; diff --git a/traceroute.c b/traceroute.c index 22b90f2..4ebfec2 100644 --- a/traceroute.c +++ b/traceroute.c @@ -133,6 +133,7 @@ int traceroute(char *mesh_iface, int argc, char **argv) goto out; }
+ memset(&icmp_packet_out, 0, sizeof(icmp_packet_out)); memcpy(&icmp_packet_out.dst, dst_mac, ETH_ALEN); icmp_packet_out.version = BATADV_COMPAT_VERSION; icmp_packet_out.packet_type = BATADV_ICMP;