diff options
Diffstat (limited to 'include/net/route.h')
-rw-r--r-- | include/net/route.h | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/include/net/route.h b/include/net/route.h index 59b0b19205a2..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 | ||
@@ -110,16 +113,17 @@ 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 rt_cache_flush(int how); | 115 | extern void rt_cache_flush(int how); |
113 | 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); |
114 | 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); |
115 | 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); |
116 | 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); |
117 | 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); |
118 | extern void ip_rt_send_redirect(struct sk_buff *skb); | 121 | extern void ip_rt_send_redirect(struct sk_buff *skb); |
119 | 122 | ||
120 | 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); | ||
121 | extern void ip_rt_multicast_event(struct in_device *); | 125 | extern void ip_rt_multicast_event(struct in_device *); |
122 | 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); |
123 | extern void ip_rt_get_source(u8 *src, struct rtable *rt); | 127 | extern void ip_rt_get_source(u8 *src, struct rtable *rt); |
124 | 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); |
125 | 129 | ||
@@ -147,6 +151,7 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst, | |||
147 | int flags) | 151 | int flags) |
148 | { | 152 | { |
149 | struct flowi fl = { .oif = oif, | 153 | struct flowi fl = { .oif = oif, |
154 | .mark = sk->sk_mark, | ||
150 | .nl_u = { .ip4_u = { .daddr = dst, | 155 | .nl_u = { .ip4_u = { .daddr = dst, |
151 | .saddr = src, | 156 | .saddr = src, |
152 | .tos = tos } }, | 157 | .tos = tos } }, |
@@ -156,8 +161,9 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst, | |||
156 | .dport = dport } } }; | 161 | .dport = dport } } }; |
157 | 162 | ||
158 | int err; | 163 | int err; |
164 | struct net *net = sk->sk_net; | ||
159 | if (!dst || !src) { | 165 | if (!dst || !src) { |
160 | err = __ip_route_output_key(rp, &fl); | 166 | err = __ip_route_output_key(net, rp, &fl); |
161 | if (err) | 167 | if (err) |
162 | return err; | 168 | return err; |
163 | fl.fl4_dst = (*rp)->rt_dst; | 169 | fl.fl4_dst = (*rp)->rt_dst; |
@@ -166,7 +172,7 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst, | |||
166 | *rp = NULL; | 172 | *rp = NULL; |
167 | } | 173 | } |
168 | security_sk_classify_flow(sk, &fl); | 174 | security_sk_classify_flow(sk, &fl); |
169 | return ip_route_output_flow(rp, &fl, sk, flags); | 175 | return ip_route_output_flow(net, rp, &fl, sk, flags); |
170 | } | 176 | } |
171 | 177 | ||
172 | static inline int ip_route_newports(struct rtable **rp, u8 protocol, | 178 | static inline int ip_route_newports(struct rtable **rp, u8 protocol, |
@@ -183,7 +189,7 @@ static inline int ip_route_newports(struct rtable **rp, u8 protocol, | |||
183 | ip_rt_put(*rp); | 189 | ip_rt_put(*rp); |
184 | *rp = NULL; | 190 | *rp = NULL; |
185 | security_sk_classify_flow(sk, &fl); | 191 | security_sk_classify_flow(sk, &fl); |
186 | return ip_route_output_flow(rp, &fl, sk, 0); | 192 | return ip_route_output_flow(sk->sk_net, rp, &fl, sk, 0); |
187 | } | 193 | } |
188 | return 0; | 194 | return 0; |
189 | } | 195 | } |