diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2014-01-17 16:12:42 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2014-01-30 21:59:10 +0800 |
commit | a984595cfb4910ba6f464c69c316f1613f10f894 (patch) | |
tree | 12af540bf1ac4f93aebb5f65585c9ebd751b8aff /discover | |
parent | 67e015d08f9a9f53b1ec0a6c301ce1a9516ea69a (diff) | |
download | talos-petitboot-a984595cfb4910ba6f464c69c316f1613f10f894.tar.gz talos-petitboot-a984595cfb4910ba6f464c69c316f1613f10f894.zip |
discover/network: Use platform definition for DHCP architecture ID
Allow a platform to specify a DHCP architecture ID, as this is
platform-specific.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover')
-rw-r--r-- | discover/network.c | 12 | ||||
-rw-r--r-- | discover/platform-powerpc.c | 1 | ||||
-rw-r--r-- | discover/platform.c | 5 | ||||
-rw-r--r-- | discover/platform.h | 2 |
4 files changed, 18 insertions, 2 deletions
diff --git a/discover/network.c b/discover/network.c index 9da0f7a..c300f3d 100644 --- a/discover/network.c +++ b/discover/network.c @@ -212,8 +212,9 @@ static void udhcpc_process_exit(struct process *process) static void configure_interface_dhcp(struct interface *interface) { + const struct platform *platform; + char pidfile[256], id[10]; struct process *process; - char pidfile[256]; int rc; const char *argv[] = { pb_system_apps.udhcpc, @@ -221,14 +222,21 @@ static void configure_interface_dhcp(struct interface *interface) "-n", "-O", "pxeconffile", "-O", "pxepathprefix", - "-x", "0x5d:000a", "-p", pidfile, "-i", interface->name, + "-x", id, /* [11,12] - dhcp client identifier */ NULL, }; + snprintf(pidfile, sizeof(pidfile), "%s/udhcpc-%s.pid", PIDFILE_BASE, interface->name); + platform = platform_get(); + if (platform && platform->dhcp_arch_id != 0xffff) + snprintf(id, sizeof(id), "0x5d:%04x", platform->dhcp_arch_id); + else + argv[11] = NULL; + process = process_create(interface); process->path = pb_system_apps.udhcpc; diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c index 7761769..b0a35a7 100644 --- a/discover/platform-powerpc.c +++ b/discover/platform-powerpc.c @@ -560,6 +560,7 @@ static bool probe(struct platform *p, void *ctx) static struct platform platform_powerpc = { .name = "powerpc", + .dhcp_arch_id = 0x000e, .probe = probe, .load_config = load_config, .save_config = save_config, diff --git a/discover/platform.c b/discover/platform.c index 66e776e..d52c9f6 100644 --- a/discover/platform.c +++ b/discover/platform.c @@ -102,6 +102,11 @@ int platform_init(void *ctx) return 0; } +const struct platform *platform_get(void) +{ + return platform; +} + int config_set(struct config *newconfig) { int rc; diff --git a/discover/platform.h b/discover/platform.h index 44315fa..a01ac71 100644 --- a/discover/platform.h +++ b/discover/platform.h @@ -8,11 +8,13 @@ struct platform { bool (*probe)(struct platform *, void *); int (*load_config)(struct platform *, struct config *); int (*save_config)(struct platform *, struct config *); + uint16_t dhcp_arch_id; void *platform_data; }; int platform_init(void *ctx); int platform_fini(void); +const struct platform *platform_get(void); /* configuration interface */ const struct config *config_get(void); |