diff options
author | David S. Miller <davem@davemloft.net> | 2012-06-09 02:24:18 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-09 02:24:18 -0400 |
commit | fbfe95a42e90b3dd079cc9019ba7d7700feee0f6 (patch) | |
tree | f5f16e6efcf1411a47df8b836f669fc452489dd4 /include/net/route.h | |
parent | 7123aaa3a1416529ce461e98108e6b343b294643 (diff) |
inet: Create and use rt{,6}_get_peer_create().
There's a lot of places that open-code rt{,6}_get_peer() only because
they want to set 'create' to one. So add an rt{,6}_get_peer_create()
for their sake.
There were also a few spots open-coding plain rt{,6}_get_peer() and
those are transformed here as well.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/route.h')
-rw-r--r-- | include/net/route.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/include/net/route.h b/include/net/route.h index ed2b78e2375d..433fc6c1d404 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -296,15 +296,25 @@ static inline struct rtable *ip_route_newports(struct flowi4 *fl4, struct rtable | |||
296 | 296 | ||
297 | extern void rt_bind_peer(struct rtable *rt, __be32 daddr, int create); | 297 | extern void rt_bind_peer(struct rtable *rt, __be32 daddr, int create); |
298 | 298 | ||
299 | static inline struct inet_peer *rt_get_peer(struct rtable *rt, __be32 daddr) | 299 | static inline struct inet_peer *__rt_get_peer(struct rtable *rt, __be32 daddr, int create) |
300 | { | 300 | { |
301 | if (rt->peer) | 301 | if (rt->peer) |
302 | return rt->peer; | 302 | return rt->peer; |
303 | 303 | ||
304 | rt_bind_peer(rt, daddr, 0); | 304 | rt_bind_peer(rt, daddr, create); |
305 | return rt->peer; | 305 | return rt->peer; |
306 | } | 306 | } |
307 | 307 | ||
308 | static inline struct inet_peer *rt_get_peer(struct rtable *rt, __be32 daddr) | ||
309 | { | ||
310 | return __rt_get_peer(rt, daddr, 0); | ||
311 | } | ||
312 | |||
313 | static inline struct inet_peer *rt_get_peer_create(struct rtable *rt, __be32 daddr) | ||
314 | { | ||
315 | return __rt_get_peer(rt, daddr, 1); | ||
316 | } | ||
317 | |||
308 | static inline int inet_iif(const struct sk_buff *skb) | 318 | static inline int inet_iif(const struct sk_buff *skb) |
309 | { | 319 | { |
310 | return skb_rtable(skb)->rt_iif; | 320 | return skb_rtable(skb)->rt_iif; |