On Sun, Jun 11, 2017 at 8:58 PM, Jamal Hadi Salim <j...@mojatatu.com> wrote: >> Maybe this should both be "inet_request_mark()"? >> > > Challenge is making of a synack requires a new allocated skb; > and sk is a listening socket - which should/has a mark of > 0 meaning at ip_build_and_send_pkt() it overrides > the value already set on the skb->mark.
As David says, the tcp_fwmark_accept sysctl is not really appropriate for synack packets - what it does is ensure that when a connection is accepted, sk->sk_mark is set to the mark of the incoming skb. I think the correct behaviour here is to to honour the ip_fwmark_reflect sysctl instead, and if it's enabled, make the synack mark be the same as the the incoming syn mark.