]> err.no Git - linux-2.6/blobdiff - net/ipv4/arp.c
[IPV6]: Remove unused code in ndisc_send_redirect().
[linux-2.6] / net / ipv4 / arp.c
index 5976c598cc4ba5e5cee2e7f089dc9cbd84f70a9a..efe01df8fc0ee1be88e2555ecbb2508647588eb7 100644 (file)
@@ -475,7 +475,7 @@ int arp_find(unsigned char *haddr, struct sk_buff *skb)
                return 1;
        }
 
-       paddr = ((struct rtable*)skb->dst)->rt_gateway;
+       paddr = skb->rtable->rt_gateway;
 
        if (arp_set_predefined(inet_addr_type(&init_net, paddr), haddr, paddr, dev))
                return 0;
@@ -558,8 +558,9 @@ static inline int arp_fwd_proxy(struct in_device *in_dev, struct rtable *rt)
  */
 struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
                           struct net_device *dev, __be32 src_ip,
-                          unsigned char *dest_hw, unsigned char *src_hw,
-                          unsigned char *target_hw)
+                          const unsigned char *dest_hw,
+                          const unsigned char *src_hw,
+                          const unsigned char *target_hw)
 {
        struct sk_buff *skb;
        struct arphdr *arp;
@@ -569,14 +570,13 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
         *      Allocate a buffer
         */
 
-       skb = alloc_skb(sizeof(struct arphdr)+ 2*(dev->addr_len+4)
-                               + LL_RESERVED_SPACE(dev), GFP_ATOMIC);
+       skb = alloc_skb(arp_hdr_len(dev) + LL_RESERVED_SPACE(dev), GFP_ATOMIC);
        if (skb == NULL)
                return NULL;
 
        skb_reserve(skb, LL_RESERVED_SPACE(dev));
        skb_reset_network_header(skb);
-       arp = (struct arphdr *) skb_put(skb,sizeof(struct arphdr) + 2*(dev->addr_len+4));
+       arp = (struct arphdr *) skb_put(skb, arp_hdr_len(dev));
        skb->dev = dev;
        skb->protocol = htons(ETH_P_ARP);
        if (src_hw == NULL)
@@ -672,8 +672,8 @@ void arp_xmit(struct sk_buff *skb)
  */
 void arp_send(int type, int ptype, __be32 dest_ip,
              struct net_device *dev, __be32 src_ip,
-             unsigned char *dest_hw, unsigned char *src_hw,
-             unsigned char *target_hw)
+             const unsigned char *dest_hw, const unsigned char *src_hw,
+             const unsigned char *target_hw)
 {
        struct sk_buff *skb;
 
@@ -814,7 +814,7 @@ static int arp_process(struct sk_buff *skb)
        if (arp->ar_op == htons(ARPOP_REQUEST) &&
            ip_route_input(skb, tip, sip, 0, dev) == 0) {
 
-               rt = (struct rtable*)skb->dst;
+               rt = skb->rtable;
                addr_type = rt->rt_type;
 
                if (addr_type == RTN_LOCAL) {
@@ -915,9 +915,7 @@ static int arp_rcv(struct sk_buff *skb, struct net_device *dev,
                goto freeskb;
 
        /* ARP header, plus 2 device addresses, plus 2 IP addresses.  */
-       if (!pskb_may_pull(skb, (sizeof(struct arphdr) +
-                                (2 * dev->addr_len) +
-                                (2 * sizeof(u32)))))
+       if (!pskb_may_pull(skb, arp_hdr_len(dev)))
                goto freeskb;
 
        arp = arp_hdr(skb);