case ARPOP_REPLY: /* arp reply */
/* are we waiting for a reply */
- if (!NetArpWaitPacketIP || !NetArpWaitPacketMAC)
+ if (!NetArpWaitPacketIP)
break;
#ifdef CONFIG_KEEP_SERVERADDR
arp->ar_data);
/* save address for later use */
- memcpy(NetArpWaitPacketMAC,
- &arp->ar_sha, ARP_HLEN);
+ if (NetArpWaitPacketMAC != NULL)
+ memcpy(NetArpWaitPacketMAC,
+ &arp->ar_sha, ARP_HLEN);
net_get_arp_handler()((uchar *)arp, 0, reply_ip_addr,
0, len);
/* modify header, and transmit it */
memcpy(((struct ethernet_hdr *)NetArpWaitTxPacket)->
- et_dest, NetArpWaitPacketMAC, ARP_HLEN);
+ et_dest, &arp->ar_sha, ARP_HLEN);
NetSendPacket(NetArpWaitTxPacket,
NetArpWaitTxPacketSize);
static int ping_send(void)
{
- static uchar mac[6];
uchar *pkt;
int eth_hdr_size;
/* XXX always send arp request */
- memcpy(mac, NetEtherNullAddr, 6);
-
debug("sending ARP for %pI4\n", &NetPingIP);
NetArpWaitPacketIP = NetPingIP;
- NetArpWaitPacketMAC = mac;
- pkt = NetArpWaitTxPacket;
- eth_hdr_size = NetSetEther(pkt, mac, PROT_IP);
- pkt += eth_hdr_size;
+ eth_hdr_size = NetSetEther(NetArpWaitTxPacket, NetEtherNullAddr,
+ PROT_IP);
+ pkt = NetArpWaitTxPacket + eth_hdr_size;
set_icmp_header(pkt, NetPingIP);