Skip to content

Commit afdf359

Browse files
authored
Merge pull request #984 from pennam/hostname-fix
patch: check for user network interface before reading hostname
2 parents 84c44cd + 4d7047b commit afdf359

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
From 4292f8b7c4aa38b68d22c413f91bdc95192cfad6 Mon Sep 17 00:00:00 2001
2+
From: pennam <m.pennasilico@arduino.cc>
3+
Date: Tue, 29 Oct 2024 11:30:00 +0100
4+
Subject: [PATCH] Add user network interface check before reading hostname
5+
6+
---
7+
connectivity/lwipstack/source/LWIPInterface.cpp | 8 +++++---
8+
1 file changed, 5 insertions(+), 3 deletions(-)
9+
10+
diff --git a/connectivity/lwipstack/source/LWIPInterface.cpp b/connectivity/lwipstack/source/LWIPInterface.cpp
11+
index 64869a3538..da964543c7 100644
12+
--- a/connectivity/lwipstack/source/LWIPInterface.cpp
13+
+++ b/connectivity/lwipstack/source/LWIPInterface.cpp
14+
@@ -446,9 +446,11 @@ nsapi_error_t LWIP::add_ethernet_interface(EMAC &emac, bool default_if, OnboardN
15+
interface->memory_manager = &memory_manager;
16+
interface->ppp_enabled = false;
17+
18+
- hostname = user_network_interface->get_hostname();
19+
- if (hostname) {
20+
- netif_set_hostname(&interface->netif, hostname);
21+
+ if (user_network_interface) {
22+
+ hostname = user_network_interface->get_hostname();
23+
+ if (hostname) {
24+
+ netif_set_hostname(&interface->netif, hostname);
25+
+ }
26+
}
27+
28+
#if (MBED_MAC_ADDRESS_SUM != MBED_MAC_ADDR_INTERFACE)
29+
--
30+
2.45.2
31+

0 commit comments

Comments
 (0)