diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-08-06 09:19:26 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-08-06 09:19:26 -0600 |
commit | 5b6529f173e35f3c15438869ea33dbf80d3be036 (patch) | |
tree | 77333e010b64b1307ed6a0552f6cbf5bf4b47e3a | |
parent | 8314e37e36a328b4e819410e2c75604c6eacaf26 (diff) | |
download | nuttx-5b6529f173e35f3c15438869ea33dbf80d3be036.tar.gz nuttx-5b6529f173e35f3c15438869ea33dbf80d3be036.tar.bz2 nuttx-5b6529f173e35f3c15438869ea33dbf80d3be036.zip |
NSH Networking: Software assigned MAC address is now configurable. From Lazlo
-rw-r--r-- | NxWidgets/nxwm/src/cnxconsole.cxx | 1 | ||||
-rw-r--r-- | apps/nshlib/Kconfig | 8 | ||||
-rw-r--r-- | apps/nshlib/nsh.h | 22 | ||||
-rw-r--r-- | apps/nshlib/nsh_netinit.c | 12 |
4 files changed, 37 insertions, 6 deletions
diff --git a/NxWidgets/nxwm/src/cnxconsole.cxx b/NxWidgets/nxwm/src/cnxconsole.cxx index d9bab9cfd..b8577b635 100644 --- a/NxWidgets/nxwm/src/cnxconsole.cxx +++ b/NxWidgets/nxwm/src/cnxconsole.cxx @@ -664,6 +664,7 @@ bool NxWM::nshlibInitialize(void) return false; } #endif + return true; } diff --git a/apps/nshlib/Kconfig b/apps/nshlib/Kconfig index 4d1dd6d01..7f35243fb 100644 --- a/apps/nshlib/Kconfig +++ b/apps/nshlib/Kconfig @@ -908,6 +908,14 @@ config NSH_NOMAC Set if your ethernet hardware has no built-in MAC address. If set, a bogus MAC will be assigned. +config NSH_MACADDR + hex "Software assigned MAC address" + default 0x00e0deadbeef + depends on NSH_NOMAC + ---help--- + Use this option to specific the software-assigned MAC address + to be used, in case the hardware has no built-in MAC address. + config NSH_MAX_ROUNDTRIP int "Max Ping Round-Trip (DSEC)" default 20 diff --git a/apps/nshlib/nsh.h b/apps/nshlib/nsh.h index ac7f7fbc9..4b33f4452 100644 --- a/apps/nshlib/nsh.h +++ b/apps/nshlib/nsh.h @@ -104,6 +104,28 @@ # define CONFIG_NSH_TMPDIR "/tmp" #endif +/* Networking support */ + +#ifndef CONFIG_NSH_IPADDR +# define CONFIG_NSH_IPADDR 0x0a000002 +#endif + +#ifndef CONFIG_NSH_DRIPADDR +# define CONFIG_NSH_DRIPADDR 0x0a000001 +#endif + +#ifndef CONFIG_NSH_NETMASK +# define CONFIG_NSH_NETMASK 0xffffff00 +#endif + +#ifndef CONFIG_NSH_DNSIPADDR +# define CONFIG_NSH_DNSIPADDR CONFIG_NSH_DRIPADDR +#endif + +#ifndef CONFIG_NSH_MACADDR +# define CONFIG_NSH_MACADDR 0x00e0deadbeef +#endif + /* Telnetd requires networking support */ #ifndef CONFIG_NET diff --git a/apps/nshlib/nsh_netinit.c b/apps/nshlib/nsh_netinit.c index ec502e796..d3340a0fc 100644 --- a/apps/nshlib/nsh_netinit.c +++ b/apps/nshlib/nsh_netinit.c @@ -119,12 +119,12 @@ int nsh_netinit(void) /* Many embedded network interfaces must have a software assigned MAC */ #if defined(CONFIG_NSH_NOMAC) && !defined(CONFIG_NET_SLIP) - mac[0] = 0x00; - mac[1] = 0xe0; - mac[2] = 0xde; - mac[3] = 0xad; - mac[4] = 0xbe; - mac[5] = 0xef; + mac[0] = (CONFIG_NSH_MACADDR >> (8 * 5)) & 0xff; + mac[1] = (CONFIG_NSH_MACADDR >> (8 * 4)) & 0xff; + mac[2] = (CONFIG_NSH_MACADDR >> (8 * 3)) & 0xff; + mac[3] = (CONFIG_NSH_MACADDR >> (8 * 2)) & 0xff; + mac[4] = (CONFIG_NSH_MACADDR >> (8 * 1)) & 0xff; + mac[5] = (CONFIG_NSH_MACADDR >> (8 * 0)) & 0xff; netlib_setmacaddr(NET_DEVNAME, mac); #endif |