Changeset View
Changeset View
Standalone View
Standalone View
sbin/pfctl/pfctl_parser.c
| Show First 20 Lines • Show All 685 Lines • ▼ Show 20 Lines | case PF_PASS: | ||||
| if (sn->rule.nr != -1) | if (sn->rule.nr != -1) | ||||
| printf(", filter rule %u", sn->rule.nr); | printf(", filter rule %u", sn->rule.nr); | ||||
| break; | break; | ||||
| } | } | ||||
| printf("\n"); | printf("\n"); | ||||
| } | } | ||||
| } | } | ||||
| static void | |||||
| print_eth_addr(const struct pfctl_eth_addr *a) | |||||
| { | |||||
| printf("%s%02x:%02x:%02x:%02x:%02x:%02x", a->neg ? "! " : "", | |||||
| a->addr[0], a->addr[1], a->addr[2], a->addr[3], a->addr[4], | |||||
| a->addr[5]); | |||||
| } | |||||
| void | |||||
| print_eth_rule(struct pfctl_eth_rule *r, int rule_numbers) | |||||
| { | |||||
| static const char *actiontypes[] = { "pass", "block" }; | |||||
| if (rule_numbers) | |||||
| printf("@%u ", r->nr); | |||||
| printf("ether %s", actiontypes[r->action]); | |||||
| if (r->direction == PF_IN) | |||||
| printf(" in"); | |||||
| else if (r->direction == PF_OUT) | |||||
| printf(" out"); | |||||
| if (r->quick) | |||||
| printf(" quick"); | |||||
| if (r->ifname[0]) { | |||||
| if (r->ifnot) | |||||
| printf(" on ! %s", r->ifname); | |||||
| else | |||||
| printf(" on %s", r->ifname); | |||||
| } | |||||
| if (r->proto) | |||||
| printf(" proto 0x%04x", r->proto); | |||||
| printf(" from "); | |||||
| print_eth_addr(&r->src); | |||||
| printf(" to "); | |||||
| print_eth_addr(&r->dst); | |||||
| if (r->qname[0]) | |||||
| printf(" queue %s", r->qname); | |||||
| if (r->tagname[0]) | |||||
| printf(" tag %s", r->tagname); | |||||
| } | |||||
| void | void | ||||
| print_rule(struct pfctl_rule *r, const char *anchor_call, int verbose, int numeric) | print_rule(struct pfctl_rule *r, const char *anchor_call, int verbose, int numeric) | ||||
| { | { | ||||
| static const char *actiontypes[] = { "pass", "block", "scrub", | static const char *actiontypes[] = { "pass", "block", "scrub", | ||||
| "no scrub", "nat", "no nat", "binat", "no binat", "rdr", "no rdr" }; | "no scrub", "nat", "no nat", "binat", "no binat", "rdr", "no rdr" }; | ||||
| static const char *anchortypes[] = { "anchor", "anchor", "anchor", | static const char *anchortypes[] = { "anchor", "anchor", "anchor", | ||||
| "anchor", "nat-anchor", "nat-anchor", "binat-anchor", | "anchor", "nat-anchor", "nat-anchor", "binat-anchor", | ||||
| "binat-anchor", "rdr-anchor", "rdr-anchor" }; | "binat-anchor", "rdr-anchor", "rdr-anchor" }; | ||||
| ▲ Show 20 Lines • Show All 1,186 Lines • Show Last 20 Lines | |||||