Commit 7e53633a authored by Sven Eckelmann's avatar Sven Eckelmann Committed by Marek Lindner

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: default avatarSven Eckelmann <sven@narfation.org>
Signed-off-by: default avatarMarek Lindner <mareklindner@neomailbox.ch>
parent 51b3e928
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment