1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-16 01:53:51 +01:00
RIOT/pkg/lwip/contrib/_netif.c
Erik Ekman 7593bb0e40 pkg/lwip: Update netif_get_name implementation
Correctly refer to the struct netif inside the netif_t

Fix call to netif_get_name from lwIP ifconfig shell command
2021-11-16 22:04:44 +01:00

36 lines
766 B
C

/*
* Copyright (C) 2021 ML!PA Consulting GmbH
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @{
*
* Implements @ref net_netif for @ref net_lwip
*
* @file
* @author Benjamin Valentin <benjamin.valentin@ml-pa.com>
*/
#include "fmt.h"
#include "lwip/netif/compat.h"
#include "net/netif.h"
int netif_get_name(netif_t *iface, char *name)
{
lwip_netif_t *lwip_netif = (lwip_netif_t*) iface;
struct netif *netif = &lwip_netif->lwip_netif;
int res = 2;
name[0] = netif->name[0];
name[1] = netif->name[1];
res += fmt_u16_dec(&name[res], netif->num);
name[res] = '\0';
return res;
}
/** @} */