From 2856f166c6a03e714a3644366ed466c279342eb2 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 7 Nov 2019 16:38:15 +0100 Subject: [PATCH] examples/gnrc_networking: Adapt to change in ipv6_addr_split_iface --- examples/gnrc_networking/udp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/gnrc_networking/udp.c b/examples/gnrc_networking/udp.c index c22a26a202..e8a559846e 100644 --- a/examples/gnrc_networking/udp.c +++ b/examples/gnrc_networking/udp.c @@ -39,19 +39,19 @@ static gnrc_netreg_entry_t server = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX static void send(char *addr_str, char *port_str, char *data, unsigned int num, unsigned int delay) { - gnrc_netif_t *netif; - int iface; + gnrc_netif_t *netif = NULL; + char *iface; uint16_t port; ipv6_addr_t addr; - /* get interface, if available */ iface = ipv6_addr_split_iface(addr_str); - if ((iface < 0) && (gnrc_netif_numof() == 1)) { + if ((!iface) && (gnrc_netif_numof() == 1)) { netif = gnrc_netif_iter(NULL); } - else { - netif = gnrc_netif_get_by_pid(iface); + else if (iface) { + netif = gnrc_netif_get_by_pid(atoi(iface)); } + /* parse destination address */ if (ipv6_addr_from_str(&addr, addr_str) == NULL) { puts("Error: unable to parse destination address");