From 4d7047bd82fe3b6cee63751f15172896fe67f9ec Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 29 Oct 2024 11:39:30 +0100 Subject: [PATCH] patch: check for user network interface before reading hostname --- ...-interface-check-before-reading-host.patch | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 patches/0244-Add-user-network-interface-check-before-reading-host.patch diff --git a/patches/0244-Add-user-network-interface-check-before-reading-host.patch b/patches/0244-Add-user-network-interface-check-before-reading-host.patch new file mode 100644 index 000000000..52d3e79b9 --- /dev/null +++ b/patches/0244-Add-user-network-interface-check-before-reading-host.patch @@ -0,0 +1,31 @@ +From 4292f8b7c4aa38b68d22c413f91bdc95192cfad6 Mon Sep 17 00:00:00 2001 +From: pennam +Date: Tue, 29 Oct 2024 11:30:00 +0100 +Subject: [PATCH] Add user network interface check before reading hostname + +--- + connectivity/lwipstack/source/LWIPInterface.cpp | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/connectivity/lwipstack/source/LWIPInterface.cpp b/connectivity/lwipstack/source/LWIPInterface.cpp +index 64869a3538..da964543c7 100644 +--- a/connectivity/lwipstack/source/LWIPInterface.cpp ++++ b/connectivity/lwipstack/source/LWIPInterface.cpp +@@ -446,9 +446,11 @@ nsapi_error_t LWIP::add_ethernet_interface(EMAC &emac, bool default_if, OnboardN + interface->memory_manager = &memory_manager; + interface->ppp_enabled = false; + +- hostname = user_network_interface->get_hostname(); +- if (hostname) { +- netif_set_hostname(&interface->netif, hostname); ++ if (user_network_interface) { ++ hostname = user_network_interface->get_hostname(); ++ if (hostname) { ++ netif_set_hostname(&interface->netif, hostname); ++ } + } + + #if (MBED_MAC_ADDRESS_SUM != MBED_MAC_ADDR_INTERFACE) +-- +2.45.2 +