All of lore.kernel.org
 help / color / mirror / Atom feed
* [Feature] Send hostname in DHCP request
@ 2020-07-17 14:58 Roberto Roobre Santalla
  2020-07-17 16:03 ` Denis Kenzior
  0 siblings, 1 reply; 3+ messages in thread
From: Roberto Roobre Santalla @ 2020-07-17 14:58 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1257 bytes --]

Hello,

This is my first time submitting a patch/feature request over email, I
hope I do not mess up :)

First of all, thank you for your work on iwd, I have recently started
to use it on my laptop and seems to be working very well.
I have, however, noticed that when using the built-in IP management, my
hostname was not being sent to the DHCP server. This is unfortunate
since it breaks my home network, which uses dnsmasq to build dns
records on-the-fly for hosts.

I have written and extremely simple, PoC patch which calls gethostname
and pass the returned string to the ell dhcp client.

What are your thoughts about this feature?

Regards,
- ℝ

═════════════════════════════════════
 👤 Roberto Santalla Fernández
─────────────────────────────────────
 🔑 https://keybase.io/roobre/key.asc
 🔑  0E19 86A3 593E 6226
─────────────────────────────────────
 🌍 https://roobre.es
═════════════════════════════════════


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-netconfig-Send-hostname-in-dhcp-request.patch --]
[-- Type: text/x-patch, Size: 1254 bytes --]

From f4bdd182e7d7953f5857e21ca72f39b59f0a37d0 Mon Sep 17 00:00:00 2001
From: Roberto Santalla <roobre@roobre.es>
Date: Fri, 17 Jul 2020 16:40:42 +0200
Subject: [PATCH] netconfig: Send hostname in dhcp request

---
 src/netconfig.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/netconfig.c b/src/netconfig.c
index 701ae38b..a05054ca 100644
--- a/src/netconfig.c
+++ b/src/netconfig.c
@@ -30,6 +30,7 @@
 #include <netinet/if_ether.h>
 #include <netinet/in.h>
 #include <linux/rtnetlink.h>
+#include <unistd.h>
 
 #include <ell/ell.h>
 
@@ -1109,6 +1110,8 @@ bool netconfig_configure(struct netconfig *netconfig,
 				const uint8_t *mac_address,
 				netconfig_notify_func_t notify, void *user_data)
 {
+	char hostname[128];
+
 	netconfig->active_settings = active_settings;
 	netconfig->notify = notify;
 	netconfig->user_data = user_data;
@@ -1116,6 +1119,10 @@ bool netconfig_configure(struct netconfig *netconfig,
 	l_dhcp_client_set_address(netconfig->dhcp_client, ARPHRD_ETHER,
 							mac_address, ETH_ALEN);
 
+	if (gethostname(hostname, 128) == 0) {
+		l_dhcp_client_set_hostname(netconfig->dhcp_client, hostname);
+	}
+
 	netconfig_ipv4_select_and_install(netconfig);
 
 	netconfig_ipv6_select_and_install(netconfig);
-- 
2.27.0


[-- Attachment #3: signature.asc --]
[-- Type: application/pgp-signature, Size: 512 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Feature] Send hostname in DHCP request
  2020-07-17 14:58 [Feature] Send hostname in DHCP request Roberto Roobre Santalla
@ 2020-07-17 16:03 ` Denis Kenzior
  2020-07-19 10:21   ` Roberto Roobre Santalla
  0 siblings, 1 reply; 3+ messages in thread
From: Denis Kenzior @ 2020-07-17 16:03 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 2009 bytes --]

Hi Roberto,

On 7/17/20 9:58 AM, Roberto "Roobre" Santalla wrote:
> Hello,
> 
> This is my first time submitting a patch/feature request over email, I
> hope I do not mess up :)

We prefer git send-email, similar to how kernel patches are submitted.  See 
HACKING document for more details.

> 
> First of all, thank you for your work on iwd, I have recently started
> to use it on my laptop and seems to be working very well.
> I have, however, noticed that when using the built-in IP management, my
> hostname was not being sent to the DHCP server. This is unfortunate
> since it breaks my home network, which uses dnsmasq to build dns
> records on-the-fly for hosts.

Right.  We chose not to send the hostname in order to comply with RFC 7844 [1]. 
For networks where this is required (like yours) we should probably have an 
'opt-in' method.  Perhaps the easy way to start is by adding another setting to 
the network IPv4 settings.  Maybe a boolean setting named 'SendHostname' under 
the 'DHCPv4' group.

> 
> I have written and extremely simple, PoC patch which calls gethostname
> and pass the returned string to the ell dhcp client.
> 
> What are your thoughts about this feature?

This looks fine, but needs to check the 'opt-in' setting as discussed above.

Regards,
-Denis

[1] https://tools.ietf.org/html/rfc7844#section-3.7

> 
> Regards,
> - ℝ
> 
> ═════════════════════════════════════
>   👤 Roberto Santalla Fernández
> ─────────────────────────────────────
>   🔑 https://keybase.io/roobre/key.asc
>   🔑  0E19 86A3 593E 6226
> ─────────────────────────────────────
>   🌍 https://roobre.es
> ═════════════════════════════════════
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Feature] Send hostname in DHCP request
  2020-07-17 16:03 ` Denis Kenzior
@ 2020-07-19 10:21   ` Roberto Roobre Santalla
  0 siblings, 0 replies; 3+ messages in thread
From: Roberto Roobre Santalla @ 2020-07-19 10:21 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 3201 bytes --]

Hi Denis,

I completely agree with the opt-in approach. I can take a look at the
codebase to see how config options are handled, and try to patch that
in.

Regarding git send-email, I initially thought that doing so would not
let me add context or explanation about the patch, but now I see that
it is not the case (w/ --compose). I'll follow this approach for the
upcoming patch.

Thanks!

On Fri, 2020-07-17 at 11:03 -0500, Denis Kenzior wrote:
> Hi Roberto,
> 
> On 7/17/20 9:58 AM, Roberto "Roobre" Santalla wrote:
> > Hello,
> > 
> > This is my first time submitting a patch/feature request over
> > email, I
> > hope I do not mess up :)
> 
> We prefer git send-email, similar to how kernel patches are
> submitted.  See 
> HACKING document for more details.
> 
> > First of all, thank you for your work on iwd, I have recently
> > started
> > to use it on my laptop and seems to be working very well.
> > I have, however, noticed that when using the built-in IP
> > management, my
> > hostname was not being sent to the DHCP server. This is unfortunate
> > since it breaks my home network, which uses dnsmasq to build dns
> > records on-the-fly for hosts.
> 
> Right.  We chose not to send the hostname in order to comply with RFC
> 7844 [1]. 
> For networks where this is required (like yours) we should probably
> have an 
> 'opt-in' method.  Perhaps the easy way to start is by adding another
> setting to 
> the network IPv4 settings.  Maybe a boolean setting named
> 'SendHostname' under 
> the 'DHCPv4' group.
> 
> > I have written and extremely simple, PoC patch which calls
> > gethostname
> > and pass the returned string to the ell dhcp client.
> > 
> > What are your thoughts about this feature?
> 
> This looks fine, but needs to check the 'opt-in' setting as discussed
> above.
> 
> Regards,
> -Denis
> 
> [1] https://tools.ietf.org/html/rfc7844#section-3.7
> 
> > Regards,
> > - ℝ
> > 
> > ═════════════════════════════════════
> >   👤 Roberto Santalla Fernández
> > ─────────────────────────────────────
> >   🔑 https://keybase.io/roobre/key.asc
> >   🔑  0E19 86A3 593E 6226
> > ─────────────────────────────────────
> >   🌍 https://roobre.es
> > ═════════════════════════════════════
> > 
-- 
Regards,

- ℝ

═════════════════════════════════════
 👤 Roberto Santalla Fernández
─────────────────────────────────────
 🔑 https://keybase.io/roobre/key.asc
 🔑  0E19 86A3 593E 6226
─────────────────────────────────────
 🌍 https://roobre.es
═════════════════════════════════════

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-19 10:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-17 14:58 [Feature] Send hostname in DHCP request Roberto Roobre Santalla
2020-07-17 16:03 ` Denis Kenzior
2020-07-19 10:21   ` Roberto Roobre Santalla

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.