From f198d689beb95ed6706d7d7f372df047c5fe95ac Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Tue, 7 Apr 2020 22:01:03 +0200 Subject: [PATCH] gnrc_dhcpv6_client: fix for SLIP link-layer In a point-to-point serial connection, we don't have L2 addresses. Set the link type & packet length accordingly and we will get a prefix from KEA. --- sys/include/net/arp.h | 1 + sys/net/gnrc/application_layer/dhcpv6/client.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/sys/include/net/arp.h b/sys/include/net/arp.h index 8d164ba323..844e4fca9b 100644 --- a/sys/include/net/arp.h +++ b/sys/include/net/arp.h @@ -32,6 +32,7 @@ extern "C" { * @{ */ #define ARP_HWTYPE_ETHERNET (1U) /**< Ethernet */ +#define ARP_HWTYPE_SERIAL (20U) /**< Serial Line */ #define ARP_HWTYPE_EUI64 (27U) /**< EUI-64 */ /** @} */ diff --git a/sys/net/gnrc/application_layer/dhcpv6/client.c b/sys/net/gnrc/application_layer/dhcpv6/client.c index d9d4fe80c6..960960d3dc 100644 --- a/sys/net/gnrc/application_layer/dhcpv6/client.c +++ b/sys/net/gnrc/application_layer/dhcpv6/client.c @@ -52,6 +52,11 @@ unsigned dhcpv6_client_get_duid_l2(unsigned iface, dhcpv6_duid_l2_t *duid) } else { switch (netif->device_type) { + case NETDEV_TYPE_SLIP: + duid->l2type = byteorder_htons(ARP_HWTYPE_SERIAL); + /* L2 address length is 0 */ + res = 0; + break; case NETDEV_TYPE_ETHERNET: case NETDEV_TYPE_BLE: case NETDEV_TYPE_ESP_NOW: