Date: Sun, 27 Jul 2008 11:11:16 GMT From: Gleb Kurtsou <gk@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 146037 for review Message-ID: <200807271111.m6RBBGhG081789@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=146037 Change 146037 by gk@gk_h1 on 2008/07/27 11:11:06 'pfctl -vs state' is now capable of printing state ethernet addresses do not print extra space in print_addr_ether Affected files ... .. //depot/projects/soc2008/gk_l2filter/sbin-pfctl/pf_print_state.c#5 edit .. //depot/projects/soc2008/gk_l2filter/sbin-pfctl/pfctl_table.c#3 edit Differences ... ==== //depot/projects/soc2008/gk_l2filter/sbin-pfctl/pf_print_state.c#5 (text+ko) ==== @@ -120,19 +120,23 @@ printf("/%d", bits); } - print_addr_ether(&addr->v.a.addr_ether, verbose); + putchar(' '); + print_addr_ether(&addr->v.a.addr_ether, 0); } void print_addr_ether(struct pf_addr_ether *addr, int verbose) { - if ((addr->flags & PFAE_CHECK) == 0) + if ((addr->flags & PFAE_CHECK) == 0) { + if (verbose) + printf("ether any"); return; + } if (addr->flags & PFAE_MULTICAST) { - printf(" ether multicast"); + printf("ether multicast"); } else { u_int8_t *ea = addr->octet; - printf(" ether %02x:%02x:%02x:%02x:%02x:%02x", + printf("ether %02x:%02x:%02x:%02x:%02x:%02x", ea[0], ea[1], ea[2], ea[3], ea[4], ea[5]); } } @@ -315,6 +319,28 @@ if (s->nat_src_node != NULL) printf(", sticky-address"); printf("\n"); + if (s->local_flags & PFSTATE_ETHER) { + int left_printed = 0; + + printf(" "); + if (s->lan.addr_ether.flags & PFAE_CHECK) { + print_addr_ether(&s->lan.addr_ether, 1); + if (s->direction == PF_OUT) + printf(" -> "); + else + printf(" <- "); + left_printed = 1; + } + if (!left_printed || (s->gwy.addr_ether.flags & PFAE_CHECK)) { + print_addr_ether(&s->gwy.addr_ether, 1); + if (s->direction == PF_OUT) + printf(" -> "); + else + printf(" <- "); + } + print_addr_ether(&s->ext.addr_ether, 1); + printf("\n"); + } } if (opts & PF_OPT_VERBOSE2) { printf(" id: %016llx creatorid: %08x%s\n", ==== //depot/projects/soc2008/gk_l2filter/sbin-pfctl/pfctl_table.c#3 (text+ko) ==== @@ -438,6 +438,7 @@ printf("%c %c%s", ch, (ad->pfra_not?'!':' '), buf); if (ad->pfra_net < hostnet) printf("/%d", ad->pfra_net); + putchar(' '); print_addr_ether(&ad->pfra_ether, 0); if (rad != NULL && fback != PFR_FB_NONE) { if (strlcpy(buf, "{error}", sizeof(buf)) >= sizeof(buf))
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807271111.m6RBBGhG081789>