Hi, On Thu, Oct 06, 2022 at 08:27:33AM +0200, Jan Engelhardt wrote: > > On Thursday 2022-10-06 02:28, Phil Sutter wrote: > > >All one's netmasks are a trivial default, no point in printing them. > > > >@@ -64,7 +64,7 @@ static void __NETMAP_print(const void *ip, const struct xt_entry_target *target, > > bits = xtables_ip6mask_to_cidr(&a); > > if (bits < 0) > > printf("/%s", xtables_ip6addr_to_numeric(&a)); > >- else > >+ else if (bits < sizeof(a) * 8) > > printf("/%d", bits); > > I would rather see it stay. > - iproute2 also always prints the /128 suffix > - test parsers need not special case the absence of /128 I get your point. Screen-scraping is also not uncommon among iptables users, so care has to be taken when "optimizing" output. OTOH we're a bit inconsistent: xtables_ip(6)mask_to_numeric() explicitly omits output if it would print "/32" or "/128". Maybe I'll just leave the code as-is and adjust only the test cases instead? > >--- a/extensions/libxt_MARK.c > >@@ -242,7 +242,9 @@ static void mark_tg_save(const void *ip, const struct xt_entry_target *target) > > { > > const struct xt_mark_tginfo2 *info = (const void *)target->data; > > > >- printf(" --set-xmark 0x%x/0x%x", info->mark, info->mask); > >+ printf(" --set-xmark 0x%x", info->mark); > >+ if (info->mask != 0xffffffffU) > >+ printf("/0x%x", info->mask); > > if (info->mask != UINT32_MAX) ACK. I copied from mark_tg_print(), so that's a useful fix unrelated to the discussion above. Thanks, Phil