summaryrefslogtreecommitdiffstats
path: root/include/net/route.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-06-08 23:24:18 -0700
committerDavid S. Miller <davem@davemloft.net>2012-06-08 23:24:18 -0700
commitfbfe95a42e90b3dd079cc9019ba7d7700feee0f6 (patch)
treef5f16e6efcf1411a47df8b836f669fc452489dd4 /include/net/route.h
parent7123aaa3a1416529ce461e98108e6b343b294643 (diff)
downloadop-kernel-dev-fbfe95a42e90b3dd079cc9019ba7d7700feee0f6.zip
op-kernel-dev-fbfe95a42e90b3dd079cc9019ba7d7700feee0f6.tar.gz
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.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/include/net/route.h b/include/net/route.h
index ed2b78e..433fc6c 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
extern void rt_bind_peer(struct rtable *rt, __be32 daddr, int create);
-static inline struct inet_peer *rt_get_peer(struct rtable *rt, __be32 daddr)
+static inline struct inet_peer *__rt_get_peer(struct rtable *rt, __be32 daddr, int create)
{
if (rt->peer)
return rt->peer;
- rt_bind_peer(rt, daddr, 0);
+ rt_bind_peer(rt, daddr, create);
return rt->peer;
}
+static inline struct inet_peer *rt_get_peer(struct rtable *rt, __be32 daddr)
+{
+ return __rt_get_peer(rt, daddr, 0);
+}
+
+static inline struct inet_peer *rt_get_peer_create(struct rtable *rt, __be32 daddr)
+{
+ return __rt_get_peer(rt, daddr, 1);
+}
+
static inline int inet_iif(const struct sk_buff *skb)
{
return skb_rtable(skb)->rt_iif;
OpenPOWER on IntegriCloud