HomeFreeBSD

[rtsock] Enforce netmask/RTF_HOST consistency.

Description

[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)

Details

Provenance
melifaroAuthored on Apr 23 2021, 9:53 PM
Differential Revision
D29958: [rtsock] Enforce netmask/RTF_HOST consistency
Parents
rGd6d039ea74a2: pf tests: Test using '<ifgroup>:network' in tables
Branches
Unknown
Tags
Unknown