diff options
author | Tom Rini <trini@konsulko.com> | 2023-05-06 10:34:34 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-05-06 10:34:34 -0400 |
commit | ae0772f333a7e76c4fb3771a77117b2f740d7c93 (patch) | |
tree | 89fd938073db85162aab26a9096447d7a311b957 /net/net.c | |
parent | ab75996ba49c140c529f14b5c40d0d16430feefb (diff) | |
parent | 1a3af267c097c330fb2bf12493186a345523df38 (diff) |
Merge branch '2023-05-05-networking-updates'
- Cleanup NFS support, add NFSv1 support, assorted IPv6 improvements,
PHY cleanups and improvements, ksz9477, ldpaa and rtl8169
improvements, overall network performance improvements.
Diffstat (limited to 'net/net.c')
-rw-r--r-- | net/net.c | 51 |
1 files changed, 42 insertions, 9 deletions
diff --git a/net/net.c b/net/net.c index c9a749f6cc8..43abbac7c32 100644 --- a/net/net.c +++ b/net/net.c @@ -24,7 +24,7 @@ * - name of bootfile * Next step: ARP * - * LINK_LOCAL: + * LINKLOCAL: * * Prerequisites: - own ethernet address * We want: - own IP address @@ -93,7 +93,8 @@ #include <net.h> #include <net6.h> #include <ndisc.h> -#include <net/fastboot.h> +#include <net/fastboot_udp.h> +#include <net/fastboot_tcp.h> #include <net/tftp.h> #include <net/ncsi.h> #if defined(CONFIG_CMD_PCAP) @@ -107,6 +108,8 @@ #include <watchdog.h> #include <linux/compiler.h> #include <test/test.h> +#include <net/tcp.h> +#include <net/wget.h> #include "arp.h" #include "bootp.h" #include "cdp.h" @@ -120,8 +123,8 @@ #if defined(CONFIG_CMD_WOL) #include "wol.h" #endif -#include <net/tcp.h> -#include <net/wget.h> +#include "dhcpv6.h" +#include "net_rand.h" /** BOOTP EXTENTIONS **/ @@ -135,6 +138,8 @@ struct in_addr net_dns_server; /* Our 2nd DNS IP address */ struct in_addr net_dns_server2; #endif +/* Indicates whether the pxe path prefix / config file was specified in dhcp option */ +char *pxelinux_configfile; /** END OF BOOTP EXTENTIONS **/ @@ -346,6 +351,8 @@ void net_auto_load(void) static int net_init_loop(void) { + static bool first_call = true; + if (eth_get_dev()) { memcpy(net_ethaddr, eth_get_ethaddr(), 6); @@ -365,6 +372,12 @@ static int net_init_loop(void) */ return -ENONET; + if (IS_ENABLED(CONFIG_IPV6_ROUTER_DISCOVERY)) + if (first_call && use_ip6) { + first_call = false; + srand_mac(); /* This is for rand used in ip6_send_rs. */ + net_loop(RS); + } return 0; } @@ -498,9 +511,14 @@ restart: tftp_start_server(); break; #endif -#ifdef CONFIG_UDP_FUNCTION_FASTBOOT - case FASTBOOT: - fastboot_start_server(); +#if defined(CONFIG_UDP_FUNCTION_FASTBOOT) + case FASTBOOT_UDP: + fastboot_udp_start_server(); + break; +#endif +#if defined(CONFIG_TCP_FUNCTION_FASTBOOT) + case FASTBOOT_TCP: + fastboot_tcp_start_server(); break; #endif #if defined(CONFIG_CMD_DHCP) @@ -510,6 +528,10 @@ restart: dhcp_request(); /* Basically same as BOOTP */ break; #endif + case DHCP6: + if (IS_ENABLED(CONFIG_CMD_DHCP6)) + dhcp6_start(); + break; #if defined(CONFIG_CMD_BOOTP) case BOOTP: bootp_reset(); @@ -574,6 +596,10 @@ restart: ncsi_probe_packages(); break; #endif + case RS: + if (IS_ENABLED(CONFIG_IPV6_ROUTER_DISCOVERY)) + ip6_send_rs(); + break; default: break; } @@ -671,7 +697,13 @@ restart: x = time_handler; time_handler = (thand_f *)0; (*x)(); - } + } else if (IS_ENABLED(CONFIG_IPV6_ROUTER_DISCOVERY)) + if (time_handler && protocol == RS) + if (!ip6_is_unspecified_addr(&net_gateway6) && + net_prefix_length != 0) { + net_set_state(NETLOOP_SUCCESS); + net_set_timeout_handler(0, NULL); + } if (net_state == NETLOOP_FAIL) ret = net_start_again(); @@ -1491,7 +1523,8 @@ common: /* Fall through */ case NETCONS: - case FASTBOOT: + case FASTBOOT_UDP: + case FASTBOOT_TCP: case TFTPSRV: if (IS_ENABLED(CONFIG_IPV6) && use_ip6) { if (!memcmp(&net_link_local_ip6, &net_null_addr_ip6, |