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/build.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/build.c')
-rw-r--r-- | src/build.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/build.c b/src/build.c index 63a85db..6b0fad7 100644 --- a/src/build.c +++ b/src/build.c @@ -92,6 +92,17 @@ __build_natseqadj(const struct nf_conntrack *ct, struct nethdr *n) addattr(n, NTA_NAT_SEQ_ADJ, &data, sizeof(struct nta_attr_natseqadj)); } +static inline void +__build_sctp(const struct nf_conntrack *ct, struct nethdr *n) +{ + struct nta_attr_sctp data = { + .state = nfct_get_attr_u8(ct, ATTR_SCTP_STATE), + .vtag_orig = htonl(nfct_get_attr_u32(ct, ATTR_SCTP_VTAG_ORIG)), + .vtag_repl = htonl(nfct_get_attr_u32(ct, ATTR_SCTP_VTAG_REPL)), + }; + addattr(n, NTA_STATE_SCTP, &data, sizeof(struct nta_attr_sctp)); +} + static enum nf_conntrack_attr nat_type[] = { ATTR_ORIG_NAT_SEQ_CORRECTION_POS, ATTR_ORIG_NAT_SEQ_OFFSET_BEFORE, ATTR_ORIG_NAT_SEQ_OFFSET_AFTER, ATTR_REPL_NAT_SEQ_CORRECTION_POS, @@ -117,7 +128,10 @@ void build_payload(const struct nf_conntrack *ct, struct nethdr *n) __build_u32(ct, ATTR_STATUS, n, NTA_STATUS); if (nfct_attr_is_set(ct, ATTR_TCP_STATE)) - __build_u8(ct, ATTR_TCP_STATE, n, NTA_STATE); + __build_u8(ct, ATTR_TCP_STATE, n, NTA_STATE_TCP); + else if (nfct_attr_is_set(ct, ATTR_SCTP_STATE)) + __build_sctp(ct, n); + if (!CONFIG(commit_timeout) && nfct_attr_is_set(ct, ATTR_TIMEOUT)) __build_u32(ct, ATTR_TIMEOUT, n, NTA_TIMEOUT); if (nfct_attr_is_set(ct, ATTR_MARK)) |