Changeset View
Changeset View
Standalone View
Standalone View
lib/libpfctl/libpfctl.c
| Show First 20 Lines • Show All 182 Lines • ▼ Show 20 Lines | pfctl_get_status(int dev) | ||||
| if (nvl == NULL) { | if (nvl == NULL) { | ||||
| free(status); | free(status); | ||||
| return (NULL); | return (NULL); | ||||
| } | } | ||||
| status->running = nvlist_get_bool(nvl, "running"); | status->running = nvlist_get_bool(nvl, "running"); | ||||
| status->since = nvlist_get_number(nvl, "since"); | status->since = nvlist_get_number(nvl, "since"); | ||||
| status->debug = nvlist_get_number(nvl, "debug"); | status->debug = nvlist_get_number(nvl, "debug"); | ||||
| status->hostid = nvlist_get_number(nvl, "hostid"); | status->hostid = ntohl(nvlist_get_number(nvl, "hostid")); | ||||
| status->states = nvlist_get_number(nvl, "states"); | status->states = nvlist_get_number(nvl, "states"); | ||||
| status->src_nodes = nvlist_get_number(nvl, "src_nodes"); | status->src_nodes = nvlist_get_number(nvl, "src_nodes"); | ||||
| strlcpy(status->ifname, nvlist_get_string(nvl, "ifname"), | strlcpy(status->ifname, nvlist_get_string(nvl, "ifname"), | ||||
| IFNAMSIZ); | IFNAMSIZ); | ||||
| chksum = nvlist_get_binary(nvl, "chksum", &len); | chksum = nvlist_get_binary(nvl, "chksum", &len); | ||||
| assert(len == PF_MD5_DIGEST_LENGTH); | assert(len == PF_MD5_DIGEST_LENGTH); | ||||
| memcpy(status->pf_chksum, chksum, len); | memcpy(status->pf_chksum, chksum, len); | ||||
| ▲ Show 20 Lines • Show All 610 Lines • ▼ Show 20 Lines | pf_state_export_to_state(struct pfctl_state *ps, const struct pf_state_export *s) | ||||
| ps->anchor = ntohl(s->anchor); | ps->anchor = ntohl(s->anchor); | ||||
| ps->nat_rule = ntohl(s->nat_rule); | ps->nat_rule = ntohl(s->nat_rule); | ||||
| ps->creation = ntohl(s->creation); | ps->creation = ntohl(s->creation); | ||||
| ps->expire = ntohl(s->expire); | ps->expire = ntohl(s->expire); | ||||
| ps->packets[0] = s->packets[0]; | ps->packets[0] = s->packets[0]; | ||||
| ps->packets[1] = s->packets[1]; | ps->packets[1] = s->packets[1]; | ||||
| ps->bytes[0] = s->bytes[0]; | ps->bytes[0] = s->bytes[0]; | ||||
| ps->bytes[1] = s->bytes[1]; | ps->bytes[1] = s->bytes[1]; | ||||
| ps->creatorid = s->creatorid; | ps->creatorid = ntohl(s->creatorid); | ||||
| ps->key[0].proto = s->proto; | ps->key[0].proto = s->proto; | ||||
| ps->key[1].proto = s->proto; | ps->key[1].proto = s->proto; | ||||
| ps->key[0].af = s->af; | ps->key[0].af = s->af; | ||||
| ps->key[1].af = s->af; | ps->key[1].af = s->af; | ||||
| ps->direction = s->direction; | ps->direction = s->direction; | ||||
| ps->state_flags = s->state_flags; | ps->state_flags = s->state_flags; | ||||
| ps->sync_flags = s->sync_flags; | ps->sync_flags = s->sync_flags; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 222 Lines • Show Last 20 Lines | |||||