[NETFILTER] ctnetlink: add one nesting level for TCP state
To keep consistency, the TCP private protocol information is nested attributes under CTA_PROTOINFO_TCP. This way the sequence of attributes to access the TCP state information looks like here below: CTA_PROTOINFO CTA_PROTOINFO_TCP CTA_PROTOINFO_TCP_STATE instead of: CTA_PROTOINFO CTA_PROTOINFO_TCP_STATE Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Harald Welte <laforge@netfilter.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Родитель
5bbc243aaf
Коммит
e1c73b78e3
|
@ -70,11 +70,18 @@ enum ctattr_l4proto {
|
||||||
|
|
||||||
enum ctattr_protoinfo {
|
enum ctattr_protoinfo {
|
||||||
CTA_PROTOINFO_UNSPEC,
|
CTA_PROTOINFO_UNSPEC,
|
||||||
CTA_PROTOINFO_TCP_STATE,
|
CTA_PROTOINFO_TCP,
|
||||||
__CTA_PROTOINFO_MAX
|
__CTA_PROTOINFO_MAX
|
||||||
};
|
};
|
||||||
#define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1)
|
#define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1)
|
||||||
|
|
||||||
|
enum ctattr_protoinfo_tcp {
|
||||||
|
CTA_PROTOINFO_TCP_UNSPEC,
|
||||||
|
CTA_PROTOINFO_TCP_STATE,
|
||||||
|
__CTA_PROTOINFO_TCP_MAX
|
||||||
|
};
|
||||||
|
#define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1)
|
||||||
|
|
||||||
enum ctattr_counters {
|
enum ctattr_counters {
|
||||||
CTA_COUNTERS_UNSPEC,
|
CTA_COUNTERS_UNSPEC,
|
||||||
CTA_COUNTERS_PACKETS,
|
CTA_COUNTERS_PACKETS,
|
||||||
|
|
|
@ -341,11 +341,15 @@ static int tcp_print_conntrack(struct seq_file *s,
|
||||||
static int tcp_to_nfattr(struct sk_buff *skb, struct nfattr *nfa,
|
static int tcp_to_nfattr(struct sk_buff *skb, struct nfattr *nfa,
|
||||||
const struct ip_conntrack *ct)
|
const struct ip_conntrack *ct)
|
||||||
{
|
{
|
||||||
|
struct nfattr *nest_parms = NFA_NEST(skb, CTA_PROTOINFO_TCP);
|
||||||
|
|
||||||
read_lock_bh(&tcp_lock);
|
read_lock_bh(&tcp_lock);
|
||||||
NFA_PUT(skb, CTA_PROTOINFO_TCP_STATE, sizeof(u_int8_t),
|
NFA_PUT(skb, CTA_PROTOINFO_TCP_STATE, sizeof(u_int8_t),
|
||||||
&ct->proto.tcp.state);
|
&ct->proto.tcp.state);
|
||||||
read_unlock_bh(&tcp_lock);
|
read_unlock_bh(&tcp_lock);
|
||||||
|
|
||||||
|
NFA_NEST_END(skb, nest_parms);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
nfattr_failure:
|
nfattr_failure:
|
||||||
|
|
Загрузка…
Ссылка в новой задаче