]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - net/rarp.c
Merge branch 'master' of git://git.denx.de/u-boot-nand-flash
[karo-tx-uboot.git] / net / rarp.c
index bd073c32a6dee6a71de82df6eeb33b1354e46023..49185b4e1472adf9d25172ee8ee7af43d703751f 100644 (file)
@@ -43,10 +43,10 @@ int RarpTry;
  */
 void rarp_receive(struct ip_udp_hdr *ip, unsigned len)
 {
-       ARP_t *arp;
+       struct arp_hdr *arp;
 
-       debug("Got RARP\n");
-       arp = (ARP_t *)ip;
+       debug_cond(DEBUG_NET_PKT, "Got RARP\n");
+       arp = (struct arp_hdr *)ip;
        if (len < ARP_HDR_SIZE) {
                printf("bad length %d < %d\n", len, ARP_HDR_SIZE);
                return;
@@ -63,7 +63,7 @@ void rarp_receive(struct ip_udp_hdr *ip, unsigned len)
                if (NetServerIP == 0)
                        NetCopyIP(&NetServerIP, &arp->ar_data[6]);
                memcpy(NetServerEther, &arp->ar_data[0], 6);
-               debug("Got good RARP\n");
+               debug_cond(DEBUG_DEV_PKT, "Got good RARP\n");
                net_auto_load();
        }
 }
@@ -87,14 +87,16 @@ static void RarpTimeout(void)
 void RarpRequest(void)
 {
        uchar *pkt;
-       ARP_t *rarp;
+       struct arp_hdr *rarp;
+       int eth_hdr_size;
 
        printf("RARP broadcast %d\n", ++RarpTry);
        pkt = NetTxPacket;
 
-       pkt += NetSetEther(pkt, NetBcastAddr, PROT_RARP);
+       eth_hdr_size = NetSetEther(pkt, NetBcastAddr, PROT_RARP);
+       pkt += eth_hdr_size;
 
-       rarp = (ARP_t *)pkt;
+       rarp = (struct arp_hdr *)pkt;
 
        rarp->ar_hrd = htons(ARP_ETHER);
        rarp->ar_pro = htons(PROT_IP);
@@ -108,7 +110,7 @@ void RarpRequest(void)
        /* dest IP addr set to broadcast */
        memset(&rarp->ar_data[16], 0xff,        4);
 
-       NetSendPacket(NetTxPacket, (pkt - NetTxPacket) + ARP_HDR_SIZE);
+       NetSendPacket(NetTxPacket, eth_hdr_size + ARP_HDR_SIZE);
 
        NetSetTimeout(TIMEOUT, RarpTimeout);
 }