aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander V. Chernikov <melifaro@FreeBSD.org>2023-04-09 09:26:12 +0000
committerAlexander V. Chernikov <melifaro@FreeBSD.org>2023-04-09 09:26:12 +0000
commit0d4038e3012b86c4f1ce5c2f25736993a1c9ac38 (patch)
tree7af5335339df4f21f1dfd9c57e03d35b26b2012b
parent75379ea2e4613f5c6b71648b3efb075b211ee01d (diff)
downloadsrc-0d4038e3012b86c4f1ce5c2f25736993a1c9ac38.tar.gz
src-0d4038e3012b86c4f1ce5c2f25736993a1c9ac38.zip
netlink: set prefix-related flags to the created nexthop.
This fixes incorrect flag combinations when adding IPv4/IPv6 host routes. MFC after: 3 days
-rw-r--r--sys/netlink/route/rt.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/netlink/route/rt.c b/sys/netlink/route/rt.c
index 288ff111a038..7e81d59d696b 100644
--- a/sys/netlink/route/rt.c
+++ b/sys/netlink/route/rt.c
@@ -732,7 +732,7 @@ get_pxflag(const struct nl_parsed_route *attrs)
pxflag = NHF_DEFAULT;
break;
case AF_INET6:
- if (attrs->rtm_dst_len == 32)
+ if (attrs->rtm_dst_len == 128)
pxflag = NHF_HOST;
else if (attrs->rtm_dst_len == 0)
pxflag = NHF_DEFAULT;
@@ -776,6 +776,7 @@ create_nexthop_one(struct nl_parsed_route *attrs, struct rta_mpath_nh *mpnh,
}
if (mpnh->ifp != NULL)
nhop_set_transmit_ifp(nh, mpnh->ifp);
+ nhop_set_pxtype_flag(nh, get_pxflag(attrs));
nhop_set_rtflags(nh, attrs->rta_rtflags);
if (attrs->rtm_protocol > RTPROT_STATIC)
nhop_set_origin(nh, attrs->rtm_protocol);
@@ -852,6 +853,7 @@ create_nexthop_from_attrs(struct nl_parsed_route *attrs,
nhop_set_broadcast(nh, true);
if (attrs->rtm_protocol > RTPROT_STATIC)
nhop_set_origin(nh, attrs->rtm_protocol);
+ nhop_set_pxtype_flag(nh, get_pxflag(attrs));
nhop_set_rtflags(nh, attrs->rta_rtflags);
switch (attrs->rtm_type) {