summaryrefslogtreecommitdiffstats
path: root/src/exthdr.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2017-09-28 17:17:42 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2017-09-29 12:37:44 +0200
commit9c4747d04075ad1e79aa0f346e7227a43e72405e (patch)
treeb955c4ef459b1a54080c4b8944d2266259aa7d51 /src/exthdr.c
parent8254efdc504f202eab7be64f06bf011b02d9693a (diff)
exthdr: Simplify tcp option printing a bit
This eliminates the need for that temporary buffer. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/exthdr.c')
-rw-r--r--src/exthdr.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/exthdr.c b/src/exthdr.c
index 4add3da2..37c76884 100644
--- a/src/exthdr.c
+++ b/src/exthdr.c
@@ -31,17 +31,13 @@ static void exthdr_expr_print(const struct expr *expr, struct output_ctx *octx)
* multiplicator
*/
unsigned int offset = expr->exthdr.offset / 64;
- char buf[9] = {0};
- if (expr->exthdr.flags & NFT_EXTHDR_F_PRESENT) {
- printf("tcp option %s", expr->exthdr.desc->name);
+ printf("tcp option %s", expr->exthdr.desc->name);
+ if (expr->exthdr.flags & NFT_EXTHDR_F_PRESENT)
return;
- }
-
if (offset)
- snprintf(buf, sizeof buf, "%d", offset);
- printf("tcp option %s%s %s", expr->exthdr.desc->name, buf,
- expr->exthdr.tmpl->token);
+ printf("%d", offset);
+ printf(" %s", expr->exthdr.tmpl->token);
} else {
if (expr->exthdr.flags & NFT_EXTHDR_F_PRESENT)
printf("exthdr %s", expr->exthdr.desc->name);