Tom Rini | 70df9d6 | 2018-05-07 17:02:21 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copied from Linux Monitor (LiMon) - Networking. |
| 4 | * |
| 5 | * Copyright 1994 - 2000 Neil Russell. |
| 6 | * (See License) |
| 7 | * Copyright 2000 Roland Borde |
| 8 | * Copyright 2000 Paolo Scaffardi |
| 9 | * Copyright 2000-2002 Wolfgang Denk, wd@denx.de |
| 10 | */ |
| 11 | |
| 12 | #include <common.h> |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 13 | #include <env.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 14 | #include <log.h> |
Simon Glass | 274e0b0 | 2020-05-10 11:39:56 -0600 | [diff] [blame] | 15 | #include <net.h> |
Simon Glass | dbd7954 | 2020-05-10 11:40:11 -0600 | [diff] [blame] | 16 | #include <linux/delay.h> |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 17 | |
| 18 | #include "arp.h" |
| 19 | |
| 20 | #ifndef CONFIG_ARP_TIMEOUT |
| 21 | /* Milliseconds before trying ARP again */ |
| 22 | # define ARP_TIMEOUT 5000UL |
| 23 | #else |
| 24 | # define ARP_TIMEOUT CONFIG_ARP_TIMEOUT |
| 25 | #endif |
| 26 | |
| 27 | |
| 28 | #ifndef CONFIG_NET_RETRY_COUNT |
| 29 | # define ARP_TIMEOUT_COUNT 5 /* # of timeouts before giving up */ |
| 30 | #else |
| 31 | # define ARP_TIMEOUT_COUNT CONFIG_NET_RETRY_COUNT |
| 32 | #endif |
| 33 | |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 34 | struct in_addr net_arp_wait_packet_ip; |
| 35 | static struct in_addr net_arp_wait_reply_ip; |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 36 | /* MAC address of waiting packet's destination */ |
Joe Hershberger | 85ae776 | 2015-04-08 01:41:08 -0500 | [diff] [blame] | 37 | uchar *arp_wait_packet_ethaddr; |
| 38 | int arp_wait_tx_packet_size; |
| 39 | ulong arp_wait_timer_start; |
| 40 | int arp_wait_try; |
Joe Hershberger | e79a518 | 2018-09-26 16:49:02 -0500 | [diff] [blame] | 41 | uchar *arp_tx_packet; /* THE ARP transmit packet */ |
Joe Hershberger | 85ae776 | 2015-04-08 01:41:08 -0500 | [diff] [blame] | 42 | static uchar arp_tx_packet_buf[PKTSIZE_ALIGN + PKTALIGN]; |
Joe Hershberger | de8205a | 2012-05-23 07:59:24 +0000 | [diff] [blame] | 43 | |
Joe Hershberger | 85ae776 | 2015-04-08 01:41:08 -0500 | [diff] [blame] | 44 | void arp_init(void) |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 45 | { |
| 46 | /* XXX problem with bss workaround */ |
Joe Hershberger | 85ae776 | 2015-04-08 01:41:08 -0500 | [diff] [blame] | 47 | arp_wait_packet_ethaddr = NULL; |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 48 | net_arp_wait_packet_ip.s_addr = 0; |
| 49 | net_arp_wait_reply_ip.s_addr = 0; |
Joe Hershberger | 85ae776 | 2015-04-08 01:41:08 -0500 | [diff] [blame] | 50 | arp_wait_tx_packet_size = 0; |
| 51 | arp_tx_packet = &arp_tx_packet_buf[0] + (PKTALIGN - 1); |
| 52 | arp_tx_packet -= (ulong)arp_tx_packet % PKTALIGN; |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 53 | } |
| 54 | |
Joe Hershberger | 85ae776 | 2015-04-08 01:41:08 -0500 | [diff] [blame] | 55 | void arp_raw_request(struct in_addr source_ip, const uchar *target_ethaddr, |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 56 | struct in_addr target_ip) |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 57 | { |
| 58 | uchar *pkt; |
Joe Hershberger | de15d093 | 2012-05-23 07:58:08 +0000 | [diff] [blame] | 59 | struct arp_hdr *arp; |
Joe Hershberger | f7ea805 | 2012-05-23 07:59:09 +0000 | [diff] [blame] | 60 | int eth_hdr_size; |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 61 | |
Joe Hershberger | 85ae776 | 2015-04-08 01:41:08 -0500 | [diff] [blame] | 62 | debug_cond(DEBUG_DEV_PKT, "ARP broadcast %d\n", arp_wait_try); |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 63 | |
Joe Hershberger | 85ae776 | 2015-04-08 01:41:08 -0500 | [diff] [blame] | 64 | pkt = arp_tx_packet; |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 65 | |
Joe Hershberger | a8ca4f6 | 2015-04-08 01:41:05 -0500 | [diff] [blame] | 66 | eth_hdr_size = net_set_ether(pkt, net_bcast_ethaddr, PROT_ARP); |
Joe Hershberger | f7ea805 | 2012-05-23 07:59:09 +0000 | [diff] [blame] | 67 | pkt += eth_hdr_size; |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 68 | |
Joe Hershberger | 85ae776 | 2015-04-08 01:41:08 -0500 | [diff] [blame] | 69 | arp = (struct arp_hdr *)pkt; |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 70 | |
| 71 | arp->ar_hrd = htons(ARP_ETHER); |
| 72 | arp->ar_pro = htons(PROT_IP); |
Joe Hershberger | 2f78749 | 2012-05-23 07:58:17 +0000 | [diff] [blame] | 73 | arp->ar_hln = ARP_HLEN; |
| 74 | arp->ar_pln = ARP_PLEN; |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 75 | arp->ar_op = htons(ARPOP_REQUEST); |
| 76 | |
Joe Hershberger | 8ecdbed | 2015-04-08 01:41:04 -0500 | [diff] [blame] | 77 | memcpy(&arp->ar_sha, net_ethaddr, ARP_HLEN); /* source ET addr */ |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 78 | net_write_ip(&arp->ar_spa, source_ip); /* source IP addr */ |
Joe Hershberger | 85ae776 | 2015-04-08 01:41:08 -0500 | [diff] [blame] | 79 | memcpy(&arp->ar_tha, target_ethaddr, ARP_HLEN); /* target ET addr */ |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 80 | net_write_ip(&arp->ar_tpa, target_ip); /* target IP addr */ |
Joe Hershberger | c07e810 | 2012-05-23 08:00:11 +0000 | [diff] [blame] | 81 | |
Joe Hershberger | 85ae776 | 2015-04-08 01:41:08 -0500 | [diff] [blame] | 82 | net_send_packet(arp_tx_packet, eth_hdr_size + ARP_HDR_SIZE); |
Joe Hershberger | c07e810 | 2012-05-23 08:00:11 +0000 | [diff] [blame] | 83 | } |
| 84 | |
Joe Hershberger | 85ae776 | 2015-04-08 01:41:08 -0500 | [diff] [blame] | 85 | void arp_request(void) |
Joe Hershberger | c07e810 | 2012-05-23 08:00:11 +0000 | [diff] [blame] | 86 | { |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 87 | if ((net_arp_wait_packet_ip.s_addr & net_netmask.s_addr) != |
| 88 | (net_ip.s_addr & net_netmask.s_addr)) { |
| 89 | if (net_gateway.s_addr == 0) { |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 90 | puts("## Warning: gatewayip needed but not set\n"); |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 91 | net_arp_wait_reply_ip = net_arp_wait_packet_ip; |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 92 | } else { |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 93 | net_arp_wait_reply_ip = net_gateway; |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 94 | } |
| 95 | } else { |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 96 | net_arp_wait_reply_ip = net_arp_wait_packet_ip; |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 97 | } |
| 98 | |
Joe Hershberger | 8ecdbed | 2015-04-08 01:41:04 -0500 | [diff] [blame] | 99 | arp_raw_request(net_ip, net_null_ethaddr, net_arp_wait_reply_ip); |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 100 | } |
| 101 | |
Stefan BrĂ¼ns | cc97ead | 2015-08-30 17:46:54 +0200 | [diff] [blame] | 102 | int arp_timeout_check(void) |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 103 | { |
| 104 | ulong t; |
| 105 | |
Joe Hershberger | 5641f67 | 2018-09-26 16:48:58 -0500 | [diff] [blame] | 106 | if (!arp_is_waiting()) |
Stefan BrĂ¼ns | cc97ead | 2015-08-30 17:46:54 +0200 | [diff] [blame] | 107 | return 0; |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 108 | |
| 109 | t = get_timer(0); |
| 110 | |
| 111 | /* check for arp timeout */ |
Joe Hershberger | 85ae776 | 2015-04-08 01:41:08 -0500 | [diff] [blame] | 112 | if ((t - arp_wait_timer_start) > ARP_TIMEOUT) { |
| 113 | arp_wait_try++; |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 114 | |
Joe Hershberger | 85ae776 | 2015-04-08 01:41:08 -0500 | [diff] [blame] | 115 | if (arp_wait_try >= ARP_TIMEOUT_COUNT) { |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 116 | puts("\nARP Retry count exceeded; starting again\n"); |
Joe Hershberger | 85ae776 | 2015-04-08 01:41:08 -0500 | [diff] [blame] | 117 | arp_wait_try = 0; |
Stefan BrĂ¼ns | 86f1fe4 | 2015-08-30 17:46:43 +0200 | [diff] [blame] | 118 | net_set_state(NETLOOP_FAIL); |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 119 | } else { |
Joe Hershberger | 85ae776 | 2015-04-08 01:41:08 -0500 | [diff] [blame] | 120 | arp_wait_timer_start = t; |
| 121 | arp_request(); |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 122 | } |
| 123 | } |
Stefan BrĂ¼ns | cc97ead | 2015-08-30 17:46:54 +0200 | [diff] [blame] | 124 | return 1; |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 125 | } |
| 126 | |
Joe Hershberger | 85ae776 | 2015-04-08 01:41:08 -0500 | [diff] [blame] | 127 | void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len) |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 128 | { |
Joe Hershberger | de15d093 | 2012-05-23 07:58:08 +0000 | [diff] [blame] | 129 | struct arp_hdr *arp; |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 130 | struct in_addr reply_ip_addr; |
Joe Hershberger | f7ea805 | 2012-05-23 07:59:09 +0000 | [diff] [blame] | 131 | int eth_hdr_size; |
Joe Hershberger | e79a518 | 2018-09-26 16:49:02 -0500 | [diff] [blame] | 132 | uchar *tx_packet; |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 133 | |
| 134 | /* |
| 135 | * We have to deal with two types of ARP packets: |
| 136 | * - REQUEST packets will be answered by sending our |
| 137 | * IP address - if we know it. |
| 138 | * - REPLY packates are expected only after we asked |
| 139 | * for the TFTP server's or the gateway's ethernet |
| 140 | * address; so if we receive such a packet, we set |
| 141 | * the server ethernet address |
| 142 | */ |
Joe Hershberger | 05a377b | 2012-05-23 08:01:04 +0000 | [diff] [blame] | 143 | debug_cond(DEBUG_NET_PKT, "Got ARP\n"); |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 144 | |
Joe Hershberger | de15d093 | 2012-05-23 07:58:08 +0000 | [diff] [blame] | 145 | arp = (struct arp_hdr *)ip; |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 146 | if (len < ARP_HDR_SIZE) { |
| 147 | printf("bad length %d < %d\n", len, ARP_HDR_SIZE); |
| 148 | return; |
| 149 | } |
| 150 | if (ntohs(arp->ar_hrd) != ARP_ETHER) |
| 151 | return; |
| 152 | if (ntohs(arp->ar_pro) != PROT_IP) |
| 153 | return; |
Joe Hershberger | 2f78749 | 2012-05-23 07:58:17 +0000 | [diff] [blame] | 154 | if (arp->ar_hln != ARP_HLEN) |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 155 | return; |
Joe Hershberger | 2f78749 | 2012-05-23 07:58:17 +0000 | [diff] [blame] | 156 | if (arp->ar_pln != ARP_PLEN) |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 157 | return; |
| 158 | |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 159 | if (net_ip.s_addr == 0) |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 160 | return; |
| 161 | |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 162 | if (net_read_ip(&arp->ar_tpa).s_addr != net_ip.s_addr) |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 163 | return; |
| 164 | |
| 165 | switch (ntohs(arp->ar_op)) { |
| 166 | case ARPOP_REQUEST: |
| 167 | /* reply with our IP address */ |
Joe Hershberger | 05a377b | 2012-05-23 08:01:04 +0000 | [diff] [blame] | 168 | debug_cond(DEBUG_DEV_PKT, "Got ARP REQUEST, return our IP\n"); |
Joe Hershberger | 530cd6b | 2012-05-23 07:59:16 +0000 | [diff] [blame] | 169 | eth_hdr_size = net_update_ether(et, et->et_src, PROT_ARP); |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 170 | arp->ar_op = htons(ARPOP_REPLY); |
Joe Hershberger | 2f78749 | 2012-05-23 07:58:17 +0000 | [diff] [blame] | 171 | memcpy(&arp->ar_tha, &arp->ar_sha, ARP_HLEN); |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 172 | net_copy_ip(&arp->ar_tpa, &arp->ar_spa); |
Joe Hershberger | 8ecdbed | 2015-04-08 01:41:04 -0500 | [diff] [blame] | 173 | memcpy(&arp->ar_sha, net_ethaddr, ARP_HLEN); |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 174 | net_copy_ip(&arp->ar_spa, &net_ip); |
Joe Hershberger | 39048f6 | 2012-05-23 08:00:13 +0000 | [diff] [blame] | 175 | |
| 176 | #ifdef CONFIG_CMD_LINK_LOCAL |
| 177 | /* |
| 178 | * Work-around for brain-damaged Cisco equipment with |
| 179 | * arp-proxy enabled. |
| 180 | * |
| 181 | * If the requesting IP is not on our subnet, wait 5ms to |
| 182 | * reply to ARP request so that our reply will overwrite |
| 183 | * the arp-proxy's instead of the other way around. |
| 184 | */ |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 185 | if ((net_read_ip(&arp->ar_tpa).s_addr & net_netmask.s_addr) != |
| 186 | (net_read_ip(&arp->ar_spa).s_addr & net_netmask.s_addr)) |
Joe Hershberger | 39048f6 | 2012-05-23 08:00:13 +0000 | [diff] [blame] | 187 | udelay(5000); |
| 188 | #endif |
Joe Hershberger | e79a518 | 2018-09-26 16:49:02 -0500 | [diff] [blame] | 189 | tx_packet = net_get_async_tx_pkt_buf(); |
| 190 | memcpy(tx_packet, et, eth_hdr_size + ARP_HDR_SIZE); |
| 191 | net_send_packet(tx_packet, eth_hdr_size + ARP_HDR_SIZE); |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 192 | return; |
| 193 | |
| 194 | case ARPOP_REPLY: /* arp reply */ |
Joe Hershberger | 5641f67 | 2018-09-26 16:48:58 -0500 | [diff] [blame] | 195 | /* are we waiting for a reply? */ |
| 196 | if (!arp_is_waiting()) |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 197 | break; |
| 198 | |
Simon Glass | cc041b6 | 2021-12-18 11:27:48 -0700 | [diff] [blame^] | 199 | if (IS_ENABLED(CONFIG_KEEP_SERVERADDR) && |
| 200 | net_server_ip.s_addr == net_arp_wait_packet_ip.s_addr) { |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 201 | char buf[20]; |
Mike Frysinger | dc36a6a | 2012-07-10 00:41:50 +0000 | [diff] [blame] | 202 | sprintf(buf, "%pM", &arp->ar_sha); |
Simon Glass | 6a38e41 | 2017-08-03 12:22:09 -0600 | [diff] [blame] | 203 | env_set("serveraddr", buf); |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 204 | } |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 205 | |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 206 | reply_ip_addr = net_read_ip(&arp->ar_spa); |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 207 | |
| 208 | /* matched waiting packet's address */ |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 209 | if (reply_ip_addr.s_addr == net_arp_wait_reply_ip.s_addr) { |
Joe Hershberger | 05a377b | 2012-05-23 08:01:04 +0000 | [diff] [blame] | 210 | debug_cond(DEBUG_DEV_PKT, |
Joe Hershberger | 85ae776 | 2015-04-08 01:41:08 -0500 | [diff] [blame] | 211 | "Got ARP REPLY, set eth addr (%pM)\n", |
| 212 | arp->ar_data); |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 213 | |
| 214 | /* save address for later use */ |
Joe Hershberger | 85ae776 | 2015-04-08 01:41:08 -0500 | [diff] [blame] | 215 | if (arp_wait_packet_ethaddr != NULL) |
| 216 | memcpy(arp_wait_packet_ethaddr, |
Joe Hershberger | e96624a | 2012-05-23 07:59:20 +0000 | [diff] [blame] | 217 | &arp->ar_sha, ARP_HLEN); |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 218 | |
Joe Hershberger | f50357b | 2012-05-23 07:59:15 +0000 | [diff] [blame] | 219 | net_get_arp_handler()((uchar *)arp, 0, reply_ip_addr, |
Joe Hershberger | 85ae776 | 2015-04-08 01:41:08 -0500 | [diff] [blame] | 220 | 0, len); |
Joe Hershberger | f50357b | 2012-05-23 07:59:15 +0000 | [diff] [blame] | 221 | |
Joe Hershberger | de8205a | 2012-05-23 07:59:24 +0000 | [diff] [blame] | 222 | /* set the mac address in the waiting packet's header |
| 223 | and transmit it */ |
Joe Hershberger | a8ca4f6 | 2015-04-08 01:41:05 -0500 | [diff] [blame] | 224 | memcpy(((struct ethernet_hdr *)net_tx_packet)->et_dest, |
| 225 | &arp->ar_sha, ARP_HLEN); |
Joe Hershberger | 85ae776 | 2015-04-08 01:41:08 -0500 | [diff] [blame] | 226 | net_send_packet(net_tx_packet, arp_wait_tx_packet_size); |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 227 | |
| 228 | /* no arp request pending now */ |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 229 | net_arp_wait_packet_ip.s_addr = 0; |
Joe Hershberger | 85ae776 | 2015-04-08 01:41:08 -0500 | [diff] [blame] | 230 | arp_wait_tx_packet_size = 0; |
| 231 | arp_wait_packet_ethaddr = NULL; |
Joe Hershberger | aae0508 | 2012-05-23 07:58:01 +0000 | [diff] [blame] | 232 | } |
| 233 | return; |
| 234 | default: |
| 235 | debug("Unexpected ARP opcode 0x%x\n", |
| 236 | ntohs(arp->ar_op)); |
| 237 | return; |
| 238 | } |
| 239 | } |
Joe Hershberger | 5641f67 | 2018-09-26 16:48:58 -0500 | [diff] [blame] | 240 | |
| 241 | bool arp_is_waiting(void) |
| 242 | { |
| 243 | return !!net_arp_wait_packet_ip.s_addr; |
| 244 | } |