aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander V. Chernikov <melifaro@FreeBSD.org>2023-04-02 13:50:05 +0000
committerAlexander V. Chernikov <melifaro@FreeBSD.org>2023-04-02 13:50:05 +0000
commit68f9e13563f677169728f55f5523142530d26c11 (patch)
tree3f67bffdf6f340b0c76903835ee95c351b6cde8a
parentc35a43b261f807fd85b8cc30306112eee9dd62ce (diff)
downloadsrc-68f9e13563f677169728f55f5523142530d26c11.tar.gz
src-68f9e13563f677169728f55f5523142530d26c11.zip
route: add support for exact-prefix-match via netlink.
-rw-r--r--sbin/route/route_netlink.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sbin/route/route_netlink.c b/sbin/route/route_netlink.c
index 66b1920a58db..ce7da288496f 100644
--- a/sbin/route/route_netlink.c
+++ b/sbin/route/route_netlink.c
@@ -203,6 +203,10 @@ rtmsg_nl_int(struct nl_helper *h, int cmd, int rtm_flags, int fib,
rtm->rtm_type = rtm_type;
rtm->rtm_dst_len = plen;
+ /* Request exact prefix match if mask is set */
+ if ((cmd == RTSOCK_RTM_GET) && (mask != NULL))
+ rtm->rtm_flags = RTM_F_PREFIX;
+
snl_add_msg_attr_ip(&nw, RTA_DST, dst);
snl_add_msg_attr_u32(&nw, RTA_TABLE, fib);