svn commit: r359823 - in head: etc/mtree include lib/libc/gen sys/conf sys/net sys/net/route sys/netinet sys/netinet6 sys/sys usr.bin/netstat
Alexander V. Chernikov
melifaro at freebsd.org
Tue Apr 14 13:15:37 UTC 2020
14.04.2020, 13:25, "Hans Petter Selasky" <hps at selasky.org>:
> Hi,
Hi Hans,
Thank you!
Indeed, the check slipped through the cracks while merging the code.
Should be fixed by r359917.
I'll add the testcases to cover that later today.
>
> It looks like you need to add some NULL checks:
>
>> diff --git a/sys/netinet/in_rmx.c b/sys/netinet/in_rmx.c
>> index eeb7760c5cc..5f9ae967177 100644
>> --- a/sys/netinet/in_rmx.c
>> +++ b/sys/netinet/in_rmx.c
>> @@ -103,7 +103,7 @@ rib4_preadd(u_int fibnum, const struct sockaddr *addr, const struct sockaddr *ma
>>
>> /* Ensure that default route nhop has special flag */
>> const struct sockaddr_in *mask4 = (const struct sockaddr_in *)mask;
>> - if ((rt_flags & RTF_HOST) == 0 && mask4->sin_addr.s_addr == 0)
>> + if ((rt_flags & RTF_HOST) == 0 && mask4 != NULL && mask4->sin_addr.s_addr == 0)
>> nh->nh_flags |= NHF_DEFAULT;
>>
>> /* Set nhop type to basic per-AF nhop */
>> diff --git a/sys/netinet6/in6_rmx.c b/sys/netinet6/in6_rmx.c
>> index 7f10b290309..4621669dab9 100644
>> --- a/sys/netinet6/in6_rmx.c
>> +++ b/sys/netinet6/in6_rmx.c
>> @@ -125,7 +125,7 @@ rib6_preadd(u_int fibnum, const struct sockaddr *addr, const struct sockaddr *ma
>>
>> /* Ensure that default route nhop has special flag */
>> const struct sockaddr_in6 *mask6 = (const struct sockaddr_in6 *)mask;
>> - if ((nhop_get_rtflags(nh) & RTF_HOST) == 0 &&
>> + if ((nhop_get_rtflags(nh) & RTF_HOST) == 0 && mask6 != NULL &&
>> IN6_IS_ADDR_UNSPECIFIED(&mask6->sin6_addr))
>> nh->nh_flags |= NHF_DEFAULT;
>
> Else I hit a panic with this command:
>
> sysctl net.inet.icmp.bmcastecho=1
> route add -net 255.255.255.255 a.b.c.d
>
> Where a.b.c.d is a valid IPv4 on the local network.
>
> --HPS
More information about the svn-src-all
mailing list