Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1471173imm; Wed, 25 Jul 2018 19:33:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcSSaULGxHCdO1ULIcRdYp8c7tVZj9abluyxj7PmXMms+m/MGhKby9cfhd7fk4Xk6+vAU1U X-Received: by 2002:a62:9bc5:: with SMTP id e66-v6mr135864pfk.84.1532572411247; Wed, 25 Jul 2018 19:33:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532572411; cv=none; d=google.com; s=arc-20160816; b=FoB06SxciQ5tPX18Q63B+Mit1c3DCf5K6DkitT/oSs776Y6/E8Ix7jKYmmWCyRg/6O bJIvgujIDAytsaU3qCvLkQF4+qAVXxuXY352sCY7MJdTlN/e7HZPk/yVM1sv9k4UIDxa OkRQACD7FFtIDGlb7/+mG2RX0fTjHLVG7L8isbGWLiiQAf90JtQ5xK78hOOU9JU9hC+D sn2VTGlp8H6A6nY2jZVLEQbhg3AhMdw/yRkkt+RW5Ies+kH3S4EPMM4U4AOTwwElo2od CQA8pgUNBSbSVF6/AkP3NDBSZ9X12ln99JjftwQOu1nUJ0SUg+muMdG1WUBZ31/bpWcd m/fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=6C2SkELl5J+d+DA1SAR8gQBCVXA7QDjBRXy/0yXYOx8=; b=qshjpSsMVsN9Wd2DNmTxLe1h5JK0zOp3zWuzn/2vUZCVGWmXC6BzbMRw40EYhZilQ6 oHZAVQcoG+UdddjXd5HW1A0gfV+ZaSlsgmBDmE5/zzrfX8vmHvr1JnoniGOSu7qpRjW9 zPkuJhi1d5Qp9KZpxNZpbA7H+xNQPGHFoXVAaKvNibyHcvQxNQBKidbnksVPH2J1mQqQ ZC5t6S2Neh9zvnPEgqDaPThRC9t9Wh3zmdHbcdiHnPkCZxJrJkKjcdnqxEE6eWYV/OBP qHF8Z8yb/AZ/WLCyxGZrXCu9zgoNOky43ktqryV1yBbacXJx2hLPioifasbTGJ2CN8l/ XzVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=fUf6faqO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l6-v6si115672pgl.567.2018.07.25.19.33.16; Wed, 25 Jul 2018 19:33:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=fUf6faqO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729514AbeGZDqj (ORCPT + 99 others); Wed, 25 Jul 2018 23:46:39 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:44822 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729450AbeGZDqj (ORCPT ); Wed, 25 Jul 2018 23:46:39 -0400 Received: by mail-ed1-f65.google.com with SMTP id f23-v6so324131edr.11 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=grrHm2EUWKyAO+JSFsqsdX3PVwRavqxA4F0XCYAJqVYCAnaRcO1Ww1sympZyFPTim4 6rKzDEb1Oa36PTVKgTlRSzmEmt4SOnZWHXHh3k97wd44YUGx08b50BvTym+Ehj98JWUb GdJTYCn+X7RzZghulbSzHE60NHGC7dyrd0fmcDBsFWWR/KVaNIgNvhjF0e0ececOQFLZ lEauB/VSUHpDB22sgvxIYLx8puX5wUb2GBDZ2jaWCiZT7P8uYKnmIGwTVeybShW34dCm tVRZqspDxb8b/RIOWjLkVtSA2in/qsWm8h4ydOU3tRnN5VXWn/wlFU1Cr/f4Q7BeLy/D xRIw== X-Gm-Message-State: AOUpUlGH82mmuBtNUTb7dsg/2y6u7NDjogutPCGIDyCqrRaKAUT7/Tro EWnR0GfYNaYCja5OJkPbDVlmgWRI+xU= 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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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) { -- 2.13.6