]> git.neil.brown.name Git - history.git/commitdiff
[IPSEC]: Move xfrm[46]_tunnel_check_size into xfrm[46]_output.c
authorHerbert Xu <herbert@gondor.apana.org.au>
Mon, 2 Aug 2004 10:04:02 +0000 (03:04 -0700)
committerDavid S. Miller <davem@nuts.davemloft.net>
Mon, 2 Aug 2004 10:04:02 +0000 (03:04 -0700)
This patch moves xfrm[46]_tunnel_check_size() into xfrm[46]_output.c
where it can be made static since it's only used there.

While moving the icmp.h inclusions over I also discovered that the
tunnel files are missing an inclusion of net/protocol.h.  So I've
added them as well.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@redhat.com>
include/net/xfrm.h
net/ipv4/xfrm4_output.c
net/ipv4/xfrm4_tunnel.c
net/ipv6/xfrm6_output.c
net/ipv6/xfrm6_tunnel.c
net/xfrm/xfrm_export.c

index 493b7237f68d4ce0f3dc01b7551c8a3e22a5d8ae..aaf74999a1f3ff5dcd2d046c50f103812661f1d1 100644 (file)
@@ -821,11 +821,9 @@ extern int xfrm4_rcv(struct sk_buff *skb);
 extern int xfrm4_output(struct sk_buff **pskb);
 extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler);
 extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler);
-extern int xfrm4_tunnel_check_size(struct sk_buff *skb);
 extern int xfrm6_rcv(struct sk_buff **pskb, unsigned int *nhoffp);
 extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler);
 extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler);
-extern int xfrm6_tunnel_check_size(struct sk_buff *skb);
 extern u32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr);
 extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr);
 extern u32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr);
index f65ec865a9a68dbfbcb10fbf42dc29d1941e759c..191cec718e95ac55cff60acfc16ca2b055e62f15 100644 (file)
@@ -13,6 +13,7 @@
 #include <net/inet_ecn.h>
 #include <net/ip.h>
 #include <net/xfrm.h>
+#include <net/icmp.h>
 
 /* Add encapsulation header.
  *
@@ -67,6 +68,30 @@ static void xfrm4_encap(struct sk_buff *skb)
        memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
 }
 
+static int xfrm4_tunnel_check_size(struct sk_buff *skb)
+{
+       int mtu, ret = 0;
+       struct dst_entry *dst;
+       struct iphdr *iph = skb->nh.iph;
+
+       if (IPCB(skb)->flags & IPSKB_XFRM_TUNNEL_SIZE)
+               goto out;
+
+       IPCB(skb)->flags |= IPSKB_XFRM_TUNNEL_SIZE;
+       
+       if (!(iph->frag_off & htons(IP_DF)))
+               goto out;
+
+       dst = skb->dst;
+       mtu = dst_pmtu(dst) - dst->header_len - dst->trailer_len;
+       if (skb->len > mtu) {
+               icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu));
+               ret = -EMSGSIZE;
+       }
+out:
+       return ret;
+}
+
 int xfrm4_output(struct sk_buff **pskb)
 {
        struct sk_buff *skb = *pskb;
index 710a281bac710d4676cab5fd5be565cb989e10d9..0d1a0b0c7901265a7b76823365435aed1b6bd286 100644 (file)
@@ -6,31 +6,7 @@
 #include <linux/skbuff.h>
 #include <net/xfrm.h>
 #include <net/ip.h>
-#include <net/icmp.h>
-
-int xfrm4_tunnel_check_size(struct sk_buff *skb)
-{
-       int mtu, ret = 0;
-       struct dst_entry *dst;
-       struct iphdr *iph = skb->nh.iph;
-
-       if (IPCB(skb)->flags & IPSKB_XFRM_TUNNEL_SIZE)
-               goto out;
-
-       IPCB(skb)->flags |= IPSKB_XFRM_TUNNEL_SIZE;
-       
-       if (!(iph->frag_off & htons(IP_DF)))
-               goto out;
-
-       dst = skb->dst;
-       mtu = dst_pmtu(dst) - dst->header_len - dst->trailer_len;
-       if (skb->len > mtu) {
-               icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu));
-               ret = -EMSGSIZE;
-       }
-out:
-       return ret;
-}
+#include <net/protocol.h>
 
 static int ipip_output(struct sk_buff **pskb)
 {
index 028c9dd96bebe5b5fec936ed2471772d9d387cba..712856f0f3569957cde3a72498554012f4e9dc55 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <linux/skbuff.h>
 #include <linux/spinlock.h>
+#include <linux/icmpv6.h>
 #include <net/inet_ecn.h>
 #include <net/ipv6.h>
 #include <net/xfrm.h>
@@ -68,6 +69,23 @@ static void xfrm6_encap(struct sk_buff *skb)
        ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr);
 }
 
+static int xfrm6_tunnel_check_size(struct sk_buff *skb)
+{
+       int mtu, ret = 0;
+       struct dst_entry *dst = skb->dst;
+
+       mtu = dst_pmtu(dst) - sizeof(struct ipv6hdr);
+       if (mtu < IPV6_MIN_MTU)
+               mtu = IPV6_MIN_MTU;
+
+       if (skb->len > mtu) {
+               icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev);
+               ret = -EMSGSIZE;
+       }
+
+       return ret;
+}
+
 int xfrm6_output(struct sk_buff **pskb)
 {
        struct sk_buff *skb = *pskb;
index d35c87ff83ddff0f4f6c6aaf6a36aaf234164e89..5766a133411a358a2427c74ab107f370f1d4a1ec 100644 (file)
@@ -27,8 +27,8 @@
 #include <linux/list.h>
 #include <net/ip.h>
 #include <net/xfrm.h>
-#include <net/icmp.h>
 #include <net/ipv6.h>
+#include <net/protocol.h>
 #include <linux/ipv6.h>
 #include <linux/icmpv6.h>
 
@@ -343,25 +343,6 @@ void xfrm6_tunnel_free_spi(xfrm_address_t *saddr)
 
 EXPORT_SYMBOL(xfrm6_tunnel_free_spi);
 
-int xfrm6_tunnel_check_size(struct sk_buff *skb)
-{
-       int mtu, ret = 0;
-       struct dst_entry *dst = skb->dst;
-
-       mtu = dst_pmtu(dst) - sizeof(struct ipv6hdr);
-       if (mtu < IPV6_MIN_MTU)
-               mtu = IPV6_MIN_MTU;
-
-       if (skb->len > mtu) {
-               icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev);
-               ret = -EMSGSIZE;
-       }
-
-       return ret;
-}
-
-EXPORT_SYMBOL(xfrm6_tunnel_check_size);
-
 static int xfrm6_tunnel_output(struct sk_buff **pskb)
 {
        struct sk_buff *skb = *pskb;
index e77179ccf742d1c07c477c50db86501ac7f1db37..f72754953d2976811f4ed91ac3c6634715d630b2 100644 (file)
@@ -35,7 +35,6 @@ EXPORT_SYMBOL(xfrm_parse_spi);
 EXPORT_SYMBOL(xfrm4_rcv);
 EXPORT_SYMBOL(xfrm4_tunnel_register);
 EXPORT_SYMBOL(xfrm4_tunnel_deregister);
-EXPORT_SYMBOL(xfrm4_tunnel_check_size);
 EXPORT_SYMBOL(xfrm_register_type);
 EXPORT_SYMBOL(xfrm_unregister_type);
 EXPORT_SYMBOL(xfrm_get_type);