diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-01-29 00:31:36 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-02-06 21:48:30 +0100 |
commit | 815805101cbc0e513cf909a77b5dfcd8d39684fd (patch) | |
tree | 3e1b202b3542863ccd495942842d6186baea43b7 /src/expect/snprintf_default.c | |
parent | 9064374e7758bc4fa167d1c30ccc751ea588f5db (diff) |
expect: add class support
This patch allows you to specify the expectation class.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/expect/snprintf_default.c')
-rw-r--r-- | src/expect/snprintf_default.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/expect/snprintf_default.c b/src/expect/snprintf_default.c index 77f9c3b..44b7719 100644 --- a/src/expect/snprintf_default.c +++ b/src/expect/snprintf_default.c @@ -19,6 +19,16 @@ __snprintf_expect_timeout(char *buf, unsigned int len, return 0; } +static int +__snprintf_expect_class(char *buf, unsigned int len, + const struct nf_expect *exp) +{ + if (test_bit(ATTR_EXP_CLASS, exp->set)) + return snprintf(buf, len, "class=%u ", exp->class); + + return 0; +} + static int __snprintf_expect_proto(char *buf, unsigned int len, const struct nf_expect *exp) @@ -101,6 +111,9 @@ int __snprintf_expect_default(char *buf, BUFFER_SIZE(ret, size, len, offset); } + ret = __snprintf_expect_class(buf+offset, len, exp); + BUFFER_SIZE(ret, size, len, offset); + if (test_bit(ATTR_EXP_HELPER_NAME, exp->set)) { ret = snprintf(buf+offset, len, "helper=%s", exp->helper_name); BUFFER_SIZE(ret, size, len, offset); |