Skip to contentSkip to conversation

net/ipv6/route.c: packets originating on device match lo

PATCH Applied David McCullough 2 participants 2 messages Jun 26, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net/ipv6/route.c: packets originating on device match lo

Hi all,

Fix to allow IPv6 packets originating locally to match rules with the "iff" set to "lo". This allows IPv6 rule matching work the same as it does for IPv4. From the iproute2 man page:

iif NAME
select the incoming device to match. If the interface is loop‐ back, the rule only matches packets originating from this host. This means that you may create separate routing tables for for‐ warded and local packets and, hence, completely segregate them.

Cheers,
Davidm

net/ipv6/route.c +2 -0
diff -u -p -r1.1.1.59 route.c
@@ -931,6 +931,8 @@ struct dst_entry * ip6_route_output(stru
 {
 	int flags = 0;
 
+	fl6->flowi6_iif = net->loopback_dev->ifindex;
+
 	if ((sk && sk->sk_bound_dev_if) || rt6_need_strict(&fl6->daddr))
 		flags |= RT6_LOOKUP_F_IFACE;
 
Signature · 2 lines
David McCullough,      [email protected],  Ph:+61 734352815
McAfee - SnapGear      http://www.mcafee.com         http://www.uCdot.org
maintainer Applied
#1 lore raw

From: David McCullough <[email protected]>
Date: Tue, 26 Jun 2012 11:42:26 +1000

Quoted 11 lines

Fix to allow IPv6 packets originating locally to match rules with the "iff" set to "lo". This allows IPv6 rule matching work the same as it does for IPv4. From the iproute2 man page:

iif NAME
select the incoming device to match. If the interface is loop‐ back, the rule only matches packets originating from this host. This means that you may create separate routing tables for for‐ warded and local packets and, hence, completely segregate them.

Applied to net-next.