diff options
author | Phil Sutter <phil@nwl.cc> | 2022-11-25 03:13:14 +0100 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2022-11-29 13:25:26 +0100 |
commit | 023dd2c515be63ddb2f0b6a6f3bccab4cdf7a71c (patch) | |
tree | 4209d3e8123555385bbc731fe8da9ac2c90bf07b /extensions/libxt_hashlimit.c | |
parent | 208290ff0bfecb49044c3df87149aa6fa683de09 (diff) |
libxtables: xt_xlate_add() to take care of spacing
Try to eliminate most of the whitespace issues by separating strings
from separate xt_xlate_add() calls by whitespace if needed.
Cover the common case of consecutive range, list or MAC/IP address
printing by inserting whitespace only if the string to be appended
starts with an alphanumeric character or a brace. The latter helps to
make spacing in anonymous sets consistent.
Provide *_nospc() variants which disable the auto-spacing for the
mandatory exception to the rule.
Make things round by dropping any trailing whitespace before returning
the buffer via xt_xlate_get().
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'extensions/libxt_hashlimit.c')
-rw-r--r-- | extensions/libxt_hashlimit.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/extensions/libxt_hashlimit.c b/extensions/libxt_hashlimit.c index 93ee1c32..24e784ab 100644 --- a/extensions/libxt_hashlimit.c +++ b/extensions/libxt_hashlimit.c @@ -1270,7 +1270,7 @@ static void hashlimit_print_subnet_xlate(struct xt_xlate *xl, } } - xt_xlate_add(xl, fmt, acm); + xt_xlate_add_nospc(xl, fmt, acm); if (nblocks > 0) xt_xlate_add(xl, "%c", sep); } |