dhcp: Fix address endianness in l2_send
PATCH 1/1 dhcp: Fix address endianness in l2_send
dhcp_set_ip_udp_headers was unnecessarily trying to convert saddr and daddr from host byte order to network order, the addresses are already passsed in network byte order by the current 2 callers. This wasn't breaking normal dhcp but could break P2P where the DHCP OFFER and ACK source address is used by the client:
DHCPOFFER of 192.168.1.2 from 1.1.168.192
--- ell/dhcp-transport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
ell/dhcp-transport.c +2 -2
@@ -169,8 +169,8 @@ static void dhcp_set_ip_udp_headers(struct iphdr *ip, struct udphdr *udp, ip->tot_len =L_CPU_TO_BE16 (len +sizeof (*ip) +sizeof (*udp)); ip->protocol =IPPROTO_UDP ; - ip->saddr =L_CPU_TO_BE32 (saddr); - ip->daddr =L_CPU_TO_BE32 (daddr); + ip->saddr = saddr; + ip->daddr = daddr; udp->source =L_CPU_TO_BE16 (sport); udp->dest =L_CPU_TO_BE16 (dport);
Signature · 1 line
2.30.2
Hi Andrew,
Quoted 11 lines · Andrew Zaborowski
dhcp_set_ip_udp_headerswas unnecessarily trying to convert saddr and daddr from host byte order to network order, the addresses are already passsed in network byte order by the current 2 callers. This wasn't breaking normal dhcp but could break P2P where the DHCP OFFER and ACK source address is used by the client:DHCPOFFER of 192.168.1.2 from 1.1.168.192
--- ell/dhcp-transport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Funny, guess we brought some ConnMan bugs into ell. Nice catch. Applied, thanks.
Regards,
-Denis