]> git.decadent.org.uk Git - odhcp6c.git/blobdiff - src/script.c
Remove obsolete prefix class support
[odhcp6c.git] / src / script.c
index d99327721d6575fafad0b0d5fb73ba745d67c50a..f8d440f98319772423e2680dbc6a75ef5b379fb4 100644 (file)
@@ -163,9 +163,7 @@ static void entry_to_env(const char *name, const void *data, size_t len, enum en
                                buf_len += snprintf(&buf[buf_len], 24, ",%u,%u", e[i].preferred, e[i].valid);
                        }
 
-                       if ((type == ENTRY_PREFIX || type == ENTRY_ADDRESS) && e[i].class)
-                               buf_len += snprintf(&buf[buf_len], 12, ",class=%u", e[i].class);
-                       else if (type == ENTRY_PREFIX && ntohl(e[i].iaid) != 1)
+                       if (type == ENTRY_PREFIX && ntohl(e[i].iaid) != 1)
                                buf_len += snprintf(&buf[buf_len], 16, ",class=%08x", ntohl(e[i].iaid));
 
                        if (type == ENTRY_PREFIX && e[i].priority) {
@@ -184,6 +182,15 @@ static void entry_to_env(const char *name, const void *data, size_t len, enum en
 }
 
 
+static void int_to_env(const char *name, int value)
+{
+       size_t len = 12 + strlen(name);
+       char *buf = realloc(NULL, len);
+       snprintf(buf, len, "%s=%d", name, value);
+       putenv(buf);
+}
+
+
 static void s46_to_env_portparams(const uint8_t *data, size_t len, FILE *fp)
 {
        uint8_t *odata;
@@ -366,6 +373,11 @@ void script_call(const char *status)
                entry_to_env("RA_ROUTES", ra_route, ra_route_len, ENTRY_ROUTE);
                entry_to_env("RA_DNS", ra_dns, ra_dns_len, ENTRY_HOST);
 
+               int_to_env("RA_HOPLIMIT", ra_conf_hoplimit(0));
+               int_to_env("RA_MTU", ra_conf_mtu(0));
+               int_to_env("RA_REACHABLE", ra_conf_reachable(0));
+               int_to_env("RA_RETRANSMIT", ra_conf_retransmit(0));
+
                char *buf = malloc(10 + passthru_len * 2);
                strncpy(buf, "PASSTHRU=", 10);
                script_hexlify(&buf[9], passthru, passthru_len);