diff options
Diffstat (limited to 'include/net/route.h')
-rw-r--r-- | include/net/route.h | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/include/net/route.h b/include/net/route.h index f7ce6259f86f..eadad5901429 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -27,12 +27,14 @@ | |||
27 | #include <net/dst.h> | 27 | #include <net/dst.h> |
28 | #include <net/inetpeer.h> | 28 | #include <net/inetpeer.h> |
29 | #include <net/flow.h> | 29 | #include <net/flow.h> |
30 | #include <net/sock.h> | ||
30 | #include <linux/in_route.h> | 31 | #include <linux/in_route.h> |
31 | #include <linux/rtnetlink.h> | 32 | #include <linux/rtnetlink.h> |
32 | #include <linux/route.h> | 33 | #include <linux/route.h> |
33 | #include <linux/ip.h> | 34 | #include <linux/ip.h> |
34 | #include <linux/cache.h> | 35 | #include <linux/cache.h> |
35 | #include <linux/security.h> | 36 | #include <linux/security.h> |
37 | #include <net/sock.h> | ||
36 | 38 | ||
37 | #ifndef __KERNEL__ | 39 | #ifndef __KERNEL__ |
38 | #warning This file is not supposed to be used outside of kernel. | 40 | #warning This file is not supposed to be used outside of kernel. |
@@ -60,6 +62,7 @@ struct rtable | |||
60 | 62 | ||
61 | struct in_device *idev; | 63 | struct in_device *idev; |
62 | 64 | ||
65 | int rt_genid; | ||
63 | unsigned rt_flags; | 66 | unsigned rt_flags; |
64 | __u16 rt_type; | 67 | __u16 rt_type; |
65 | 68 | ||
@@ -109,18 +112,18 @@ struct in_device; | |||
109 | extern int ip_rt_init(void); | 112 | extern int ip_rt_init(void); |
110 | extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw, | 113 | extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw, |
111 | __be32 src, struct net_device *dev); | 114 | __be32 src, struct net_device *dev); |
112 | extern void ip_rt_advice(struct rtable **rp, int advice); | ||
113 | extern void rt_cache_flush(int how); | 115 | extern void rt_cache_flush(int how); |
114 | extern int __ip_route_output_key(struct rtable **, const struct flowi *flp); | 116 | extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp); |
115 | extern int ip_route_output_key(struct rtable **, struct flowi *flp); | 117 | extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp); |
116 | extern int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); | 118 | extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); |
117 | extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin); | 119 | extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin); |
118 | extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu); | 120 | extern unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, unsigned short new_mtu); |
119 | extern void ip_rt_send_redirect(struct sk_buff *skb); | 121 | extern void ip_rt_send_redirect(struct sk_buff *skb); |
120 | 122 | ||
121 | extern unsigned inet_addr_type(__be32 addr); | 123 | extern unsigned inet_addr_type(struct net *net, __be32 addr); |
124 | extern unsigned inet_dev_addr_type(struct net *net, const struct net_device *dev, __be32 addr); | ||
122 | extern void ip_rt_multicast_event(struct in_device *); | 125 | extern void ip_rt_multicast_event(struct in_device *); |
123 | extern int ip_rt_ioctl(unsigned int cmd, void __user *arg); | 126 | extern int ip_rt_ioctl(struct net *, unsigned int cmd, void __user *arg); |
124 | extern void ip_rt_get_source(u8 *src, struct rtable *rt); | 127 | extern void ip_rt_get_source(u8 *src, struct rtable *rt); |
125 | extern int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb); | 128 | extern int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb); |
126 | 129 | ||
@@ -148,6 +151,7 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst, | |||
148 | int flags) | 151 | int flags) |
149 | { | 152 | { |
150 | struct flowi fl = { .oif = oif, | 153 | struct flowi fl = { .oif = oif, |
154 | .mark = sk->sk_mark, | ||
151 | .nl_u = { .ip4_u = { .daddr = dst, | 155 | .nl_u = { .ip4_u = { .daddr = dst, |
152 | .saddr = src, | 156 | .saddr = src, |
153 | .tos = tos } }, | 157 | .tos = tos } }, |
@@ -157,8 +161,9 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst, | |||
157 | .dport = dport } } }; | 161 | .dport = dport } } }; |
158 | 162 | ||
159 | int err; | 163 | int err; |
164 | struct net *net = sk->sk_net; | ||
160 | if (!dst || !src) { | 165 | if (!dst || !src) { |
161 | err = __ip_route_output_key(rp, &fl); | 166 | err = __ip_route_output_key(net, rp, &fl); |
162 | if (err) | 167 | if (err) |
163 | return err; | 168 | return err; |
164 | fl.fl4_dst = (*rp)->rt_dst; | 169 | fl.fl4_dst = (*rp)->rt_dst; |
@@ -167,7 +172,7 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst, | |||
167 | *rp = NULL; | 172 | *rp = NULL; |
168 | } | 173 | } |
169 | security_sk_classify_flow(sk, &fl); | 174 | security_sk_classify_flow(sk, &fl); |
170 | return ip_route_output_flow(rp, &fl, sk, flags); | 175 | return ip_route_output_flow(net, rp, &fl, sk, flags); |
171 | } | 176 | } |
172 | 177 | ||
173 | static inline int ip_route_newports(struct rtable **rp, u8 protocol, | 178 | static inline int ip_route_newports(struct rtable **rp, u8 protocol, |
@@ -184,7 +189,7 @@ static inline int ip_route_newports(struct rtable **rp, u8 protocol, | |||
184 | ip_rt_put(*rp); | 189 | ip_rt_put(*rp); |
185 | *rp = NULL; | 190 | *rp = NULL; |
186 | security_sk_classify_flow(sk, &fl); | 191 | security_sk_classify_flow(sk, &fl); |
187 | return ip_route_output_flow(rp, &fl, sk, 0); | 192 | return ip_route_output_flow(sk->sk_net, rp, &fl, sk, 0); |
188 | } | 193 | } |
189 | return 0; | 194 | return 0; |
190 | } | 195 | } |