From patchwork Thu Jul 26 02:31:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Safonov X-Patchwork-Id: 949431 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=arista.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=arista.com header.i=@arista.com header.b="fUf6faqO"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41bbj645fdz9s29 for ; Thu, 26 Jul 2018 12:32:26 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729502AbeGZDqj (ORCPT ); Wed, 25 Jul 2018 23:46:39 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:35764 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729038AbeGZDqi (ORCPT ); Wed, 25 Jul 2018 23:46:38 -0400 Received: by mail-ed1-f65.google.com with SMTP id e6-v6so339393edr.2 for ; Wed, 25 Jul 2018 19:32:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=googlenew; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6C2SkELl5J+d+DA1SAR8gQBCVXA7QDjBRXy/0yXYOx8=; b=fUf6faqOO/TcoZXkzKhndEw/rFIkTIKr8IBH6d/Rz/UDiO4vFkW6PHvlqeharxgltg z09CLMoj/N3v901QNThclraXGww736EtgmnpDCYLm+4QONZLipLe7UakioFUAxF9LSYq dcZ7ZDzrOxUDJMpYKLeNPwNXLns489dm///Ijun8osHTwKenYapZjoNHIgGogYk4uuZS kP7doBP6+vuDs/knxMuxP/kd4bU+TR1aOfsTCYNVo1aDKyHCnFpBfeeMDHxpGQVDuF4N 65tTtZpWcpjHawpxtFksn3HU4Axc8o8zO86ESHvtsmfddDL9iojDhbqfq+Nzz8Ju6Tfr Chwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6C2SkELl5J+d+DA1SAR8gQBCVXA7QDjBRXy/0yXYOx8=; b=Ud1T2O3lkPm+AHc8jLOwaHdRIsqHTnxL6GspL0nSf1IQaDMo9LaDHiwsa7SrlmKdqs TAr8EOv0NfkDIpxyCinFwUqxgsWKcEA2b6az5Tc+Hw7VqM8sUEDDyO1kWnir6WY0N4Aq 151XtGG7mllMQEjDgUDi2QBwJJjiUO6Sij39sAhKIgSH0olF+1OPNnvu2bjSjNGDgyl0 pg9gQd9rSj3nU0eviO9VpbiKZM36XDDSnuaQtZbZGq6FXe+kKc05QtbPy2o30qwPREv1 SHqDJaOfNmiWbnoYINCQiw7XF5HoTwZ9U71oiXqaaphGrCz52hdMaJHUY2eCpTnDolVK 5uXg== X-Gm-Message-State: AOUpUlEKqhvcOfvi7S9u3BE2a1jOXjeMS0bbRtF1bvhvLEinJygejO+e i221nsb91zteZRlVp26hJTzUyg== X-Google-Smtp-Source: AAOMgpd/LjiVOi0r6rdv3t3em7ZRO8x14m+zcpA7VQR4J12XIbD3IIuQhgHlavxtz/eeGBj8yyPq/g== X-Received: by 2002:a50:ed92:: with SMTP id h18-v6mr492026edr.117.1532572324976; Wed, 25 Jul 2018 19:32:04 -0700 (PDT) Received: from dhcp.ire.aristanetworks.com ([217.173.96.166]) by smtp.gmail.com with ESMTPSA id x13-v6sm241024edx.17.2018.07.25.19.32.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Jul 2018 19:32:04 -0700 (PDT) From: Dmitry Safonov To: linux-kernel@vger.kernel.org Cc: Dmitry Safonov , "David S. Miller" , Herbert Xu , Steffen Klassert , Dmitry Safonov <0x7f454c46@gmail.com>, netdev@vger.kernel.org Subject: [PATCH 16/18] xfrm: Notify compat listeners about policy flush Date: Thu, 26 Jul 2018 03:31:42 +0100 Message-Id: <20180726023144.31066-17-dima@arista.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180726023144.31066-1-dima@arista.com> References: <20180726023144.31066-1-dima@arista.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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" Cc: Herbert Xu Cc: Steffen Klassert Cc: netdev@vger.kernel.org Signed-off-by: Dmitry Safonov --- 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) {