From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Egerer Subject: [PATCH iproute2-resend 2/3] xfrm_policy: Do not attempt to deleteall a socket policy Date: Thu, 2 Nov 2017 14:13:25 +0100 Message-ID: <5e5afcd7-eaa3-6ba1-803d-722ac9535bf4@secunet.com> References: <20171101220508.5be2176f@shemminger-XPS-13-9360> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Cc: To: Stephen Hemminger Return-path: Received: from a.mx.secunet.com ([62.96.220.36]:41958 "EHLO a.mx.secunet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755455AbdKBNOw (ORCPT ); Thu, 2 Nov 2017 09:14:52 -0400 In-Reply-To: <20171101220508.5be2176f@shemminger-XPS-13-9360> Sender: netdev-owner@vger.kernel.org List-ID: Socket polices are added to a socket using setsockopt(2). They cannot be deleted by iproute2. The attempt to delete them causes an error (EINVAL). To avoid this unnecessary error message all socket policies are skipped in xfrm_policy_keep. Signed-off-by: Thomas Egerer --- ip/xfrm_policy.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ip/xfrm_policy.c b/ip/xfrm_policy.c index 7d2139e..e2fa771 100644 --- a/ip/xfrm_policy.c +++ b/ip/xfrm_policy.c @@ -735,6 +735,10 @@ static int xfrm_policy_keep(const struct sockaddr_nl *who, if (!xfrm_policy_filter_match(xpinfo, ptype)) return 0; + /* can't delete socket policies */ + if (xpinfo->dir >= XFRM_POLICY_MAX) + return 0; + if (xb->offset + NLMSG_LENGTH(sizeof(*xpid)) > xb->size) return 0; -- 2.6.4