Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1471063imm; Wed, 25 Jul 2018 19:33:21 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcMpJq9lZlQ1MxU6mUtklsUk8gB5LwqrcCkdvTjRZ2QbnQcpU3BWQTWhnRho8CoaZqQ+2nV X-Received: by 2002:a17:902:704c:: with SMTP id h12-v6mr77701plt.237.1532572401024; Wed, 25 Jul 2018 19:33:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532572401; cv=none; d=google.com; s=arc-20160816; b=i0JqEaRm8bVEJUOgf5FMZraTUMmcXTlFpmDP9k5HOYNamQt6uxmsvZ9RBuJO+FN9vG hbf3/CoQvCV4kZ5XUyhN2PwBnA8C5q1jX5Xvuty4j/oOL2J+aBxk0LmZNUAZTQmJhVE6 ANnXD3L9JxZ74wcaPFClp4jVH7m6ngHz/AmIIMHOkQCtqAYoGDbyxJIos1jCzHGgDjQ4 OzdgSFC7UkGjCWYnXbAkwvt9fet1sYrLPj8+h3jj/ByhQPBUfisnThFuS44bYAXRDULG at5ft3WAVHY+r5aENYjaK4ZllNgQ7NHhe5J479hTmY4L+ZNVLEmJpvNOi4FdQJXtSLNQ EUYQ== 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=wmvEwHXGrv0tUfQuAGw1QAVTFm4+aPV+0zO5SRaH9Dc=; b=brDn8fJ/enZu/aeowqioleeTuZr3n5XVaHutU4z4jIm9YCLt6KVQYzv9CZFai3J1Oz VAKTBNV8KLkwuNCXHMCUMC9qy+ryoX3tcfS7XUiH1AOcpb4mW4K2bAqbLppo9pVT/UtL hLg/pGIF5CJM495RyopeNPyxP6SaDAAVjEVX7zbOjt6qCJKJZkP+aKZoNI7WOUUGgpxh yWgJEkYCwPg+eoxcGxA6iYRLP2pZ+IQq4nTn2aDmuZ22zZ1kxjqcsJ20c+8OQ4F0rjgu EjZb+ewNSUchaXYR4N9xWAqiRECMLCgadM488QDSocg7LVRXIHRLNRuDf1v2/CfJObCz 4g6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b="GFasW/3r"; 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 b78-v6si131400pfk.342.2018.07.25.19.33.06; Wed, 25 Jul 2018 19:33:20 -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="GFasW/3r"; 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 S1728681AbeGZDql (ORCPT + 99 others); Wed, 25 Jul 2018 23:46:41 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:44823 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729456AbeGZDqj (ORCPT ); Wed, 25 Jul 2018 23:46:39 -0400 Received: by mail-ed1-f65.google.com with SMTP id f23-v6so324154edr.11 for ; Wed, 25 Jul 2018 19:32:06 -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=wmvEwHXGrv0tUfQuAGw1QAVTFm4+aPV+0zO5SRaH9Dc=; b=GFasW/3rpCfEDxx869JZ2gMOa0aGVdQ+Xp0AqFkV79sxenfv/FofBLpJY3EEsyq0LK F8Bn1JqlHZl/ouwO81Xe503uYa0xMxvYkYogN+K5IAja14NM6XZmVUxf0MQVRSkJT7t1 z4HgQpG2dgafxwArde4dGK/5qkL5BBUtFrHE9otFocSvl3xG1PTpQro1+vBB6d4DAa4E hZvxmrnXnYeJBRV4vzUVNof4nKYA4ecopviyT+CA78y/BcupZawgo1/308JKRwu+RCLz alUSjDEar4cnlaPdCJrt76XRNGnx5Coe3Yd2HCugGvXsTNkvF5JOKvzVb+iJx7KTXn6X ARYg== 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=wmvEwHXGrv0tUfQuAGw1QAVTFm4+aPV+0zO5SRaH9Dc=; b=tGhH3O0wKI2cOdpZqx9XQBS1FAkgvbfQ8VzfXcZ2hIDwkb61g/1+EAYAWGBQ4xJ1cH lLz03l2kunP189e/Azex7uBIKWERjosZNsYpXIN4mkMYNZqJJSzPZoz4yEV+B61inPLx /Bf6b6h9jk9nKKOYTruZSpIT78EQjUnDeIFJxfO04VyymNzpwnbAIwICSyK/QbZ6oQsV vxj5swHK3rOPg618/+eCBEJADk3mdRQWwpAy/CHfhIUVG2iwZqs7SLRta62gNqce3ICI L6lhSeNR0Go1yn7T0XyQBXBWtt1AVBLjNTpRaB1C2zLm/rJtQ0+CuQWTLvyht7To0nih Mscw== X-Gm-Message-State: AOUpUlEgQU+i6g1biFOJtg0zvSRhdeZkyrkyoP3SIs77zITmOQDftarL jY4hjLg8hW/TQgPgbdqpDfvGZkicSnQ= X-Received: by 2002:a50:9a02:: with SMTP id o2-v6mr517551edb.236.1532572325870; Wed, 25 Jul 2018 19:32:05 -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.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Jul 2018 19:32:05 -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 17/18] xfrm: Notify compat listeners about state flush Date: Thu, 26 Jul 2018 03:31:43 +0100 Message-Id: <20180726023144.31066-18-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_SA - applications that uses native UABI for messages; XFRMNLGRP_COMPAT_SA - 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 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 7bba0638c014..7e3a132b76fb 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -2879,7 +2879,7 @@ static int xfrm_aevent_state_notify(struct xfrm_state *x, const struct km_event return xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_AEVENTS); } -static int xfrm_notify_sa_flush(const struct km_event *c) +static int __xfrm_notify_sa_flush(const struct km_event *c, unsigned int group) { struct net *net = c->net; struct xfrm_usersa_flush *p; @@ -2902,7 +2902,16 @@ static int xfrm_notify_sa_flush(const struct km_event *c) nlmsg_end(skb, nlh); - return xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_SA); + return xfrm_nlmsg_multicast(net, skb, 0, group); +} + +static int xfrm_notify_sa_flush(const struct km_event *c) +{ + int ret = __xfrm_notify_sa_flush(c, XFRMNLGRP_SA); + + if ((ret && ret != -ESRCH) || !IS_ENABLED(CONFIG_COMPAT)) + return ret; + return __xfrm_notify_sa_flush(c, XFRMNLGRP_COMPAT_SA); } static inline unsigned int xfrm_sa_len(struct xfrm_state *x) -- 2.13.6