diff options
author | Denys Vlasenko | 2017-09-29 14:09:02 +0200 |
---|---|---|
committer | Denys Vlasenko | 2017-09-29 14:22:43 +0200 |
commit | 2b9acc60c0468379cd24d13bc9e3f3e50761c0c9 (patch) | |
tree | cc210e6cc6c63605bd7100ec3f516b62416b1f4e | |
parent | 0c4dbd481aedb5d22c1048e7f7eb547a3b5e50a5 (diff) | |
download | busybox-2b9acc60c0468379cd24d13bc9e3f3e50761c0c9.zip busybox-2b9acc60c0468379cd24d13bc9e3f3e50761c0c9.tar.gz |
udhcpc[6]: initialize entire sockaddr_ll
I see random field values like sll_hatype=0x267 when I strace.
They seem to not matter, but just in case they sometimes do,
let's at least have deterministic values (via memset(0)).
function old new delta
change_listen_mode 308 322 +14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | networking/udhcp/d6_dhcpc.c | 5 | ||||
-rw-r--r-- | networking/udhcp/d6_packet.c | 2 | ||||
-rw-r--r-- | networking/udhcp/dhcpc.c | 5 | ||||
-rw-r--r-- | networking/udhcp/packet.c | 2 |
4 files changed, 14 insertions, 0 deletions
diff --git a/networking/udhcp/d6_dhcpc.c b/networking/udhcp/d6_dhcpc.c index 714555f..d4bb350 100644 --- a/networking/udhcp/d6_dhcpc.c +++ b/networking/udhcp/d6_dhcpc.c @@ -881,9 +881,14 @@ static int d6_raw_socket(int ifindex) fd = xsocket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IPV6)); log2("got raw socket fd %d", fd); + memset(&sock, 0, sizeof(sock)); /* let's be deterministic */ sock.sll_family = AF_PACKET; sock.sll_protocol = htons(ETH_P_IPV6); sock.sll_ifindex = ifindex; + /*sock.sll_hatype = ARPHRD_???;*/ + /*sock.sll_pkttype = PACKET_???;*/ + /*sock.sll_halen = ???;*/ + /*sock.sll_addr[8] = ???;*/ xbind(fd, (struct sockaddr *) &sock, sizeof(sock)); #if 0 diff --git a/networking/udhcp/d6_packet.c b/networking/udhcp/d6_packet.c index 79a0ac8..a0656c1 100644 --- a/networking/udhcp/d6_packet.c +++ b/networking/udhcp/d6_packet.c @@ -75,6 +75,8 @@ int FAST_FUNC d6_send_raw_packet( dest_sll.sll_family = AF_PACKET; dest_sll.sll_protocol = htons(ETH_P_IPV6); dest_sll.sll_ifindex = ifindex; + /*dest_sll.sll_hatype = ARPHRD_???;*/ + /*dest_sll.sll_pkttype = PACKET_???;*/ dest_sll.sll_halen = 6; memcpy(dest_sll.sll_addr, dest_arp, 6); diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index 99d91bf..6c74996 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c @@ -1010,9 +1010,14 @@ static int udhcp_raw_socket(int ifindex) */ log2("got raw socket fd"); + memset(&sock, 0, sizeof(sock)); /* let's be deterministic */ sock.sll_family = AF_PACKET; sock.sll_protocol = htons(ETH_P_IP); sock.sll_ifindex = ifindex; + /*sock.sll_hatype = ARPHRD_???;*/ + /*sock.sll_pkttype = PACKET_???;*/ + /*sock.sll_halen = ???;*/ + /*sock.sll_addr[8] = ???;*/ xbind(fd, (struct sockaddr *) &sock, sizeof(sock)); #if 0 /* Several users reported breakage when BPF filter is used */ diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c index 9e1b46d..44d9cee 100644 --- a/networking/udhcp/packet.c +++ b/networking/udhcp/packet.c @@ -129,6 +129,8 @@ int FAST_FUNC udhcp_send_raw_packet(struct dhcp_packet *dhcp_pkt, dest_sll.sll_family = AF_PACKET; dest_sll.sll_protocol = htons(ETH_P_IP); dest_sll.sll_ifindex = ifindex; + /*dest_sll.sll_hatype = ARPHRD_???;*/ + /*dest_sll.sll_pkttype = PACKET_???;*/ dest_sll.sll_halen = 6; memcpy(dest_sll.sll_addr, dest_arp, 6); |