summaryrefslogtreecommitdiffstats
path: root/include/net/xfrm.h
diff options
context:
space:
mode:
authorHannes Frederic Sowa <hannes@stressinduktion.org>2013-08-13 04:35:58 +0200
committerSteffen Klassert <steffen.klassert@secunet.com>2013-08-14 13:09:07 +0200
commit0ea9d5e3e0e03a63b11392f5613378977dae7eca (patch)
treea363333080f9f8647f3f80dc7e736a308c36b7cb /include/net/xfrm.h
parent628e341f319f1a64a4639088faba952e4ec8f0a8 (diff)
xfrm: introduce helper for safe determination of mtu
skb->sk socket can be of AF_INET or AF_INET6 address family. Thus we always have to make sure we a referring to the correct interpretation of skb->sk. We only depend on header defines to query the mtu, so we don't introduce a new dependency to ipv6 by this change. Cc: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'include/net/xfrm.h')
-rw-r--r--include/net/xfrm.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index e823786e7c6..b41d2d10ff0 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -20,6 +20,7 @@
#include <net/route.h>
#include <net/ipv6.h>
#include <net/ip6_fib.h>
+#include <net/ip6_route.h>
#include <net/flow.h>
#include <linux/interrupt.h>
@@ -1723,4 +1724,15 @@ static inline int xfrm_mark_put(struct sk_buff *skb, const struct xfrm_mark *m)
return ret;
}
+static inline int xfrm_skb_dst_mtu(struct sk_buff *skb)
+{
+ struct sock *sk = skb->sk;
+
+ if (sk && sk->sk_family == AF_INET6)
+ return ip6_skb_dst_mtu(skb);
+ else if (sk && sk->sk_family == AF_INET)
+ return ip_skb_dst_mtu(skb);
+ return dst_mtu(skb_dst(skb));
+}
+
#endif /* _NET_XFRM_H */