Messages in this thread Patch in this message | | | From | Dmitry Safonov <> | Subject | [PATCH 16/18] xfrm: Notify compat listeners about policy flush | Date | Thu, 26 Jul 2018 03:31:42 +0100 |
| |
Notify two groups of listeners: XFRMNLGRP_POLICY - applications that uses native UABI for messages; XFRMNLGRP_COMPAT_POLICY - applications that uses compat UABI for messages;
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> --- net/xfrm/xfrm_user.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 752019963b1e..7bba0638c014 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -3368,7 +3368,8 @@ static int xfrm_notify_policy(struct xfrm_policy *xp, int dir, return __xfrm_notify_policy(xp, dir, c, true); } -static int xfrm_notify_policy_flush(const struct km_event *c) +static int __xfrm_notify_policy_flush(const struct km_event *c, + unsigned int group) { struct net *net = c->net; struct nlmsghdr *nlh; @@ -3389,13 +3390,22 @@ static int xfrm_notify_policy_flush(const struct km_event *c) nlmsg_end(skb, nlh); - return xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_POLICY); + return xfrm_nlmsg_multicast(net, skb, 0, group); out_free_skb: kfree_skb(skb); return err; } +static int xfrm_notify_policy_flush(const struct km_event *c) +{ + int ret = __xfrm_notify_policy_flush(c, XFRMNLGRP_POLICY); + + if ((ret && ret != -ESRCH) || !IS_ENABLED(CONFIG_COMPAT)) + return ret; + return __xfrm_notify_policy_flush(c, XFRMNLGRP_COMPAT_POLICY); +} + static int xfrm_send_policy_notify(struct xfrm_policy *xp, int dir, const struct km_event *c) { -- 2.13.6
| |