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:
+1
-1
@@ -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
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user