Skip to content

Commit 3206c51

Browse files
hs256ummakynes
authored andcommitted
netfilter: nft_ct: make l3 protocol field optional for timeout object
If l3 protocol value is not specified for ct timeout object then use the value from nft_ctx protocol family. Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 1bfc2bc commit 3206c51

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎net/netfilter/nft_ct.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -832,12 +832,13 @@ static int nft_ct_timeout_obj_init(const struct nft_ctx *ctx,
832832
__u8 l4num;
833833
int ret;
834834

835-
if (!tb[NFTA_CT_TIMEOUT_L3PROTO] ||
836-
!tb[NFTA_CT_TIMEOUT_L4PROTO] ||
835+
if (!tb[NFTA_CT_TIMEOUT_L4PROTO] ||
837836
!tb[NFTA_CT_TIMEOUT_DATA])
838837
return -EINVAL;
839838

840-
l3num = ntohs(nla_get_be16(tb[NFTA_CT_TIMEOUT_L3PROTO]));
839+
if (tb[NFTA_CT_TIMEOUT_L3PROTO])
840+
l3num = ntohs(nla_get_be16(tb[NFTA_CT_TIMEOUT_L3PROTO]));
841+
841842
l4num = nla_get_u8(tb[NFTA_CT_TIMEOUT_L4PROTO]);
842843
priv->l4proto = l4num;
843844

0 commit comments

Comments
 (0)