mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] net: dhcp: add support to send the hostname to the dhcp server
@ 2012-04-15  4:05 Jean-Christophe PLAGNIOL-VILLARD
  2012-04-15  4:05 ` [PATCH 2/3] net: dhcp: allow to user env var as user class too Jean-Christophe PLAGNIOL-VILLARD
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-04-15  4:05 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 net/dhcp.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/net/dhcp.c b/net/dhcp.c
index 0116ba4..c3c41a0 100644
--- a/net/dhcp.c
+++ b/net/dhcp.c
@@ -237,6 +237,7 @@ static int dhcp_set_string_options(struct dhcp_param *param, u8 *e)
 	return str_len + 2;
 }
 
+#define DHCP_HOSTNAME		12
 #define DHCP_VENDOR_ID		60
 #define DHCP_CLIENT_ID		61
 #define DHCP_USER_CLASS		77
@@ -244,6 +245,10 @@ static int dhcp_set_string_options(struct dhcp_param *param, u8 *e)
 
 struct dhcp_param dhcp_params[] = {
 	{
+		.option = DHCP_HOSTNAME,
+		.handle = dhcp_set_string_options,
+		.barebox_var_name = "hostname",
+	}, {
 		.option = DHCP_VENDOR_ID,
 		.handle = dhcp_set_string_options,
 		.barebox_var_name = "dhcp_vendor_id",
@@ -614,8 +619,10 @@ static int do_dhcp(int argc, char *argv[])
 
 	dhcp_reset_env();
 
-	while((opt = getopt(argc, argv, "v:c:u:U:")) > 0) {
+	while((opt = getopt(argc, argv, "h:v:c:u:U:")) > 0) {
 		switch(opt) {
+		case 'U':
+			dhcp_set_param_data(DHCP_HOSTNAME, optarg);
 		case 'v':
 			dhcp_set_param_data(DHCP_VENDOR_ID, optarg);
 			break;
@@ -698,7 +705,7 @@ BAREBOX_CMD_END
 
 BAREBOX_MAGICVAR(bootfile, "bootfile returned from DHCP request");
 BAREBOX_MAGICVAR(nameserver, "Nameserver returned from DHCP request");
-BAREBOX_MAGICVAR(hostname, "hostname returned from DHCP request");
+BAREBOX_MAGICVAR(hostname, "hostname to send or returned from DHCP request");
 BAREBOX_MAGICVAR(domainname, "domainname returned from DHCP request");
 BAREBOX_MAGICVAR(rootpath, "rootpath returned from DHCP request");
 BAREBOX_MAGICVAR(dhcp_vendor_id, "vendor id to send to the DHCP server");
-- 
1.7.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2012-04-18 10:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-15  4:05 [PATCH 1/3] net: dhcp: add support to send the hostname to the dhcp server Jean-Christophe PLAGNIOL-VILLARD
2012-04-15  4:05 ` [PATCH 2/3] net: dhcp: allow to user env var as user class too Jean-Christophe PLAGNIOL-VILLARD
2012-04-15 16:57   ` Sascha Hauer
2012-04-15 16:49     ` Jean-Christophe PLAGNIOL-VILLARD
2012-04-15  4:05 ` [PATCH 3/3] config: switch machine to hostname Jean-Christophe PLAGNIOL-VILLARD
2012-04-15  7:51 ` [PATCH 1/3] net: dhcp: add support to send the hostname to the dhcp server Baruch Siach
2012-04-15 13:27 ` [PATCH 1/3 v2] " Jean-Christophe PLAGNIOL-VILLARD
2012-04-18 10:05 ` [PATCH 1/3] " Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox