Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 9835
b: refs/heads/master
c: 3392315
h: refs/heads/master
i:
  9833: b88fa78
  9831: ea427c2
v: v3
  • Loading branch information
Pablo Neira Ayuso authored and David S. Miller committed Oct 11, 2005
1 parent e3758a1 commit 0fa6792
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a051a8f7306476af0a74370ad56e793cb6c43bf7
refs/heads/master: 339231537506846cb232a2f0cc4a2c662b2d5b07
3 changes: 3 additions & 0 deletions trunk/include/linux/netfilter_ipv4/ip_conntrack_protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ struct ip_conntrack_protocol
int (*to_nfattr)(struct sk_buff *skb, struct nfattr *nfa,
const struct ip_conntrack *ct);

/* convert nfnetlink attributes to protoinfo */
int (*from_nfattr)(struct nfattr *tb[], struct ip_conntrack *ct);

int (*tuple_to_nfattr)(struct sk_buff *skb,
const struct ip_conntrack_tuple *t);
int (*nfattr_to_tuple)(struct nfattr *tb[],
Expand Down
23 changes: 23 additions & 0 deletions trunk/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,28 @@ static int tcp_to_nfattr(struct sk_buff *skb, struct nfattr *nfa,
read_unlock_bh(&tcp_lock);
return -1;
}

static int nfattr_to_tcp(struct nfattr *cda[], struct ip_conntrack *ct)
{
struct nfattr *attr = cda[CTA_PROTOINFO_TCP-1];
struct nfattr *tb[CTA_PROTOINFO_TCP_MAX];

if (nfattr_parse_nested(tb, CTA_PROTOINFO_TCP_MAX, attr) < 0)
goto nfattr_failure;

if (!tb[CTA_PROTOINFO_TCP_STATE-1])
return -EINVAL;

write_lock_bh(&tcp_lock);
ct->proto.tcp.state =
*(u_int8_t *)NFA_DATA(tb[CTA_PROTOINFO_TCP_STATE-1]);
write_unlock_bh(&tcp_lock);

return 0;

nfattr_failure:
return -1;
}
#endif

static unsigned int get_conntrack_index(const struct tcphdr *tcph)
Expand Down Expand Up @@ -1127,6 +1149,7 @@ struct ip_conntrack_protocol ip_conntrack_protocol_tcp =
#if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \
defined(CONFIG_IP_NF_CONNTRACK_NETLINK_MODULE)
.to_nfattr = tcp_to_nfattr,
.from_nfattr = nfattr_to_tcp,
.tuple_to_nfattr = ip_ct_port_tuple_to_nfattr,
.nfattr_to_tuple = ip_ct_port_nfattr_to_tuple,
#endif
Expand Down

0 comments on commit 0fa6792

Please sign in to comment.