From 5bfee718d2f7118c94264acb3638e6b54d93e57b Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 12 Nov 2021 15:18:01 +0900 Subject: [PATCH] sd-netlink: introduce sd_rtnl_message_nexthop_get_flags() --- src/libsystemd/sd-netlink/netlink-message-rtnl.c | 14 ++++++++++++++ src/systemd/sd-netlink.h | 1 + 2 files changed, 15 insertions(+) diff --git a/src/libsystemd/sd-netlink/netlink-message-rtnl.c b/src/libsystemd/sd-netlink/netlink-message-rtnl.c index 9e8ec397e9b..d15ca06aa85 100644 --- a/src/libsystemd/sd-netlink/netlink-message-rtnl.c +++ b/src/libsystemd/sd-netlink/netlink-message-rtnl.c @@ -321,6 +321,20 @@ int sd_rtnl_message_nexthop_set_flags(sd_netlink_message *m, uint8_t flags) { return 0; } +int sd_rtnl_message_nexthop_get_flags(sd_netlink_message *m, uint8_t *ret) { + struct nhmsg *nhm; + + assert_return(m, -EINVAL); + assert_return(m->hdr, -EINVAL); + assert_return(rtnl_message_type_is_nexthop(m->hdr->nlmsg_type), -EINVAL); + assert_return(ret, -EINVAL); + + nhm = NLMSG_DATA(m->hdr); + *ret = nhm->nh_flags; + + return 0; +} + int sd_rtnl_message_nexthop_get_family(sd_netlink_message *m, uint8_t *family) { struct nhmsg *nhm; diff --git a/src/systemd/sd-netlink.h b/src/systemd/sd-netlink.h index 66a1bb6a33f..c166cc16716 100644 --- a/src/systemd/sd-netlink.h +++ b/src/systemd/sd-netlink.h @@ -172,6 +172,7 @@ int sd_rtnl_message_route_get_type(sd_netlink_message *m, unsigned char *type); int sd_rtnl_message_new_nexthop(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t nlmsg_type, int nh_family, unsigned char nh_protocol); int sd_rtnl_message_nexthop_set_flags(sd_netlink_message *m, uint8_t flags); +int sd_rtnl_message_nexthop_get_flags(sd_netlink_message *m, uint8_t *ret); int sd_rtnl_message_nexthop_get_family(sd_netlink_message *m, uint8_t *family); int sd_rtnl_message_nexthop_get_protocol(sd_netlink_message *m, uint8_t *protocol); -- 2.47.3