diff options
Diffstat (limited to 'include/net/route.h')
-rw-r--r-- | include/net/route.h | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/include/net/route.h b/include/net/route.h index f46af256880c..ee81307863d5 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <net/inetpeer.h> | 28 | #include <net/inetpeer.h> |
29 | #include <net/flow.h> | 29 | #include <net/flow.h> |
30 | #include <net/inet_sock.h> | 30 | #include <net/inet_sock.h> |
31 | #include <net/ip_fib.h> | ||
32 | #include <net/l3mdev.h> | ||
31 | #include <linux/in_route.h> | 33 | #include <linux/in_route.h> |
32 | #include <linux/rtnetlink.h> | 34 | #include <linux/rtnetlink.h> |
33 | #include <linux/rcupdate.h> | 35 | #include <linux/rcupdate.h> |
@@ -64,6 +66,8 @@ struct rtable { | |||
64 | /* Miscellaneous cached information */ | 66 | /* Miscellaneous cached information */ |
65 | u32 rt_pmtu; | 67 | u32 rt_pmtu; |
66 | 68 | ||
69 | u32 rt_table_id; | ||
70 | |||
67 | struct list_head rt_uncached; | 71 | struct list_head rt_uncached; |
68 | struct uncached_list *rt_uncached_list; | 72 | struct uncached_list *rt_uncached_list; |
69 | }; | 73 | }; |
@@ -110,9 +114,17 @@ struct in_device; | |||
110 | int ip_rt_init(void); | 114 | int ip_rt_init(void); |
111 | void rt_cache_flush(struct net *net); | 115 | void rt_cache_flush(struct net *net); |
112 | void rt_flush_dev(struct net_device *dev); | 116 | void rt_flush_dev(struct net_device *dev); |
113 | struct rtable *__ip_route_output_key(struct net *, struct flowi4 *flp); | 117 | struct rtable *__ip_route_output_key_hash(struct net *, struct flowi4 *flp, |
118 | int mp_hash); | ||
119 | |||
120 | static inline struct rtable *__ip_route_output_key(struct net *net, | ||
121 | struct flowi4 *flp) | ||
122 | { | ||
123 | return __ip_route_output_key_hash(net, flp, -1); | ||
124 | } | ||
125 | |||
114 | struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp, | 126 | struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp, |
115 | struct sock *sk); | 127 | const struct sock *sk); |
116 | struct dst_entry *ipv4_blackhole_route(struct net *net, | 128 | struct dst_entry *ipv4_blackhole_route(struct net *net, |
117 | struct dst_entry *dst_orig); | 129 | struct dst_entry *dst_orig); |
118 | 130 | ||
@@ -254,9 +266,6 @@ static inline void ip_route_connect_init(struct flowi4 *fl4, __be32 dst, __be32 | |||
254 | if (inet_sk(sk)->transparent) | 266 | if (inet_sk(sk)->transparent) |
255 | flow_flags |= FLOWI_FLAG_ANYSRC; | 267 | flow_flags |= FLOWI_FLAG_ANYSRC; |
256 | 268 | ||
257 | if (netif_index_is_vrf(sock_net(sk), oif)) | ||
258 | flow_flags |= FLOWI_FLAG_VRFSRC | FLOWI_FLAG_SKIP_NH_OIF; | ||
259 | |||
260 | flowi4_init_output(fl4, oif, sk->sk_mark, tos, RT_SCOPE_UNIVERSE, | 269 | flowi4_init_output(fl4, oif, sk->sk_mark, tos, RT_SCOPE_UNIVERSE, |
261 | protocol, flow_flags, dst, src, dport, sport); | 270 | protocol, flow_flags, dst, src, dport, sport); |
262 | } | 271 | } |
@@ -273,6 +282,10 @@ static inline struct rtable *ip_route_connect(struct flowi4 *fl4, | |||
273 | ip_route_connect_init(fl4, dst, src, tos, oif, protocol, | 282 | ip_route_connect_init(fl4, dst, src, tos, oif, protocol, |
274 | sport, dport, sk); | 283 | sport, dport, sk); |
275 | 284 | ||
285 | if (!src && oif) { | ||
286 | l3mdev_get_saddr(net, oif, fl4); | ||
287 | src = fl4->saddr; | ||
288 | } | ||
276 | if (!dst || !src) { | 289 | if (!dst || !src) { |
277 | rt = __ip_route_output_key(net, fl4); | 290 | rt = __ip_route_output_key(net, fl4); |
278 | if (IS_ERR(rt)) | 291 | if (IS_ERR(rt)) |