Date: Tue, 4 May 2021 21:43:07 GMT From: "Alexander V. Chernikov" <melifaro@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 3fd9848f1593 - stable/13 - [rtsock] Enforce netmask/RTF_HOST consistency. Message-ID: <202105042143.144Lh7u9072616@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=3fd9848f15930d5ddde4375e540045cc4dc214d6 commit 3fd9848f15930d5ddde4375e540045cc4dc214d6 Author: Alexander V. Chernikov <melifaro@FreeBSD.org> AuthorDate: 2021-04-23 21:53:47 +0000 Commit: Alexander V. Chernikov <melifaro@FreeBSD.org> CommitDate: 2021-05-04 21:29:36 +0000 [rtsock] Enforce netmask/RTF_HOST consistency. Traditionally we had 2 sources of information whether the added/delete route request targets network or a host route: netmask (RTA_NETMASK) and RTF_HOST flag. The former one is tricky: netmask can be empty or can explicitly specify the host netmask. Parsing netmask sockaddr requires per-family parsing and that's what rtsock code traditionally avoided. As a result, consistency was not enforced and it was possible to specify network with the RTF_HOST flag and vice versa. Continue normalization efforts from D29826 and D29826 and ensure that RTF_HOST flag always reflects host/network data from netmask field. Differential Revision: https://reviews.freebsd.org/D29958 MFC after: 2 days (cherry picked from commit 5d1403a79a3e56403fb63c062252a23fce81e5f1) --- sys/net/rtsock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 405300a394de..6930bd167ac1 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1503,6 +1503,7 @@ cleanup_xaddrs_inet(struct rt_addrinfo *info, struct linear_buffer *lb) return (ENOBUFS); fill_sockaddr_inet(mask_sa, mask); info->rti_info[RTAX_NETMASK] = (struct sockaddr *)mask_sa; + info->rti_flags &= ~RTF_HOST; } else remove_netmask(info); @@ -1563,6 +1564,7 @@ cleanup_xaddrs_inet6(struct rt_addrinfo *info, struct linear_buffer *lb) return (ENOBUFS); fill_sockaddr_inet6((struct sockaddr_in6 *)sa, &mask, 0); info->rti_info[RTAX_NETMASK] = sa; + info->rti_flags &= ~RTF_HOST; } else remove_netmask(info);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105042143.144Lh7u9072616>