[NETFILTER]: Introduce NF_INET_ hook values
[safe/jmp/linux-2.6] / net / ipv4 / ipvs / ip_vs_xmit.c
index d1403d0..1e96bf8 100644 (file)
@@ -16,8 +16,8 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/ip.h>
 #include <linux/tcp.h>                  /* for tcphdr */
+#include <net/ip.h>
 #include <net/tcp.h>                    /* for csum_tcpudp_magic */
 #include <net/udp.h>
 #include <net/icmp.h>                   /* for icmp_send */
@@ -128,8 +128,8 @@ ip_vs_dst_reset(struct ip_vs_dest *dest)
 #define IP_VS_XMIT(skb, rt)                            \
 do {                                                   \
        (skb)->ipvs_property = 1;                       \
-       (skb)->ip_summed = CHECKSUM_NONE;               \
-       NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, (skb), NULL,  \
+       skb_forward_csum(skb);                          \
+       NF_HOOK(PF_INET, NF_INET_LOCAL_OUT, (skb), NULL,        \
                (rt)->u.dst.dev, dst_output);           \
 } while (0)
 
@@ -156,7 +156,7 @@ ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
                  struct ip_vs_protocol *pp)
 {
        struct rtable *rt;                      /* Route to the other host */
-       struct iphdr  *iph = skb->nh.iph;
+       struct iphdr  *iph = ip_hdr(skb);
        u8     tos = iph->tos;
        int    mtu;
        struct flowi fl = {
@@ -193,7 +193,7 @@ ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
                ip_rt_put(rt);
                return NF_STOLEN;
        }
-       ip_send_check(skb->nh.iph);
+       ip_send_check(ip_hdr(skb));
 
        /* drop old route */
        dst_release(skb->dst);
@@ -226,7 +226,7 @@ ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
 {
        struct rtable *rt;              /* Route to the other host */
        int mtu;
-       struct iphdr *iph = skb->nh.iph;
+       struct iphdr *iph = ip_hdr(skb);
 
        EnterFunction(10);
 
@@ -253,7 +253,7 @@ ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
        }
 
        /* copy-on-write the packet before mangling it */
-       if (!ip_vs_make_skb_writable(&skb, sizeof(struct iphdr)))
+       if (!skb_make_writable(skb, sizeof(struct iphdr)))
                goto tx_error_put;
 
        if (skb_cow(skb, rt->u.dst.dev->hard_header_len))
@@ -264,10 +264,10 @@ ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
        skb->dst = &rt->u.dst;
 
        /* mangle the packet */
-       if (pp->dnat_handler && !pp->dnat_handler(&skb, pp, cp))
+       if (pp->dnat_handler && !pp->dnat_handler(skb, pp, cp))
                goto tx_error;
-       skb->nh.iph->daddr = cp->daddr;
-       ip_send_check(skb->nh.iph);
+       ip_hdr(skb)->daddr = cp->daddr;
+       ip_send_check(ip_hdr(skb));
 
        IP_VS_DBG_PKT(10, pp, skb, 0, "After DNAT");
 
@@ -320,11 +320,12 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
 {
        struct rtable *rt;                      /* Route to the other host */
        struct net_device *tdev;                /* Device to other host */
-       struct iphdr  *old_iph = skb->nh.iph;
+       struct iphdr  *old_iph = ip_hdr(skb);
        u8     tos = old_iph->tos;
        __be16 df = old_iph->frag_off;
+       sk_buff_data_t old_transport_header = skb->transport_header;
        struct iphdr  *iph;                     /* Our new IP header */
-       int    max_headroom;                    /* The extra header space needed */
+       unsigned int max_headroom;              /* The extra header space needed */
        int    mtu;
 
        EnterFunction(10);
@@ -377,10 +378,10 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
                }
                kfree_skb(skb);
                skb = new_skb;
-               old_iph = skb->nh.iph;
+               old_iph = ip_hdr(skb);
        }
 
-       skb->h.raw = (void *) old_iph;
+       skb->transport_header = old_transport_header;
 
        /* fix old IP header checksum */
        ip_send_check(old_iph);
@@ -396,7 +397,7 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
        /*
         *      Push down and install the IPIP header.
         */
-       iph                     =       skb->nh.iph;
+       iph                     =       ip_hdr(skb);
        iph->version            =       4;
        iph->ihl                =       sizeof(struct iphdr)>>2;
        iph->frag_off           =       df;
@@ -405,14 +406,12 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
        iph->daddr              =       rt->rt_dst;
        iph->saddr              =       rt->rt_src;
        iph->ttl                =       old_iph->ttl;
-       iph->tot_len            =       htons(skb->len);
        ip_select_ident(iph, &rt->u.dst, NULL);
-       ip_send_check(iph);
 
        /* Another hack: avoid icmp_send in ip_fragment */
        skb->local_df = 1;
 
-       IP_VS_XMIT(skb, rt);
+       ip_local_out(skb);
 
        LeaveFunction(10);
 
@@ -436,7 +435,7 @@ ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
              struct ip_vs_protocol *pp)
 {
        struct rtable *rt;                      /* Route to the other host */
-       struct iphdr  *iph = skb->nh.iph;
+       struct iphdr  *iph = ip_hdr(skb);
        int    mtu;
 
        EnterFunction(10);
@@ -461,7 +460,7 @@ ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
                ip_rt_put(rt);
                return NF_STOLEN;
        }
-       ip_send_check(skb->nh.iph);
+       ip_send_check(ip_hdr(skb));
 
        /* drop old route */
        dst_release(skb->dst);
@@ -515,12 +514,12 @@ ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
         * mangle and send the packet here (only for VS/NAT)
         */
 
-       if (!(rt = __ip_vs_get_out_rt(cp, RT_TOS(skb->nh.iph->tos))))
+       if (!(rt = __ip_vs_get_out_rt(cp, RT_TOS(ip_hdr(skb)->tos))))
                goto tx_error_icmp;
 
        /* MTU checking */
        mtu = dst_mtu(&rt->u.dst);
-       if ((skb->len > mtu) && (skb->nh.iph->frag_off & htons(IP_DF))) {
+       if ((skb->len > mtu) && (ip_hdr(skb)->frag_off & htons(IP_DF))) {
                ip_rt_put(rt);
                icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu));
                IP_VS_DBG_RL("ip_vs_in_icmp(): frag needed\n");
@@ -528,7 +527,7 @@ ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
        }
 
        /* copy-on-write the packet before mangling it */
-       if (!ip_vs_make_skb_writable(&skb, offset))
+       if (!skb_make_writable(skb, offset))
                goto tx_error_put;
 
        if (skb_cow(skb, rt->u.dst.dev->hard_header_len))