From b7a5d5e828989b2f32746fe860f4e8b59c332198 Mon Sep 17 00:00:00 2001 From: Vytas Dauksa Date: Thu, 23 Jan 2014 07:37:48 +0100 Subject: print mark & mark mask in hex rather then decimal modified ipset_print_mark to print in hex rather then decimal and altered accordingly test cases. Signed-off-by: Jozsef Kadlecsik --- lib/ipset_hash_ipmark.c | 2 +- lib/print.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/ipset_hash_ipmark.c b/lib/ipset_hash_ipmark.c index fdea32f..922e6c0 100644 --- a/lib/ipset_hash_ipmark.c +++ b/lib/ipset_hash_ipmark.c @@ -28,7 +28,7 @@ static const struct ipset_arg hash_ipmark_create_args0[] = { }, { .name = { "markmask", NULL }, .has_arg = IPSET_MANDATORY_ARG, .opt = IPSET_OPT_MARKMASK, - .parse = ipset_parse_uint32, .print = ipset_print_number, + .parse = ipset_parse_uint32, .print = ipset_print_mark, }, { .name = { "hashsize", NULL }, .has_arg = IPSET_MANDATORY_ARG, .opt = IPSET_OPT_HASHSIZE, diff --git a/lib/print.c b/lib/print.c index 8e2924e..f81c074 100644 --- a/lib/print.c +++ b/lib/print.c @@ -514,12 +514,12 @@ ipset_print_mark(char *buf, unsigned int len, assert(buf); assert(len > 0); assert(data); - assert(opt == IPSET_OPT_MARK); + assert(opt == IPSET_OPT_MARK || opt == IPSET_OPT_MARKMASK); - mark = ipset_data_get(data, IPSET_OPT_MARK); + mark = ipset_data_get(data, opt); assert(mark); - size = snprintf(buf, len, "%u", *mark); + size = snprintf(buf, len, "0x%08llx", *mark); SNPRINTF_FAILURE(size, len, offset); return offset; -- cgit v1.2.3