? o ? x Index: npf_show.c =================================================================== RCS file: /cvsroot/src/usr.sbin/npf/npfctl/npf_show.c,v retrieving revision 1.22 diff -u -u -r1.22 npf_show.c --- npf_show.c 29 Dec 2016 20:48:50 -0000 1.22 +++ npf_show.c 29 Dec 2016 21:31:49 -0000 @@ -338,6 +338,13 @@ } static void +npfctl_print_id(npf_conf_info_t *ctx, nl_rule_t *rl) +{ + uint64_t id = id = npf_rule_getid(rl); + fprintf(ctx->fp, "# id=\"%" PRIu64 "\" ", id); +} + +static void npfctl_print_filter(npf_conf_info_t *ctx, nl_rule_t *rl) { const void *marks; @@ -399,8 +406,7 @@ if ((attr & NPF_DYNAMIC_GROUP) == NPF_RULE_GROUP) { /* Group; done. */ - fputs("\n", ctx->fp); - return; + goto out; } /* Print filter criteria. */ @@ -411,12 +417,8 @@ fprintf(ctx->fp, "apply \"%s\" ", rproc); } - /* If dynamic rule - print its ID. */ - if ((attr & NPF_DYNAMIC_GROUP) == NPF_RULE_DYNAMIC) { - uint64_t id = npf_rule_getid(rl); - fprintf(ctx->fp, "# id = \"%" PRIx64 "\" ", id); - } - +out: + npfctl_print_id(ctx, rl); fputs("\n", ctx->fp); } @@ -465,6 +467,7 @@ ifname, (flags & NPF_NAT_STATIC) ? "static" : "dynamic", seg1, arrow, seg2); npfctl_print_filter(ctx, rl); + npfctl_print_id(ctx, rl); fputs("\n", ctx->fp); free(seg); }