diff options
Diffstat (limited to 'include/net/route.h')
-rw-r--r-- | include/net/route.h | 76 |
1 files changed, 25 insertions, 51 deletions
diff --git a/include/net/route.h b/include/net/route.h index 98705468ac03..c29ef2733f2d 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -40,45 +40,39 @@ | |||
40 | #define RT_CONN_FLAGS(sk) (RT_TOS(inet_sk(sk)->tos) | sock_flag(sk, SOCK_LOCALROUTE)) | 40 | #define RT_CONN_FLAGS(sk) (RT_TOS(inet_sk(sk)->tos) | sock_flag(sk, SOCK_LOCALROUTE)) |
41 | 41 | ||
42 | struct fib_nh; | 42 | struct fib_nh; |
43 | struct inet_peer; | ||
44 | struct fib_info; | 43 | struct fib_info; |
45 | struct rtable { | 44 | struct rtable { |
46 | struct dst_entry dst; | 45 | struct dst_entry dst; |
47 | 46 | ||
48 | /* Lookup key. */ | ||
49 | __be32 rt_key_dst; | ||
50 | __be32 rt_key_src; | ||
51 | |||
52 | int rt_genid; | 47 | int rt_genid; |
53 | unsigned int rt_flags; | 48 | unsigned int rt_flags; |
54 | __u16 rt_type; | 49 | __u16 rt_type; |
55 | __u8 rt_key_tos; | 50 | __u16 rt_is_input; |
56 | 51 | ||
57 | __be32 rt_dst; /* Path destination */ | ||
58 | __be32 rt_src; /* Path source */ | ||
59 | int rt_route_iif; | ||
60 | int rt_iif; | 52 | int rt_iif; |
61 | int rt_oif; | ||
62 | __u32 rt_mark; | ||
63 | 53 | ||
64 | /* Info on neighbour */ | 54 | /* Info on neighbour */ |
65 | __be32 rt_gateway; | 55 | __be32 rt_gateway; |
66 | 56 | ||
67 | /* Miscellaneous cached information */ | 57 | /* Miscellaneous cached information */ |
68 | __be32 rt_spec_dst; /* RFC1122 specific destination */ | 58 | u32 rt_pmtu; |
69 | u32 rt_peer_genid; | ||
70 | struct inet_peer *peer; /* long-living peer info */ | ||
71 | struct fib_info *fi; /* for client ref to shared metrics */ | ||
72 | }; | 59 | }; |
73 | 60 | ||
74 | static inline bool rt_is_input_route(const struct rtable *rt) | 61 | static inline bool rt_is_input_route(const struct rtable *rt) |
75 | { | 62 | { |
76 | return rt->rt_route_iif != 0; | 63 | return rt->rt_is_input != 0; |
77 | } | 64 | } |
78 | 65 | ||
79 | static inline bool rt_is_output_route(const struct rtable *rt) | 66 | static inline bool rt_is_output_route(const struct rtable *rt) |
80 | { | 67 | { |
81 | return rt->rt_route_iif == 0; | 68 | return rt->rt_is_input == 0; |
69 | } | ||
70 | |||
71 | static inline __be32 rt_nexthop(const struct rtable *rt, __be32 daddr) | ||
72 | { | ||
73 | if (rt->rt_gateway) | ||
74 | return rt->rt_gateway; | ||
75 | return daddr; | ||
82 | } | 76 | } |
83 | 77 | ||
84 | struct ip_rt_acct { | 78 | struct ip_rt_acct { |
@@ -111,10 +105,7 @@ extern struct ip_rt_acct __percpu *ip_rt_acct; | |||
111 | 105 | ||
112 | struct in_device; | 106 | struct in_device; |
113 | extern int ip_rt_init(void); | 107 | extern int ip_rt_init(void); |
114 | extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw, | ||
115 | __be32 src, struct net_device *dev); | ||
116 | extern void rt_cache_flush(struct net *net, int how); | 108 | extern void rt_cache_flush(struct net *net, int how); |
117 | extern void rt_cache_flush_batch(struct net *net); | ||
118 | extern struct rtable *__ip_route_output_key(struct net *, struct flowi4 *flp); | 109 | extern struct rtable *__ip_route_output_key(struct net *, struct flowi4 *flp); |
119 | extern struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp, | 110 | extern struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp, |
120 | struct sock *sk); | 111 | struct sock *sk); |
@@ -166,24 +157,16 @@ static inline struct rtable *ip_route_output_gre(struct net *net, struct flowi4 | |||
166 | return ip_route_output_key(net, fl4); | 157 | return ip_route_output_key(net, fl4); |
167 | } | 158 | } |
168 | 159 | ||
169 | extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src, | 160 | extern int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src, |
170 | u8 tos, struct net_device *devin, bool noref); | 161 | u8 tos, struct net_device *devin); |
171 | |||
172 | static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src, | ||
173 | u8 tos, struct net_device *devin) | ||
174 | { | ||
175 | return ip_route_input_common(skb, dst, src, tos, devin, false); | ||
176 | } | ||
177 | |||
178 | static inline int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 src, | ||
179 | u8 tos, struct net_device *devin) | ||
180 | { | ||
181 | return ip_route_input_common(skb, dst, src, tos, devin, true); | ||
182 | } | ||
183 | 162 | ||
184 | extern unsigned short ip_rt_frag_needed(struct net *net, const struct iphdr *iph, | 163 | extern void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu, |
185 | unsigned short new_mtu, struct net_device *dev); | 164 | int oif, u32 mark, u8 protocol, int flow_flags); |
186 | extern void ip_rt_send_redirect(struct sk_buff *skb); | 165 | extern void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu); |
166 | extern void ipv4_redirect(struct sk_buff *skb, struct net *net, | ||
167 | int oif, u32 mark, u8 protocol, int flow_flags); | ||
168 | extern void ipv4_sk_redirect(struct sk_buff *skb, struct sock *sk); | ||
169 | extern void ip_rt_send_redirect(struct sk_buff *skb); | ||
187 | 170 | ||
188 | extern unsigned int inet_addr_type(struct net *net, __be32 addr); | 171 | extern unsigned int inet_addr_type(struct net *net, __be32 addr); |
189 | extern unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev, __be32 addr); | 172 | extern unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev, __be32 addr); |
@@ -244,8 +227,6 @@ static inline void ip_route_connect_init(struct flowi4 *fl4, __be32 dst, __be32 | |||
244 | 227 | ||
245 | if (inet_sk(sk)->transparent) | 228 | if (inet_sk(sk)->transparent) |
246 | flow_flags |= FLOWI_FLAG_ANYSRC; | 229 | flow_flags |= FLOWI_FLAG_ANYSRC; |
247 | if (protocol == IPPROTO_TCP) | ||
248 | flow_flags |= FLOWI_FLAG_PRECOW_METRICS; | ||
249 | if (can_sleep) | 230 | if (can_sleep) |
250 | flow_flags |= FLOWI_FLAG_CAN_SLEEP; | 231 | flow_flags |= FLOWI_FLAG_CAN_SLEEP; |
251 | 232 | ||
@@ -294,20 +275,13 @@ static inline struct rtable *ip_route_newports(struct flowi4 *fl4, struct rtable | |||
294 | return rt; | 275 | return rt; |
295 | } | 276 | } |
296 | 277 | ||
297 | extern void rt_bind_peer(struct rtable *rt, __be32 daddr, int create); | ||
298 | |||
299 | static inline struct inet_peer *rt_get_peer(struct rtable *rt, __be32 daddr) | ||
300 | { | ||
301 | if (rt->peer) | ||
302 | return rt->peer; | ||
303 | |||
304 | rt_bind_peer(rt, daddr, 0); | ||
305 | return rt->peer; | ||
306 | } | ||
307 | |||
308 | static inline int inet_iif(const struct sk_buff *skb) | 278 | static inline int inet_iif(const struct sk_buff *skb) |
309 | { | 279 | { |
310 | return skb_rtable(skb)->rt_iif; | 280 | int iif = skb_rtable(skb)->rt_iif; |
281 | |||
282 | if (iif) | ||
283 | return iif; | ||
284 | return skb->skb_iif; | ||
311 | } | 285 | } |
312 | 286 | ||
313 | extern int sysctl_ip_default_ttl; | 287 | extern int sysctl_ip_default_ttl; |