提交 f1d2d284 编写于 作者: J Joe Hershberger

net: Remove static allocation for MAC address in PingSend()

Don't force ARP clients to return the MAC address if they don't care
(such as ping)
Signed-off-by: NJoe Hershberger <joe.hershberger@ni.com>
Acked-by: NMike Frysinger <vapier@gentoo.org>
上级 2c00e099
......@@ -170,7 +170,7 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
case ARPOP_REPLY: /* arp reply */
/* are we waiting for a reply */
if (!NetArpWaitPacketIP || !NetArpWaitPacketMAC)
if (!NetArpWaitPacketIP)
break;
#ifdef CONFIG_KEEP_SERVERADDR
......@@ -189,15 +189,16 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
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);
......
......@@ -40,22 +40,18 @@ static void set_icmp_header(uchar *pkt, IPaddr_t dest)
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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册