All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Frank Wunderlich <frank-w@public-files.de>
Cc: netfilter@vger.kernel.org
Subject: Re: Re: Re: Re: Re: Flowtable with ppp/bridge
Date: Thu, 6 May 2021 00:55:16 +0200	[thread overview]
Message-ID: <20210505225516.GB13833@salvia> (raw)
In-Reply-To: <trinity-95c69486-d51d-4c21-8923-e845e0c04269-1620204924394@3c-app-gmx-bs20>

On Wed, May 05, 2021 at 10:55:24AM +0200, Frank Wunderlich wrote:
> Hi,
> > Gesendet: Dienstag, 04. Mai 2021 um 13:42 Uhr
> > Von: "Pablo Neira Ayuso" <pablo@netfilter.org>
>
> > You also need TCP clamp MTU in a non-flowtable setup.
> hi,
> thats clear now, but i guess i had not much problems till now because of Path discovery
>
> > > $ifwan is my ppp8, and "tcp flags syn" imho should match syn and syn+ack.
> >
> > syn+ack matches iifname $ifwan.
>
> imho this depends on the initiator of the connection. if i try to
> establish connection from my lan, this is true, and mss is set by
> oifname ppp0. Afair SYN-ACK from "Server" does use my size for
> syn-ack (if it is smaller that its size), or am i wrong?

rfc6691 says that TCP MSS is:

   The maximum number of data octets that may be received by the
   sender of this TCP option in TCP segments with no TCP header
   options transmitted in IP datagrams with no IP header option

> if i initiate a connection from the public internet, i need to match
> iifname ppp0, but only if my ISP does not modify mss on pushing the
> initial SYN-Packet through the ppp-tunnel. But afair in this case i
> modify mss with oifname, but on response (SYN-ACK) i send back to
> the initiator.
>
> > Only the two initial syn and syn+ack packets follow the classic
> > forwarding path. Therefore, the FORWARD chain in your example above is
> > evaluated only for the two initial packets of the TCP connection.
> >
> > You should add the 'flow add' rule at the bottom of your ruleset in
> > your example above.
>
> good to know, so flowtable does always "accept" matching packets
> (here all udp/tcp), right?

Yes, the flowtable lookup comes from the ingress hook that comes much
sooner than the forward chain.

> and final foward-policy does neyer hit if flowtable condition
> matches.

The forward policy is skipped once the flowtable lookup finds a
matching entry.

By "flowtable condition" I'm not sure if you're refering to the "flow
add" statement through.

So based on your original simple example (untested) ruleset that
I'd suggest:

table x {
   flowtable x {
        hook ingress priority 0
        devices = { eth0, eth1, eth2 }
   }

   chain FORWARD_established {
        ip protocol { tcp, udp } flow add @x
        accept
   }

   chain REJECTED {
        # your rules to reject traffic here
   }

   chain FORWARD_new {
        oifname $ifexternal ip saddr $iprangesblocked jump REJECTED comment "block internal ip ranges to have only internal access"
        udp dport {41,43,44,58,59,60} jump REJECTED comment "block ipv6 in ipv4 tunnel"
   }

   chain FORWARD {
        type filter hook forward priority 0; policy drop;

        tcp flags syn tcp option maxseg size set rt mtu
        ct state vmap { established : jump FORWARD_established, related : jump FORWARD_established, new : jump FORWARD_new }
   }
}

  reply	other threads:[~2021-05-05 22:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-26 15:30 Flowtable with ppp/bridge Frank Wunderlich
2021-04-26 17:29 ` Pablo Neira Ayuso
2021-04-26 17:51   ` Frank Wunderlich
2021-04-26 17:57     ` Pablo Neira Ayuso
2021-04-26 18:08       ` Frank Wunderlich
2021-04-27 23:49         ` Pablo Neira Ayuso
2021-04-28  8:07           ` Frank Wunderlich
2021-04-28 17:26             ` Frank Wunderlich
2021-04-29 13:59               ` Aw: " Frank Wunderlich
2021-05-02 13:51                 ` Frank Wunderlich
2021-05-02 22:11                   ` Pablo Neira Ayuso
2021-05-03 18:56                     ` Aw: " Frank Wunderlich
2021-05-03 21:32                       ` Pablo Neira Ayuso
2021-05-04 10:54                         ` Aw: " Frank Wunderlich
2021-05-04 11:42                           ` Pablo Neira Ayuso
2021-05-05  8:55                             ` Aw: " Frank Wunderlich
2021-05-05 22:55                               ` Pablo Neira Ayuso [this message]
2021-05-06  9:53                                 ` Aw: " Frank Wunderlich
2021-05-06 15:51                                   ` Pablo Neira Ayuso
2021-05-10  6:50                                     ` Aw: " Frank Wunderlich
2021-05-10  8:24                                       ` Pablo Neira Ayuso
2021-05-10  9:00                                         ` Aw: " Frank Wunderlich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210505225516.GB13833@salvia \
    --to=pablo@netfilter.org \
    --cc=frank-w@public-files.de \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.