From e51b0c1e2b1e36962530904ba83eeb5b8a656e4c Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Tue, 14 Nov 2017 22:46:24 +0100 Subject: [PATCH] gnrc_netif2: adapt setting of maximum packet size for slipdev --- sys/net/gnrc/netif2/gnrc_netif2.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sys/net/gnrc/netif2/gnrc_netif2.c b/sys/net/gnrc/netif2/gnrc_netif2.c index 18ea7ec008b5c..4fe016152a3fe 100644 --- a/sys/net/gnrc/netif2/gnrc_netif2.c +++ b/sys/net/gnrc/netif2/gnrc_netif2.c @@ -1100,10 +1100,15 @@ static void _init_from_device(gnrc_netif2_t *netif) break; #endif default: - res = dev->driver->get(dev, NETOPT_MAX_PACKET_SIZE, &tmp, sizeof(tmp)); - assert(res == sizeof(tmp)); #ifdef MODULE_GNRC_IPV6 - netif->ipv6.mtu = tmp; + res = dev->driver->get(dev, NETOPT_MAX_PACKET_SIZE, &tmp, sizeof(tmp)); + if (res < 0) { + /* assume maximum possible transition unit */ + netif->ipv6.mtu = UINT16_MAX; + } + else { + netif->ipv6.mtu = tmp; + } #endif } _update_l2addr_from_dev(netif);