libnetlink: Add helper to add a group via setsockopt
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 <dsahern@gmail.com>
This commit is contained in:
parent
7392401027
commit
9860becfe3
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue