Netdev List
 help / color / mirror / Atom feed
From: Noel Kuntze <noel.kuntze@thermi.consulting>
To: netdev@vger.kernel.org, steffen.klassert@secunet.com,
	davem@davemloft.net
Subject: XFRM with bridged packets problem
Date: Wed, 29 Jan 2020 10:39:32 +0100	[thread overview]
Message-ID: <f595200d-46e5-b28c-fd3b-331ddad11347@thermi.consulting> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1310 bytes --]

Hello List, Steffen, Dave,

I have found a bug in XFRM/The IPv4 network stack.
Reproduced on 4.19.99 lts and 5.4.15.

Following my notes to the problem:

XFRM docker issue
================

Topology:
docker container with veth pair attached to docker0.
docker0 address 172.17.0.1, container address 172.17.0.2
IPsec policy based tunnel from 172.16.20.2/32 to 0.0.0.0/0
Passthrough policies for multicast, 172.17.0.0/16 to 172.17.0.0/16,
no matching policy for 172.17.0.2 == 0.0.0.0/0
Packets are sent through tunnel regardless
Packets with wrong source IP can be observed on other IPsec peer, traffic counters of incoming SA increases; One endpoint is on the internet, no shared link.

Naturally, the packets are dropped when they're received by the other peer because the policy doesn't match the negotiated policies don't match the packets.

After adding an SNAT rule on the docker host to change the packets' source address to 172.16.20.2, they match the policies on the server and make it onwards. Before then "XfrmInNoPols" in /proc/self/net/xfrm_stat is increased for every packet.

Please let me know what you think.

Kind regards

Noel

-- 
Noel Kuntze
IT security consultant

GPG Key ID: 0x0739AD6C
Fingerprint: 3524 93BE B5F7 8E63 1372 AF2D F54E E40B 0739 AD6C



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

                 reply	other threads:[~2020-01-29  9:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=f595200d-46e5-b28c-fd3b-331ddad11347@thermi.consulting \
    --to=noel.kuntze@thermi.consulting \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=steffen.klassert@secunet.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox