Page 1 of 1

LWIP Hostname

Posted: Sat Oct 08, 2016 11:31 pm
by A319
Good morning,

I'm playing around with Ethernet and the LWIP library. I want to identify my boards by using the hostname. Unfortunately this feature is implemented but very static. in the lwipthread.c (190). Would it be possible to add a LWIP_HOSTNAME definition, so I don't have to change that in the binding.

Regards
Sven

Code: Select all

diff --git a/os/various/lwip_bindings/lwipthread.c b/os/various/lwip_bindings/lwipthread.c
index a94ca33..d52a22c 100644
--- a/os/various/lwip_bindings/lwipthread.c
+++ b/os/various/lwip_bindings/lwipthread.c
@@ -187,7 +187,7 @@ static struct pbuf *low_level_input(struct netif *netif) {
 static err_t ethernetif_init(struct netif *netif) {
 #if LWIP_NETIF_HOSTNAME
   /* Initialize interface hostname */
-  netif->hostname = "lwip";
+  netif->hostname = LWIP_HOSTNAME;
 #endif /* LWIP_NETIF_HOSTNAME */
 
   /*
diff --git a/os/various/lwip_bindings/lwipthread.h b/os/various/lwip_bindings/lwipthread.h
index 8b76eb6..752229d 100644
--- a/os/various/lwip_bindings/lwipthread.h
+++ b/os/various/lwip_bindings/lwipthread.h
@@ -139,6 +139,13 @@
 #endif
 
 /**
+ * @brief  Interface hostname.
+ */
+#if !defined(LWIP_HOSTNAME) || defined(__DOXYGEN__)
+#define LWIP_HOSTNAME                       "chibios"
+#endif
+
+/**
  * @brief   Runtime TCP/IP settings.
  */
 typedef struct lwipthread_opts {

Re: LWIP Hostname

Posted: Mon Oct 10, 2016 9:08 pm
by RoccoMarco
Moved to General Support