svn commit: r281164 - head/sys/netpfil/pf

Richard Tector richardtector at thekeelecentre.com
Mon Apr 6 20:58:18 UTC 2015


On 06/04/2015 20:05, Kristof Provost wrote:
> Author: kp
> Date: Mon Apr  6 19:05:00 2015
> New Revision: 281164
> URL: https://svnweb.freebsd.org/changeset/base/281164
>
> Log:
>    pf: Skip firewall for refragmented ip6 packets
>
>    In cases where we scrub (fragment reassemble) on both input and output
>    we risk ending up in infinite loops when forwarding packets.
>
>    Fragmented packets come in and get collected until we can defragment. At
>    that point the defragmented packet is handed back to the ip stack (at
>    the pfil point in ip6_input(). Normal processing continues.
>
>    Eventually we figure out that the packet has to be forwarded and we end
>    up at the pfil hook in ip6_forward(). After doing the inspection on the
>    defragmented packet we see that the packet has been defragmented and
>    because we're forwarding we have to refragment it.
>
>    In pf_refragment6() we split the packet up again and then ip6_forward()
>    the individual fragments.  Those fragments hit the pfil hook on the way
>    out, so they're collected until we can reconstruct the full packet, at
>    which point we're right back where we left off and things continue until
>    we run out of stack.
>
>    Break that loop by marking the fragments generated by pf_refragment6()
>    as M_SKIP_FIREWALL. There's no point in processing those packets in the
>    firewall anyway. We've already filtered on the full packet.
>

Kristof,

Firstly, many thanks for working on this.

I was just wondering how this affects the case where we might have 
if-bound rules?

Really basic example:

   pass quick on $outside_if inet6 proto udp from any to $myhost
   block drop quick on $inside_if inet6 proto udp from any to $myhost 
port $secret_svc
   pass quick on $inside_if inet6 proto udp from any to $myhost

If the fragments generated after processing occurs on the inbound 
interface are then marked to be skipped then will they therefore not be 
matched by the drop rule in the example above?

Regards,

Richard


More information about the svn-src-head mailing list