aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/route.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/route.h')
-rw-r--r--include/net/route.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/include/net/route.h b/include/net/route.h
index 59b0b19205a2..4eabf008413b 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -33,6 +33,7 @@
33#include <linux/ip.h> 33#include <linux/ip.h>
34#include <linux/cache.h> 34#include <linux/cache.h>
35#include <linux/security.h> 35#include <linux/security.h>
36#include <net/sock.h>
36 37
37#ifndef __KERNEL__ 38#ifndef __KERNEL__
38#warning This file is not supposed to be used outside of kernel. 39#warning This file is not supposed to be used outside of kernel.
@@ -110,16 +111,17 @@ extern int ip_rt_init(void);
110extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw, 111extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw,
111 __be32 src, struct net_device *dev); 112 __be32 src, struct net_device *dev);
112extern void rt_cache_flush(int how); 113extern void rt_cache_flush(int how);
113extern int __ip_route_output_key(struct rtable **, const struct flowi *flp); 114extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp);
114extern int ip_route_output_key(struct rtable **, struct flowi *flp); 115extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp);
115extern int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); 116extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags);
116extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin); 117extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin);
117extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu); 118extern unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, unsigned short new_mtu);
118extern void ip_rt_send_redirect(struct sk_buff *skb); 119extern void ip_rt_send_redirect(struct sk_buff *skb);
119 120
120extern unsigned inet_addr_type(__be32 addr); 121extern unsigned inet_addr_type(struct net *net, __be32 addr);
122extern unsigned inet_dev_addr_type(struct net *net, const struct net_device *dev, __be32 addr);
121extern void ip_rt_multicast_event(struct in_device *); 123extern void ip_rt_multicast_event(struct in_device *);
122extern int ip_rt_ioctl(unsigned int cmd, void __user *arg); 124extern int ip_rt_ioctl(struct net *, unsigned int cmd, void __user *arg);
123extern void ip_rt_get_source(u8 *src, struct rtable *rt); 125extern void ip_rt_get_source(u8 *src, struct rtable *rt);
124extern int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb); 126extern int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb);
125 127
@@ -156,8 +158,9 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst,
156 .dport = dport } } }; 158 .dport = dport } } };
157 159
158 int err; 160 int err;
161 struct net *net = sk->sk_net;
159 if (!dst || !src) { 162 if (!dst || !src) {
160 err = __ip_route_output_key(rp, &fl); 163 err = __ip_route_output_key(net, rp, &fl);
161 if (err) 164 if (err)
162 return err; 165 return err;
163 fl.fl4_dst = (*rp)->rt_dst; 166 fl.fl4_dst = (*rp)->rt_dst;
@@ -166,7 +169,7 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst,
166 *rp = NULL; 169 *rp = NULL;
167 } 170 }
168 security_sk_classify_flow(sk, &fl); 171 security_sk_classify_flow(sk, &fl);
169 return ip_route_output_flow(rp, &fl, sk, flags); 172 return ip_route_output_flow(net, rp, &fl, sk, flags);
170} 173}
171 174
172static inline int ip_route_newports(struct rtable **rp, u8 protocol, 175static inline int ip_route_newports(struct rtable **rp, u8 protocol,
@@ -183,7 +186,7 @@ static inline int ip_route_newports(struct rtable **rp, u8 protocol,
183 ip_rt_put(*rp); 186 ip_rt_put(*rp);
184 *rp = NULL; 187 *rp = NULL;
185 security_sk_classify_flow(sk, &fl); 188 security_sk_classify_flow(sk, &fl);
186 return ip_route_output_flow(rp, &fl, sk, 0); 189 return ip_route_output_flow(sk->sk_net, rp, &fl, sk, 0);
187 } 190 }
188 return 0; 191 return 0;
189} 192}