]> err.no Git - linux-2.6/blobdiff - net/ipv4/icmp.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[linux-2.6] / net / ipv4 / icmp.c
index 4d70c21c50aaf70a174a7dfc2dd58d73d5d2f395..d38cbba92a4dddf62a7d53da29671ce0fa1896d7 100644 (file)
@@ -355,7 +355,7 @@ static void icmp_push_reply(struct icmp_bxm *icmp_param,
                           ipc, rt, MSG_DONTWAIT) < 0)
                ip_flush_pending_frames(icmp_socket->sk);
        else if ((skb = skb_peek(&icmp_socket->sk->sk_write_queue)) != NULL) {
-               struct icmphdr *icmph = skb->h.icmph;
+               struct icmphdr *icmph = icmp_hdr(skb);
                __wsum csum = 0;
                struct sk_buff *skb1;
 
@@ -450,7 +450,8 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
         */
        iph = ip_hdr(skb_in);
 
-       if ((u8 *)iph < skb_in->head || (u8 *)(iph + 1) > skb_in->tail)
+       if ((u8 *)iph < skb_in->head ||
+           (skb_in->network_header + sizeof(*iph)) > skb_in->tail)
                goto out;
 
        /*
@@ -613,7 +614,7 @@ static void icmp_unreach(struct sk_buff *skb)
        if (!pskb_may_pull(skb, sizeof(struct iphdr)))
                goto out_err;
 
-       icmph = skb->h.icmph;
+       icmph = icmp_hdr(skb);
        iph   = (struct iphdr *)skb->data;
 
        if (iph->ihl < 5) /* Mangled header, drop. */
@@ -743,7 +744,7 @@ static void icmp_redirect(struct sk_buff *skb)
 
        iph = (struct iphdr *)skb->data;
 
-       switch (skb->h.icmph->code & 7) {
+       switch (icmp_hdr(skb)->code & 7) {
        case ICMP_REDIR_NET:
        case ICMP_REDIR_NETTOS:
                /*
@@ -752,7 +753,7 @@ static void icmp_redirect(struct sk_buff *skb)
        case ICMP_REDIR_HOST:
        case ICMP_REDIR_HOSTTOS:
                ip_rt_redirect(ip_hdr(skb)->saddr, iph->daddr,
-                              skb->h.icmph->un.gateway,
+                              icmp_hdr(skb)->un.gateway,
                               iph->saddr, skb->dev);
                break;
        }
@@ -780,7 +781,7 @@ static void icmp_echo(struct sk_buff *skb)
        if (!sysctl_icmp_echo_ignore_all) {
                struct icmp_bxm icmp_param;
 
-               icmp_param.data.icmph      = *skb->h.icmph;
+               icmp_param.data.icmph      = *icmp_hdr(skb);
                icmp_param.data.icmph.type = ICMP_ECHOREPLY;
                icmp_param.skb             = skb;
                icmp_param.offset          = 0;
@@ -816,7 +817,7 @@ static void icmp_timestamp(struct sk_buff *skb)
        icmp_param.data.times[2] = icmp_param.data.times[1];
        if (skb_copy_bits(skb, 0, &icmp_param.data.times[0], 4))
                BUG();
-       icmp_param.data.icmph      = *skb->h.icmph;
+       icmp_param.data.icmph      = *icmp_hdr(skb);
        icmp_param.data.icmph.type = ICMP_TIMESTAMPREPLY;
        icmp_param.data.icmph.code = 0;
        icmp_param.skb             = skb;
@@ -943,7 +944,7 @@ int icmp_rcv(struct sk_buff *skb)
        if (!pskb_pull(skb, sizeof(struct icmphdr)))
                goto error;
 
-       icmph = skb->h.icmph;
+       icmph = icmp_hdr(skb);
 
        /*
         *      18 is the highest 'known' ICMP type. Anything else is a mystery