Skip to content

Commit a3d9001

Browse files
pothosklassert
authored andcommitted
Revert "xfrm: state and policy should fail if XFRMA_IF_ID 0"
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>
1 parent 4ff2980 commit a3d9001

1 file changed

Lines changed: 3 additions & 18 deletions

File tree

net/xfrm/xfrm_user.c

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -630,13 +630,8 @@ static struct xfrm_state *xfrm_state_construct(struct net *net,
630630

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

633-
if (attrs[XFRMA_IF_ID]) {
633+
if (attrs[XFRMA_IF_ID])
634634
x->if_id = nla_get_u32(attrs[XFRMA_IF_ID]);
635-
if (!x->if_id) {
636-
err = -EINVAL;
637-
goto error;
638-
}
639-
}
640635

641636
err = __xfrm_init_state(x, false, attrs[XFRMA_OFFLOAD_DEV]);
642637
if (err)
@@ -1432,13 +1427,8 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh,
14321427

14331428
mark = xfrm_mark_get(attrs, &m);
14341429

1435-
if (attrs[XFRMA_IF_ID]) {
1430+
if (attrs[XFRMA_IF_ID])
14361431
if_id = nla_get_u32(attrs[XFRMA_IF_ID]);
1437-
if (!if_id) {
1438-
err = -EINVAL;
1439-
goto out_noput;
1440-
}
1441-
}
14421432

14431433
if (p->info.seq) {
14441434
x = xfrm_find_acq_byseq(net, mark, p->info.seq);
@@ -1751,13 +1741,8 @@ static struct xfrm_policy *xfrm_policy_construct(struct net *net, struct xfrm_us
17511741

17521742
xfrm_mark_get(attrs, &xp->mark);
17531743

1754-
if (attrs[XFRMA_IF_ID]) {
1744+
if (attrs[XFRMA_IF_ID])
17551745
xp->if_id = nla_get_u32(attrs[XFRMA_IF_ID]);
1756-
if (!xp->if_id) {
1757-
err = -EINVAL;
1758-
goto error;
1759-
}
1760-
}
17611746

17621747
return xp;
17631748
error:

0 commit comments

Comments
 (0)