diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2009-04-18 19:36:38 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2009-04-18 19:36:38 +0200 |
commit | 400ae54438c4b85126f9fab0ae1dc067823b70f7 (patch) | |
tree | 6a558de31de6dd19ba193890df883ad2c768890f /src/parse.c | |
parent | a9554339451a0698e33b0964d0e8113f714470a4 (diff) | |
download | conntrack-tools-400ae54438c4b85126f9fab0ae1dc067823b70f7.tar.gz conntrack-tools-400ae54438c4b85126f9fab0ae1dc067823b70f7.zip |
sync: add support for SCTP state replication
This patch adds initial support for SCTP state replication.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/parse.c')
-rw-r--r-- | src/parse.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/parse.c b/src/parse.c index 76287fd..d14910a 100644 --- a/src/parse.c +++ b/src/parse.c @@ -29,6 +29,7 @@ static void parse_u16(struct nf_conntrack *ct, int attr, void *data); static void parse_u32(struct nf_conntrack *ct, int attr, void *data); static void parse_group(struct nf_conntrack *ct, int attr, void *data); static void parse_nat_seq_adj(struct nf_conntrack *ct, int attr, void *data); +static void parse_sctp(struct nf_conntrack *ct, int attr, void *data); struct parser { void (*parse)(struct nf_conntrack *ct, int attr, void *data); @@ -57,7 +58,7 @@ static struct parser h[NTA_MAX] = { .attr = ATTR_L4PROTO, .size = NTA_SIZE(sizeof(uint8_t)), }, - [NTA_STATE] = { + [NTA_STATE_TCP] = { .parse = parse_u8, .attr = ATTR_TCP_STATE, .size = NTA_SIZE(sizeof(uint8_t)), @@ -121,6 +122,10 @@ static struct parser h[NTA_MAX] = { .parse = parse_nat_seq_adj, .size = NTA_SIZE(sizeof(struct nta_attr_natseqadj)), }, + [NTA_STATE_SCTP] = { + .parse = parse_sctp, + .size = NTA_SIZE(sizeof(struct nta_attr_sctp)), + }, }; static void @@ -168,6 +173,15 @@ parse_nat_seq_adj(struct nf_conntrack *ct, int attr, void *data) ntohl(this->orig_seq_correction_pos)); } +static void +parse_sctp(struct nf_conntrack *ct, int attr, void *data) +{ + struct nta_attr_sctp *this = data; + nfct_set_attr_u8(ct, ATTR_SCTP_STATE, this->state); + nfct_set_attr_u32(ct, ATTR_SCTP_VTAG_ORIG, ntohl(this->vtag_orig)); + nfct_set_attr_u32(ct, ATTR_SCTP_VTAG_REPL, ntohl(this->vtag_repl)); +} + int parse_payload(struct nf_conntrack *ct, struct nethdr *net, size_t remain) { int len; |