From 8a3cf8ca770711157dcc4e5cd2ab7461386bcba6 Mon Sep 17 00:00:00 2001 From: grumpy-dude Date: Wed, 12 Jun 2019 17:05:41 -0700 Subject: [PATCH] Allow configuration of local netif hostname via new LWIP component configuration menu item Signed-off-by: Sagar Bijwe Merges https://github.com/espressif/esp-idf/pull/3627 --- components/lwip/Kconfig | 6 ++++++ components/lwip/port/esp32/netif/ethernetif.c | 2 +- components/lwip/port/esp32/netif/nettestif.c | 2 +- components/lwip/port/esp32/netif/wlanif.c | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index 6fa8a507e..96bdcd5b2 100644 --- a/components/lwip/Kconfig +++ b/components/lwip/Kconfig @@ -1,5 +1,11 @@ menu "LWIP" + config LWIP_LOCAL_HOSTNAME + string "Local netif hostname" + default 'espressif' + help + The name this device will report to other devices on the network + config LWIP_L2_TO_L3_COPY bool "Enable copy between Layer2 and Layer3 packets" default n diff --git a/components/lwip/port/esp32/netif/ethernetif.c b/components/lwip/port/esp32/netif/ethernetif.c index d61653fca..99ad88c27 100644 --- a/components/lwip/port/esp32/netif/ethernetif.c +++ b/components/lwip/port/esp32/netif/ethernetif.c @@ -222,7 +222,7 @@ ethernetif_init(struct netif *netif) /* Initialize interface hostname */ #if ESP_LWIP - netif->hostname = "espressif"; + netif->hostname = CONFIG_LWIP_LOCAL_HOSTNAME; #else netif->hostname = "lwip"; #endif diff --git a/components/lwip/port/esp32/netif/nettestif.c b/components/lwip/port/esp32/netif/nettestif.c index 741f54279..4422c2195 100644 --- a/components/lwip/port/esp32/netif/nettestif.c +++ b/components/lwip/port/esp32/netif/nettestif.c @@ -39,7 +39,7 @@ err_t nettestif_init(struct netif *netif) g_last_netif = netif; - netif->hostname = "espressif"; + netif->hostname = CONFIG_LWIP_LOCAL_HOSTNAME; /* * Initialize the snmp variables and counters inside the struct netif. diff --git a/components/lwip/port/esp32/netif/wlanif.c b/components/lwip/port/esp32/netif/wlanif.c index 7c60b6934..cd2bdac8d 100644 --- a/components/lwip/port/esp32/netif/wlanif.c +++ b/components/lwip/port/esp32/netif/wlanif.c @@ -202,7 +202,7 @@ wlanif_init(struct netif *netif) /* Initialize interface hostname */ #if ESP_LWIP - netif->hostname = "espressif"; + netif->hostname = CONFIG_LWIP_LOCAL_HOSTNAME; #else netif->hostname = "lwip"; #endif