aboutsummaryrefslogtreecommitdiff
path: root/sys/netpfil
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2019-07-29 13:21:31 +0000
committerKristof Provost <kp@FreeBSD.org>2019-07-29 13:21:31 +0000
commitf287767d4fdb246b3aa2b09049fe5b438cc0dd3c (patch)
tree5b292c3949dae17b9958764ac76af1f07ca27896 /sys/netpfil
parentd4e6a529595dc4ace5be06a3fe9db4e05ebfd4eb (diff)
downloadsrc-f287767d4fdb246b3aa2b09049fe5b438cc0dd3c.tar.gz
src-f287767d4fdb246b3aa2b09049fe5b438cc0dd3c.zip
pf: Remove partial RFC2675 support
Remove our (very partial) support for RFC2675 Jumbograms. They're not used, not actually supported and not a good idea. Reviewed by: thj@ Differential Revision: https://reviews.freebsd.org/D21086
Notes
Notes: svn path=/head/; revision=350414
Diffstat (limited to 'sys/netpfil')
-rw-r--r--sys/netpfil/pf/pf.c4
-rw-r--r--sys/netpfil/pf/pf_norm.c41
2 files changed, 9 insertions, 36 deletions
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index a3a1e512d8cd..0754d50da935 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -6351,9 +6351,8 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb
m = *m0; /* pf_normalize messes with m0 */
h = mtod(m, struct ip6_hdr *);
-#if 1
/*
- * we do not support jumbogram yet. if we keep going, zero ip6_plen
+ * we do not support jumbogram. if we keep going, zero ip6_plen
* will do something bad, so drop the packet for now.
*/
if (htons(h->ip6_plen) == 0) {
@@ -6361,7 +6360,6 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb
REASON_SET(&reason, PFRES_NORM); /*XXX*/
goto done;
}
-#endif
pd.src = (struct pf_addr *)&h->ip6_src;
pd.dst = (struct pf_addr *)&h->ip6_dst;
diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c
index 82ff5063fd8b..6c3a33212bef 100644
--- a/sys/netpfil/pf/pf_norm.c
+++ b/sys/netpfil/pf/pf_norm.c
@@ -1139,9 +1139,8 @@ pf_normalize_ip6(struct mbuf **m0, int dir, struct pfi_kif *kif,
int off;
struct ip6_ext ext;
struct ip6_opt opt;
- struct ip6_opt_jumbo jumbo;
struct ip6_frag frag;
- u_int32_t jumbolen = 0, plen;
+ u_int32_t plen;
int optend;
int ooff;
u_int8_t proto;
@@ -1185,6 +1184,11 @@ pf_normalize_ip6(struct mbuf **m0, int dir, struct pfi_kif *kif,
if (sizeof(struct ip6_hdr) + IPV6_MAXPACKET < m->m_pkthdr.len)
goto drop;
+ plen = ntohs(h->ip6_plen);
+ /* jumbo payload option not supported */
+ if (plen == 0)
+ goto drop;
+
extoff = 0;
off = sizeof(struct ip6_hdr);
proto = h->ip6_nxt;
@@ -1228,26 +1232,8 @@ pf_normalize_ip6(struct mbuf **m0, int dir, struct pfi_kif *kif,
goto shortpkt;
if (ooff + sizeof(opt) + opt.ip6o_len > optend)
goto drop;
- switch (opt.ip6o_type) {
- case IP6OPT_JUMBO:
- if (h->ip6_plen != 0)
- goto drop;
- if (!pf_pull_hdr(m, ooff, &jumbo,
- sizeof(jumbo), NULL, NULL,
- AF_INET6))
- goto shortpkt;
- memcpy(&jumbolen, jumbo.ip6oj_jumbo_len,
- sizeof(jumbolen));
- jumbolen = ntohl(jumbolen);
- if (jumbolen <= IPV6_MAXPACKET)
- goto drop;
- if (sizeof(struct ip6_hdr) + jumbolen !=
- m->m_pkthdr.len)
- goto drop;
- break;
- default:
- break;
- }
+ if (opt.ip6o_type == IP6OPT_JUMBO)
+ goto drop;
ooff += sizeof(opt) + opt.ip6o_len;
} while (ooff < optend);
@@ -1260,13 +1246,6 @@ pf_normalize_ip6(struct mbuf **m0, int dir, struct pfi_kif *kif,
}
} while (!terminal);
- /* jumbo payload option must be present, or plen > 0 */
- if (ntohs(h->ip6_plen) == 0)
- plen = jumbolen;
- else
- plen = ntohs(h->ip6_plen);
- if (plen == 0)
- goto drop;
if (sizeof(struct ip6_hdr) + plen > m->m_pkthdr.len)
goto shortpkt;
@@ -1275,10 +1254,6 @@ pf_normalize_ip6(struct mbuf **m0, int dir, struct pfi_kif *kif,
return (PF_PASS);
fragment:
- /* Jumbo payload packets cannot be fragmented. */
- plen = ntohs(h->ip6_plen);
- if (plen == 0 || jumbolen)
- goto drop;
if (sizeof(struct ip6_hdr) + plen > m->m_pkthdr.len)
goto shortpkt;