Changeset View
Changeset View
Standalone View
Standalone View
contrib/tcpdump/print-pflog.c
Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | |||||
/* For reading capture files on other systems */ | /* For reading capture files on other systems */ | ||||
#define OPENBSD_AF_INET 2 | #define OPENBSD_AF_INET 2 | ||||
#define OPENBSD_AF_INET6 24 | #define OPENBSD_AF_INET6 24 | ||||
static void | static void | ||||
pflog_print(netdissect_options *ndo, const struct pfloghdr *hdr) | pflog_print(netdissect_options *ndo, const struct pfloghdr *hdr) | ||||
{ | { | ||||
uint32_t rulenr, subrulenr; | uint32_t rulenr, subrulenr, ridentifier; | ||||
rulenr = EXTRACT_32BITS(&hdr->rulenr); | rulenr = EXTRACT_32BITS(&hdr->rulenr); | ||||
subrulenr = EXTRACT_32BITS(&hdr->subrulenr); | subrulenr = EXTRACT_32BITS(&hdr->subrulenr); | ||||
ridentifier = EXTRACT_32BITS(&hdr->ridentifier); | |||||
if (subrulenr == (uint32_t)-1) | if (subrulenr == (uint32_t)-1) | ||||
ND_PRINT((ndo, "rule %u/", rulenr)); | ND_PRINT((ndo, "rule %u/", rulenr)); | ||||
else | else | ||||
ND_PRINT((ndo, "rule %u.%s.%u/", rulenr, hdr->ruleset, subrulenr)); | ND_PRINT((ndo, "rule %u.%s.%u/", rulenr, hdr->ruleset, subrulenr)); | ||||
ND_PRINT((ndo, "%s", tok2str(pf_reasons, "unkn(%u)", hdr->reason))); | ND_PRINT((ndo, "%s", tok2str(pf_reasons, "unkn(%u)", hdr->reason))); | ||||
if (hdr->uid != UID_MAX) | if (hdr->uid != UID_MAX) | ||||
ND_PRINT((ndo, " [uid %u]", (unsigned)hdr->uid)); | ND_PRINT((ndo, " [uid %u]", (unsigned)hdr->uid)); | ||||
if (ridentifier != 0) | |||||
ND_PRINT((ndo, " [ridentifier %u]", ridentifier)); | |||||
ND_PRINT((ndo, ": %s %s on %s: ", | ND_PRINT((ndo, ": %s %s on %s: ", | ||||
tok2str(pf_actions, "unkn(%u)", hdr->action), | tok2str(pf_actions, "unkn(%u)", hdr->action), | ||||
tok2str(pf_directions, "unkn(%u)", hdr->dir), | tok2str(pf_directions, "unkn(%u)", hdr->dir), | ||||
hdr->ifname)); | hdr->ifname)); | ||||
} | } | ||||
u_int | u_int | ||||
▲ Show 20 Lines • Show All 78 Lines • Show Last 20 Lines |