git: 0d4038e3012b - main - netlink: set prefix-related flags to the created nexthop.

From: Alexander V. Chernikov <melifaro_at_FreeBSD.org>
Date: Sun, 09 Apr 2023 09:28:25 UTC
The branch main has been updated by melifaro:

URL: https://cgit.FreeBSD.org/src/commit/?id=0d4038e3012b86c4f1ce5c2f25736993a1c9ac38

commit 0d4038e3012b86c4f1ce5c2f25736993a1c9ac38
Author:     Alexander V. Chernikov <melifaro@FreeBSD.org>
AuthorDate: 2023-04-09 09:26:12 +0000
Commit:     Alexander V. Chernikov <melifaro@FreeBSD.org>
CommitDate: 2023-04-09 09:26:12 +0000

    netlink: set prefix-related flags to the created nexthop.
    
    This fixes incorrect flag combinations when adding IPv4/IPv6 host
    routes.
    
    MFC after:      3 days
---
 sys/netlink/route/rt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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