xfrm_policy: Do not attempt to deleteall a socket policy

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 <thomas.egerer@secunet.com>
This commit is contained in:
Thomas Egerer 2017-10-30 19:11:45 +01:00 committed by Stephen Hemminger
parent 20e4840a0a
commit 5474d440b8
1 changed files with 4 additions and 0 deletions

View File

@ -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;