]> git.ozlabs.org Git - petitboot/blobdiff - discover/network.c
discover: Use ID_FS_TYPE property for filesystem type detection
[petitboot] / discover / network.c
index 9da0f7a72526837011c67191152e4653c048e12c..9acd4cb5f0cf695637c4d087a066d87947442eb9 100644 (file)
@@ -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);