Skip to content

Commit

Permalink
FROMGIT: Revert "xfrm: state and policy should fail if XFRMA_IF_ID 0"
Browse files Browse the repository at this point in the history
This reverts commit 68ac0f3 because ID
0 was meant to be used for configuring the policy/state without
matching for a specific interface (e.g., Cilium is affected, see
cilium/cilium#18789 and
cilium/cilium#19019).

Signed-off-by: Kai Lueke <kailueke@linux.microsoft.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Link: https://lore.kernel.org/netdev/20220309130839.3263912-3-steffen.klassert@secunet.com/
(cherry picked from commit a3d9001
 https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=a3d9001b4e287fc043e5539d03d71a32ab114bcb)
Bug: 221187056
Test: run_net_test.sh
Change-Id: Iccaf42f776cad9166f808c490bfce586f850554c
  • Loading branch information
pothos authored and Yan Yan committed Mar 10, 2022
1 parent 07c2fd8 commit 2966e1d
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions net/xfrm/xfrm_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -629,13 +629,8 @@ static struct xfrm_state *xfrm_state_construct(struct net *net,

xfrm_smark_init(attrs, &x->props.smark);

if (attrs[XFRMA_IF_ID]) {
if (attrs[XFRMA_IF_ID])
x->if_id = nla_get_u32(attrs[XFRMA_IF_ID]);
if (!x->if_id) {
err = -EINVAL;
goto error;
}
}

err = __xfrm_init_state(x, false, attrs[XFRMA_OFFLOAD_DEV]);
if (err)
Expand Down Expand Up @@ -1371,13 +1366,8 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh,

mark = xfrm_mark_get(attrs, &m);

if (attrs[XFRMA_IF_ID]) {
if (attrs[XFRMA_IF_ID])
if_id = nla_get_u32(attrs[XFRMA_IF_ID]);
if (!if_id) {
err = -EINVAL;
goto out_noput;
}
}

if (p->info.seq) {
x = xfrm_find_acq_byseq(net, mark, p->info.seq);
Expand Down Expand Up @@ -1690,13 +1680,8 @@ static struct xfrm_policy *xfrm_policy_construct(struct net *net, struct xfrm_us

xfrm_mark_get(attrs, &xp->mark);

if (attrs[XFRMA_IF_ID]) {
if (attrs[XFRMA_IF_ID])
xp->if_id = nla_get_u32(attrs[XFRMA_IF_ID]);
if (!xp->if_id) {
err = -EINVAL;
goto error;
}
}

return xp;
error:
Expand Down

0 comments on commit 2966e1d

Please sign in to comment.