Skip to content

Commit ee6ca2b

Browse files
committed
sys/shell/gnrc_netif: Use l2util versions of link addr helpers
To avoid dependency on gnrc files. As suggested in #16965
1 parent 28b8536 commit ee6ca2b

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

sys/shell/Makefile.dep

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ USEMODULE += stdin
33
ifneq (,$(filter shell_cmds_default,$(USEMODULE)))
44
USEMODULE += shell_cmd_sys
55

6+
ifneq (,$(filter netif,$(USEMODULE)))
7+
USEMODULE += l2util
8+
endif
69
ifneq (,$(filter app_metadata,$(USEMODULE)))
710
USEMODULE += shell_cmd_app_metadata
811
endif

sys/shell/cmds/gnrc_netif.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "net/gnrc/netif.h"
3030
#include "net/gnrc/netif/hdr.h"
3131
#include "net/ipv6/addr.h"
32+
#include "net/l2util.h"
3233
#include "net/lora.h"
3334
#include "net/loramac.h"
3435
#include "net/netif.h"
@@ -660,7 +661,7 @@ static void _netif_list(netif_t *iface)
660661
if (res >= 0) {
661662
char hwaddr_str[res * 3];
662663
printf(" HWaddr: %s ",
663-
gnrc_netif_addr_to_str(hwaddr, res, hwaddr_str));
664+
l2util_addr_to_str(hwaddr, res, hwaddr_str));
664665
}
665666
res = netif_get_opt(iface, NETOPT_CHANNEL, 0, &u16, sizeof(u16));
666667
if (res >= 0) {
@@ -788,7 +789,7 @@ static void _netif_list(netif_t *iface)
788789
if (res >= 0) {
789790
char hwaddr_str[res * 3];
790791
printf("Long HWaddr: ");
791-
printf("%s ", gnrc_netif_addr_to_str(hwaddr, res, hwaddr_str));
792+
printf("%s ", l2util_addr_to_str(hwaddr, res, hwaddr_str));
792793
line_thresh++;
793794
}
794795
line_thresh = _newline(0U, line_thresh);
@@ -935,8 +936,8 @@ static void _netif_list(netif_t *iface)
935936
for (unsigned i = 0; i < CONFIG_L2FILTER_LISTSIZE; i++) {
936937
if (filter[i].addr_len > 0) {
937938
char hwaddr_str[filter[i].addr_len * 3];
938-
gnrc_netif_addr_to_str(filter[i].addr, filter[i].addr_len,
939-
hwaddr_str);
939+
l2util_addr_to_str(filter[i].addr, filter[i].addr_len,
940+
hwaddr_str);
940941
printf(" %2i: %s\n", count++, hwaddr_str);
941942
}
942943
}
@@ -1300,7 +1301,7 @@ static int _netif_set_lw_key(netif_t *iface, netopt_t opt, char *key_str)
13001301
static int _netif_set_addr(netif_t *iface, netopt_t opt, char *addr_str)
13011302
{
13021303
uint8_t addr[GNRC_NETIF_L2ADDR_MAXLEN];
1303-
size_t addr_len = gnrc_netif_addr_from_str(addr_str, addr);
1304+
size_t addr_len = l2util_addr_from_str(addr_str, addr);
13041305

13051306
if (addr_len == 0) {
13061307
printf("error: unable to parse address.\n"
@@ -1449,7 +1450,7 @@ static int _netif_set_encrypt_key(netif_t *iface, netopt_t opt, char *key_str)
14491450
static int _netif_addrm_l2filter(netif_t *iface, char *val, bool add)
14501451
{
14511452
uint8_t addr[GNRC_NETIF_L2ADDR_MAXLEN];
1452-
size_t addr_len = gnrc_netif_addr_from_str(val, addr);
1453+
size_t addr_len = l2util_addr_from_str(val, addr);
14531454

14541455
if ((addr_len == 0) || (addr_len > CONFIG_L2FILTER_ADDR_MAXLEN)) {
14551456
printf("error: given address is invalid\n");

0 commit comments

Comments
 (0)