@@ -1784,20 +1784,6 @@ static inline int xfrm_aevent_is_on(struct net *net)
rcu_read_unlock();
return ret;
}
-
-static inline int xfrm_acquire_is_on(struct net *net)
-{
- struct sock *nlsk;
- int ret = 0;
-
- rcu_read_lock();
- nlsk = rcu_dereference(net->xfrm.nlsk);
- if (nlsk)
- ret = netlink_has_listeners(nlsk, XFRMNLGRP_ACQUIRE);
- rcu_read_unlock();
-
- return ret;
-}
#endif
static inline unsigned int aead_len(struct xfrm_algo_aead *alg)
@@ -3517,6 +3517,22 @@ static int xfrm_send_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr,
return xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_MAPPING);
}
+static inline int xfrm_acquire_is_on(struct net *net)
+{
+ struct sock *nlsk;
+ int ret = 0;
+
+ rcu_read_lock();
+ nlsk = rcu_dereference(net->xfrm.nlsk);
+ if (nlsk)
+ ret = netlink_has_listeners(nlsk, XFRMNLGRP_ACQUIRE);
+ if (!ret || IS_ENABLED(CONFIG_COMPAT))
+ ret = netlink_has_listeners(nlsk, XFRMNLGRP_COMPAT_ACQUIRE);
+ rcu_read_unlock();
+
+ return ret;
+}
+
static bool xfrm_is_alive(const struct km_event *c)
{
return (bool)xfrm_acquire_is_on(c->net);
As now there are two groups of listeners: XFRMNLGRP_ACQUIRE - applications that uses native UABI for messages; XFRMNLGRP_COMPAT_ACQUIRE - applications that uses compat UABI for messages; So, both groups should be checked for listeners of acquire notifications. Cc: "David S. Miller" <davem@davemloft.net> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Steffen Klassert <steffen.klassert@secunet.com> Cc: netdev@vger.kernel.org Signed-off-by: Dmitry Safonov <dima@arista.com> --- include/net/xfrm.h | 14 -------------- net/xfrm/xfrm_user.c | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 14 deletions(-)