Skip to contentSkip to conversation

ifupdown-script: send current hostname in DHCP request

PATCH New Peter Korsgaard 2 participants 3 messages Oct 30, 2018 – Nov 5, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ifupdown-script: send current hostname in DHCP request

For the default (BR2_SYSTEM_DHCP) /etc/network/interfaces handling.

Both the "big" and busybox ifupdown variants pass the hostname argument to the DHCP client through the shell, so we can use $() to expand to the current hostname value.

---
 package/ifupdown-scripts/ifupdown-scripts.mk | 1 +
 1 file changed, 1 insertion(+)
package/ifupdown-scripts/ifupdown-scripts.mk +1 -0
index ebc89b3872..17364aed03 100644
@@ -23,6 +23,7 @@ define IFUPDOWN_SCRIPTS_DHCP
 		echo "iface $(IFUPDOWN_SCRIPTS_DHCP_IFACE) inet dhcp"; \
 		echo "  pre-up /etc/network/nfs_check"; \
 		echo "  wait-delay 15"; \
+		echo "  hostname \$$(hostname)"; \
 	) >> $(TARGET_DIR)/etc/network/interfaces
 	$(INSTALL) -m 0755 -D $(IFUPDOWN_SCRIPTS_PKGDIR)/nfs_check \
 		$(TARGET_DIR)/etc/network/nfs_check
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 ifupdown-script: send current hostname in DHCP request

Peter,

Quoted 7 lines · Peter Korsgaard

For the default (BR2_SYSTEM_DHCP) /etc/network/interfaces handling.

Both the "big" and busybox ifupdown variants pass the hostname argument to the DHCP client through the shell, so we can use $() to expand to the current hostname value.

The man page for the interfaces file mentioned that only pump, dhcpcd and udhcpc use the hostname value from interfaces. With dhclient requiring the dhclient.conf to specify the set hostname option with the hostname string. Would it be worth mentioning that here in the comment that for most (pump, dhcpcd, udhcpc) the hostname parameter will work but some clients like dhclient require a separate configuration file?

Quoted 23 lines
---
 package/ifupdown-scripts/ifupdown-scripts.mk | 1 +
 1 file changed, 1 insertion(+)
package/ifupdown-scripts/ifupdown-scripts.mk +1 -1
index ebc89b3872..17364aed03 100644
@@ -23,6 +23,7 @@ define IFUPDOWN_SCRIPTS_DHCP
                echo "iface $(IFUPDOWN_SCRIPTS_DHCP_IFACE) inet dhcp"; \
                echo "  pre-up /etc/network/nfs_check"; \
                echo "  wait-delay 15"; \
+               echo "  hostname \$$(hostname)"; \
        ) >> $(TARGET_DIR)/etc/network/interfaces
        $(INSTALL) -m 0755 -D $(IFUPDOWN_SCRIPTS_PKGDIR)/nfs_check \
                $(TARGET_DIR)/etc/network/nfs_check
--

2.11.0

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 8 lines
Matthew L Weber / Pr Software Engineer
Airborne Information Systems / RC Linux Secure Platforms
MS 131-100, C Ave NE, Cedar Rapids, IA, 52498, USA
www.rockwellcollins.com

Note: Any Export License Required Information and License Restricted
Third Party Intellectual Property (TPIP) content must be encrypted and
sent to matthew.weber at corp.rockwellcollins.com.
#2 lore raw

PATCH 1/1 ifupdown-script: send current hostname in DHCP request

Quoted 19 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Matthew" == Matthew Weber <[email protected]> writes:

Peter,

Quoted 7 lines · Peter Korsgaard

For the default (BR2_SYSTEM_DHCP) /etc/network/interfaces handling.

Both the "big" and busybox ifupdown variants pass the hostname argument to the DHCP client through the shell, so we can use $() to expand to the current hostname value.

The man page for the interfaces file mentioned that only pump, dhcpcd and udhcpc use the hostname value from interfaces. With dhclient requiring the dhclient.conf to specify the set hostname option with the hostname string. Would it be worth mentioning that here in the comment that for most (pump, dhcpcd, udhcpc) the hostname parameter will work but some clients like dhclient require a separate configuration file?

Quoted 1 line

I've added a comment about that and applied, thanks.

Signature · 1 line
Bye, Peter Korsgaard