aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-09-29 14:09:02 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-09-29 14:22:43 +0200
commit2b9acc60c0468379cd24d13bc9e3f3e50761c0c9 (patch)
treecc210e6cc6c63605bd7100ec3f516b62416b1f4e /networking/udhcp
parent0c4dbd481aedb5d22c1048e7f7eb547a3b5e50a5 (diff)
downloadbusybox-w32-2b9acc60c0468379cd24d13bc9e3f3e50761c0c9.tar.gz
busybox-w32-2b9acc60c0468379cd24d13bc9e3f3e50761c0c9.tar.bz2
busybox-w32-2b9acc60c0468379cd24d13bc9e3f3e50761c0c9.zip
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>
Diffstat (limited to 'networking/udhcp')
-rw-r--r--networking/udhcp/d6_dhcpc.c5
-rw-r--r--networking/udhcp/d6_packet.c2
-rw-r--r--networking/udhcp/dhcpc.c5
-rw-r--r--networking/udhcp/packet.c2
4 files changed, 14 insertions, 0 deletions
diff --git a/networking/udhcp/d6_dhcpc.c b/networking/udhcp/d6_dhcpc.c
index 714555fa8..d4bb3507b 100644
--- a/networking/udhcp/d6_dhcpc.c
+++ b/networking/udhcp/d6_dhcpc.c
@@ -881,9 +881,14 @@ static int d6_raw_socket(int ifindex)
881 fd = xsocket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IPV6)); 881 fd = xsocket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IPV6));
882 log2("got raw socket fd %d", fd); 882 log2("got raw socket fd %d", fd);
883 883
884 memset(&sock, 0, sizeof(sock)); /* let's be deterministic */
884 sock.sll_family = AF_PACKET; 885 sock.sll_family = AF_PACKET;
885 sock.sll_protocol = htons(ETH_P_IPV6); 886 sock.sll_protocol = htons(ETH_P_IPV6);
886 sock.sll_ifindex = ifindex; 887 sock.sll_ifindex = ifindex;
888 /*sock.sll_hatype = ARPHRD_???;*/
889 /*sock.sll_pkttype = PACKET_???;*/
890 /*sock.sll_halen = ???;*/
891 /*sock.sll_addr[8] = ???;*/
887 xbind(fd, (struct sockaddr *) &sock, sizeof(sock)); 892 xbind(fd, (struct sockaddr *) &sock, sizeof(sock));
888 893
889#if 0 894#if 0
diff --git a/networking/udhcp/d6_packet.c b/networking/udhcp/d6_packet.c
index 79a0ac8a8..a0656c1da 100644
--- a/networking/udhcp/d6_packet.c
+++ b/networking/udhcp/d6_packet.c
@@ -75,6 +75,8 @@ int FAST_FUNC d6_send_raw_packet(
75 dest_sll.sll_family = AF_PACKET; 75 dest_sll.sll_family = AF_PACKET;
76 dest_sll.sll_protocol = htons(ETH_P_IPV6); 76 dest_sll.sll_protocol = htons(ETH_P_IPV6);
77 dest_sll.sll_ifindex = ifindex; 77 dest_sll.sll_ifindex = ifindex;
78 /*dest_sll.sll_hatype = ARPHRD_???;*/
79 /*dest_sll.sll_pkttype = PACKET_???;*/
78 dest_sll.sll_halen = 6; 80 dest_sll.sll_halen = 6;
79 memcpy(dest_sll.sll_addr, dest_arp, 6); 81 memcpy(dest_sll.sll_addr, dest_arp, 6);
80 82
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 99d91bf70..6c74996ef 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -1010,9 +1010,14 @@ static int udhcp_raw_socket(int ifindex)
1010 */ 1010 */
1011 log2("got raw socket fd"); 1011 log2("got raw socket fd");
1012 1012
1013 memset(&sock, 0, sizeof(sock)); /* let's be deterministic */
1013 sock.sll_family = AF_PACKET; 1014 sock.sll_family = AF_PACKET;
1014 sock.sll_protocol = htons(ETH_P_IP); 1015 sock.sll_protocol = htons(ETH_P_IP);
1015 sock.sll_ifindex = ifindex; 1016 sock.sll_ifindex = ifindex;
1017 /*sock.sll_hatype = ARPHRD_???;*/
1018 /*sock.sll_pkttype = PACKET_???;*/
1019 /*sock.sll_halen = ???;*/
1020 /*sock.sll_addr[8] = ???;*/
1016 xbind(fd, (struct sockaddr *) &sock, sizeof(sock)); 1021 xbind(fd, (struct sockaddr *) &sock, sizeof(sock));
1017 1022
1018#if 0 /* Several users reported breakage when BPF filter is used */ 1023#if 0 /* Several users reported breakage when BPF filter is used */
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c
index 9e1b46d2f..44d9ceec7 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,
129 dest_sll.sll_family = AF_PACKET; 129 dest_sll.sll_family = AF_PACKET;
130 dest_sll.sll_protocol = htons(ETH_P_IP); 130 dest_sll.sll_protocol = htons(ETH_P_IP);
131 dest_sll.sll_ifindex = ifindex; 131 dest_sll.sll_ifindex = ifindex;
132 /*dest_sll.sll_hatype = ARPHRD_???;*/
133 /*dest_sll.sll_pkttype = PACKET_???;*/
132 dest_sll.sll_halen = 6; 134 dest_sll.sll_halen = 6;
133 memcpy(dest_sll.sll_addr, dest_arp, 6); 135 memcpy(dest_sll.sll_addr, dest_arp, 6);
134 136