pf: rename the pf_pdesc field rh_cnt to badopts

It is also used for IPv4 options now.
ok mcbride@ henning@

Reviewed by:	zlei
Obtained from:	OpenBSD, bluhm <bluhm@openbsd.org>, 4fe6abd45f
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D46650
This commit is contained in:
Kristof Provost
2024-09-11 14:46:51 +02:00
parent 27f54be50b
commit 39f615e90c
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -1611,7 +1611,7 @@ struct pf_pdesc {
struct pf_rule_actions act;
u_int32_t p_len; /* total length of payload */
u_int32_t rh_cnt; /* Route header count */
u_int32_t badopts; /* v4 options or v6 routing headers */
u_int16_t *ip_sum;
u_int16_t *proto_sum;
+3 -3
View File
@@ -8600,7 +8600,7 @@ pf_setup_pdesc(sa_family_t af, int dir, struct pf_pdesc *pd, struct mbuf *m,
pd->act.rtableid = -1;
if (h->ip_hl > 5) /* has options */
pd->rh_cnt++;
pd->badopts++;
/* fragments not reassembled handled later */
if (h->ip_off & htons(IP_MF | IP_OFFMASK))
@@ -8643,7 +8643,7 @@ pf_setup_pdesc(sa_family_t af, int dir, struct pf_pdesc *pd, struct mbuf *m,
case IPPROTO_ROUTING: {
struct ip6_rthdr rthdr;
if (pd->rh_cnt++) {
if (pd->badopts++) {
DPFPRINTF(PF_DEBUG_MISC,
("pf: IPv6 more than one rthdr"));
*action = PF_DROP;
@@ -9236,7 +9236,7 @@ pf_test(sa_family_t af, int dir, int pflags, struct ifnet *ifp, struct mbuf **m0
done:
PF_RULES_RUNLOCK();
if (action == PF_PASS && pd.rh_cnt &&
if (action == PF_PASS && pd.badopts &&
!((s && s->state_flags & PFSTATE_ALLOWOPTS) || r->allow_opts)) {
action = PF_DROP;
REASON_SET(&reason, PFRES_IPOPTIONS);