diff options
author | Joe Hershberger <joe.hershberger@ni.com> | 2012-05-23 08:00:12 +0000 |
---|---|---|
committer | Joe Hershberger <joe.hershberger@ni.com> | 2012-05-23 17:53:08 -0500 |
commit | d22c338e07cc98276ea5cc4feaa5a370baa63243 (patch) | |
tree | ac72ae8a2d99ba9b48757aa148a8fe1b5f1cdd7d /common | |
parent | 228041893c2b6f79326f4b49ee7b3b3a90e90e8e (diff) | |
download | u-boot-d22c338e07cc98276ea5cc4feaa5a370baa63243.zip u-boot-d22c338e07cc98276ea5cc4feaa5a370baa63243.tar.gz u-boot-d22c338e07cc98276ea5cc4feaa5a370baa63243.tar.bz2 |
net: Add link-local addressing support
Code based on networking/zcip.c in busybox
commit 8531d76a15890c2c535908ce888b2e2aed35b172
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'common')
-rw-r--r-- | common/cmd_net.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/common/cmd_net.c b/common/cmd_net.c index 2f66056..a9ade8b 100644 --- a/common/cmd_net.c +++ b/common/cmd_net.c @@ -428,3 +428,34 @@ U_BOOT_CMD( ); #endif /* CONFIG_CMD_DNS */ + +#if defined(CONFIG_CMD_LINK_LOCAL) +static int do_link_local(cmd_tbl_t *cmdtp, int flag, int argc, + char * const argv[]) +{ + char tmp[22]; + + if (NetLoop(LINKLOCAL) < 0) + return 1; + + NetOurGatewayIP = 0; + ip_to_string(NetOurGatewayIP, tmp); + setenv("gatewayip", tmp); + + ip_to_string(NetOurSubnetMask, tmp); + setenv("netmask", tmp); + + ip_to_string(NetOurIP, tmp); + setenv("ipaddr", tmp); + setenv("llipaddr", tmp); /* store this for next time */ + + return 0; +} + +U_BOOT_CMD( + linklocal, 1, 1, do_link_local, + "acquire a network IP address using the link-local protocol", + "" +); + +#endif /* CONFIG_CMD_LINK_LOCAL */ |