From ad4fc4b76e1986d0f2fbd772b55797932afa9dd1 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 7 Nov 2019 16:45:28 +0100 Subject: [PATCH] tests/nanocoap_cli: Adapt to change in ipv6_addr_split_iface --- tests/nanocoap_cli/nanocli_client.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/nanocoap_cli/nanocli_client.c b/tests/nanocoap_cli/nanocli_client.c index 0a7757bde7..d790d6734b 100644 --- a/tests/nanocoap_cli/nanocli_client.c +++ b/tests/nanocoap_cli/nanocli_client.c @@ -37,8 +37,8 @@ static ssize_t _send(coap_pkt_t *pkt, size_t len, char *addr_str, char *port_str remote.family = AF_INET6; /* parse for interface */ - int iface = ipv6_addr_split_iface(addr_str); - if (iface == -1) { + char *iface = ipv6_addr_split_iface(addr_str); + if (!iface) { if (gnrc_netif_numof() == 1) { /* assign the single interface found in gnrc_netif_numof() */ remote.netif = (uint16_t)gnrc_netif_iter(NULL)->pid; @@ -48,11 +48,12 @@ static ssize_t _send(coap_pkt_t *pkt, size_t len, char *addr_str, char *port_str } } else { - if (gnrc_netif_get_by_pid(iface) == NULL) { + int pid = atoi(iface); + if (gnrc_netif_get_by_pid(pid) == NULL) { puts("nanocli: interface not valid"); return 0; } - remote.netif = iface; + remote.netif = pid; } /* parse destination address */