From: David Miller <davem@davemloft.net>
To: fruggeri@aristanetworks.com
Cc: fruggeri@arista.com, netdev@vger.kernel.org, duanj.fnst@cn.fujitsu.com
Subject: Re: Regression from "ipv4: Cache ip_error() routes even when not forwarding."
Date: Fri, 16 Jan 2015 19:59:28 -0500 (EST) [thread overview]
Message-ID: <20150116.195928.509872837968316789.davem@davemloft.net> (raw)
In-Reply-To: <20150117000755.CC87348A0C5@fruggeri-Arora18.sjc.aristanetworks.com>
From: fruggeri@aristanetworks.com (Francesco Ruggeri)
Date: Fri, 16 Jan 2015 16:07:55 -0800
>
> Commit 251da413("ipv4: Cache ip_error() routes even when not forwarding."),
> later slightly modified by cd0f0b95("ipv4: distinguish EHOSTUNREACH from
> the ENETUNREACH"), introduced a regression where an ip_error route is cached
> when an ARP request is received on a non-forwarding non matching interface,
> and it affects later legitimate packets for the same destination even if
> coming over different interfaces.
Always CC: the authors of the changes you feel are responsible for
a problem. Adding, Duan Jiong.
> Attached are two scripts that show the problem. The first one does basic
> forwarding, and the second one does proxy arp.
> In both cases a dummy interface is created for the sole purpose of receiving
> an ARP request that results in the ip_error route to be cached. The offending
> ARP request is generated by using a 'ping -c 1' (commented out in the scripts).
> Verified in 3.16 build.
>
> Francesco Ruggeri
>
> #########################################################
> # Basic routing 1.1.1.2@host1 -> 2.2.2.2@host2 via router
>
> ip netns add dummy
> ip netns exec dummy bash
>
> ip netns add host1
> ip netns add host2
> ip netns add router
> ip link add eth0 type veth peer name rtr-eth0 netns router
> ip link add eth1 type veth peer name rtr-eth1 netns router
> ip link set eth1 netns host1
> ip link add eth2 type veth peer name rtr-eth2 netns router
> ip link set eth2 netns host2
>
> ip netns exec host1 bash
> ip link set up lo
> ip link set up eth1 ; ip addr add 1.1.1.2/24 dev eth1
> ip route add default via 1.1.1.1
> exit
>
> ip netns exec host2 bash
> ip link set up lo
> ip link set up eth2 ; ip addr add 2.2.2.2/24 dev eth2
> ip route add default via 2.2.2.1
> exit
>
> ip netns exec router bash
> ip link set up lo
> ip link set up rtr-eth0 ; ip addr add 1.2.3.4/24 dev rtr-eth0
> ip link set up rtr-eth1 ; ip addr add 1.1.1.1/24 dev rtr-eth1
> ip link set up rtr-eth2 ; ip addr add 2.2.2.1/24 dev rtr-eth2
> echo 0 > /proc/sys/net/ipv4/conf/rtr-eth0/forwarding
> echo 1 > /proc/sys/net/ipv4/conf/rtr-eth1/forwarding
> echo 1 > /proc/sys/net/ipv4/conf/rtr-eth2/forwarding
> exit
>
> ip link set up lo
> ip link set up eth0 ; ip addr add 2.2.2.1/24 dev eth0
> # Uncommenting line below makes following ping return Host Unreachable
> #ping -c 1 2.2.2.2
> ip netns exec host1 ping -c 3 2.2.2.2
>
> ip netns del host1
> ip netns del host2
> ip netns del router
> exit
> ip netns del dummy
>
> ######################################################
> # Proxy ARP
>
> ip netns add router
> ip netns exec router bash
>
> ip netns add host1
> ip link add rtr-h1 type veth peer name host1-e0 netns host1
> ip link set up rtr-h1
> ip netns exec host1 bash
> ip link set up lo
> ip link set up host1-e0
> ip addr add 10.10.1.2/16 dev host1-e0
> exit
> echo 1 > /proc/sys/net/ipv4/conf/rtr-h1/forwarding
> echo 1 > /proc/sys/net/ipv4/conf/rtr-h1/proxy_arp
> ip addr add 10.10.1.1/24 dev rtr-h1
>
> ip netns add host2
> ip link add rtr-h2 type veth peer name host2-e0 netns host2
> ip link set up rtr-h2
> ip netns exec host2 bash
> ip link set up lo
> ip link set up host2-e0
> ip addr add 10.10.2.2/16 dev host2-e0
> exit
> echo 1 > /proc/sys/net/ipv4/conf/rtr-h2/proxy_arp
> echo 1 > /proc/sys/net/ipv4/conf/rtr-h2/forwarding
> ip addr add 10.10.2.1/24 dev rtr-h2
>
> ip netns add host3
> ip link add rtr-h3 type veth peer name host3-e0 netns host3
> ip link set up rtr-h3
> ip netns exec host3 bash
> ip link set up lo
> ip link set up host3-e0
> ip addr add 10.10.1.2/16 dev host3-e0
> exit
> echo 8 > /proc/sys/net/ipv4/conf/rtr-h3/arp_ignore
> echo 0 > /proc/sys/net/ipv4/conf/rtr-h3/forwarding
> ip addr add 1.2.3.4/24 dev rtr-h3
>
> # Uncommenting line below makes following ping fail
> #ip netns exec host3 ping -c 1 10.10.2.2
> ip netns exec host1 ping -c 3 10.10.2.2
>
> ip netns del host1
> ip netns del host2
> ip netns del host3
> exit
> ip netns del router
>
next prev parent reply other threads:[~2015-01-17 0:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-17 0:07 Regression from "ipv4: Cache ip_error() routes even when not forwarding." Francesco Ruggeri
2015-01-17 0:59 ` David Miller [this message]
2015-01-17 8:25 ` Julian Anastasov
2015-01-17 16:30 ` Francesco Ruggeri
2015-01-19 6:08 ` Francesco Ruggeri
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=20150116.195928.509872837968316789.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=duanj.fnst@cn.fujitsu.com \
--cc=fruggeri@arista.com \
--cc=fruggeri@aristanetworks.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox