From 7533cca286edee99db29eb1238653a2040738d3e Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 14 Apr 2009 10:35:27 +0200 Subject: src: add initial DCCP support This patch adds initial DCCP support for libnetfilter_conntrack. Signed-off-by: Pablo Neira Ayuso --- src/conntrack/snprintf_default.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/conntrack/snprintf_default.c') diff --git a/src/conntrack/snprintf_default.c b/src/conntrack/snprintf_default.c index dbc5fb1..4802c47 100644 --- a/src/conntrack/snprintf_default.c +++ b/src/conntrack/snprintf_default.c @@ -16,6 +16,7 @@ static char *proto2str[IPPROTO_MAX] = { [IPPROTO_SCTP] = "sctp", [IPPROTO_GRE] = "gre", [IPPROTO_UDPLITE] = "udplite", + [IPPROTO_DCCP] = "dccp", }; static char *l3proto2str[AF_MAX] = { @@ -47,6 +48,19 @@ static const char *sctp_states[] = { "SHUTDOWN_ACK_SENT", }; +static const char *dccp_states[] = { + "NONE", + "REQUEST", + "RESPOND", + "PARTOPEN", + "OPEN", + "CLOSEREQ", + "CLOSING", + "TIMEWAIT", + "IGNORE", + "INVALID", +}; + static int __snprintf_l3protocol(char *buf, unsigned int len, const struct nf_conntrack *ct) @@ -86,6 +100,12 @@ int __snprintf_protoinfo_sctp(char *buf, { return snprintf(buf, len, "%s ", sctp_states[ct->protoinfo.sctp.state]); } +int __snprintf_protoinfo_dccp(char *buf, + unsigned int len, + const struct nf_conntrack *ct) +{ + return snprintf(buf, len, "%s ", dccp_states[ct->protoinfo.dccp.state]); +} int __snprintf_address_ipv4(char *buf, unsigned int len, @@ -288,6 +308,11 @@ int __snprintf_conntrack_default(char *buf, BUFFER_SIZE(ret, size, len, offset); } + if (test_bit(ATTR_DCCP_STATE, ct->set)) { + ret = __snprintf_protoinfo_dccp(buf+offset, len, ct); + BUFFER_SIZE(ret, size, len, offset); + } + ret = __snprintf_address(buf+offset, len, &ct->tuple[__DIR_ORIG]); BUFFER_SIZE(ret, size, len, offset); -- cgit v1.2.3