[PATCH] libbb: send_to_from with mixed ip/ipv6 addresses

Imu Li i at imu.li
Thu Sep 18 13:16:31 UTC 2014


Imu Li wrote:
>  	cmsgptr = CMSG_FIRSTHDR(&msg);
> +# if ENABLE_FEATURE_IPV6
> +	if ((to->sa_family == AF_INET || to->sa_family == AF_INET6) && from->sa_family == AF_INET) {
> +# else
>  	if (to->sa_family == AF_INET && from->sa_family == AF_INET) {
> +# endif

A less ifdef bangled patch would just replace the line, but I wasn't sure
if there was a desire to keep all code referencing IPv6 at all within
ENABLE_FEATURE_IPV6.

By way of documenting the original bug, here a tcpdump trace from before
the patch:

04:56:40.204377 IP (tos 0x10, ttl 64, id 53660, offset 0, flags [DF], proto UDP (17), length 76)
    10.0.0.2.123 > 10.14.0.1.123: NTPv4, length 48
04:56:40.207651 IP (tos 0x0, ttl 63, id 2187, offset 0, flags [DF], proto UDP (17), length 76)
    10.0.1.1.123 > 10.0.0.2.123: NTPv4, length 48
04:56:42.204367 IP (tos 0x10, ttl 64, id 53661, offset 0, flags [DF], proto UDP (17), length 76)
    10.0.0.2.123 > 10.14.0.1.123: NTPv4, length 48
04:56:42.210399 IP (tos 0x0, ttl 63, id 2188, offset 0, flags [DF], proto UDP (17), length 76)
    10.0.1.1.123 > 10.0.0.2.123: NTPv4, length 48

and after:

05:15:37.104981 IP (tos 0x10, ttl 64, id 53688, offset 0, flags [DF], proto UDP (17), length 76)
    10.0.0.2.123 > 10.14.0.1.123: NTPv4, length 48
05:15:37.107678 IP (tos 0x0, ttl 63, id 2216, offset 0, flags [DF], proto UDP (17), length 76)
    10.14.0.1.123 > 10.0.0.2.123: NTPv4, length 48
05:15:39.104977 IP (tos 0x10, ttl 64, id 53689, offset 0, flags [DF], proto UDP (17), length 76)
    10.0.0.2.123 > 10.14.0.1.123: NTPv4, length 48
05:15:39.113053 IP (tos 0x0, ttl 63, id 2217, offset 0, flags [DF], proto UDP (17), length 76)
    10.14.0.1.123 > 10.0.0.2.123: NTPv4, length 48

Thank you much,
imuli

-- 
All original matter is hereby placed immediately under the public domain.


More information about the busybox mailing list