fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / net / ipv4 / ipvs / ip_vs_xmit.c
index 204767b..e1f77bd 100644 (file)
@@ -52,6 +52,7 @@ __ip_vs_dst_check(struct ip_vs_dest *dest, u32 rtos, u32 cookie)
        if ((dst->obsolete || rtos != dest->dst_rtos) &&
            dst->ops->check(dst, cookie) == NULL) {
                dest->dst_cache = NULL;
+               dst_release(dst);
                return NULL;
        }
        dst_hold(dst);
@@ -124,10 +125,10 @@ ip_vs_dst_reset(struct ip_vs_dest *dest)
        dst_release(old_dst);
 }
 
-
 #define IP_VS_XMIT(skb, rt)                            \
 do {                                                   \
-       (skb)->nfcache |= NFC_IPVS_PROPERTY;            \
+       (skb)->ipvs_property = 1;                       \
+       (skb)->ip_summed = CHECKSUM_NONE;               \
        NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, (skb), NULL,  \
                (rt)->u.dst.dev, dst_output);           \
 } while (0)
@@ -176,7 +177,7 @@ ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
        }
 
        /* MTU checking */
-       mtu = dst_pmtu(&rt->u.dst);
+       mtu = dst_mtu(&rt->u.dst);
        if ((skb->len > mtu) && (iph->frag_off&__constant_htons(IP_DF))) {
                ip_rt_put(rt);
                icmp_send(skb, ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED, htonl(mtu));
@@ -201,9 +202,6 @@ ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
        /* Another hack: avoid icmp_send in ip_fragment */
        skb->local_df = 1;
 
-#ifdef CONFIG_NETFILTER_DEBUG
-       skb->nf_debug = 0;
-#endif /* CONFIG_NETFILTER_DEBUG */
        IP_VS_XMIT(skb, rt);
 
        LeaveFunction(10);
@@ -234,18 +232,19 @@ ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
 
        /* check if it is a connection of no-client-port */
        if (unlikely(cp->flags & IP_VS_CONN_F_NO_CPORT)) {
-               __u16 pt;
-               if (skb_copy_bits(skb, iph->ihl*4, &pt, sizeof(pt)) < 0)
+               __be16 _pt, *p;
+               p = skb_header_pointer(skb, iph->ihl*4, sizeof(_pt), &_pt);
+               if (p == NULL)
                        goto tx_error;
-               ip_vs_conn_fill_cport(cp, pt);
-               IP_VS_DBG(10, "filled cport=%d\n", ntohs(pt));
+               ip_vs_conn_fill_cport(cp, *p);
+               IP_VS_DBG(10, "filled cport=%d\n", ntohs(*p));
        }
 
        if (!(rt = __ip_vs_get_out_rt(cp, RT_TOS(iph->tos))))
                goto tx_error_icmp;
 
        /* MTU checking */
-       mtu = dst_pmtu(&rt->u.dst);
+       mtu = dst_mtu(&rt->u.dst);
        if ((skb->len > mtu) && (iph->frag_off&__constant_htons(IP_DF))) {
                ip_rt_put(rt);
                icmp_send(skb, ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED, htonl(mtu));
@@ -279,9 +278,6 @@ ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
        /* Another hack: avoid icmp_send in ip_fragment */
        skb->local_df = 1;
 
-#ifdef CONFIG_NETFILTER_DEBUG
-       skb->nf_debug = 0;
-#endif /* CONFIG_NETFILTER_DEBUG */
        IP_VS_XMIT(skb, rt);
 
        LeaveFunction(10);
@@ -326,7 +322,7 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
        struct net_device *tdev;                /* Device to other host */
        struct iphdr  *old_iph = skb->nh.iph;
        u8     tos = old_iph->tos;
-       u16    df = old_iph->frag_off;
+       __be16 df = old_iph->frag_off;
        struct iphdr  *iph;                     /* Our new IP header */
        int    max_headroom;                    /* The extra header space needed */
        int    mtu;
@@ -345,7 +341,7 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
 
        tdev = rt->u.dst.dev;
 
-       mtu = dst_pmtu(&rt->u.dst) - sizeof(struct iphdr);
+       mtu = dst_mtu(&rt->u.dst) - sizeof(struct iphdr);
        if (mtu < 68) {
                ip_rt_put(rt);
                IP_VS_DBG_RL("ip_vs_tunnel_xmit(): mtu less than 68\n");
@@ -412,15 +408,9 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
        ip_select_ident(iph, &rt->u.dst, NULL);
        ip_send_check(iph);
 
-       skb->ip_summed = CHECKSUM_NONE;
-
        /* Another hack: avoid icmp_send in ip_fragment */
        skb->local_df = 1;
 
-#ifdef CONFIG_NETFILTER_DEBUG
-       skb->nf_debug = 0;
-#endif /* CONFIG_NETFILTER_DEBUG */
-
        IP_VS_XMIT(skb, rt);
 
        LeaveFunction(10);
@@ -454,7 +444,7 @@ ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
                goto tx_error_icmp;
 
        /* MTU checking */
-       mtu = dst_pmtu(&rt->u.dst);
+       mtu = dst_mtu(&rt->u.dst);
        if ((iph->frag_off&__constant_htons(IP_DF)) && skb->len > mtu) {
                icmp_send(skb, ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED, htonl(mtu));
                ip_rt_put(rt);
@@ -479,9 +469,6 @@ ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
        /* Another hack: avoid icmp_send in ip_fragment */
        skb->local_df = 1;
 
-#ifdef CONFIG_NETFILTER_DEBUG
-       skb->nf_debug = 0;
-#endif /* CONFIG_NETFILTER_DEBUG */
        IP_VS_XMIT(skb, rt);
 
        LeaveFunction(10);
@@ -520,7 +507,6 @@ ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
                        rc = NF_ACCEPT;
                /* do not touch skb anymore */
                atomic_inc(&cp->in_pkts);
-               __ip_vs_conn_put(cp);
                goto out;
        }
 
@@ -532,7 +518,7 @@ ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
                goto tx_error_icmp;
 
        /* MTU checking */
-       mtu = dst_pmtu(&rt->u.dst);
+       mtu = dst_mtu(&rt->u.dst);
        if ((skb->len > mtu) && (skb->nh.iph->frag_off&__constant_htons(IP_DF))) {
                ip_rt_put(rt);
                icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu));
@@ -556,9 +542,6 @@ ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
        /* Another hack: avoid icmp_send in ip_fragment */
        skb->local_df = 1;
 
-#ifdef CONFIG_NETFILTER_DEBUG
-       skb->nf_debug = 0;
-#endif /* CONFIG_NETFILTER_DEBUG */
        IP_VS_XMIT(skb, rt);
 
        rc = NF_STOLEN;