From d8970dae276377a0beff1c3e9d8b6f805ecf5cd5 Mon Sep 17 00:00:00 2001 From: Lothar Felten Date: Fri, 22 Jun 2018 22:29:54 +0200 Subject: net: Add new wol command - Wake on LAN Add a new command 'wol': Wait for an incoming Wake-on-LAN packet or time out if no WoL packed is received. If the WoL packet contains a password, it is saved in the environment variable 'wolpassword' using the etherwake format (dot or colon separated decimals). Intended use case: a networked device should boot an alternate image. It's attached to a network on a client site, modifying the DHCP server configuration or setup of a tftp server is not allowed. After power on the device waits a few seconds for a WoL packet. If a packet is received, the device boots the alternate image. Otherwise it boots the default image. This method is a simple way to interact with a system via network even if only the MAC address is known. Tools to send WoL packets are available on all common platforms. Some Ethernet drivers seem to pad the incoming packet. The additional padding bytes might be recognized as Wake-on-LAN password bytes. By default enabled in pengwyn_defconfig. Signed-off-by: Lothar Felten Acked-by: Joe Hershberger --- include/net.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/net.h b/include/net.h index 5760685556..9c7199aca9 100644 --- a/include/net.h +++ b/include/net.h @@ -344,6 +344,7 @@ struct vlan_ethernet_hdr { #define PROT_IP 0x0800 /* IP protocol */ #define PROT_ARP 0x0806 /* IP ARP protocol */ +#define PROT_WOL 0x0842 /* ether-wake WoL protocol */ #define PROT_RARP 0x8035 /* IP ARP protocol */ #define PROT_VLAN 0x8100 /* IEEE 802.1q protocol */ #define PROT_IPV6 0x86dd /* IPv6 over bluebook */ @@ -535,7 +536,7 @@ extern int net_restart_wrap; /* Tried all network devices */ enum proto_t { BOOTP, RARP, ARP, TFTPGET, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP, - TFTPSRV, TFTPPUT, LINKLOCAL, FASTBOOT + TFTPSRV, TFTPPUT, LINKLOCAL, FASTBOOT, WOL }; extern char net_boot_file_name[1024];/* Boot File name */ -- cgit From 449312c1c0c686ad28c51e6429d8bbdd13812b10 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Fri, 15 Jun 2018 10:29:27 +0200 Subject: net: Prefer command line arguments We can call commands like dhcp and bootp without arguments or with explicit command line arguments that really should tell the code where to look for files instead. Unfortunately, the current code simply overwrites command line arguments in the dhcp case with dhcp values. This patch allows the code to preserve the command line values if they were set on the command line. That way the semantics are slightly more intuitive. The reason this patch does that by introducing a new variable is that we can not rely on net_boot_file_name[0] being unset, as today it's completely legal to call "dhcp" and afterwards run "tftp" and expect the latter to repeat the same query as before. I would prefer not to break that behavior in case anyone relies on it. Signed-off-by: Alexander Graf Acked-by: Joe Hershberger --- include/net.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/net.h b/include/net.h index 9c7199aca9..f9984ae86c 100644 --- a/include/net.h +++ b/include/net.h @@ -540,6 +540,8 @@ enum proto_t { }; extern char net_boot_file_name[1024];/* Boot File name */ +/* Indicates whether the file name was specified on the command line */ +extern bool net_boot_file_name_explicit; /* The actual transferred size of the bootfile (in bytes) */ extern u32 net_boot_file_size; /* Boot file size in blocks as reported by the DHCP server */ -- cgit From a9ea30d267f26bee0b3a5cdd659624a866da3d19 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Fri, 15 Jun 2018 10:29:29 +0200 Subject: ax25: Switch to CONFIG_BOOTP_PREFER_SERVERIP The ax25-ae350 target currently uses CONFIG_BOOTP_SERVERIP which means we ignore the DHCP provided TFTP ip address. This breaks every case where we do now provide a serverip environment variable. Instead, let's use the new CONFIG_BOOT_PREFER_SERVERIP option to fall back to the DHCP provided TFTP IP if no serverip environment variable is set. Signed-off-by: Alexander Graf Acked-by: Joe Hershberger Acked-by: Rick Chen --- include/configs/ax25-ae350.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/configs/ax25-ae350.h b/include/configs/ax25-ae350.h index b1ca5ac11a..b230896734 100644 --- a/include/configs/ax25-ae350.h +++ b/include/configs/ax25-ae350.h @@ -11,7 +11,6 @@ * CPU and Board Configuration Options */ #define CONFIG_BOOTP_SEND_HOSTNAME -#define CONFIG_BOOTP_SERVERIP /* * Miscellaneous configurable options -- cgit