diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2008-05-21 13:30:43 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2008-05-21 13:30:43 +0200 |
commit | 7e629bad0f752f6fb3e3a435666307992e74bee2 (patch) | |
tree | f9ed7c72fc0a86754d9e451ca86ed42cde6a34cf /src/conntrack/parse.c | |
parent | ff7d53ece9e73e0bda937ad8716482c8cc881fb3 (diff) |
add full support of SCTP
Diffstat (limited to 'src/conntrack/parse.c')
-rw-r--r-- | src/conntrack/parse.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/src/conntrack/parse.c b/src/conntrack/parse.c index c21f304..a18e3ad 100644 --- a/src/conntrack/parse.c +++ b/src/conntrack/parse.c @@ -217,6 +217,33 @@ static void __parse_protoinfo_tcp(const struct nfattr *attr, } } +static void __parse_protoinfo_sctp(const struct nfattr *attr, + struct nf_conntrack *ct) +{ + struct nfattr *tb[CTA_PROTOINFO_SCTP_MAX]; + + nfnl_parse_nested(tb, CTA_PROTOINFO_SCTP_MAX, attr); + + if (tb[CTA_PROTOINFO_SCTP_STATE-1]) { + ct->protoinfo.sctp.state = + *(u_int8_t *)NFA_DATA(tb[CTA_PROTOINFO_SCTP_STATE-1]); + set_bit(ATTR_SCTP_STATE, ct->set); + } + + if (tb[CTA_PROTOINFO_SCTP_VTAG_ORIGINAL-1]) { + ct->protoinfo.sctp.vtag[__DIR_ORIG] = + ntohl(*(u_int32_t *)NFA_DATA(tb[CTA_PROTOINFO_SCTP_VTAG_ORIGINAL-1])); + set_bit(ATTR_SCTP_VTAG_ORIG, ct->set); + } + + if (tb[CTA_PROTOINFO_SCTP_VTAG_REPLY-1]) { + ct->protoinfo.sctp.vtag[__DIR_ORIG] = + ntohl(*(u_int32_t *)NFA_DATA(tb[CTA_PROTOINFO_SCTP_VTAG_REPLY-1])); + set_bit(ATTR_SCTP_VTAG_ORIG, ct->set); + } + +} + static void __parse_protoinfo(const struct nfattr *attr, struct nf_conntrack *ct) { @@ -224,10 +251,11 @@ static void __parse_protoinfo(const struct nfattr *attr, nfnl_parse_nested(tb, CTA_PROTOINFO_MAX, attr); - if (!tb[CTA_PROTOINFO_TCP-1]) - return; + if (tb[CTA_PROTOINFO_TCP-1]) + __parse_protoinfo_tcp(tb[CTA_PROTOINFO_TCP-1], ct); - __parse_protoinfo_tcp(tb[CTA_PROTOINFO_TCP-1], ct); + if (tb[CTA_PROTOINFO_SCTP-1]) + __parse_protoinfo_sctp(tb[CTA_PROTOINFO_SCTP-1], ct); } static void __parse_counters(const struct nfattr *attr, |