Hi,

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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to