ell.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] dhcp: Fix address endianness in l2_send
@ 2021-06-04  1:22 Andrew Zaborowski
  2021-06-04 16:31 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Zaborowski @ 2021-06-04  1:22 UTC (permalink / raw)
  To: ell

[-- Attachment #1: Type: text/plain, Size: 1007 bytes --]

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(-)

diff --git a/ell/dhcp-transport.c b/ell/dhcp-transport.c
index c42bf45..68108e2 100644
--- a/ell/dhcp-transport.c
+++ b/ell/dhcp-transport.c
@@ -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);
-- 
2.30.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dhcp: Fix address endianness in l2_send
  2021-06-04  1:22 [PATCH] dhcp: Fix address endianness in l2_send Andrew Zaborowski
@ 2021-06-04 16:31 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2021-06-04 16:31 UTC (permalink / raw)
  To: ell

[-- Attachment #1: Type: text/plain, Size: 644 bytes --]

Hi Andrew,

On 6/3/21 8:22 PM, Andrew Zaborowski wrote:
> 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(-)
> 

Funny, guess we brought some ConnMan bugs into ell.  Nice catch.  Applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-04 16:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-04  1:22 [PATCH] dhcp: Fix address endianness in l2_send Andrew Zaborowski
2021-06-04 16:31 ` Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).