diff options
Diffstat (limited to 'include/net/route.h')
-rw-r--r-- | include/net/route.h | 62 |
1 files changed, 53 insertions, 9 deletions
diff --git a/include/net/route.h b/include/net/route.h index 98705468ac03..211e2665139b 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -65,12 +65,45 @@ struct rtable { | |||
65 | __be32 rt_gateway; | 65 | __be32 rt_gateway; |
66 | 66 | ||
67 | /* Miscellaneous cached information */ | 67 | /* Miscellaneous cached information */ |
68 | __be32 rt_spec_dst; /* RFC1122 specific destination */ | ||
69 | u32 rt_peer_genid; | 68 | u32 rt_peer_genid; |
70 | struct inet_peer *peer; /* long-living peer info */ | 69 | unsigned long _peer; /* long-living peer info */ |
71 | struct fib_info *fi; /* for client ref to shared metrics */ | 70 | struct fib_info *fi; /* for client ref to shared metrics */ |
72 | }; | 71 | }; |
73 | 72 | ||
73 | static inline struct inet_peer *rt_peer_ptr(struct rtable *rt) | ||
74 | { | ||
75 | return inetpeer_ptr(rt->_peer); | ||
76 | } | ||
77 | |||
78 | static inline bool rt_has_peer(struct rtable *rt) | ||
79 | { | ||
80 | return inetpeer_ptr_is_peer(rt->_peer); | ||
81 | } | ||
82 | |||
83 | static inline void __rt_set_peer(struct rtable *rt, struct inet_peer *peer) | ||
84 | { | ||
85 | __inetpeer_ptr_set_peer(&rt->_peer, peer); | ||
86 | } | ||
87 | |||
88 | static inline bool rt_set_peer(struct rtable *rt, struct inet_peer *peer) | ||
89 | { | ||
90 | return inetpeer_ptr_set_peer(&rt->_peer, peer); | ||
91 | } | ||
92 | |||
93 | static inline void rt_init_peer(struct rtable *rt, struct inet_peer_base *base) | ||
94 | { | ||
95 | inetpeer_init_ptr(&rt->_peer, base); | ||
96 | } | ||
97 | |||
98 | static inline void rt_transfer_peer(struct rtable *rt, struct rtable *ort) | ||
99 | { | ||
100 | rt->_peer = ort->_peer; | ||
101 | if (rt_has_peer(ort)) { | ||
102 | struct inet_peer *peer = rt_peer_ptr(ort); | ||
103 | atomic_inc(&peer->refcnt); | ||
104 | } | ||
105 | } | ||
106 | |||
74 | static inline bool rt_is_input_route(const struct rtable *rt) | 107 | static inline bool rt_is_input_route(const struct rtable *rt) |
75 | { | 108 | { |
76 | return rt->rt_route_iif != 0; | 109 | return rt->rt_route_iif != 0; |
@@ -181,9 +214,10 @@ static inline int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 s | |||
181 | return ip_route_input_common(skb, dst, src, tos, devin, true); | 214 | return ip_route_input_common(skb, dst, src, tos, devin, true); |
182 | } | 215 | } |
183 | 216 | ||
184 | extern unsigned short ip_rt_frag_needed(struct net *net, const struct iphdr *iph, | 217 | extern void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu, |
185 | unsigned short new_mtu, struct net_device *dev); | 218 | int oif, u32 mark, u8 protocol, int flow_flags); |
186 | extern void ip_rt_send_redirect(struct sk_buff *skb); | 219 | extern void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu); |
220 | extern void ip_rt_send_redirect(struct sk_buff *skb); | ||
187 | 221 | ||
188 | extern unsigned int inet_addr_type(struct net *net, __be32 addr); | 222 | 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); | 223 | extern unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev, __be32 addr); |
@@ -296,13 +330,23 @@ static inline struct rtable *ip_route_newports(struct flowi4 *fl4, struct rtable | |||
296 | 330 | ||
297 | extern void rt_bind_peer(struct rtable *rt, __be32 daddr, int create); | 331 | extern void rt_bind_peer(struct rtable *rt, __be32 daddr, int create); |
298 | 332 | ||
333 | static inline struct inet_peer *__rt_get_peer(struct rtable *rt, __be32 daddr, int create) | ||
334 | { | ||
335 | if (rt_has_peer(rt)) | ||
336 | return rt_peer_ptr(rt); | ||
337 | |||
338 | rt_bind_peer(rt, daddr, create); | ||
339 | return (rt_has_peer(rt) ? rt_peer_ptr(rt) : NULL); | ||
340 | } | ||
341 | |||
299 | static inline struct inet_peer *rt_get_peer(struct rtable *rt, __be32 daddr) | 342 | static inline struct inet_peer *rt_get_peer(struct rtable *rt, __be32 daddr) |
300 | { | 343 | { |
301 | if (rt->peer) | 344 | return __rt_get_peer(rt, daddr, 0); |
302 | return rt->peer; | 345 | } |
303 | 346 | ||
304 | rt_bind_peer(rt, daddr, 0); | 347 | static inline struct inet_peer *rt_get_peer_create(struct rtable *rt, __be32 daddr) |
305 | return rt->peer; | 348 | { |
349 | return __rt_get_peer(rt, daddr, 1); | ||
306 | } | 350 | } |
307 | 351 | ||
308 | static inline int inet_iif(const struct sk_buff *skb) | 352 | static inline int inet_iif(const struct sk_buff *skb) |