From: David Ahern <dsah...@gmail.com> groups > 31 have to be joined using the setsockopt. Since the nexthop group is 32, add a helper to allow 'ip monitor' to listen for nexthop messages.
Signed-off-by: David Ahern <dsah...@gmail.com> --- include/libnetlink.h | 3 ++- lib/libnetlink.c | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/libnetlink.h b/include/libnetlink.h index 503b3ec11bb6..599b2c592f68 100644 --- a/include/libnetlink.h +++ b/include/libnetlink.h @@ -45,7 +45,8 @@ int rtnl_open(struct rtnl_handle *rth, unsigned int subscriptions) int rtnl_open_byproto(struct rtnl_handle *rth, unsigned int subscriptions, int protocol) __attribute__((warn_unused_result)); - +int rtnl_add_nl_group(struct rtnl_handle *rth, unsigned int group) + __attribute__((warn_unused_result)); void rtnl_close(struct rtnl_handle *rth); void rtnl_set_strict_dump(struct rtnl_handle *rth); diff --git a/lib/libnetlink.c b/lib/libnetlink.c index 6ae51a9dba14..eb85bbdf01ee 100644 --- a/lib/libnetlink.c +++ b/lib/libnetlink.c @@ -173,6 +173,12 @@ void rtnl_set_strict_dump(struct rtnl_handle *rth) rth->flags |= RTNL_HANDLE_F_STRICT_CHK; } +int rtnl_add_nl_group(struct rtnl_handle *rth, unsigned int group) +{ + return setsockopt(rth->fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, + &group, sizeof(group)); +} + void rtnl_close(struct rtnl_handle *rth) { if (rth->fd >= 0) { -- 2.11.0