* [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
* [PATCH 2/3] net: dhcp: allow to user env var as user class too
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 ` Jean-Christophe PLAGNIOL-VILLARD
2012-04-15 16:57 ` Sascha Hauer
2012-04-15 4:05 ` [PATCH 3/3] config: switch machine to hostname Jean-Christophe PLAGNIOL-VILLARD
` (3 subsequent siblings)
4 siblings, 1 reply; 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 c3c41a0..ecff819 100644
--- a/net/dhcp.c
+++ b/net/dhcp.c
@@ -211,6 +211,7 @@ struct dhcp_opt dhcp_options[] = {
struct dhcp_param {
unsigned char option;
const char *barebox_var_name;
+ const char *barebox_var_alt_name;
int (*handle)(struct dhcp_param *param, u8 *e);
void *data;
};
@@ -220,8 +221,12 @@ static int dhcp_set_string_options(struct dhcp_param *param, u8 *e)
int str_len;
char* str = param->data;
- if (!str && param->barebox_var_name)
- str = (char*)getenv(param->barebox_var_name);
+ if (!str) {
+ if (param->barebox_var_name)
+ str = (char*)getenv(param->barebox_var_name);
+ else if (param->barebox_var_alt_name)
+ str = (char*)getenv(param->barebox_var_alt_name);
+ }
if (!str)
return 0;
@@ -260,6 +265,7 @@ struct dhcp_param dhcp_params[] = {
.option = DHCP_USER_CLASS,
.handle = dhcp_set_string_options,
.barebox_var_name = "dhcp_user_class",
+ .barebox_var_alt_name = "user",
}, {
.option = DHCP_CLIENT_UUID,
.handle = dhcp_set_string_options,
@@ -712,5 +718,6 @@ BAREBOX_MAGICVAR(dhcp_vendor_id, "vendor id to send to the DHCP server");
BAREBOX_MAGICVAR(dhcp_client_uuid, "cliend uuid to send to the DHCP server");
BAREBOX_MAGICVAR(dhcp_client_id, "cliend id to send to the DHCP server");
BAREBOX_MAGICVAR(dhcp_user_class, "user class to send to the DHCP server");
+BAREBOX_MAGICVAR(user, "user class to send to the DHCP server");
BAREBOX_MAGICVAR(dhcp_tftp_server_name, "TFTP server Name returned from DHCP request");
BAREBOX_MAGICVAR(dhcp_oftree_file, "OF tree returned from DHCP request (option 224)");
--
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
* [PATCH 3/3] config: switch machine to hostname
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 4:05 ` 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
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-04-15 4:05 UTC (permalink / raw)
To: barebox
So we can use it for dhcp request too.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/boards/chumby_falconwing/env/config | 2 +-
arch/arm/boards/eukrea_cpuimx25/env/config | 14 +++++++-------
.../env/config | 14 +++++++-------
arch/arm/boards/eukrea_cpuimx51/env/config | 14 +++++++-------
arch/arm/boards/freescale-mx28-evk/env/config | 12 ++++++------
arch/arm/boards/freescale-mx35-3-stack/env/config | 14 +++++++-------
arch/arm/boards/freescale-mx51-pdk/env/config | 14 +++++++-------
arch/arm/boards/freescale-mx53-loco/env/config | 14 +++++++-------
arch/arm/boards/freescale-mx53-smd/env/config | 14 +++++++-------
arch/arm/boards/guf-cupid/env/config | 14 +++++++-------
arch/arm/boards/guf-neso/env/config | 14 +++++++-------
arch/arm/boards/karo-tx25/env/config | 14 +++++++-------
arch/arm/boards/karo-tx28/env/config | 14 +++++++-------
arch/arm/boards/mini2440/env/config | 14 +++++++-------
arch/arm/boards/panda/env/config | 12 ++++++------
arch/arm/boards/pcm027/env/config | 14 +++++++-------
arch/arm/boards/pcm037/env/config | 14 +++++++-------
arch/arm/boards/pcm038/env/config | 14 +++++++-------
arch/arm/boards/pcm043/env/config | 14 +++++++-------
arch/arm/boards/pcm049/env/config | 14 +++++++-------
arch/arm/boards/phycard-a-l1/env/config | 18 +++++++++---------
arch/arm/boards/phycard-a-xl2/env/config | 14 +++++++-------
arch/arm/boards/phycard-i.MX27/env/config | 14 +++++++-------
arch/arm/boards/scb9328/env/config | 14 +++++++-------
arch/arm/boards/tqma53/env/config | 8 ++++----
defaultenv/config | 18 +++++++++---------
26 files changed, 175 insertions(+), 175 deletions(-)
copy arch/arm/boards/{eukrea_cpuimx25 => eukrea_cpuimx35}/env/config (73%)
diff --git a/arch/arm/boards/chumby_falconwing/env/config b/arch/arm/boards/chumby_falconwing/env/config
index 1419161..bf48da6 100644
--- a/arch/arm/boards/chumby_falconwing/env/config
+++ b/arch/arm/boards/chumby_falconwing/env/config
@@ -1,6 +1,6 @@
#!/bin/sh
-machine=falconwing
+hostname=falconwing
# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
diff --git a/arch/arm/boards/eukrea_cpuimx25/env/config b/arch/arm/boards/eukrea_cpuimx25/env/config
index bc1cfd5..9d9ff9a 100644
--- a/arch/arm/boards/eukrea_cpuimx25/env/config
+++ b/arch/arm/boards/eukrea_cpuimx25/env/config
@@ -3,7 +3,7 @@
# otg port mode : can be 'host' or 'device'
otg_mode="device"
-machine=eukrea-cpuimx25
+hostname=eukrea-cpuimx25
# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
@@ -22,16 +22,16 @@ rootfs_loc=nand
# rootfs
rootfs_type=ubifs
-rootfsimage=$machine/rootfs.$rootfs_type
+rootfsimage=$hostname/rootfs.$rootfs_type
# kernel
-kernelimage=$machine/uImage-${machine}.bin
+kernelimage=$hostname/uImage-${hostname}.bin
# barebox and it's env
-bareboximage=$machine/barebox-${machine}.bin
-bareboxenvimage=$machine/bareboxenv-${machine}.bin
+bareboximage=$hostname/barebox-${hostname}.bin
+bareboxenvimage=$hostname/bareboxenv-${hostname}.bin
-nfsroot="$eth0.serverip:/srv/nfs/$machine"
+nfsroot="$eth0.serverip:/srv/nfs/$hostname"
autoboot_timeout=1
@@ -40,7 +40,7 @@ bootargs="console=ttymxc0,115200 otg_mode=$otg_mode"
nand_parts="256k(barebox)ro,128k(bareboxenv),3M(kernel),-(root)"
rootfs_mtdblock_nand=3
nand_device="mxc_nand"
-ubiroot="$machine-rootfs"
+ubiroot="$hostname-rootfs"
device_type="nand"
# set a fancy prompt (if support is compiled in)
diff --git a/arch/arm/boards/eukrea_cpuimx25/env/config b/arch/arm/boards/eukrea_cpuimx35/env/config
similarity index 73%
copy from arch/arm/boards/eukrea_cpuimx25/env/config
copy to arch/arm/boards/eukrea_cpuimx35/env/config
index bc1cfd5..1b19bd2 100644
--- a/arch/arm/boards/eukrea_cpuimx25/env/config
+++ b/arch/arm/boards/eukrea_cpuimx35/env/config
@@ -3,7 +3,7 @@
# otg port mode : can be 'host' or 'device'
otg_mode="device"
-machine=eukrea-cpuimx25
+hostname=eukrea-cpuimx35
# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
@@ -22,16 +22,16 @@ rootfs_loc=nand
# rootfs
rootfs_type=ubifs
-rootfsimage=$machine/rootfs.$rootfs_type
+rootfsimage=$hostname/rootfs.$rootfs_type
# kernel
-kernelimage=$machine/uImage-${machine}.bin
+kernelimage=$hostname/uImage-${hostname}.bin
# barebox and it's env
-bareboximage=$machine/barebox-${machine}.bin
-bareboxenvimage=$machine/bareboxenv-${machine}.bin
+bareboximage=$hostname/barebox-${hostname}.bin
+bareboxenvimage=$hostname/bareboxenv-${hostname}.bin
-nfsroot="$eth0.serverip:/srv/nfs/$machine"
+nfsroot="$eth0.serverip:/srv/nfs/$hostname"
autoboot_timeout=1
@@ -40,7 +40,7 @@ bootargs="console=ttymxc0,115200 otg_mode=$otg_mode"
nand_parts="256k(barebox)ro,128k(bareboxenv),3M(kernel),-(root)"
rootfs_mtdblock_nand=3
nand_device="mxc_nand"
-ubiroot="$machine-rootfs"
+ubiroot="$hostname-rootfs"
device_type="nand"
# set a fancy prompt (if support is compiled in)
diff --git a/arch/arm/boards/eukrea_cpuimx51/env/config b/arch/arm/boards/eukrea_cpuimx51/env/config
index 1b57b29..531fa43 100644
--- a/arch/arm/boards/eukrea_cpuimx51/env/config
+++ b/arch/arm/boards/eukrea_cpuimx51/env/config
@@ -6,7 +6,7 @@ otg_mode="device"
# ex : 640x480M-16@60 800x600M-24@60 1024x768M-16@60
video="CMO-QVGA"
-machine=eukrea-cpuimx51
+hostname=eukrea-cpuimx51
# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
@@ -25,16 +25,16 @@ rootfs_loc=nand
# rootfs
rootfs_type=ubifs
-rootfsimage=$machine/rootfs.$rootfs_type
+rootfsimage=$hostname/rootfs.$rootfs_type
# kernel
-kernelimage=$machine/uImage-${machine}.bin
+kernelimage=$hostname/uImage-${hostname}.bin
# barebox and it's env
-bareboximage=$machine/barebox-${machine}.bin
-bareboxenvimage=$machine/bareboxenv-${machine}.bin
+bareboximage=$hostname/barebox-${hostname}.bin
+bareboxenvimage=$hostname/bareboxenv-${hostname}.bin
-nfsroot="$eth0.serverip:/srv/nfs/$machine"
+nfsroot="$eth0.serverip:/srv/nfs/$hostname"
autoboot_timeout=1
@@ -49,7 +49,7 @@ bootargs="console=ttymxc0,115200 otg_mode=$otg_mode video=$video screen_type=$sc
nand_parts="256k(barebox)ro,128k(bareboxenv),3M(kernel),-(root)"
rootfs_mtdblock_nand=3
nand_device="mxc_nand"
-ubiroot="$machine-rootfs"
+ubiroot="$hostname-rootfs"
device_type="nand"
# set a fancy prompt (if support is compiled in)
diff --git a/arch/arm/boards/freescale-mx28-evk/env/config b/arch/arm/boards/freescale-mx28-evk/env/config
index 5095633..3951c5b 100644
--- a/arch/arm/boards/freescale-mx28-evk/env/config
+++ b/arch/arm/boards/freescale-mx28-evk/env/config
@@ -1,6 +1,6 @@
#!/bin/sh
-machine=mx28-evk
+hostname=mx28-evk
#user=
# use 'dhcp' to do dhcp in barebox and in kernel
@@ -24,21 +24,21 @@ rootfs_loc=net
rootfs_type=ext2
# where is the rootfs in case of 'rootfs_loc=disk' (linux name)
rootfs_part_linux_dev=mmcblk0p4
-rootfsimage=rootfs-${machine}.$rootfs_type
+rootfsimage=rootfs-${hostname}.$rootfs_type
# where is the kernel image in case of 'kernel_loc=disk'
kernel_part=disk0.2
-kernelimage=zImage-$machine
-bareboximage=barebox-${machine}.bin
-bareboxenvimage=barebox-${machine}.bin
+kernelimage=zImage-$hostname
+bareboximage=barebox-${hostname}.bin
+bareboxenvimage=barebox-${hostname}.bin
if [ -n $user ]; then
bareboximage="$user"-"$bareboximage"
bareboxenvimage="$user"-"$bareboxenvimage"
kernelimage="$user"-"$kernelimage"
rootfsimage="$user"-"$rootfsimage"
- nfsroot="/home/$user/nfsroot/$machine"
+ nfsroot="/home/$user/nfsroot/$hostname"
else
nfsroot="/path/to/nfs/root"
fi
diff --git a/arch/arm/boards/freescale-mx35-3-stack/env/config b/arch/arm/boards/freescale-mx35-3-stack/env/config
index 9f37348..171ae8c 100644
--- a/arch/arm/boards/freescale-mx35-3-stack/env/config
+++ b/arch/arm/boards/freescale-mx35-3-stack/env/config
@@ -1,6 +1,6 @@
#!/bin/sh
-machine=mx35-3stack
+hostname=mx35-3stack
eth0.serverip=
user=
@@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
-rootfsimage=root-$machine.$rootfs_type
+rootfsimage=root-$hostname.$rootfs_type
-kernelimage=zImage-$machine
-#kernelimage=uImage-$machine
-#kernelimage=Image-$machine
-#kernelimage=Image-$machine.lzo
+kernelimage=zImage-$hostname
+#kernelimage=uImage-$hostname
+#kernelimage=Image-$hostname
+#kernelimage=Image-$hostname.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
- nfsroot="$eth0.serverip:/home/$user/nfsroot/$machine"
+ nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"
diff --git a/arch/arm/boards/freescale-mx51-pdk/env/config b/arch/arm/boards/freescale-mx51-pdk/env/config
index 10690c9..7a2841e 100644
--- a/arch/arm/boards/freescale-mx51-pdk/env/config
+++ b/arch/arm/boards/freescale-mx51-pdk/env/config
@@ -1,6 +1,6 @@
#!/bin/sh
-machine=babbage
+hostname=babbage
eth0.serverip=
user=
@@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
-rootfsimage=root-$machine.$rootfs_type
+rootfsimage=root-$hostname.$rootfs_type
-kernelimage=zImage-$machine
-#kernelimage=uImage-$machine
-#kernelimage=Image-$machine
-#kernelimage=Image-$machine.lzo
+kernelimage=zImage-$hostname
+#kernelimage=uImage-$hostname
+#kernelimage=Image-$hostname
+#kernelimage=Image-$hostname.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
- nfsroot="$eth0.serverip:/home/$user/nfsroot/$machine"
+ nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"
diff --git a/arch/arm/boards/freescale-mx53-loco/env/config b/arch/arm/boards/freescale-mx53-loco/env/config
index 98f5eaf..dbcbb35 100644
--- a/arch/arm/boards/freescale-mx53-loco/env/config
+++ b/arch/arm/boards/freescale-mx53-loco/env/config
@@ -1,6 +1,6 @@
#!/bin/sh
-machine=loco
+hostname=loco
eth0.serverip=
user=
@@ -24,16 +24,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
-rootfsimage=root-$machine.$rootfs_type
+rootfsimage=root-$hostname.$rootfs_type
-kernelimage=zImage-$machine
-#kernelimage=uImage-$machine
-#kernelimage=Image-$machine
-#kernelimage=Image-$machine.lzo
+kernelimage=zImage-$hostname
+#kernelimage=uImage-$hostname
+#kernelimage=Image-$hostname
+#kernelimage=Image-$hostname.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
- nfsroot="$eth0.serverip:/home/$user/nfsroot/$machine"
+ nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"
diff --git a/arch/arm/boards/freescale-mx53-smd/env/config b/arch/arm/boards/freescale-mx53-smd/env/config
index fd238a6..d2afb29 100644
--- a/arch/arm/boards/freescale-mx53-smd/env/config
+++ b/arch/arm/boards/freescale-mx53-smd/env/config
@@ -1,6 +1,6 @@
#!/bin/sh
-machine=loco
+hostname=loco
eth0.serverip=
user=
@@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
-rootfsimage=root-$machine.$rootfs_type
+rootfsimage=root-$hostname.$rootfs_type
-kernelimage=zImage-$machine
-#kernelimage=uImage-$machine
-#kernelimage=Image-$machine
-#kernelimage=Image-$machine.lzo
+kernelimage=zImage-$hostname
+#kernelimage=uImage-$hostname
+#kernelimage=Image-$hostname
+#kernelimage=Image-$hostname.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
- nfsroot="$eth0.serverip:/home/$user/nfsroot/$machine"
+ nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"
diff --git a/arch/arm/boards/guf-cupid/env/config b/arch/arm/boards/guf-cupid/env/config
index 930a97d..1be875d 100644
--- a/arch/arm/boards/guf-cupid/env/config
+++ b/arch/arm/boards/guf-cupid/env/config
@@ -1,6 +1,6 @@
#!/bin/sh
-machine=cupid
+hostname=cupid
eth0.serverip=
user=
@@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
-rootfsimage=root-$machine.$rootfs_type
+rootfsimage=root-$hostname.$rootfs_type
-kernelimage=zImage-$machine
-#kernelimage=uImage-$machine
-#kernelimage=Image-$machine
-#kernelimage=Image-$machine.lzo
+kernelimage=zImage-$hostname
+#kernelimage=uImage-$hostname
+#kernelimage=Image-$hostname
+#kernelimage=Image-$hostname.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
- nfsroot="$eth0.serverip:/home/$user/nfsroot/$machine"
+ nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"
diff --git a/arch/arm/boards/guf-neso/env/config b/arch/arm/boards/guf-neso/env/config
index 9b675b5..3013728 100644
--- a/arch/arm/boards/guf-neso/env/config
+++ b/arch/arm/boards/guf-neso/env/config
@@ -1,6 +1,6 @@
#!/bin/sh
-machine=guf-neso
+hostname=guf-neso
eth0.serverip=
user=
@@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
-rootfsimage=root-$machine.$rootfs_type
+rootfsimage=root-$hostname.$rootfs_type
-kernelimage=zImage-$machine
-#kernelimage=uImage-$machine
-#kernelimage=Image-$machine
-#kernelimage=Image-$machine.lzo
+kernelimage=zImage-$hostname
+#kernelimage=uImage-$hostname
+#kernelimage=Image-$hostname
+#kernelimage=Image-$hostname.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
- nfsroot="$eth0.serverip:/home/$user/nfsroot/$machine"
+ nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"
diff --git a/arch/arm/boards/karo-tx25/env/config b/arch/arm/boards/karo-tx25/env/config
index 69f2c26..28a5e7f 100644
--- a/arch/arm/boards/karo-tx25/env/config
+++ b/arch/arm/boards/karo-tx25/env/config
@@ -1,5 +1,5 @@
-machine=tx25
+hostname=tx25
baseboard=tx28stk5
user=
@@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
-rootfsimage=root-$machine.$rootfs_type
+rootfsimage=root-$hostname.$rootfs_type
-kernelimage=zImage-$machine
-#kernelimage=uImage-$machine
-#kernelimage=Image-$machine
-#kernelimage=Image-$machine.lzo
+kernelimage=zImage-$hostname
+#kernelimage=uImage-$hostname
+#kernelimage=Image-$hostname
+#kernelimage=Image-$hostname.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
- nfsroot="$eth0.serverip:/home/$user/nfsroot/$machine"
+ nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"
diff --git a/arch/arm/boards/karo-tx28/env/config b/arch/arm/boards/karo-tx28/env/config
index ed361eb..b5222e9 100644
--- a/arch/arm/boards/karo-tx28/env/config
+++ b/arch/arm/boards/karo-tx28/env/config
@@ -1,7 +1,7 @@
#
#
-machine=tx28
+hostname=tx28
baseboard=tx28stk5
# use 'dhcp' to do dhcp in barebox and in kernel
@@ -22,16 +22,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
-rootfsimage=root-$machine.$rootfs_type
+rootfsimage=root-$hostname.$rootfs_type
-kernelimage=zImage-$machine
-#kernelimage=uImage-$machine
-#kernelimage=Image-$machine
-#kernelimage=Image-$machine.lzo
+kernelimage=zImage-$hostname
+#kernelimage=uImage-$hostname
+#kernelimage=Image-$hostname
+#kernelimage=Image-$hostname.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
- nfsroot="$eth0.serverip:/home/$user/nfsroot/$machine"
+ nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"
diff --git a/arch/arm/boards/mini2440/env/config b/arch/arm/boards/mini2440/env/config
index ac8c32a..77cc34f 100644
--- a/arch/arm/boards/mini2440/env/config
+++ b/arch/arm/boards/mini2440/env/config
@@ -1,6 +1,6 @@
#!/bin/sh
-machine=mini2440
+hostname=mini2440
eth0.serverip=
user=
@@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
-rootfsimage=root-${machine}.${rootfs_type}
+rootfsimage=root-${hostname}.${rootfs_type}
-kernelimage=zImage-${machine}
-#kernelimage=uImage-$machine
-#kernelimage=Image-$machine
-#kernelimage=Image-$machine.lzo
+kernelimage=zImage-${hostname}
+#kernelimage=uImage-$hostname
+#kernelimage=Image-$hostname
+#kernelimage=Image-$hostname.lzo
if [ -n $user ]; then
kernelimage="${user}"-"${kernelimage}"
- nfsroot="${eth0.serverip}:/home/${user}/nfsroot/${machine}"
+ nfsroot="${eth0.serverip}:/home/${user}/nfsroot/${hostname}"
rootfsimage="${user}"-"${rootfsimage}"
else
nfsroot="${eth0.serverip}:/path/to/nfs/root"
diff --git a/arch/arm/boards/panda/env/config b/arch/arm/boards/panda/env/config
index 29672be..29a63f3 100644
--- a/arch/arm/boards/panda/env/config
+++ b/arch/arm/boards/panda/env/config
@@ -1,6 +1,6 @@
#!/bin/sh
-machine=panda
+hostname=panda
user=
# use 'dhcp' to do dhcp in barebox and in kernel
@@ -18,14 +18,14 @@ kernel_loc=tftp
# can be either 'net', 'nor', 'nand' or 'initrd'
rootfs_loc=net
-kernelimage=zImage-$machine
-#kernelimage=uImage-$machine
-#kernelimage=Image-$machine
-#kernelimage=Image-${machine}.lzo
+kernelimage=zImage-$hostname
+#kernelimage=uImage-$hostname
+#kernelimage=Image-$hostname
+#kernelimage=Image-${hostname}.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
- nfsroot="$eth0.serverip:/home/$user/nfsroot/$machine"
+ nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"
diff --git a/arch/arm/boards/pcm027/env/config b/arch/arm/boards/pcm027/env/config
index 433f259..3ed963c 100644
--- a/arch/arm/boards/pcm027/env/config
+++ b/arch/arm/boards/pcm027/env/config
@@ -1,6 +1,6 @@
#!/bin/sh
-machine=pcm027
+hostname=pcm027
eth0.serverip=
user=
@@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
-rootfsimage=root-$machine.$rootfs_type
+rootfsimage=root-$hostname.$rootfs_type
-kernelimage=zImage-$machine
-#kernelimage=uImage-$machine
-#kernelimage=Image-$machine
-#kernelimage=Image-$machine.lzo
+kernelimage=zImage-$hostname
+#kernelimage=uImage-$hostname
+#kernelimage=Image-$hostname
+#kernelimage=Image-$hostname.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
- nfsroot="$eth0.serverip:/home/$user/nfsroot/$machine"
+ nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"
diff --git a/arch/arm/boards/pcm037/env/config b/arch/arm/boards/pcm037/env/config
index d67d319..fcdb777 100644
--- a/arch/arm/boards/pcm037/env/config
+++ b/arch/arm/boards/pcm037/env/config
@@ -1,6 +1,6 @@
#!/bin/sh
-machine=pcm037
+hostname=pcm037
eth0.serverip=
user=
@@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
-rootfsimage=root-$machine.$rootfs_type
+rootfsimage=root-$hostname.$rootfs_type
-kernelimage=zImage-$machine
-#kernelimage=uImage-$machine
-#kernelimage=Image-$machine
-#kernelimage=Image-$machine.lzo
+kernelimage=zImage-$hostname
+#kernelimage=uImage-$hostname
+#kernelimage=Image-$hostname
+#kernelimage=Image-$hostname.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
- nfsroot="$eth0.serverip:/home/$user/nfsroot/$machine"
+ nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"
diff --git a/arch/arm/boards/pcm038/env/config b/arch/arm/boards/pcm038/env/config
index b1a5f42..32be5ec 100644
--- a/arch/arm/boards/pcm038/env/config
+++ b/arch/arm/boards/pcm038/env/config
@@ -1,6 +1,6 @@
#!/bin/sh
-machine=pcm038
+hostname=pcm038
eth0.serverip=
user=
@@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
-rootfsimage=root-$machine.$rootfs_type
+rootfsimage=root-$hostname.$rootfs_type
-kernelimage=zImage-$machine
-#kernelimage=uImage-$machine
-#kernelimage=Image-$machine
-#kernelimage=Image-$machine.lzo
+kernelimage=zImage-$hostname
+#kernelimage=uImage-$hostname
+#kernelimage=Image-$hostname
+#kernelimage=Image-$hostname.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
- nfsroot="$eth0.serverip:/home/$user/nfsroot/$machine"
+ nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"
diff --git a/arch/arm/boards/pcm043/env/config b/arch/arm/boards/pcm043/env/config
index 2a355e6..644c7fb 100644
--- a/arch/arm/boards/pcm043/env/config
+++ b/arch/arm/boards/pcm043/env/config
@@ -1,6 +1,6 @@
#!/bin/sh
-machine=pcm043
+hostname=pcm043
eth0.serverip=
user=
@@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
-rootfsimage=root-$machine.$rootfs_type
+rootfsimage=root-$hostname.$rootfs_type
-kernelimage=zImage-$machine
-#kernelimage=uImage-$machine
-#kernelimage=Image-$machine
-#kernelimage=Image-$machine.lzo
+kernelimage=zImage-$hostname
+#kernelimage=uImage-$hostname
+#kernelimage=Image-$hostname
+#kernelimage=Image-$hostname.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
- nfsroot="$eth0.serverip:/home/$user/nfsroot/$machine"
+ nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"
diff --git a/arch/arm/boards/pcm049/env/config b/arch/arm/boards/pcm049/env/config
index f348714..efbe9ea 100644
--- a/arch/arm/boards/pcm049/env/config
+++ b/arch/arm/boards/pcm049/env/config
@@ -1,6 +1,6 @@
#!/bin/sh
-machine=pcm049
+hostname=pcm049
eth0.serverip=
user=
@@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
-rootfsimage=root-${machine}.$rootfs_type
+rootfsimage=root-${hostname}.$rootfs_type
-kernelimage=zImage-$machine
-#kernelimage=uImage-$machine
-#kernelimage=Image-$machine
-#kernelimage=Image-${machine}.lzo
+kernelimage=zImage-$hostname
+#kernelimage=uImage-$hostname
+#kernelimage=Image-$hostname
+#kernelimage=Image-${hostname}.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
- nfsroot="$eth0.serverip:/home/$user/nfsroot/$machine"
+ nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"
diff --git a/arch/arm/boards/phycard-a-l1/env/config b/arch/arm/boards/phycard-a-l1/env/config
index 4a648b9..e0f4dcc 100644
--- a/arch/arm/boards/phycard-a-l1/env/config
+++ b/arch/arm/boards/phycard-a-l1/env/config
@@ -1,6 +1,6 @@
#!/bin/sh
-machine=pcaal1
+hostname=pcaal1
#user=
# Enter MAC address here if not retrieved automatically
@@ -26,26 +26,26 @@ rootfs_loc=nand
rootfs_type=jffs2
# where is the rootfs in case of 'rootfs_loc=disk' (linux name)
rootfs_part_linux_dev=mmcblk0p4
-rootfsimage=rootfs-${machine}.$rootfs_type
+rootfsimage=rootfs-${hostname}.$rootfs_type
# where is the kernel image in case of 'kernel_loc=disk'
kernel_part=disk0.2
# The image type of the kernel. Can be uimage, zimage, raw or raw_lzo
-#kernelimage=zImage-$machine
-kernelimage=uImage-$machine
-#kernelimage=Image-$machine
-#kernelimage=Image-$machine.lzo
+#kernelimage=zImage-$hostname
+kernelimage=uImage-$hostname
+#kernelimage=Image-$hostname
+#kernelimage=Image-$hostname.lzo
-bareboximage=barebox-${machine}.bin
-bareboxenvimage=barebox-${machine}.bin
+bareboximage=barebox-${hostname}.bin
+bareboxenvimage=barebox-${hostname}.bin
if [ -n $user ]; then
bareboximage="$user"-"$bareboximage"
bareboxenvimage="$user"-"$bareboxenvimage"
kernelimage="$user"-"$kernelimage"
rootfsimage="$user"-"$rootfsimage"
- nfsroot="/home/$user/nfsroot/$machine"
+ nfsroot="/home/$user/nfsroot/$hostname"
else
nfsroot="/path/to/nfs/root"
fi
diff --git a/arch/arm/boards/phycard-a-xl2/env/config b/arch/arm/boards/phycard-a-xl2/env/config
index 0cbfb16..59e8eb3 100644
--- a/arch/arm/boards/phycard-a-xl2/env/config
+++ b/arch/arm/boards/phycard-a-xl2/env/config
@@ -1,6 +1,6 @@
#!/bin/sh
-machine=pcaaxl2
+hostname=pcaaxl2
user=
# use 'dhcp' to do dhcp in barebox and in kernel
@@ -20,16 +20,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
-rootfsimage=root-${machine}.$rootfs_type
+rootfsimage=root-${hostname}.$rootfs_type
-kernelimage=zImage-$machine
-#kernelimage=uImage-$machine
-#kernelimage=Image-$machine
-#kernelimage=Image-${machine}.lzo
+kernelimage=zImage-$hostname
+#kernelimage=uImage-$hostname
+#kernelimage=Image-$hostname
+#kernelimage=Image-${hostname}.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
- nfsroot="$eth0.serverip:/home/$user/nfsroot/$machine"
+ nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"
diff --git a/arch/arm/boards/phycard-i.MX27/env/config b/arch/arm/boards/phycard-i.MX27/env/config
index 5db33d0..367029b 100644
--- a/arch/arm/boards/phycard-i.MX27/env/config
+++ b/arch/arm/boards/phycard-i.MX27/env/config
@@ -1,6 +1,6 @@
#!/bin/sh
-machine=pca100
+hostname=pca100
eth0.serverip=
user=
@@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
-rootfsimage=root-$machine.$rootfs_type
+rootfsimage=root-$hostname.$rootfs_type
-kernelimage=zImage-$machine
-#kernelimage=uImage-$machine
-#kernelimage=Image-$machine
-#kernelimage=Image-$machine.lzo
+kernelimage=zImage-$hostname
+#kernelimage=uImage-$hostname
+#kernelimage=Image-$hostname
+#kernelimage=Image-$hostname.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
- nfsroot="$eth0.serverip:/home/$user/nfsroot/$machine"
+ nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"
diff --git a/arch/arm/boards/scb9328/env/config b/arch/arm/boards/scb9328/env/config
index e1c5807..a8eace7 100644
--- a/arch/arm/boards/scb9328/env/config
+++ b/arch/arm/boards/scb9328/env/config
@@ -1,6 +1,6 @@
#!/bin/sh
-machine=scb9328
+hostname=scb9328
eth0.serverip=
user=
@@ -21,16 +21,16 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
-rootfsimage=root-$machine.$rootfs_type
+rootfsimage=root-$hostname.$rootfs_type
-kernelimage=zImage-$machine
-#kernelimage=uImage-$machine
-#kernelimage=Image-$machine
-#kernelimage=Image-$machine.lzo
+kernelimage=zImage-$hostname
+#kernelimage=uImage-$hostname
+#kernelimage=Image-$hostname
+#kernelimage=Image-$hostname.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
- nfsroot="$eth0.serverip:/home/$user/nfsroot/$machine"
+ nfsroot="$eth0.serverip:/home/$user/nfsroot/$hostname"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"
diff --git a/arch/arm/boards/tqma53/env/config b/arch/arm/boards/tqma53/env/config
index 97b009c..723b094 100644
--- a/arch/arm/boards/tqma53/env/config
+++ b/arch/arm/boards/tqma53/env/config
@@ -1,6 +1,6 @@
#!/bin/sh
-machine=tqma53
+hostname=tqma53
serverip=
user=
@@ -21,13 +21,13 @@ rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
-rootfsimage=root-$machine.$rootfs_type
+rootfsimage=root-$hostname.$rootfs_type
-kernelimage=zImage-$machine
+kernelimage=zImage-$hostname
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
- nfsroot="$serverip:/home/$user/nfsroot/$machine"
+ nfsroot="$serverip:/home/$user/nfsroot/$hostname"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$serverip:/path/to/nfs/root"
diff --git a/defaultenv/config b/defaultenv/config
index 39a9c99..3e4c2ee 100644
--- a/defaultenv/config
+++ b/defaultenv/config
@@ -1,6 +1,6 @@
#!/bin/sh
-machine=FIXME
+hostname=FIXME
#user=
# Enter MAC address here if not retrieved automatically
@@ -29,25 +29,25 @@ oftree_loc=tftp
rootfs_type=ubifs
# where is the rootfs in case of 'rootfs_loc=disk' (linux name)
rootfs_part_linux_dev=mmcblk0p4
-rootfsimage=rootfs-${machine}.$rootfs_type
+rootfsimage=rootfs-${hostname}.$rootfs_type
# where is the kernel image in case of 'kernel_loc=disk'
kernel_part=disk0.2
-kernelimage=zImage-$machine
-#kernelimage=uImage-$machine
-#kernelimage=Image-$machine
-#kernelimage=Image-$machine.lzo
+kernelimage=zImage-$hostname
+#kernelimage=uImage-$hostname
+#kernelimage=Image-$hostname
+#kernelimage=Image-$hostname.lzo
-bareboximage=barebox-${machine}.bin
-bareboxenvimage=barebox-${machine}.bin
+bareboximage=barebox-${hostname}.bin
+bareboxenvimage=barebox-${hostname}.bin
if [ -n $user ]; then
bareboximage="$user"-"$bareboximage"
bareboxenvimage="$user"-"$bareboxenvimage"
kernelimage="$user"-"$kernelimage"
rootfsimage="$user"-"$rootfsimage"
- nfsroot="/home/$user/nfsroot/$machine"
+ nfsroot="/home/$user/nfsroot/$hostname"
else
nfsroot="/path/to/nfs/root"
fi
--
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
* Re: [PATCH 1/3] net: dhcp: add support to send the hostname to the dhcp server
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 4:05 ` [PATCH 3/3] config: switch machine to hostname Jean-Christophe PLAGNIOL-VILLARD
@ 2012-04-15 7:51 ` 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
4 siblings, 0 replies; 8+ messages in thread
From: Baruch Siach @ 2012-04-15 7:51 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
Hi Jean-Christophe,
On Sun, Apr 15, 2012 at 06:05:37AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> 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':
s/U/h/
baruch
> + 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
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3 v2] net: dhcp: add support to send the hostname to the dhcp server
2012-04-15 4:05 [PATCH 1/3] net: dhcp: add support to send the hostname to the dhcp server Jean-Christophe PLAGNIOL-VILLARD
` (2 preceding siblings ...)
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 ` Jean-Christophe PLAGNIOL-VILLARD
2012-04-18 10:05 ` [PATCH 1/3] " Sascha Hauer
4 siblings, 0 replies; 8+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-04-15 13:27 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
net/dhcp.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/net/dhcp.c b/net/dhcp.c
index 0116ba4..9dc1c28 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,11 @@ 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 'H':
+ dhcp_set_param_data(DHCP_HOSTNAME, optarg);
+ break;
case 'v':
dhcp_set_param_data(DHCP_VENDOR_ID, optarg);
break;
@@ -672,6 +680,8 @@ out:
BAREBOX_CMD_HELP_START(dhcp)
BAREBOX_CMD_HELP_USAGE("dhcp [OPTIONS]\n")
BAREBOX_CMD_HELP_SHORT("Invoke dhcp client to obtain ip/boot params.\n")
+BAREBOX_CMD_HELP_OPT ("-H <hostname>",
+"Hostname to send to the DHCP server\n");
BAREBOX_CMD_HELP_OPT ("-v <vendor_id>",
"DHCP Vendor ID (code 60) submitted in DHCP requests. It can\n"
"be used in the DHCP server's configuration to select options\n"
@@ -698,7 +708,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
* Re: [PATCH 2/3] net: dhcp: allow to user env var as user class too
2012-04-15 16:57 ` Sascha Hauer
@ 2012-04-15 16:49 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 0 replies; 8+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-04-15 16:49 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On 18:57 Sun 15 Apr , Sascha Hauer wrote:
> On Sun, Apr 15, 2012 at 06:05:38AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > 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 c3c41a0..ecff819 100644
> > --- a/net/dhcp.c
> > +++ b/net/dhcp.c
> > @@ -211,6 +211,7 @@ struct dhcp_opt dhcp_options[] = {
> > struct dhcp_param {
> > unsigned char option;
> > const char *barebox_var_name;
> > + const char *barebox_var_alt_name;
> > int (*handle)(struct dhcp_param *param, u8 *e);
> > void *data;
> > };
> > @@ -220,8 +221,12 @@ static int dhcp_set_string_options(struct dhcp_param *param, u8 *e)
> > int str_len;
> > char* str = param->data;
> >
> > - if (!str && param->barebox_var_name)
> > - str = (char*)getenv(param->barebox_var_name);
> > + if (!str) {
> > + if (param->barebox_var_name)
> > + str = (char*)getenv(param->barebox_var_name);
> > + else if (param->barebox_var_alt_name)
> > + str = (char*)getenv(param->barebox_var_alt_name);
> > + }
> >
> > if (!str)
> > return 0;
> > @@ -260,6 +265,7 @@ struct dhcp_param dhcp_params[] = {
> > .option = DHCP_USER_CLASS,
> > .handle = dhcp_set_string_options,
> > .barebox_var_name = "dhcp_user_class",
> > + .barebox_var_alt_name = "user",
> > }, {
> > .option = DHCP_CLIENT_UUID,
> > .handle = dhcp_set_string_options,
> > @@ -712,5 +718,6 @@ BAREBOX_MAGICVAR(dhcp_vendor_id, "vendor id to send to the DHCP server");
> > BAREBOX_MAGICVAR(dhcp_client_uuid, "cliend uuid to send to the DHCP server");
> > BAREBOX_MAGICVAR(dhcp_client_id, "cliend id to send to the DHCP server");
> > BAREBOX_MAGICVAR(dhcp_user_class, "user class to send to the DHCP server");
> > +BAREBOX_MAGICVAR(user, "user class to send to the DHCP server");
>
> This does not look good. I think 'user' is a too generic name to be a
> magicvar, also it does not fit into the current dhcp_ scheme. Why not
> add a dhcp_user_class=$user to the environment if necessary?
I known but I want to have a automatic and common way to manage it
without any modification for the user
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] net: dhcp: allow to user env var as user class too
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
0 siblings, 1 reply; 8+ messages in thread
From: Sascha Hauer @ 2012-04-15 16:57 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Sun, Apr 15, 2012 at 06:05:38AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> 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 c3c41a0..ecff819 100644
> --- a/net/dhcp.c
> +++ b/net/dhcp.c
> @@ -211,6 +211,7 @@ struct dhcp_opt dhcp_options[] = {
> struct dhcp_param {
> unsigned char option;
> const char *barebox_var_name;
> + const char *barebox_var_alt_name;
> int (*handle)(struct dhcp_param *param, u8 *e);
> void *data;
> };
> @@ -220,8 +221,12 @@ static int dhcp_set_string_options(struct dhcp_param *param, u8 *e)
> int str_len;
> char* str = param->data;
>
> - if (!str && param->barebox_var_name)
> - str = (char*)getenv(param->barebox_var_name);
> + if (!str) {
> + if (param->barebox_var_name)
> + str = (char*)getenv(param->barebox_var_name);
> + else if (param->barebox_var_alt_name)
> + str = (char*)getenv(param->barebox_var_alt_name);
> + }
>
> if (!str)
> return 0;
> @@ -260,6 +265,7 @@ struct dhcp_param dhcp_params[] = {
> .option = DHCP_USER_CLASS,
> .handle = dhcp_set_string_options,
> .barebox_var_name = "dhcp_user_class",
> + .barebox_var_alt_name = "user",
> }, {
> .option = DHCP_CLIENT_UUID,
> .handle = dhcp_set_string_options,
> @@ -712,5 +718,6 @@ BAREBOX_MAGICVAR(dhcp_vendor_id, "vendor id to send to the DHCP server");
> BAREBOX_MAGICVAR(dhcp_client_uuid, "cliend uuid to send to the DHCP server");
> BAREBOX_MAGICVAR(dhcp_client_id, "cliend id to send to the DHCP server");
> BAREBOX_MAGICVAR(dhcp_user_class, "user class to send to the DHCP server");
> +BAREBOX_MAGICVAR(user, "user class to send to the DHCP server");
This does not look good. I think 'user' is a too generic name to be a
magicvar, also it does not fit into the current dhcp_ scheme. Why not
add a dhcp_user_class=$user to the environment if necessary?
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] net: dhcp: add support to send the hostname to the dhcp server
2012-04-15 4:05 [PATCH 1/3] net: dhcp: add support to send the hostname to the dhcp server Jean-Christophe PLAGNIOL-VILLARD
` (3 preceding siblings ...)
2012-04-15 13:27 ` [PATCH 1/3 v2] " Jean-Christophe PLAGNIOL-VILLARD
@ 2012-04-18 10:05 ` Sascha Hauer
4 siblings, 0 replies; 8+ messages in thread
From: Sascha Hauer @ 2012-04-18 10:05 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
Applied 1/3v2 and 3/3. I didn't apply 2/ for reasons mentioned.
Sascha
On Sun, Apr 15, 2012 at 06:05:37AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> 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
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
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