Skip to content

Commit

Permalink
sys/shell/gnrc_netif: Set lwIP netif state on up/down
Browse files Browse the repository at this point in the history
  • Loading branch information
yarrick committed Oct 11, 2023
1 parent c49cd44 commit 726e2eb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sys/shell/cmds/gnrc_netif.c
Original file line number Diff line number Diff line change
Expand Up @@ -1684,10 +1684,17 @@ static uint8_t _get_prefix_len(char *addr)

static int _netif_link(netif_t *iface, netopt_enable_t en)
{
#if IS_USED(MODULE_LWIP_NETIF) /* lwIP sets netif state, not link state */
if (netif_set_opt(iface, NETOPT_ACTIVE, 0, &en, sizeof(en)) < 0) {
printf("error: unable to set state %s\n", en == NETOPT_ENABLE ? "up" : "down");
return 1;
}
#else
if (netif_set_opt(iface, NETOPT_LINK, 0, &en, sizeof(en)) < 0) {
printf("error: unable to set link %s\n", en == NETOPT_ENABLE ? "up" : "down");
return 1;
}
#endif
return 0;
}

Expand Down

0 comments on commit 726e2eb

Please sign in to comment.