[PATCH 02/43] util.c: Don't byte-swap IPv4 addresses, even if we don't have IPv6.

Ian Jackson ijackson at chiark.greenend.org.uk
Sun Apr 30 17:52:15 BST 2017


Mark Wooding writes ("[PATCH 02/43] util.c: Don't byte-swap IPv4 addresses, even if we don't have IPv6."):
> I think this has always been wrong for setting up UDP sockets: before
> the introduction of `string_item_to_iaddr', `udp_apply' would call
> `string_item_to_ipaddr' directly, and neglected to swap the bytes.

In a32d56fb "ipv6: introduce union iaddr", in udp.c:

 -  addr.sin_addr.s_addr=htonl(st->addr);
 +  addr=st->addr;

st->addr.sin_addr should have gained the htonl but:

 -  st->addr=j?string_item_to_ipaddr(j, "udp"):INADDR_ANY;
 +  st->addr.sin.sin_addr.s_addr=j?string_item_to_ipaddr(j, "udp"):INADDR_ANY;

So I think binding the udp sockets to specific addresses has been
broken on big-endian machines since then.  Ie, effectively, since
0.4.x.

but 


-- 
Ian Jackson <ijackson at chiark.greenend.org.uk>   These opinions are my own.

If I emailed you from an address @fyvzl.net or @evade.org.uk, that is
a private address which bypasses my fierce spamfilter.



More information about the sgo-software-discuss mailing list