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.h58
1 files changed, 29 insertions, 29 deletions
diff --git a/include/net/route.h b/include/net/route.h
index 707cfc8eccdc..088a1867348f 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -118,9 +118,10 @@ extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw,
118 __be32 src, struct net_device *dev); 118 __be32 src, struct net_device *dev);
119extern void rt_cache_flush(struct net *net, int how); 119extern void rt_cache_flush(struct net *net, int how);
120extern void rt_cache_flush_batch(struct net *net); 120extern void rt_cache_flush_batch(struct net *net);
121extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp); 121extern struct rtable *__ip_route_output_key(struct net *, const struct flowi *flp);
122extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp); 122extern struct rtable *ip_route_output_key(struct net *, struct flowi *flp);
123extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk); 123extern struct rtable *ip_route_output_flow(struct net *, struct flowi *flp,
124 struct sock *sk);
124extern struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_orig); 125extern struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_orig);
125 126
126extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src, 127extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src,
@@ -166,10 +167,10 @@ static inline char rt_tos2priority(u8 tos)
166 return ip_tos2prio[IPTOS_TOS(tos)>>1]; 167 return ip_tos2prio[IPTOS_TOS(tos)>>1];
167} 168}
168 169
169static inline int ip_route_connect(struct rtable **rp, __be32 dst, 170static inline struct rtable *ip_route_connect(__be32 dst, __be32 src, u32 tos,
170 __be32 src, u32 tos, int oif, u8 protocol, 171 int oif, u8 protocol,
171 __be16 sport, __be16 dport, struct sock *sk, 172 __be16 sport, __be16 dport,
172 bool can_sleep) 173 struct sock *sk, bool can_sleep)
173{ 174{
174 struct flowi fl = { .oif = oif, 175 struct flowi fl = { .oif = oif,
175 .mark = sk->sk_mark, 176 .mark = sk->sk_mark,
@@ -179,8 +180,8 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst,
179 .proto = protocol, 180 .proto = protocol,
180 .fl_ip_sport = sport, 181 .fl_ip_sport = sport,
181 .fl_ip_dport = dport }; 182 .fl_ip_dport = dport };
182 int err;
183 struct net *net = sock_net(sk); 183 struct net *net = sock_net(sk);
184 struct rtable *rt;
184 185
185 if (inet_sk(sk)->transparent) 186 if (inet_sk(sk)->transparent)
186 fl.flags |= FLOWI_FLAG_ANYSRC; 187 fl.flags |= FLOWI_FLAG_ANYSRC;
@@ -190,29 +191,29 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst,
190 fl.flags |= FLOWI_FLAG_CAN_SLEEP; 191 fl.flags |= FLOWI_FLAG_CAN_SLEEP;
191 192
192 if (!dst || !src) { 193 if (!dst || !src) {
193 err = __ip_route_output_key(net, rp, &fl); 194 rt = __ip_route_output_key(net, &fl);
194 if (err) 195 if (IS_ERR(rt))
195 return err; 196 return rt;
196 fl.fl4_dst = (*rp)->rt_dst; 197 fl.fl4_dst = rt->rt_dst;
197 fl.fl4_src = (*rp)->rt_src; 198 fl.fl4_src = rt->rt_src;
198 ip_rt_put(*rp); 199 ip_rt_put(rt);
199 *rp = NULL;
200 } 200 }
201 security_sk_classify_flow(sk, &fl); 201 security_sk_classify_flow(sk, &fl);
202 return ip_route_output_flow(net, rp, &fl, sk); 202 return ip_route_output_flow(net, &fl, sk);
203} 203}
204 204
205static inline int ip_route_newports(struct rtable **rp, u8 protocol, 205static inline struct rtable *ip_route_newports(struct rtable *rt,
206 __be16 orig_sport, __be16 orig_dport, 206 u8 protocol, __be16 orig_sport,
207 __be16 sport, __be16 dport, struct sock *sk) 207 __be16 orig_dport, __be16 sport,
208 __be16 dport, struct sock *sk)
208{ 209{
209 if (sport != orig_sport || dport != orig_dport) { 210 if (sport != orig_sport || dport != orig_dport) {
210 struct flowi fl = { .oif = (*rp)->fl.oif, 211 struct flowi fl = { .oif = rt->fl.oif,
211 .mark = (*rp)->fl.mark, 212 .mark = rt->fl.mark,
212 .fl4_dst = (*rp)->fl.fl4_dst, 213 .fl4_dst = rt->fl.fl4_dst,
213 .fl4_src = (*rp)->fl.fl4_src, 214 .fl4_src = rt->fl.fl4_src,
214 .fl4_tos = (*rp)->fl.fl4_tos, 215 .fl4_tos = rt->fl.fl4_tos,
215 .proto = (*rp)->fl.proto, 216 .proto = rt->fl.proto,
216 .fl_ip_sport = sport, 217 .fl_ip_sport = sport,
217 .fl_ip_dport = dport }; 218 .fl_ip_dport = dport };
218 219
@@ -220,12 +221,11 @@ static inline int ip_route_newports(struct rtable **rp, u8 protocol,
220 fl.flags |= FLOWI_FLAG_ANYSRC; 221 fl.flags |= FLOWI_FLAG_ANYSRC;
221 if (protocol == IPPROTO_TCP) 222 if (protocol == IPPROTO_TCP)
222 fl.flags |= FLOWI_FLAG_PRECOW_METRICS; 223 fl.flags |= FLOWI_FLAG_PRECOW_METRICS;
223 ip_rt_put(*rp); 224 ip_rt_put(rt);
224 *rp = NULL;
225 security_sk_classify_flow(sk, &fl); 225 security_sk_classify_flow(sk, &fl);
226 return ip_route_output_flow(sock_net(sk), rp, &fl, sk); 226 return ip_route_output_flow(sock_net(sk), &fl, sk);
227 } 227 }
228 return 0; 228 return rt;
229} 229}
230 230
231extern void rt_bind_peer(struct rtable *rt, int create); 231extern void rt_bind_peer(struct rtable *rt, int create);