Changeset View
Changeset View
Standalone View
Standalone View
lib/libpfctl/libpfctl.c
Show First 20 Lines • Show All 1,105 Lines • ▼ Show 20 Lines | |||||
static void | static void | ||||
pf_state_export_to_state(struct pfctl_state *ps, const struct pf_state_export *s) | pf_state_export_to_state(struct pfctl_state *ps, const struct pf_state_export *s) | ||||
{ | { | ||||
assert(s->version >= PF_STATE_VERSION); | assert(s->version >= PF_STATE_VERSION); | ||||
ps->id = s->id; | ps->id = s->id; | ||||
strlcpy(ps->ifname, s->ifname, sizeof(ps->ifname)); | strlcpy(ps->ifname, s->ifname, sizeof(ps->ifname)); | ||||
strlcpy(ps->orig_ifname, s->orig_ifname, sizeof(ps->orig_ifname)); | strlcpy(ps->orig_ifname, s->orig_ifname, sizeof(ps->orig_ifname)); | ||||
strlcpy(ps->rt_ifname, s->rt_ifname, sizeof(ps->rt_ifname)); | |||||
pf_state_key_export_to_state_key(&ps->key[0], &s->key[0]); | pf_state_key_export_to_state_key(&ps->key[0], &s->key[0]); | ||||
pf_state_key_export_to_state_key(&ps->key[1], &s->key[1]); | pf_state_key_export_to_state_key(&ps->key[1], &s->key[1]); | ||||
pf_state_peer_export_to_state_peer(&ps->src, &s->src); | pf_state_peer_export_to_state_peer(&ps->src, &s->src); | ||||
pf_state_peer_export_to_state_peer(&ps->dst, &s->dst); | pf_state_peer_export_to_state_peer(&ps->dst, &s->dst); | ||||
bcopy(&s->rt_addr, &ps->rt_addr, sizeof(ps->rt_addr)); | bcopy(&s->rt_addr, &ps->rt_addr, sizeof(ps->rt_addr)); | ||||
ps->rule = ntohl(s->rule); | ps->rule = ntohl(s->rule); | ||||
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 = ntohl(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 = ntohs(s->state_flags); | ||||
ps->sync_flags = s->sync_flags; | ps->sync_flags = ntohs(s->sync_flags); | ||||
ps->qid = ntohs(s->qid); | |||||
ps->pqid = ntohs(s->pqid); | |||||
ps->dnpipe = ntohs(s->dnpipe); | |||||
ps->dnrpipe = ntohs(s->dnrpipe); | |||||
ps->rtableid = ntohl(s->rtableid); | |||||
ps->min_ttl = s->min_ttl; | |||||
ps->set_tos = s->set_tos; | |||||
ps->max_mss = ntohs(s->max_mss); | |||||
ps->rt = s->rt; | |||||
ps->set_prio[0] = s->set_prio[0]; | |||||
ps->set_prio[1] = s->set_prio[1]; | |||||
} | } | ||||
int | int | ||||
pfctl_get_states(int dev, struct pfctl_states *states) | pfctl_get_states(int dev, struct pfctl_states *states) | ||||
{ | { | ||||
struct pfioc_states_v2 ps; | struct pfioc_states_v2 ps; | ||||
struct pf_state_export *p; | struct pf_state_export *p; | ||||
char *inbuf = NULL, *newinbuf = NULL; | char *inbuf = NULL, *newinbuf = NULL; | ||||
▲ Show 20 Lines • Show All 382 Lines • Show Last 20 Lines |