-.\" $OpenBSD: pf.conf.5,v 1.563 2017/05/22 19:15:29 jmc Exp $
+.\" $OpenBSD: pf.conf.5,v 1.564 2017/05/31 09:19:10 bluhm Exp $
.\"
.\" Copyright (c) 2002, Daniel Hartmeier
.\" Copyright (c) 2003 - 2013 Henning Brauer <henning@openbsd.org>
.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: May 22 2017 $
+.Dd $Mdocdate: May 31 2017 $
.Dt PF.CONF 5
.Os
.Sh NAME
.Ql from any to any .
.Pp
.It Cm allow-opts
-By default, IPv4 packets with IP options or IPv6 packets with routing
-extension headers are blocked.
+By default, packets with IPv4 options or IPv6 hop-by-hop or destination
+options header are blocked.
When
.Cm allow-opts
is specified for a
.Ic pass
rule, packets that pass the filter based on that rule (last matching)
-do so even if they contain IP options or routing extension headers.
+do so even if they contain options.
For packets that match state, the rule that initially created the
state is used.
-The implicit pass rule that is used when a packet does not match
-any rules does not allow IP options.
+The implicit pass rule, that is used when a packet does not match
+any rules, does not allow IP options or option headers.
+Note that IPv6 packets with type 0 routing headers are always dropped.
.Pp
.It Cm divert-packet port Ar port
Used to send matching packets to
-/* $OpenBSD: pf.c,v 1.1032 2017/05/30 08:10:01 henning Exp $ */
+/* $OpenBSD: pf.c,v 1.1033 2017/05/31 09:19:10 bluhm Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
REASON_SET(reason, PFRES_SHORT);
return (PF_DROP);
}
+ if (hlen != sizeof(struct ip))
+ pd->badopts++;
end = pd->off + ntohs(h->ip_len);
pd->off += hlen;
pd->proto = h->ip_p;
pd->proto = h->ip6_nxt;
for (hdr_cnt = 0; hdr_cnt < pf_hdr_limit; hdr_cnt++) {
+ switch (pd->proto) {
+ case IPPROTO_HOPOPTS:
+ case IPPROTO_DSTOPTS:
+ pd->badopts++;
+ }
switch (pd->proto) {
case IPPROTO_FRAGMENT:
if (fraghdr_cnt++) {
pd->tot_len = ntohs(h->ip_len);
pd->tos = h->ip_tos & ~IPTOS_ECN_MASK;
pd->ttl = h->ip_ttl;
- if (h->ip_hl > 5) /* has options */
- pd->badopts++;
pd->virtual_proto = (h->ip_off & htons(IP_MF | IP_OFFMASK)) ?
PF_VPROTO_FRAGMENT : pd->proto;