net: apps: Comment out code if IPv6 ND is in use
If neighbor discovery is in use, then we do not need to do various route etc setup. Normally ND needs to be active but in some specific scenarios it can be turned off. One such scenario is if an application is run inside qemu which uses slip and host tun0 interface for communication, in this case host typically do not activate ND for tun0 so we need to disable it also in zephyr side. Change-Id: I8ac59990c5bbcdb06cca98bde7be3a0ad6e807a8 Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
e0f966de10
commit
04ef24d21b
6 changed files with 22 additions and 31 deletions
|
@ -50,11 +50,13 @@ char fiberStack[STACKSIZE];
|
|||
|
||||
static coap_observee_t *obs;
|
||||
|
||||
#ifdef CONFIG_NETWORKING_IPV6_NO_ND
|
||||
/* The peer is the server in our case. Just invent a mac
|
||||
* address for it because lower parts of the stack cannot set it
|
||||
* in this test as we do not have any radios.
|
||||
*/
|
||||
static uint8_t peer_mac[] = { 0x15, 0x0a, 0xbe, 0xef, 0xf0, 0x0d };
|
||||
#endif
|
||||
|
||||
/* This is my mac address
|
||||
*/
|
||||
|
@ -105,7 +107,9 @@ static inline void init_app(void)
|
|||
uip_ipaddr(&addr, 192,0,2,2);
|
||||
uip_sethostaddr(&addr);
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NETWORKING_IPV6_NO_ND
|
||||
{
|
||||
uip_ipaddr_t *addr;
|
||||
const uip_lladdr_t *lladdr = (const uip_lladdr_t *)&peer_mac;
|
||||
|
|
|
@ -115,11 +115,12 @@ static inline void init_app(void)
|
|||
uip_ipaddr(&addr, 192,0,2,2);
|
||||
uip_sethostaddr(&addr);
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NETWORKING_IPV6_NO_ND
|
||||
{
|
||||
uip_ipaddr_t *addr;
|
||||
|
||||
#ifdef CONFIG_NETWORKING_IPV6_NO_ND
|
||||
/* Set the routes and neighbor cache only if we do not have
|
||||
* neighbor discovery enabled. This setting should only be
|
||||
* used if running in qemu and using slip (tun device).
|
||||
|
@ -135,14 +136,6 @@ static inline void init_app(void)
|
|||
*/
|
||||
uip_ds6_nbr_add(addr, lladdr, 0, NBR_REACHABLE);
|
||||
|
||||
#else
|
||||
/* Hard code the route to peer just in case, not to
|
||||
* be done in real life applications.
|
||||
*/
|
||||
addr = (uip_ipaddr_t *)&in6addr_peer;
|
||||
uip_ds6_defrt_add(addr, 0);
|
||||
#endif
|
||||
|
||||
addr = (uip_ipaddr_t *)&in6addr_my;
|
||||
uip_ds6_addr_add(addr, 0, ADDR_MANUAL);
|
||||
}
|
||||
|
|
|
@ -79,11 +79,13 @@ static const unsigned char ecdsa_pub_key_y[] = {
|
|||
0xD0, 0x43, 0xB1, 0xFB, 0x03, 0xE2, 0x2F, 0x4D,
|
||||
0x17, 0xDE, 0x43, 0xF9, 0xF9, 0xAD, 0xEE, 0x70};
|
||||
|
||||
#ifdef CONFIG_NETWORKING_IPV6_NO_ND
|
||||
/* The peer is the server in our case. Just invent a mac
|
||||
* address for it because lower parts of the stack cannot set it
|
||||
* in this test as we do not have any radios.
|
||||
*/
|
||||
static uint8_t peer_mac[] = { 0x15, 0x0a, 0xbe, 0xef, 0xf0, 0x0d };
|
||||
#endif
|
||||
|
||||
/* This is my mac address
|
||||
*/
|
||||
|
@ -127,7 +129,9 @@ static inline void init_app(void)
|
|||
uip_ipaddr(&addr, 192,0,2,2);
|
||||
uip_sethostaddr(&addr);
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NETWORKING_IPV6_NO_ND
|
||||
{
|
||||
uip_ipaddr_t *addr;
|
||||
const uip_lladdr_t *lladdr = (const uip_lladdr_t *)&peer_mac;
|
||||
|
|
|
@ -96,7 +96,9 @@ static inline void init_app(void)
|
|||
uip_ipaddr(&addr, 192,0,2,2);
|
||||
uip_sethostaddr(&addr);
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NETWORKING_IPV6_NO_ND
|
||||
{
|
||||
uip_ipaddr_t *addr;
|
||||
|
||||
|
|
|
@ -115,11 +115,12 @@ static inline void init_app(void)
|
|||
uip_ipaddr(&addr, 192,0,2,2);
|
||||
uip_sethostaddr(&addr);
|
||||
}
|
||||
#else /* IPv6 */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NETWORKING_IPV6_NO_ND
|
||||
{
|
||||
uip_ipaddr_t *addr;
|
||||
|
||||
#ifdef CONFIG_NETWORKING_IPV6_NO_ND
|
||||
/* Set the routes and neighbor cache only if we do not have
|
||||
* neighbor discovery enabled. This setting should only be
|
||||
* used if running in qemu and using slip (tun device).
|
||||
|
@ -134,13 +135,6 @@ static inline void init_app(void)
|
|||
* but do it here so that test works from first packet.
|
||||
*/
|
||||
uip_ds6_nbr_add(addr, lladdr, 0, NBR_REACHABLE);
|
||||
#else
|
||||
/* Hard code the route to peer just in case, not to
|
||||
* be done in real life applications.
|
||||
*/
|
||||
addr = (uip_ipaddr_t *)&in6addr_peer;
|
||||
uip_ds6_defrt_add(addr, 0);
|
||||
#endif
|
||||
|
||||
addr = (uip_ipaddr_t *)&in6addr_my;
|
||||
uip_ds6_addr_add(addr, 0, ADDR_MANUAL);
|
||||
|
|
|
@ -89,11 +89,12 @@ static inline void init_app(void)
|
|||
uip_ipaddr(&addr, 192,0,2,2);
|
||||
uip_sethostaddr(&addr);
|
||||
}
|
||||
#else /* IPv6 */
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NETWORKING_IPV6_NO_ND)
|
||||
{
|
||||
uip_ipaddr_t *addr;
|
||||
|
||||
#if defined(CONFIG_NETWORKING_IPV6_NO_ND)
|
||||
/* Set the routes and neighbor cache only if we do not have
|
||||
* neighbor discovery enabled. This setting should only be
|
||||
* used if running in qemu and using slip (tun device).
|
||||
|
@ -108,13 +109,6 @@ static inline void init_app(void)
|
|||
* but do it here so that test works from first packet.
|
||||
*/
|
||||
uip_ds6_nbr_add(addr, lladdr, 0, NBR_REACHABLE);
|
||||
#else
|
||||
/* Hard code the route to peer just in case, not to
|
||||
* be done in real life applications.
|
||||
*/
|
||||
addr = (uip_ipaddr_t *)&in6addr_peer;
|
||||
uip_ds6_defrt_add(addr, 0);
|
||||
#endif
|
||||
|
||||
addr = (uip_ipaddr_t *)&in6addr_my;
|
||||
uip_ds6_addr_add(addr, 0, ADDR_MANUAL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue