|
@@ -1222,6 +1222,12 @@ static const struct nla_policy tcp_nla_policy[CTA_PROTOINFO_TCP_MAX+1] = {
|
|
|
[CTA_PROTOINFO_TCP_FLAGS_REPLY] = { .len = sizeof(struct nf_ct_tcp_flags) },
|
|
|
};
|
|
|
|
|
|
+#define TCP_NLATTR_SIZE ( \
|
|
|
+ NLA_ALIGN(NLA_HDRLEN + 1) + \
|
|
|
+ NLA_ALIGN(NLA_HDRLEN + 1) + \
|
|
|
+ NLA_ALIGN(NLA_HDRLEN + sizeof(sizeof(struct nf_ct_tcp_flags))) + \
|
|
|
+ NLA_ALIGN(NLA_HDRLEN + sizeof(sizeof(struct nf_ct_tcp_flags))))
|
|
|
+
|
|
|
static int nlattr_to_tcp(struct nlattr *cda[], struct nf_conn *ct)
|
|
|
{
|
|
|
struct nlattr *pattr = cda[CTA_PROTOINFO_TCP];
|
|
@@ -1274,12 +1280,6 @@ static int nlattr_to_tcp(struct nlattr *cda[], struct nf_conn *ct)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-static int tcp_nlattr_size(void)
|
|
|
-{
|
|
|
- return nla_total_size(0) /* CTA_PROTOINFO_TCP */
|
|
|
- + nla_policy_len(tcp_nla_policy, CTA_PROTOINFO_TCP_MAX + 1);
|
|
|
-}
|
|
|
-
|
|
|
static unsigned int tcp_nlattr_tuple_size(void)
|
|
|
{
|
|
|
static unsigned int size __read_mostly;
|
|
@@ -1557,11 +1557,11 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp4 __read_mostly =
|
|
|
.can_early_drop = tcp_can_early_drop,
|
|
|
#if IS_ENABLED(CONFIG_NF_CT_NETLINK)
|
|
|
.to_nlattr = tcp_to_nlattr,
|
|
|
- .nlattr_size = tcp_nlattr_size,
|
|
|
.from_nlattr = nlattr_to_tcp,
|
|
|
.tuple_to_nlattr = nf_ct_port_tuple_to_nlattr,
|
|
|
.nlattr_to_tuple = nf_ct_port_nlattr_to_tuple,
|
|
|
.nlattr_tuple_size = tcp_nlattr_tuple_size,
|
|
|
+ .nlattr_size = TCP_NLATTR_SIZE,
|
|
|
.nla_policy = nf_ct_port_nla_policy,
|
|
|
#endif
|
|
|
#if IS_ENABLED(CONFIG_NF_CT_NETLINK_TIMEOUT)
|
|
@@ -1594,8 +1594,8 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp6 __read_mostly =
|
|
|
.error = tcp_error,
|
|
|
.can_early_drop = tcp_can_early_drop,
|
|
|
#if IS_ENABLED(CONFIG_NF_CT_NETLINK)
|
|
|
+ .nlattr_size = TCP_NLATTR_SIZE,
|
|
|
.to_nlattr = tcp_to_nlattr,
|
|
|
- .nlattr_size = tcp_nlattr_size,
|
|
|
.from_nlattr = nlattr_to_tcp,
|
|
|
.tuple_to_nlattr = nf_ct_port_tuple_to_nlattr,
|
|
|
.nlattr_to_tuple = nf_ct_port_nlattr_to_tuple,
|