From ba3b04e7fed52415c5d5cdd1ee4e5a15e6d2ec7e Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Thu, 28 Mar 2019 08:16:29 +0100 Subject: [PATCH] Add #define for minimum IPv6 MTU length --- src/core/ipv6/nd6.c | 4 ++-- src/include/lwip/prot/ip6.h | 2 ++ src/netif/lowpan6.c | 2 +- src/netif/lowpan6_ble.c | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/ipv6/nd6.c b/src/core/ipv6/nd6.c index d65ed4e1..81992fa3 100644 --- a/src/core/ipv6/nd6.c +++ b/src/core/ipv6/nd6.c @@ -693,7 +693,7 @@ nd6_input(struct pbuf *p, struct netif *inp) } mtu_opt = (struct mtu_option *)buffer; mtu32 = lwip_htonl(mtu_opt->mtu); - if ((mtu32 >= 1280) && (mtu32 <= 0xffff)) { + if ((mtu32 >= IP6_MIN_MTU_LENGTH) && (mtu32 <= 0xffff)) { #if LWIP_ND6_ALLOW_RA_UPDATES if (inp->mtu) { /* don't set the mtu for IPv6 higher than the netif driver supports */ @@ -2312,7 +2312,7 @@ nd6_get_destination_mtu(const ip6_addr_t *ip6addr, struct netif *netif) return netif_mtu6(netif); } - return 1280; /* Minimum MTU */ + return IP6_MIN_MTU_LENGTH; /* Minimum MTU */ } diff --git a/src/include/lwip/prot/ip6.h b/src/include/lwip/prot/ip6.h index 0f6de455..7df81edd 100644 --- a/src/include/lwip/prot/ip6.h +++ b/src/include/lwip/prot/ip6.h @@ -44,6 +44,8 @@ extern "C" { #endif +#define IP6_MIN_MTU_LENGTH 1280 + /** This is the packed version of ip6_addr_t, used in network headers that are itself packed */ #ifdef PACK_STRUCT_USE_INCLUDES diff --git a/src/netif/lowpan6.c b/src/netif/lowpan6.c index 7f0d2767..5e6f0097 100644 --- a/src/netif/lowpan6.c +++ b/src/netif/lowpan6.c @@ -881,7 +881,7 @@ lowpan6_if_init(struct netif *netif) MIB2_INIT_NETIF(netif, snmp_ifType_other, 0); /* maximum transfer unit */ - netif->mtu = 1280; + netif->mtu = IP6_MIN_MTU_LENGTH; /* broadcast capability */ netif->flags = NETIF_FLAG_BROADCAST /* | NETIF_FLAG_LOWPAN6 */; diff --git a/src/netif/lowpan6_ble.c b/src/netif/lowpan6_ble.c index d89816d3..6de0ae32 100644 --- a/src/netif/lowpan6_ble.c +++ b/src/netif/lowpan6_ble.c @@ -417,7 +417,7 @@ rfc7668_if_init(struct netif *netif) MIB2_INIT_NETIF(netif, snmp_ifType_other, 0); /* maximum transfer unit, set according to RFC7668 ch2.4 */ - netif->mtu = 1280; + netif->mtu = IP6_MIN_MTU_LENGTH; /* no flags set (no broadcast, ethernet,...)*/ netif->flags = 0;