The branch main has been updated by melifaro:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=5d1403a79a3e56403fb63c062252a23fce81e5f1

commit 5d1403a79a3e56403fb63c062252a23fce81e5f1
Author:     Alexander V. Chernikov <[email protected]>
AuthorDate: 2021-04-23 21:53:47 +0000
Commit:     Alexander V. Chernikov <[email protected]>
CommitDate: 2021-04-24 22:41:27 +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
---
 sys/net/rtsock.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index b7a7e5170c74..fae15fdf4be6 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);
 
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "[email protected]"

Reply via email to