X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fnetwork.c;h=9acd4cb5f0cf695637c4d087a066d87947442eb9;hp=cf340dad86b6540c712c9110c30b2b38babe8650;hb=43f340b66d8323c6e797868d07fc98482052ba35;hpb=23f75c74abde1b336e470d3febe68a45bfa68c5b diff --git a/discover/network.c b/discover/network.c index cf340da..9acd4cb 100644 --- a/discover/network.c +++ b/discover/network.c @@ -14,13 +14,13 @@ #include #include #include -#include #include #include #include "file.h" #include "network.h" #include "sysinfo.h" +#include "platform.h" #include "device-handler.h" #define HWADDR_SIZE 6 @@ -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; @@ -525,7 +533,7 @@ static void network_init_dns(struct network *network) buf = talloc_realloc(network, buf, char, len + dns_conf_len + 1); memcpy(buf + len, dns_conf, dns_conf_len); len += dns_conf_len; - buf[len - 1] = '\0'; + buf[len] = '\0'; modified = true; talloc_free(dns_conf);