samples: net: Do not use static address in DHPCv4

If user has enabled DHCPv4 support, then do not try
to set static IPv4 address.

Change-Id: Ia359f578044d72b951f53c509c92c09d575207f0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2016-11-21 10:20:57 +02:00
parent 06fd64d1a0
commit 0cc43a62ac
2 changed files with 9 additions and 1 deletions

View File

@ -149,8 +149,12 @@ static inline void init_app(void)
#endif
#if defined(CONFIG_NET_IPV4)
#if defined(CONFIG_NET_DHCPV4)
net_dhcpv4_start(net_if_get_default());
#else
net_if_ipv4_addr_add(net_if_get_default(), &in4addr_my,
NET_ADDR_MANUAL, 0);
#endif /* CONFIG_NET_DHCPV4 */
k_sem_init(&recv_ipv4, 0, UINT_MAX);
#endif

View File

@ -111,9 +111,13 @@ static inline void init_app(void)
#endif
#if defined(CONFIG_NET_IPV4)
#if defined(CONFIG_NET_DHCPV4)
net_dhcpv4_start(net_if_get_default());
#else
net_if_ipv4_addr_add(net_if_get_default(), &in4addr_my,
NET_ADDR_MANUAL, 0);
#endif
#endif /* CONFIG_NET_DHCPV4 */
#endif /* CONFIG_NET_IPV4 */
}
static inline bool get_context(struct net_context **udp_recv4,