libpfctl: Fix u_* counters
struct pf_rule had a few counter_u64_t counters. Those couldn't be usefully comminicated with userspace, so the fields were doubled up in uint64_t u_* versions. Now that we use struct pfctl_rule (i.e. a fully userspace version) we can safely change the structure and remove this wart. Reviewed by: glebius MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29645
This commit is contained in:
parent
e9eb09414a
commit
ab5707a5cf
@ -367,9 +367,9 @@ pf_nvrule_to_rule(const nvlist_t *nvl, struct pfctl_rule *rule)
|
|||||||
|
|
||||||
pf_nvdivert_to_divert(nvlist_get_nvlist(nvl, "divert"), rule);
|
pf_nvdivert_to_divert(nvlist_get_nvlist(nvl, "divert"), rule);
|
||||||
|
|
||||||
rule->u_states_cur = nvlist_get_number(nvl, "states_cur");
|
rule->states_cur = nvlist_get_number(nvl, "states_cur");
|
||||||
rule->u_states_tot = nvlist_get_number(nvl, "states_tot");
|
rule->states_tot = nvlist_get_number(nvl, "states_tot");
|
||||||
rule->u_src_nodes = nvlist_get_number(nvl, "src_nodes");
|
rule->src_nodes = nvlist_get_number(nvl, "src_nodes");
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -81,9 +81,9 @@ struct pfctl_rule {
|
|||||||
uid_t cuid;
|
uid_t cuid;
|
||||||
pid_t cpid;
|
pid_t cpid;
|
||||||
|
|
||||||
counter_u64_t states_cur;
|
uint64_t states_cur;
|
||||||
counter_u64_t states_tot;
|
uint64_t states_tot;
|
||||||
counter_u64_t src_nodes;
|
uint64_t src_nodes;
|
||||||
|
|
||||||
u_int16_t return_icmp;
|
u_int16_t return_icmp;
|
||||||
u_int16_t return_icmp6;
|
u_int16_t return_icmp6;
|
||||||
@ -129,10 +129,6 @@ struct pfctl_rule {
|
|||||||
struct pf_addr addr;
|
struct pf_addr addr;
|
||||||
u_int16_t port;
|
u_int16_t port;
|
||||||
} divert;
|
} divert;
|
||||||
|
|
||||||
uint64_t u_states_cur;
|
|
||||||
uint64_t u_states_tot;
|
|
||||||
uint64_t u_src_nodes;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
TAILQ_HEAD(pfctl_rulequeue, pfctl_rule);
|
TAILQ_HEAD(pfctl_rulequeue, pfctl_rule);
|
||||||
|
@ -891,12 +891,12 @@ pfctl_print_rule_counters(struct pfctl_rule *rule, int opts)
|
|||||||
(unsigned long long)(rule->packets[0] +
|
(unsigned long long)(rule->packets[0] +
|
||||||
rule->packets[1]),
|
rule->packets[1]),
|
||||||
(unsigned long long)(rule->bytes[0] +
|
(unsigned long long)(rule->bytes[0] +
|
||||||
rule->bytes[1]), (uintmax_t)rule->u_states_cur);
|
rule->bytes[1]), (uintmax_t)rule->states_cur);
|
||||||
if (!(opts & PF_OPT_DEBUG))
|
if (!(opts & PF_OPT_DEBUG))
|
||||||
printf(" [ Inserted: uid %u pid %u "
|
printf(" [ Inserted: uid %u pid %u "
|
||||||
"State Creations: %-6ju]\n",
|
"State Creations: %-6ju]\n",
|
||||||
(unsigned)rule->cuid, (unsigned)rule->cpid,
|
(unsigned)rule->cuid, (unsigned)rule->cpid,
|
||||||
(uintmax_t)rule->u_states_tot);
|
(uintmax_t)rule->states_tot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1012,7 +1012,7 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format,
|
|||||||
(unsigned long long)rule.bytes[0],
|
(unsigned long long)rule.bytes[0],
|
||||||
(unsigned long long)rule.packets[1],
|
(unsigned long long)rule.packets[1],
|
||||||
(unsigned long long)rule.bytes[1],
|
(unsigned long long)rule.bytes[1],
|
||||||
(uintmax_t)rule.u_states_tot);
|
(uintmax_t)rule.states_tot);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PFCTL_SHOW_RULES:
|
case PFCTL_SHOW_RULES:
|
||||||
|
Loading…
Reference in New Issue
Block a user