]> git.ozlabs.org Git - petitboot/blobdiff - discover/pxe-parser.c
discover/network: Send DHCP client architecture type
[petitboot] / discover / pxe-parser.c
index bc07a13c54b1ff8eb9884fe30de5977b1d04e881..e245f1b82b10536f6fb549237dc0627fc18fbb91 100644 (file)
@@ -1,5 +1,7 @@
 
-#define _GNU_SOURCE
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
 #include <string.h>
 
 #include <talloc/talloc.h>
@@ -99,6 +101,7 @@ static int pxe_parse(struct discover_context *dc)
        char **pxe_conf_files, **filename;
        struct pb_url *conf_url, *url;
        struct conf_context *conf;
+       bool complete_url;
        int len, rc;
        char *buf;
 
@@ -119,11 +122,13 @@ static int pxe_parse(struct discover_context *dc)
        parser_info = talloc_zero(conf, struct pxe_parser_info);
        conf->parser_info = parser_info;
 
-       conf_url = user_event_parse_conf_url(dc, dc->event);
+       conf_url = user_event_parse_conf_url(dc, dc->event, &complete_url);
        if (!conf_url)
                goto out_conf;
 
-       if (dc->conf_url) {
+       if (complete_url) {
+               /* we have a complete URL; use this and we're done. */
+               dc->conf_url = conf_url;
                rc = parser_request_url(dc, dc->conf_url, &buf, &len);
                if (rc)
                        goto out_conf;
@@ -132,6 +137,8 @@ static int pxe_parse(struct discover_context *dc)
                if (!pxe_conf_files)
                        goto out_conf;
 
+               rc = -1;
+
                for (filename = pxe_conf_files; *filename; filename++) {
                        url = pb_url_join(dc, conf_url, *filename);
                        if (!url)