1------------------------------------------ 2 Link-local IP address auto-configuration 3------------------------------------------ 4 5Negotiate with other link-local clients on the local network 6for an address that doesn't require explicit configuration. 7This is especially useful if a DHCP server cannot be guaranteed 8to exist in all environments that the device must operate. 9 10This is an implementation of RFC3927. 11 12---------- 13 Commands 14---------- 15 16When CONFIG_CMD_LINK_LOCAL is defined in the board config file, 17the "linklocal" command is available. This running this will 18take approximately 5 seconds while the address is negotiated. 19 20------------------------ 21 Environment interation 22------------------------ 23 24The "llipaddr" variable is set with the most recently 25negotiated address and is preferred in future negotiations. 26 27The "ipaddr", "netmask", and "gatewayip" variables are set 28after successful negotiation to enable network access. 29 30------------- 31 Limitations 32------------- 33 34RFC3927 requires that addresses are continuously checked to 35avoid conflicts, however this can only happen when the NetLoop 36is getting called. It is possible for a conflict to go undetected 37until a command that accesses the network is executed. 38 39Using NetConsole is one way to ensure that NetLoop is always 40processing packets and monitoring for conflicts. 41 42This is also not a concern if the feature is use to connect 43directly to another machine that may not be running a DHCP server. 44 45---------------- 46 Example script 47---------------- 48 49This script allows use of DHCP and/or Link-local controlled 50by env variables. It depends on CONFIG_CMD_LINK_LOCAL, CONFIG_CMD_DHCP, 51and CONFIG_BOOTP_MAY_FAIL. 52If both fail or are disabled, static settings are used. 53 54#define CONFIG_EXTRA_ENV_SETTINGS \ 55 "ipconfigcmd=if test \\\"$dhcpenabled\\\" -ne 0;" \ 56 "then " \ 57 "dhcpfail=0;dhcp || dhcpfail=1;" \ 58 "else " \ 59 "dhcpfail=-1;" \ 60 "fi;" \ 61 "if test \\\"$linklocalenabled\\\" -ne 0 -a " \ 62 "\\\"$dhcpfail\\\" -ne 0;" \ 63 "then " \ 64 "linklocal;" \ 65 "llfail=0;" \ 66 "else " \ 67 "llfail=-1;" \ 68 "fi;" \ 69 "if test \\\"$llfail\\\" -ne 0 -a " \ 70 "\\\"$dhcpfail\\\" -ne 0; " \ 71 "then " \ 72 "setenv ipaddr $sipaddr; " \ 73 "setenv netmask $snetmask; " \ 74 "setenv gatewayip $sgatewayip; " \ 75 "fi;\0" \ 76 77