diff options
author | David Miller <davem@davemloft.net> | 2012-06-30 22:02:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-20 16:31:00 -0400 |
commit | d6c0a4f609847d6e65658913f9ccbcb1c137cff3 (patch) | |
tree | 94a4f12618d5ced2a0d83eb75d4564e92a59d7df /net | |
parent | 1a00fee4ffb22312a0ac40045ecd6f222b55eb3d (diff) |
ipv4: Kill 'rt_src' from 'struct rtable'
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/route.c | 34 | ||||
-rw-r--r-- | net/ipv4/xfrm4_policy.c | 1 |
2 files changed, 15 insertions, 20 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index c89d690acdfa..fc1199dc23e7 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1272,7 +1272,6 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
1272 | rth->rt_flags = RTCF_MULTICAST; | 1272 | rth->rt_flags = RTCF_MULTICAST; |
1273 | rth->rt_type = RTN_MULTICAST; | 1273 | rth->rt_type = RTN_MULTICAST; |
1274 | rth->rt_dst = daddr; | 1274 | rth->rt_dst = daddr; |
1275 | rth->rt_src = saddr; | ||
1276 | rth->rt_route_iif = dev->ifindex; | 1275 | rth->rt_route_iif = dev->ifindex; |
1277 | rth->rt_iif = dev->ifindex; | 1276 | rth->rt_iif = dev->ifindex; |
1278 | rth->rt_oif = 0; | 1277 | rth->rt_oif = 0; |
@@ -1393,7 +1392,6 @@ static int __mkroute_input(struct sk_buff *skb, | |||
1393 | rth->rt_flags = flags; | 1392 | rth->rt_flags = flags; |
1394 | rth->rt_type = res->type; | 1393 | rth->rt_type = res->type; |
1395 | rth->rt_dst = daddr; | 1394 | rth->rt_dst = daddr; |
1396 | rth->rt_src = saddr; | ||
1397 | rth->rt_route_iif = in_dev->dev->ifindex; | 1395 | rth->rt_route_iif = in_dev->dev->ifindex; |
1398 | rth->rt_iif = in_dev->dev->ifindex; | 1396 | rth->rt_iif = in_dev->dev->ifindex; |
1399 | rth->rt_oif = 0; | 1397 | rth->rt_oif = 0; |
@@ -1561,7 +1559,6 @@ local_input: | |||
1561 | rth->rt_flags = flags|RTCF_LOCAL; | 1559 | rth->rt_flags = flags|RTCF_LOCAL; |
1562 | rth->rt_type = res.type; | 1560 | rth->rt_type = res.type; |
1563 | rth->rt_dst = daddr; | 1561 | rth->rt_dst = daddr; |
1564 | rth->rt_src = saddr; | ||
1565 | rth->rt_route_iif = dev->ifindex; | 1562 | rth->rt_route_iif = dev->ifindex; |
1566 | rth->rt_iif = dev->ifindex; | 1563 | rth->rt_iif = dev->ifindex; |
1567 | rth->rt_oif = 0; | 1564 | rth->rt_oif = 0; |
@@ -1714,7 +1711,6 @@ static struct rtable *__mkroute_output(const struct fib_result *res, | |||
1714 | rth->rt_flags = flags; | 1711 | rth->rt_flags = flags; |
1715 | rth->rt_type = type; | 1712 | rth->rt_type = type; |
1716 | rth->rt_dst = fl4->daddr; | 1713 | rth->rt_dst = fl4->daddr; |
1717 | rth->rt_src = fl4->saddr; | ||
1718 | rth->rt_route_iif = 0; | 1714 | rth->rt_route_iif = 0; |
1719 | rth->rt_iif = orig_oif ? : dev_out->ifindex; | 1715 | rth->rt_iif = orig_oif ? : dev_out->ifindex; |
1720 | rth->rt_oif = orig_oif; | 1716 | rth->rt_oif = orig_oif; |
@@ -2005,7 +2001,6 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or | |||
2005 | rt->rt_flags = ort->rt_flags; | 2001 | rt->rt_flags = ort->rt_flags; |
2006 | rt->rt_type = ort->rt_type; | 2002 | rt->rt_type = ort->rt_type; |
2007 | rt->rt_dst = ort->rt_dst; | 2003 | rt->rt_dst = ort->rt_dst; |
2008 | rt->rt_src = ort->rt_src; | ||
2009 | rt->rt_gateway = ort->rt_gateway; | 2004 | rt->rt_gateway = ort->rt_gateway; |
2010 | rt->fi = ort->fi; | 2005 | rt->fi = ort->fi; |
2011 | if (rt->fi) | 2006 | if (rt->fi) |
@@ -2036,7 +2031,7 @@ struct rtable *ip_route_output_flow(struct net *net, struct flowi4 *flp4, | |||
2036 | } | 2031 | } |
2037 | EXPORT_SYMBOL_GPL(ip_route_output_flow); | 2032 | EXPORT_SYMBOL_GPL(ip_route_output_flow); |
2038 | 2033 | ||
2039 | static int rt_fill_info(struct net *net, __be32 src, u8 tos, | 2034 | static int rt_fill_info(struct net *net, __be32 src, struct flowi4 *fl4, |
2040 | struct sk_buff *skb, u32 pid, u32 seq, int event, | 2035 | struct sk_buff *skb, u32 pid, u32 seq, int event, |
2041 | int nowait, unsigned int flags) | 2036 | int nowait, unsigned int flags) |
2042 | { | 2037 | { |
@@ -2055,7 +2050,7 @@ static int rt_fill_info(struct net *net, __be32 src, u8 tos, | |||
2055 | r->rtm_family = AF_INET; | 2050 | r->rtm_family = AF_INET; |
2056 | r->rtm_dst_len = 32; | 2051 | r->rtm_dst_len = 32; |
2057 | r->rtm_src_len = 0; | 2052 | r->rtm_src_len = 0; |
2058 | r->rtm_tos = tos; | 2053 | r->rtm_tos = fl4->flowi4_tos; |
2059 | r->rtm_table = RT_TABLE_MAIN; | 2054 | r->rtm_table = RT_TABLE_MAIN; |
2060 | if (nla_put_u32(skb, RTA_TABLE, RT_TABLE_MAIN)) | 2055 | if (nla_put_u32(skb, RTA_TABLE, RT_TABLE_MAIN)) |
2061 | goto nla_put_failure; | 2056 | goto nla_put_failure; |
@@ -2082,11 +2077,11 @@ static int rt_fill_info(struct net *net, __be32 src, u8 tos, | |||
2082 | goto nla_put_failure; | 2077 | goto nla_put_failure; |
2083 | #endif | 2078 | #endif |
2084 | if (!rt_is_input_route(rt) && | 2079 | if (!rt_is_input_route(rt) && |
2085 | rt->rt_src != src) { | 2080 | fl4->saddr != src) { |
2086 | if (nla_put_be32(skb, RTA_PREFSRC, rt->rt_src)) | 2081 | if (nla_put_be32(skb, RTA_PREFSRC, fl4->saddr)) |
2087 | goto nla_put_failure; | 2082 | goto nla_put_failure; |
2088 | } | 2083 | } |
2089 | if (rt->rt_dst != rt->rt_gateway && | 2084 | if (fl4->daddr != rt->rt_gateway && |
2090 | nla_put_be32(skb, RTA_GATEWAY, rt->rt_gateway)) | 2085 | nla_put_be32(skb, RTA_GATEWAY, rt->rt_gateway)) |
2091 | goto nla_put_failure; | 2086 | goto nla_put_failure; |
2092 | 2087 | ||
@@ -2116,7 +2111,7 @@ static int rt_fill_info(struct net *net, __be32 src, u8 tos, | |||
2116 | if (ipv4_is_multicast(dst) && !ipv4_is_local_multicast(dst) && | 2111 | if (ipv4_is_multicast(dst) && !ipv4_is_local_multicast(dst) && |
2117 | IPV4_DEVCONF_ALL(net, MC_FORWARDING)) { | 2112 | IPV4_DEVCONF_ALL(net, MC_FORWARDING)) { |
2118 | int err = ipmr_get_route(net, skb, | 2113 | int err = ipmr_get_route(net, skb, |
2119 | rt->rt_src, rt->rt_dst, | 2114 | fl4->saddr, fl4->daddr, |
2120 | r, nowait); | 2115 | r, nowait); |
2121 | if (err <= 0) { | 2116 | if (err <= 0) { |
2122 | if (!nowait) { | 2117 | if (!nowait) { |
@@ -2151,6 +2146,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void | |||
2151 | struct rtmsg *rtm; | 2146 | struct rtmsg *rtm; |
2152 | struct nlattr *tb[RTA_MAX+1]; | 2147 | struct nlattr *tb[RTA_MAX+1]; |
2153 | struct rtable *rt = NULL; | 2148 | struct rtable *rt = NULL; |
2149 | struct flowi4 fl4; | ||
2154 | __be32 dst = 0; | 2150 | __be32 dst = 0; |
2155 | __be32 src = 0; | 2151 | __be32 src = 0; |
2156 | u32 iif; | 2152 | u32 iif; |
@@ -2185,6 +2181,13 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void | |||
2185 | iif = tb[RTA_IIF] ? nla_get_u32(tb[RTA_IIF]) : 0; | 2181 | iif = tb[RTA_IIF] ? nla_get_u32(tb[RTA_IIF]) : 0; |
2186 | mark = tb[RTA_MARK] ? nla_get_u32(tb[RTA_MARK]) : 0; | 2182 | mark = tb[RTA_MARK] ? nla_get_u32(tb[RTA_MARK]) : 0; |
2187 | 2183 | ||
2184 | memset(&fl4, 0, sizeof(fl4)); | ||
2185 | fl4.daddr = dst; | ||
2186 | fl4.saddr = src; | ||
2187 | fl4.flowi4_tos = rtm->rtm_tos; | ||
2188 | fl4.flowi4_oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0; | ||
2189 | fl4.flowi4_mark = mark; | ||
2190 | |||
2188 | if (iif) { | 2191 | if (iif) { |
2189 | struct net_device *dev; | 2192 | struct net_device *dev; |
2190 | 2193 | ||
@@ -2205,13 +2208,6 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void | |||
2205 | if (err == 0 && rt->dst.error) | 2208 | if (err == 0 && rt->dst.error) |
2206 | err = -rt->dst.error; | 2209 | err = -rt->dst.error; |
2207 | } else { | 2210 | } else { |
2208 | struct flowi4 fl4 = { | ||
2209 | .daddr = dst, | ||
2210 | .saddr = src, | ||
2211 | .flowi4_tos = rtm->rtm_tos, | ||
2212 | .flowi4_oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0, | ||
2213 | .flowi4_mark = mark, | ||
2214 | }; | ||
2215 | rt = ip_route_output_key(net, &fl4); | 2211 | rt = ip_route_output_key(net, &fl4); |
2216 | 2212 | ||
2217 | err = 0; | 2213 | err = 0; |
@@ -2226,7 +2222,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void | |||
2226 | if (rtm->rtm_flags & RTM_F_NOTIFY) | 2222 | if (rtm->rtm_flags & RTM_F_NOTIFY) |
2227 | rt->rt_flags |= RTCF_NOTIFY; | 2223 | rt->rt_flags |= RTCF_NOTIFY; |
2228 | 2224 | ||
2229 | err = rt_fill_info(net, src, rtm->rtm_tos, skb, | 2225 | err = rt_fill_info(net, src, &fl4, skb, |
2230 | NETLINK_CB(in_skb).pid, nlh->nlmsg_seq, | 2226 | NETLINK_CB(in_skb).pid, nlh->nlmsg_seq, |
2231 | RTM_NEWROUTE, 0, 0); | 2227 | RTM_NEWROUTE, 0, 0); |
2232 | if (err <= 0) | 2228 | if (err <= 0) |
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index 2a8d5cfc340f..00d49e415113 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
@@ -92,7 +92,6 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, | |||
92 | xdst->u.rt.rt_flags = rt->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST | | 92 | xdst->u.rt.rt_flags = rt->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST | |
93 | RTCF_LOCAL); | 93 | RTCF_LOCAL); |
94 | xdst->u.rt.rt_type = rt->rt_type; | 94 | xdst->u.rt.rt_type = rt->rt_type; |
95 | xdst->u.rt.rt_src = rt->rt_src; | ||
96 | xdst->u.rt.rt_dst = rt->rt_dst; | 95 | xdst->u.rt.rt_dst = rt->rt_dst; |
97 | xdst->u.rt.rt_gateway = rt->rt_gateway; | 96 | xdst->u.rt.rt_gateway = rt->rt_gateway; |
98 | xdst->u.rt.rt_pmtu = rt->rt_pmtu; | 97 | xdst->u.rt.rt_pmtu = rt->rt_pmtu; |