From: Patrick McHardy <kaber@trash.net>
To: netdev@vger.kernel.org
Cc: Patrick McHardy <kaber@trash.net>
Subject: RFC: net 00/05: routing based send-to-self implementation
Date: Mon, 30 Nov 2009 18:55:30 +0100 (MET) [thread overview]
Message-ID: <20091130175529.7555.10132.sendpatchset@x2.localnet> (raw)
These patches are yet another attempt at adding "send-to-self" functionality,
allowing to send packets between two local interfaces over the wire. Unlike
the approaches I've seen so far, this one is purely routing based.
Especially the oif classification should also be useful for different setups.
The patchset consists of three parts:
- the first three patches add oif classification to fib_rules. This can be
used create special routing tables for sockets bound to an interface.
- the fourth patch changes IPv4 and IPv6 to allow to delete the local rule
with priority 0. This allows to re-create it using a lower priority and
insert new rules below it to force packets with a local destination out
on the wire.
- the fifth patch adds a devinet sysctl to accept packets with local source
addresses in fib_validate_source(). This one unfortunately seems to be
necessary, I couldn't come up with a method based purely on adding more
routes to fool fib_validate_source() into accepting those packets.
Usage example:
# move local routing rule to lower priority
ip rule add pref 1000 lookup local
ip rule del pref 0
# only reply to ARP requests for addresses configured on the device
echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
# configure device and force packets of bound sockets out on eth1
ip address add dev eth1 10.0.0.1/24
echo 1 > /proc/sys/net/ipv4/conf/eth1/accept_local
ip link set eth1 up
ip rule add pref 500 oif eth1 lookup 500
ip route add default dev eth1 table 500
# configure device and force packets of bound sockets out on eth2
ip address add dev eth2 10.0.0.2/24
echo 1 > /proc/sys/net/ipv4/conf/eth2/accept_local
ip link set eth2 up
ip rule add pref 501 oif eth2 lookup 501
ip route add default dev eth2 table 501
At this point both packets between sockets bound to eth1/eth2 will
go over the wire.
Comments welcome.
Documentation/networking/ip-sysctl.txt | 6 +++
include/linux/fib_rules.h | 8 +++-
include/linux/inetdevice.h | 1 +
include/linux/sysctl.h | 1 +
include/net/fib_rules.h | 9 +++-
kernel/sysctl_check.c | 1 +
net/core/fib_rules.c | 71 +++++++++++++++++++++++---------
net/ipv4/devinet.c | 1 +
net/ipv4/fib_frontend.c | 11 +++--
net/ipv4/fib_rules.c | 2 +-
net/ipv6/fib6_rules.c | 2 +-
11 files changed, 82 insertions(+), 31 deletions(-)
Patrick McHardy (5):
net: fib_rules: rearrange struct fib_rule
net: fib_rules: rename ifindex/ifname/FRA_IFNAME to iifindex/iifname/FRA_IIFNAME
net: fib_rules: add oif classification
net: fib_rules: allow to delete local rule
ipv4: add sysctl to accept packets with local source addresses
next reply other threads:[~2009-11-30 17:55 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-30 17:55 Patrick McHardy [this message]
2009-11-30 17:55 ` net 01/05: fib_rules: rearrange struct fib_rule Patrick McHardy
2009-11-30 17:55 ` net 02/05: fib_rules: rename ifindex/ifname/FRA_IFNAME to iifindex/iifname/FRA_IIFNAME Patrick McHardy
2009-11-30 20:21 ` Jarek Poplawski
2009-11-30 20:23 ` Patrick McHardy
2009-11-30 17:55 ` net 03/05: fib_rules: add oif classification Patrick McHardy
2009-11-30 22:31 ` Jarek Poplawski
2009-12-01 9:32 ` Patrick McHardy
2009-12-01 9:48 ` Jarek Poplawski
2009-11-30 17:55 ` net 04/05: fib_rules: allow to delete local rule Patrick McHardy
2009-12-01 13:23 ` jamal
2009-12-01 17:12 ` Alexey Kuznetsov
2009-12-01 17:38 ` Patrick McHardy
2009-11-30 17:55 ` ipv4 05/05: add sysctl to accept packets with local source addresses Patrick McHardy
2009-11-30 19:32 ` RFC: net 00/05: routing based send-to-self implementation Eric W. Biederman
2009-11-30 19:37 ` Ben Greear
2009-11-30 20:04 ` Benjamin LaHaise
2009-11-30 20:15 ` Patrick McHardy
2009-11-30 20:15 ` Ben Greear
2009-11-30 20:23 ` Benjamin LaHaise
2009-12-03 6:32 ` David Miller
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=20091130175529.7555.10132.sendpatchset@x2.localnet \
--to=kaber@trash.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).