X-Git-Url: https://git.decadent.org.uk/gitweb/?p=odhcp6c.git;a=blobdiff_plain;f=src%2Fscript.c;h=d443ede71a229e41ca0da7c0623186bdfa0ae01e;hp=13ac5627883df02e7b278f070a21e3b851504618;hb=0300fe7589a1701361735ac068e4b57bb1a1896f;hpb=a0bbaf5bffc66b1693577a374a9a599e313aefe1 diff --git a/src/script.c b/src/script.c index 13ac562..d443ede 100644 --- a/src/script.c +++ b/src/script.c @@ -209,7 +209,7 @@ static void entry_to_env(const char *name, const void *data, size_t len, enum en putenv(buf); } -#ifdef EXT_S46 + static void s46_to_env_portparams(const uint8_t *data, size_t len, FILE *fp) { uint8_t *odata; @@ -223,7 +223,7 @@ static void s46_to_env_portparams(const uint8_t *data, size_t len, FILE *fp) } } } -#endif + static void s46_to_env(enum odhcp6c_state state, const uint8_t *data, size_t len) { @@ -237,7 +237,6 @@ static void s46_to_env(enum odhcp6c_state state, const uint8_t *data, size_t len fputs(name, fp); fputc('=', fp); -#ifdef EXT_S46 const char *type = (state == STATE_S46_MAPE) ? "map-e" : (state == STATE_S46_MAPT) ? "map-t" : "lw4o6"; @@ -281,6 +280,7 @@ static void s46_to_env(enum odhcp6c_state state, const uint8_t *data, size_t len fprintf(fp, "br=%s,", buf6); } else if (state == STATE_S46_MAPT && otype == DHCPV6_OPT_S46_DMR && olen >= sizeof(struct dhcpv6_s46_dmr)) { + dmr = (struct dhcpv6_s46_dmr*)odata; memset(&in6, 0, sizeof(in6)); size_t prefix6len = dmr->dmr_prefix6_len; prefix6len = (prefix6len % 8 == 0) ? prefix6len / 8 : prefix6len / 8 + 1; @@ -326,9 +326,6 @@ static void s46_to_env(enum odhcp6c_state state, const uint8_t *data, size_t len fputc(' ', fp); } -#else - if (data && len) {} -#endif fclose(fp); putenv(str); @@ -358,7 +355,7 @@ void script_call(const char *status) { size_t dns_len, search_len, custom_len, sntp_ip_len, ntp_ip_len, ntp_dns_len; size_t sip_ip_len, sip_fqdn_len, aftr_name_len, cer_len; - size_t s46_mapt_len, s46_mape_len, s46_lw_len; + size_t s46_mapt_len, s46_mape_len, s46_lw_len, passthru_len; odhcp6c_expire(); if (delayed_call) { @@ -379,6 +376,7 @@ void script_call(const char *status) uint8_t *s46_mapt = odhcp6c_get_state(STATE_S46_MAPT, &s46_mapt_len); uint8_t *s46_mape = odhcp6c_get_state(STATE_S46_MAPE, &s46_mape_len); uint8_t *s46_lw = odhcp6c_get_state(STATE_S46_LW, &s46_lw_len); + uint8_t *passthru = odhcp6c_get_state(STATE_PASSTHRU, &passthru_len); size_t prefix_len, address_len, ra_pref_len, ra_route_len, ra_dns_len; uint8_t *prefix = odhcp6c_get_state(STATE_IA_PD, &prefix_len); @@ -409,6 +407,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); + char *buf = malloc(10 + passthru_len * 2); + strncpy(buf, "PASSTHRU=", 10); + script_hexlify(&buf[9], passthru, passthru_len); + putenv(buf); + argv[2] = (char*)status; execv(argv[0], argv); _exit(128);