From 3df6cd4d63678065ce82637d995ed3170e9e56cd Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 18 Dec 2021 11:27:48 -0700 Subject: Convert CONFIG_KEEP_SERVERADDR to Kconfig This converts the following to Kconfig: CONFIG_KEEP_SERVERADDR Drop the preprocessor usage also. Signed-off-by: Simon Glass --- net/Kconfig | 9 +++++++++ net/arp.c | 5 ++--- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'net') diff --git a/net/Kconfig b/net/Kconfig index cabe93c..8e9579a 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -99,4 +99,13 @@ config SERVERIP_FROM_PROXYDHCP_DELAY_MS receiving response from main DHCP server. Has no effect if SERVERIP_FROM_PROXYDHCP is false. +config KEEP_SERVERADDR + bool "Write the server's MAC address to 'serveraddr'" + default y if SANDBOX + help + Keeps the server's MAC address, in the env 'serveraddr' + for passing to bootargs (like Linux's netconsole option). If this is + enabled, when an ARP reply is received, the server's IP address is + written there. + endif # if NET diff --git a/net/arp.c b/net/arp.c index 1d06ed2..0b086dc 100644 --- a/net/arp.c +++ b/net/arp.c @@ -196,13 +196,12 @@ void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len) if (!arp_is_waiting()) break; -#ifdef CONFIG_KEEP_SERVERADDR - if (net_server_ip.s_addr == net_arp_wait_packet_ip.s_addr) { + if (IS_ENABLED(CONFIG_KEEP_SERVERADDR) && + net_server_ip.s_addr == net_arp_wait_packet_ip.s_addr) { char buf[20]; sprintf(buf, "%pM", &arp->ar_sha); env_set("serveraddr", buf); } -#endif reply_ip_addr = net_read_ip(&arp->ar_spa); -- cgit v1.1