Skip to content

Commit

Permalink
netfilter: nft_ct: make l3 protocol field optional for timeout object
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Harsha Sharma authored and Pablo Neira Ayuso committed Aug 16, 2018
1 parent 1bfc2bc commit 3206c51
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions net/netfilter/nft_ct.c
Original file line number Diff line number Diff line change
Expand Up @@ -832,12 +832,13 @@ static int nft_ct_timeout_obj_init(const struct nft_ctx *ctx,
__u8 l4num;
int ret;

if (!tb[NFTA_CT_TIMEOUT_L3PROTO] ||
!tb[NFTA_CT_TIMEOUT_L4PROTO] ||
if (!tb[NFTA_CT_TIMEOUT_L4PROTO] ||
!tb[NFTA_CT_TIMEOUT_DATA])
return -EINVAL;

l3num = ntohs(nla_get_be16(tb[NFTA_CT_TIMEOUT_L3PROTO]));
if (tb[NFTA_CT_TIMEOUT_L3PROTO])
l3num = ntohs(nla_get_be16(tb[NFTA_CT_TIMEOUT_L3PROTO]));

l4num = nla_get_u8(tb[NFTA_CT_TIMEOUT_L4PROTO]);
priv->l4proto = l4num;

Expand Down

0 comments on commit 3206c51

Please sign in to comment.