All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Soltys <msoltyspl@yandex.pl>
To: Linux Netdev List <netdev@vger.kernel.org>,
	David Miller <davem@davemloft.net>
Subject: Re: [BUG / question] in routing rules, some options (e.g. ipproto, sport) cause rules to be ignored in presence of packet marks
Date: Mon, 29 Mar 2021 17:42:25 +0200	[thread overview]
Message-ID: <6b707dde-c6f0-ca3e-e817-a09c1e6b3f00@yandex.pl> (raw)
In-Reply-To: <babb2ebf-862a-d05f-305a-e894e88f601e@yandex.pl>

[-- Attachment #1: Type: text/plain, Size: 1081 bytes --]

On 3/28/21 4:05 PM, Michal Soltys wrote:
> Hi,
> 
> iptables -t mangle -A OUTPUT -j MARK --set-mark 1

After some extra checks, the exact same issue happens if we mangle tos 
instead of mark, so ...

iptables -t mangle -A OUTPUT -j TOS --set-tos 0x02

... will cause same routing issues with incorrect output interface being 
set.

Anyway, I've attached 2 scripts setting up namespace with all those cases.

- run setup-host.sh
- then in the namespace: run setup-namespace.sh
- fire up another bash in ns with tcpdump on right1

nc -u -p 1194 1.2.3.4 12345

This will work fine, as the packet will be routed correctly via right2, 
tcpdump will show nothing

Now add in the namespace:

iptables -t mangle -A OUTPUT -j MARK --set-mark 1

or

iptables -t mangle -A OUTPUT -j TOS --set-tos 0x02

Same nc as above - now the packet will go out via right1, using right2's 
address (initial routing decision).


Unrelated issue - while doing the tests I noticed that routing rules 
based on tos have no effect at all for locally generated packets. Will 
make another post about it though.

[-- Attachment #2: setup-namespace.sh --]
[-- Type: application/x-shellscript, Size: 586 bytes --]

[-- Attachment #3: setup-host.sh --]
[-- Type: application/x-shellscript, Size: 260 bytes --]

  reply	other threads:[~2021-03-29 15:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-28 14:05 [BUG / question] in routing rules, some options (e.g. ipproto, sport) cause rules to be ignored in presence of packet marks Michal Soltys
2021-03-29 15:42 ` Michal Soltys [this message]
2021-03-29 20:52 ` Ido Schimmel
2021-03-29 21:18   ` Ido Schimmel
2021-03-30 11:46   ` Michal Soltys
2021-04-09 12:11   ` Michal Soltys
2021-04-09 13:02     ` Florian Westphal
2021-04-09 13:20       ` Ido Schimmel

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=6b707dde-c6f0-ca3e-e817-a09c1e6b3f00@yandex.pl \
    --to=msoltyspl@yandex.pl \
    --cc=davem@davemloft.net \
    --cc=netdev@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.