* [PATCH 14/16] ipv4: Kill rt->rt_oif
@ 2012-07-19 21:36 David Miller
2012-07-20 1:10 ` Julian Anastasov
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2012-07-19 21:36 UTC (permalink / raw)
To: netdev
Never actually used.
It was being set on output routes to the original OIF specified in the
flow key used for the lookup.
But the only user was in ipmr_rt_fib_lookup() which always runs on an
input route.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/route.h | 1 -
net/ipv4/ipmr.c | 1 -
net/ipv4/route.c | 5 -----
net/ipv4/xfrm4_policy.c | 1 -
4 files changed, 8 deletions(-)
diff --git a/include/net/route.h b/include/net/route.h
index 3c1eeab..e789a92 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -50,7 +50,6 @@ struct rtable {
int rt_route_iif;
int rt_iif;
- int rt_oif;
/* Info on neighbour */
__be32 rt_gateway;
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index eee3bf6..fa75f73 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1795,7 +1795,6 @@ static struct mr_table *ipmr_rt_fib_lookup(struct net *net, struct sk_buff *skb)
.daddr = iph->daddr,
.saddr = iph->saddr,
.flowi4_tos = RT_TOS(iph->tos),
- .flowi4_oif = rt->rt_oif,
.flowi4_iif = rt->rt_iif,
.flowi4_mark = skb->mark,
};
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 1d4e317..b7e99a6 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1326,7 +1326,6 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
rth->rt_type = RTN_MULTICAST;
rth->rt_route_iif = dev->ifindex;
rth->rt_iif = dev->ifindex;
- rth->rt_oif = 0;
rth->rt_pmtu = 0;
rth->rt_gateway = 0;
rth->fi = NULL;
@@ -1457,7 +1456,6 @@ static int __mkroute_input(struct sk_buff *skb,
rth->rt_type = res->type;
rth->rt_route_iif = in_dev->dev->ifindex;
rth->rt_iif = in_dev->dev->ifindex;
- rth->rt_oif = 0;
rth->rt_pmtu = 0;
rth->rt_gateway = 0;
rth->fi = NULL;
@@ -1636,7 +1634,6 @@ local_input:
rth->rt_type = res.type;
rth->rt_route_iif = dev->ifindex;
rth->rt_iif = dev->ifindex;
- rth->rt_oif = 0;
rth->rt_pmtu = 0;
rth->rt_gateway = 0;
rth->fi = NULL;
@@ -1802,7 +1799,6 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
rth->rt_type = type;
rth->rt_route_iif = 0;
rth->rt_iif = orig_oif ? : dev_out->ifindex;
- rth->rt_oif = orig_oif;
rth->rt_pmtu = 0;
rth->rt_gateway = 0;
rth->fi = NULL;
@@ -2079,7 +2075,6 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or
rt->rt_route_iif = ort->rt_route_iif;
rt->rt_iif = ort->rt_iif;
- rt->rt_oif = ort->rt_oif;
rt->rt_pmtu = ort->rt_pmtu;
rt->rt_genid = rt_genid(net);
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index 6074b69..3c99b4c 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -81,7 +81,6 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
xdst->u.rt.rt_route_iif = fl4->flowi4_iif;
xdst->u.rt.rt_iif = fl4->flowi4_iif;
- xdst->u.rt.rt_oif = fl4->flowi4_oif;
xdst->u.dst.dev = dev;
dev_hold(dev);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 14/16] ipv4: Kill rt->rt_oif
2012-07-19 21:36 [PATCH 14/16] ipv4: Kill rt->rt_oif David Miller
@ 2012-07-20 1:10 ` Julian Anastasov
2012-07-20 20:31 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Julian Anastasov @ 2012-07-20 1:10 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Patrick McHardy
Hello,
Added CC to Patrick McHardy as mrule author...
On Thu, 19 Jul 2012, David Miller wrote:
> Never actually used.
>
> It was being set on output routes to the original OIF specified in the
> flow key used for the lookup.
>
> But the only user was in ipmr_rt_fib_lookup() which always runs on an
> input route.
It can also work with output route, it seems
copy of locally originated traffic can be sent to local
mrouter for forwarding to remote recipients. Now we search
this mrouter with rules. We can loopback traffic to
local applications or to local multicast router (even
when no local applications are listening).
> diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
> index eee3bf6..fa75f73 100644
> --- a/net/ipv4/ipmr.c
> +++ b/net/ipv4/ipmr.c
> @@ -1795,7 +1795,6 @@ static struct mr_table *ipmr_rt_fib_lookup(struct net *net, struct sk_buff *skb)
> .daddr = iph->daddr,
> .saddr = iph->saddr,
> .flowi4_tos = RT_TOS(iph->tos),
> - .flowi4_oif = rt->rt_oif,
> .flowi4_iif = rt->rt_iif,
> .flowi4_mark = skb->mark,
But it was wrong at first place to use rt_iif
here. May be we should provide devices to "mrule" just
like we do for "rule", with the only difference that
oif now is possible to match outdev instead of preferred
device, i.e. oif is always set for output routes.
.flowi4_oif = rt_is_output_route(rt) ?
skb->dev->ifindex : 0,
.flowi4_iif = rt_is_output_route(rt) ?
net->loopback_dev->ifindex :
skb->dev->ifindex;
Before now it was risky to use just "mrule iif XXX"
because rt_iif contains the output device for output
routes and we can match output route by mistake.
With above code it is now safe to use just
"iif eth0" for input routes and "iif lo" for output
routes. Here is what will see the mrule now:
local_app -> mrouter: lo->dev
remote_app -> mrouter: dev->0 (only iif match is possible)
Let me know if patch is needed
> @@ -1802,7 +1799,6 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
> rth->rt_type = type;
> rth->rt_route_iif = 0;
> rth->rt_iif = orig_oif ? : dev_out->ifindex;
> - rth->rt_oif = orig_oif;
> rth->rt_pmtu = 0;
> rth->rt_gateway = 0;
> rth->fi = NULL;
Regards
--
Julian Anastasov <ja@ssi.bg>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 14/16] ipv4: Kill rt->rt_oif
2012-07-20 1:10 ` Julian Anastasov
@ 2012-07-20 20:31 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2012-07-20 20:31 UTC (permalink / raw)
To: ja; +Cc: netdev, kaber
From: Julian Anastasov <ja@ssi.bg>
Date: Fri, 20 Jul 2012 04:10:12 +0300 (EEST)
>> @@ -1795,7 +1795,6 @@ static struct mr_table *ipmr_rt_fib_lookup(struct net *net, struct sk_buff *skb)
>> .daddr = iph->daddr,
>> .saddr = iph->saddr,
>> .flowi4_tos = RT_TOS(iph->tos),
>> - .flowi4_oif = rt->rt_oif,
>> .flowi4_iif = rt->rt_iif,
>> .flowi4_mark = skb->mark,
>
> But it was wrong at first place to use rt_iif
> here. May be we should provide devices to "mrule" just
> like we do for "rule", with the only difference that
> oif now is possible to match outdev instead of preferred
> device, i.e. oif is always set for output routes.
>
> .flowi4_oif = rt_is_output_route(rt) ?
> skb->dev->ifindex : 0,
> .flowi4_iif = rt_is_output_route(rt) ?
> net->loopback_dev->ifindex :
> skb->dev->ifindex;
Ok.
> Let me know if patch is needed
I'll take care of it myself today, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 14/16] ipv4: Kill rt->rt_oif
@ 2012-07-20 21:26 David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2012-07-20 21:26 UTC (permalink / raw)
To: netdev
Never actually used.
It was being set on output routes to the original OIF specified in the
flow key used for the lookup.
Adjust the only user, ipmr_rt_fib_lookup(), for greater correctness of
the flowi4_oif and flowi4_iif values, thanks to feedback from Julian
Anastasov.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/route.h | 1 -
net/ipv4/ipmr.c | 7 +++++--
net/ipv4/route.c | 5 -----
net/ipv4/xfrm4_policy.c | 1 -
4 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/include/net/route.h b/include/net/route.h
index 3c1eeab..e789a92 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -50,7 +50,6 @@ struct rtable {
int rt_route_iif;
int rt_iif;
- int rt_oif;
/* Info on neighbour */
__be32 rt_gateway;
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index eee3bf6..8eec8f4 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1795,8 +1795,11 @@ static struct mr_table *ipmr_rt_fib_lookup(struct net *net, struct sk_buff *skb)
.daddr = iph->daddr,
.saddr = iph->saddr,
.flowi4_tos = RT_TOS(iph->tos),
- .flowi4_oif = rt->rt_oif,
- .flowi4_iif = rt->rt_iif,
+ .flowi4_oif = (rt_is_output_route(rt) ?
+ skb->dev->ifindex : 0),
+ .flowi4_iif = (rt_is_output_route(rt) ?
+ net->loopback_dev->ifindex :
+ skb->dev->ifindex),
.flowi4_mark = skb->mark,
};
struct mr_table *mrt;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index b870777..a280b6a 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1332,7 +1332,6 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
rth->rt_type = RTN_MULTICAST;
rth->rt_route_iif = dev->ifindex;
rth->rt_iif = dev->ifindex;
- rth->rt_oif = 0;
rth->rt_pmtu = 0;
rth->rt_gateway = 0;
rth->fi = NULL;
@@ -1463,7 +1462,6 @@ static int __mkroute_input(struct sk_buff *skb,
rth->rt_type = res->type;
rth->rt_route_iif = in_dev->dev->ifindex;
rth->rt_iif = in_dev->dev->ifindex;
- rth->rt_oif = 0;
rth->rt_pmtu = 0;
rth->rt_gateway = 0;
rth->fi = NULL;
@@ -1642,7 +1640,6 @@ local_input:
rth->rt_type = res.type;
rth->rt_route_iif = dev->ifindex;
rth->rt_iif = dev->ifindex;
- rth->rt_oif = 0;
rth->rt_pmtu = 0;
rth->rt_gateway = 0;
rth->fi = NULL;
@@ -1808,7 +1805,6 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
rth->rt_type = type;
rth->rt_route_iif = 0;
rth->rt_iif = orig_oif ? : dev_out->ifindex;
- rth->rt_oif = orig_oif;
rth->rt_pmtu = 0;
rth->rt_gateway = 0;
rth->fi = NULL;
@@ -2085,7 +2081,6 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or
rt->rt_route_iif = ort->rt_route_iif;
rt->rt_iif = ort->rt_iif;
- rt->rt_oif = ort->rt_oif;
rt->rt_pmtu = ort->rt_pmtu;
rt->rt_genid = rt_genid(net);
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index 6074b69..3c99b4c 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -81,7 +81,6 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
xdst->u.rt.rt_route_iif = fl4->flowi4_iif;
xdst->u.rt.rt_iif = fl4->flowi4_iif;
- xdst->u.rt.rt_oif = fl4->flowi4_oif;
xdst->u.dst.dev = dev;
dev_hold(dev);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-07-20 21:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-19 21:36 [PATCH 14/16] ipv4: Kill rt->rt_oif David Miller
2012-07-20 1:10 ` Julian Anastasov
2012-07-20 20:31 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2012-07-20 21:26 David Miller
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).