LWIP Hostname

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
A319
Posts: 48
Joined: Thu Feb 05, 2015 9:52 am
Has thanked: 2 times
Been thanked: 3 times

LWIP Hostname

Post 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 {
User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Has thanked: 83 times
Been thanked: 67 times

Re: LWIP Hostname

Post by RoccoMarco »

Moved to General Support
Post Reply