Commit f8403a2e47afb37bcd3b7e286996d138a116c39d

Authored by Johannes Berg
Committed by David S. Miller
1 parent 02c81ab95d

genetlink: pass only network namespace to genl_has_listeners()

There's no point to force the caller to know about the internal
genl_sock to use inside struct net, just have them pass the network
namespace. This doesn't really change code generation since it's
an inline, but makes the caller less magic - there's never any
reason to pass another socket.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 2 changed files with 3 additions and 4 deletions Side-by-side Diff

include/net/genetlink.h
... ... @@ -395,12 +395,12 @@
395 395 }
396 396  
397 397 static inline int genl_has_listeners(struct genl_family *family,
398   - struct sock *sk, unsigned int group)
  398 + struct net *net, unsigned int group)
399 399 {
400 400 if (WARN_ON_ONCE(group >= family->n_mcgrps))
401 401 return -EINVAL;
402 402 group = family->mcgrp_offset + group;
403   - return netlink_has_listeners(sk, group);
  403 + return netlink_has_listeners(net->genl_sock, group);
404 404 }
405 405 #endif /* __NET_GENERIC_NETLINK_H */
net/openvswitch/datapath.c
... ... @@ -83,8 +83,7 @@
83 83 unsigned int group)
84 84 {
85 85 return info->nlhdr->nlmsg_flags & NLM_F_ECHO ||
86   - genl_has_listeners(family, genl_info_net(info)->genl_sock,
87   - group);
  86 + genl_has_listeners(family, genl_info_net(info), group);
88 87 }
89 88  
90 89 static void ovs_notify(struct genl_family *family,