Author: melifaro Date: Tue Apr 14 13:12:22 2020 New Revision: 359917 URL: https://svnweb.freebsd.org/changeset/base/359917
Log: Plug netmask NULL check during route addition causing kernel panic. This bug was introduced by the r359823. Reported by: hselasky Modified: head/sys/netinet/in_rmx.c head/sys/netinet6/in6_rmx.c Modified: head/sys/netinet/in_rmx.c ============================================================================== --- head/sys/netinet/in_rmx.c Tue Apr 14 10:10:31 2020 (r359916) +++ head/sys/netinet/in_rmx.c Tue Apr 14 13:12:22 2020 (r359917) @@ -103,7 +103,8 @@ rib4_preadd(u_int fibnum, const struct sockaddr *addr, /* 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 */ Modified: head/sys/netinet6/in6_rmx.c ============================================================================== --- head/sys/netinet6/in6_rmx.c Tue Apr 14 10:10:31 2020 (r359916) +++ head/sys/netinet6/in6_rmx.c Tue Apr 14 13:12:22 2020 (r359917) @@ -125,7 +125,7 @@ rib6_preadd(u_int fibnum, const struct sockaddr *addr, /* 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; _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"