cols++;
}
putchar('\t');
- if (opt->type & EMBED)
+ if (opt->type & OT_EMBED)
printf(" embed");
- if (opt->type & ENCAP)
+ if (opt->type & OT_ENCAP)
printf(" encap");
- if (opt->type & INDEX)
+ if (opt->type & OT_INDEX)
printf(" index");
- if (opt->type & ARRAY)
+ if (opt->type & OT_ARRAY)
printf(" array");
- if (opt->type & UINT8)
+ if (opt->type & OT_UINT8)
printf(" uint8");
- else if (opt->type & INT8)
+ else if (opt->type & OT_INT8)
printf(" int8");
- else if (opt->type & UINT16)
+ else if (opt->type & OT_UINT16)
printf(" uint16");
- else if (opt->type & INT16)
+ else if (opt->type & OT_INT16)
printf(" int16");
- else if (opt->type & UINT32)
+ else if (opt->type & OT_UINT32)
printf(" uint32");
- else if (opt->type & INT32)
+ else if (opt->type & OT_INT32)
printf(" int32");
- else if (opt->type & ADDRIPV4)
+ else if (opt->type & OT_ADDRIPV4)
printf(" ipaddress");
- else if (opt->type & ADDRIPV6)
+ else if (opt->type & OT_ADDRIPV6)
printf(" ip6address");
- else if (opt->type & FLAG)
+ else if (opt->type & OT_FLAG)
printf(" flag");
- else if (opt->type & BITFLAG)
+ else if (opt->type & OT_BITFLAG)
printf(" bitflags");
- else if (opt->type & RFC1035)
+ else if (opt->type & OT_RFC1035)
printf(" domain");
- else if (opt->type & DOMAIN)
+ else if (opt->type & OT_DOMAIN)
printf(" dname");
- else if (opt->type & ASCII)
+ else if (opt->type & OT_ASCII)
printf(" ascii");
- else if (opt->type & RAW)
+ else if (opt->type & OT_RAW)
printf(" raw");
- else if (opt->type & BINHEX)
+ else if (opt->type & OT_BINHEX)
printf(" binhex");
- else if (opt->type & STRING)
+ else if (opt->type & OT_STRING)
printf(" string");
- if (opt->type & RFC3361)
+ if (opt->type & OT_RFC3361)
printf(" rfc3361");
- if (opt->type & RFC3442)
+ if (opt->type & OT_RFC3442)
printf(" rfc3442");
- if (opt->type & REQUEST)
+ if (opt->type & OT_REQUEST)
printf(" request");
- if (opt->type & NOREQ)
+ if (opt->type & OT_NOREQ)
printf(" norequest");
putchar('\n');
}
errno = ENOENT;
return -1;
}
- if (add == 2 && !(opt->type & ADDRIPV4)) {
+ if (add == 2 && !(opt->type & OT_ADDRIPV4)) {
free(o);
errno = EINVAL;
return -1;
if (c == ' ') {
if (lbl - 1 == slbl) /* No space at start */
break;
- if (!(type & ARRAY))
+ if (!(type & OT_ARRAY))
break;
/* Skip to the next label */
if (!start) {
while (data < e) {
c = *data++;
- if (type & BINHEX) {
+ if (type & OT_BINHEX) {
if (dst) {
if (len == 0 || len == 1) {
errno = ENOSPC;
bytes += 2;
continue;
}
- if (type & ASCII && (!isascii(c))) {
+ if (type & OT_ASCII && (!isascii(c))) {
errno = EINVAL;
break;
}
- if (!(type & (ASCII | RAW | ESCSTRING | ESCFILE)) /* plain */ &&
+ if (!(type & (OT_ASCII | OT_RAW | OT_ESCSTRING | OT_ESCFILE)) &&
(!isascii(c) && !isprint(c)))
{
errno = EINVAL;
break;
}
- if ((type & (ESCSTRING | ESCFILE) &&
+ if ((type & (OT_ESCSTRING | OT_ESCFILE) &&
(c == '\\' || !isascii(c) || !isprint(c))) ||
- (type & ESCFILE && (c == '/' || c == ' ')))
+ (type & OT_ESCFILE && (c == '/' || c == ' ')))
{
errno = EINVAL;
if (c == '\\') {
*dst = '\0';
/* Now we've printed it, validate the domain */
- if (type & DOMAIN && !valid_domainname(odst, type)) {
+ if (type & OT_DOMAIN && !valid_domainname(odst, type)) {
*odst = '\0';
return 1;
}
{
size_t sz;
- if (opt->type & ADDRIPV6)
+ if (opt->type & OT_ADDRIPV6)
sz = ADDR6SZ;
- else if (opt->type & (INT32 | UINT32 | ADDRIPV4))
+ else if (opt->type & (OT_INT32 | OT_UINT32 | OT_ADDRIPV4))
sz = sizeof(uint32_t);
- else if (opt->type & (INT16 | UINT16))
+ else if (opt->type & (OT_INT16 | OT_UINT16))
sz = sizeof(uint16_t);
- else if (opt->type & (INT8 | UINT8 | BITFLAG))
+ else if (opt->type & (OT_INT8 | OT_UINT8 | OT_BITFLAG))
sz = sizeof(uint8_t);
- else if (opt->type & FLAG)
+ else if (opt->type & OT_FLAG)
return 0;
else {
/* All other types are variable length */
/* Trim any extra data.
* Maybe we need a settng to reject DHCP options with extra data? */
- if (opt->type & ARRAY)
+ if (opt->type & OT_ARRAY)
return (ssize_t)(dl - (dl % sz));
return (ssize_t)sz;
}
size_t l;
char *tmp;
- if (opt->type & RFC1035) {
+ if (opt->type & OT_RFC1035) {
sl = decode_rfc1035(NULL, 0, data, dl);
if (sl == 0 || sl == -1)
return sl;
}
#ifdef INET
- if (opt->type & RFC3361) {
+ if (opt->type & OT_RFC3361) {
if ((tmp = decode_rfc3361(data, dl)) == NULL)
return -1;
l = strlen(tmp);
return sl;
}
- if (opt->type & RFC3442)
+ if (opt->type & OT_RFC3442)
return decode_rfc3442(s, len, data, dl);
#endif
- if (opt->type & STRING)
+ if (opt->type & OT_STRING)
return print_string(s, len, opt->type, data, dl);
- if (opt->type & FLAG) {
+ if (opt->type & OT_FLAG) {
if (s) {
*s++ = '1';
*s = '\0';
return 1;
}
- if (opt->type & BITFLAG) {
+ if (opt->type & OT_BITFLAG) {
/* bitflags are a string, MSB first, such as ABCDEFGH
* where A is 10000000, B is 01000000, etc. */
bytes = 0;
}
if (!s) {
- if (opt->type & UINT8)
+ if (opt->type & OT_UINT8)
l = 3;
- else if (opt->type & INT8)
+ else if (opt->type & OT_INT8)
l = 4;
- else if (opt->type & UINT16) {
+ else if (opt->type & OT_UINT16) {
l = 5;
dl /= 2;
- } else if (opt->type & INT16) {
+ } else if (opt->type & OT_INT16) {
l = 6;
dl /= 2;
- } else if (opt->type & UINT32) {
+ } else if (opt->type & OT_UINT32) {
l = 10;
dl /= 4;
- } else if (opt->type & INT32) {
+ } else if (opt->type & OT_INT32) {
l = 11;
dl /= 4;
- } else if (opt->type & ADDRIPV4) {
+ } else if (opt->type & OT_ADDRIPV4) {
l = 16;
dl /= 4;
- } else if (opt->type & ADDRIPV6) {
+ } else if (opt->type & OT_ADDRIPV6) {
e = data + dl;
l = 0;
while (data < e) {
bytes++;
len--;
}
- if (opt->type & UINT8) {
+ if (opt->type & OT_UINT8) {
sl = snprintf(s, len, "%u", *data);
data++;
- } else if (opt->type & INT8) {
+ } else if (opt->type & OT_INT8) {
sl = snprintf(s, len, "%d", *data);
data++;
- } else if (opt->type & UINT16) {
+ } else if (opt->type & OT_UINT16) {
memcpy(&u16, data, sizeof(u16));
u16 = ntohs(u16);
sl = snprintf(s, len, "%u", u16);
data += sizeof(u16);
- } else if (opt->type & INT16) {
+ } else if (opt->type & OT_INT16) {
memcpy(&u16, data, sizeof(u16));
s16 = (int16_t)ntohs(u16);
sl = snprintf(s, len, "%d", s16);
data += sizeof(u16);
- } else if (opt->type & UINT32) {
+ } else if (opt->type & OT_UINT32) {
memcpy(&u32, data, sizeof(u32));
u32 = ntohl(u32);
sl = snprintf(s, len, "%u", u32);
data += sizeof(u32);
- } else if (opt->type & INT32) {
+ } else if (opt->type & OT_INT32) {
memcpy(&u32, data, sizeof(u32));
s32 = (int32_t)ntohl(u32);
sl = snprintf(s, len, "%d", s32);
data += sizeof(u32);
- } else if (opt->type & ADDRIPV4) {
+ } else if (opt->type & OT_ADDRIPV4) {
memcpy(&addr.s_addr, data, sizeof(addr.s_addr));
sl = snprintf(s, len, "%s", inet_ntoa(addr));
data += sizeof(addr.s_addr);
- } else if (opt->type & ADDRIPV6) {
+ } else if (opt->type & OT_ADDRIPV6) {
sl = ipv6_printaddr(s, len, data, ifname);
data += 16;
} else {
if (ifp->wireless) {
ssid[0] = '-';
print_string(ssid + 1, sizeof(ssid) - 1,
- ESCFILE,
+ OT_ESCFILE,
(const uint8_t *)ifp->ssid, ifp->ssid_len);
} else
ssid[0] = '\0';
/* If no embedded or encapsulated options, it's easy */
if (opt->embopts_len == 0 && opt->encopts_len == 0) {
- if (!(opt->type & RESERVED)) {
+ if (!(opt->type & OT_RESERVED)) {
if (dhcp_envoption1(env == NULL ? NULL : &env[0],
prefix, opt, 1, od, ol, ifname))
return 1;
/* Create a new prefix based on the option */
if (env) {
- if (opt->type & INDEX) {
+ if (opt->type & OT_INDEX) {
if (opt->index > 999) {
errno = ENOBUFS;
logger(ctx, LOG_ERR, "%s: %m", __func__);
}
}
e = strlen(prefix) + strlen(opt->var) + 2 +
- (opt->type & INDEX ? 3 : 0);
+ (opt->type & OT_INDEX ? 3 : 0);
pfx = malloc(e);
if (pfx == NULL) {
logger(ctx, LOG_ERR, "%s: %m", __func__);
return 0;
}
- if (opt->type & INDEX)
+ if (opt->type & OT_INDEX)
snprintf(pfx, e, "%s_%s%d", prefix,
opt->var, ++opt->index);
else
* DHCP FQDN in RFC4702 have a string as the last
* option which is optional. */
if (env == NULL &&
- (ol != 0 || !(eopt->type & OPTIONAL)))
+ (ol != 0 || !(eopt->type & OT_OPTIONAL)))
logger(ctx, LOG_ERR,
"%s: %s %d.%d/%zu: missing embedded option",
ifname, __func__, opt->option,
/* Use the option prefix if the embedded option
* name is different.
* This avoids new_fqdn_fqdn which would be silly. */
- if (!(eopt->type & RESERVED)) {
+ if (!(eopt->type & OT_RESERVED)) {
ov = strcmp(opt->var, eopt->var);
if (dhcp_envoption1(env == NULL ? NULL : &env[n],
pfx, eopt, ov, od, (size_t)eo, ifname))
i++, eopt++)
{
eoc = opt->option;
- if (eopt->type & OPTION) {
+ if (eopt->type & OT_OPTION) {
dgetopt(ctx, NULL, &eoc, NULL, NULL, 0, &oopt);
if (oopt)
oopt->index = 0;
i++, eopt++)
{
if (eopt->option == eoc) {
- if (eopt->type & OPTION) {
+ if (eopt->type & OT_OPTION) {
if (oopt == NULL)
/* Report error? */
continue;
n += dhcp_envoption(ctx,
env == NULL ? NULL : &env[n], pfx,
ifname,
- eopt->type & OPTION ? oopt : eopt,
+ eopt->type & OT_OPTION ? oopt:eopt,
dgetopt, eod, eol);
break;
}
*/
#ifndef DHCPCOMMON_H
-#define DHCPCOMMON_H
+#define DHCPCOMMON_H
#include <arpa/inet.h>
#include <netinet/in.h>
#include "dhcpcd.h"
/* Max MTU - defines dhcp option length */
-#define MTU_MAX 1500
-#define MTU_MIN 576
-
-#define REQUEST (1 << 0)
-#define UINT8 (1 << 1)
-#define INT8 (1 << 2)
-#define UINT16 (1 << 3)
-#define INT16 (1 << 4)
-#define UINT32 (1 << 5)
-#define INT32 (1 << 6)
-#define ADDRIPV4 (1 << 7)
-#define STRING (1 << 8)
-#define ARRAY (1 << 9)
-#define RFC3361 (1 << 10)
-#define RFC1035 (1 << 11)
-#define RFC3442 (1 << 12)
-#define OPTIONAL (1 << 13)
-#define ADDRIPV6 (1 << 14)
-#define BINHEX (1 << 15)
-#define FLAG (1 << 16)
-#define NOREQ (1 << 17)
-#define EMBED (1 << 18)
-#define ENCAP (1 << 19)
-#define INDEX (1 << 20)
-#define OPTION (1 << 21)
-#define DOMAIN (1 << 22)
-#define ASCII (1 << 23)
-#define RAW (1 << 24)
-#define ESCSTRING (1 << 25)
-#define ESCFILE (1 << 26)
-#define BITFLAG (1 << 27)
-#define RESERVED (1 << 28)
+#define MTU_MAX 1500
+#define MTU_MIN 576
+
+#define OT_REQUEST (1 << 0)
+#define OT_UINT8 (1 << 1)
+#define OT_INT8 (1 << 2)
+#define OT_UINT16 (1 << 3)
+#define OT_INT16 (1 << 4)
+#define OT_UINT32 (1 << 5)
+#define OT_INT32 (1 << 6)
+#define OT_ADDRIPV4 (1 << 7)
+#define OT_STRING (1 << 8)
+#define OT_ARRAY (1 << 9)
+#define OT_RFC3361 (1 << 10)
+#define OT_RFC1035 (1 << 11)
+#define OT_RFC3442 (1 << 12)
+#define OT_OPTIONAL (1 << 13)
+#define OT_ADDRIPV6 (1 << 14)
+#define OT_BINHEX (1 << 15)
+#define OT_FLAG (1 << 16)
+#define OT_NOREQ (1 << 17)
+#define OT_EMBED (1 << 18)
+#define OT_ENCAP (1 << 19)
+#define OT_INDEX (1 << 20)
+#define OT_OPTION (1 << 21)
+#define OT_DOMAIN (1 << 22)
+#define OT_ASCII (1 << 23)
+#define OT_RAW (1 << 24)
+#define OT_ESCSTRING (1 << 25)
+#define OT_ESCFILE (1 << 26)
+#define OT_BITFLAG (1 << 27)
+#define OT_RESERVED (1 << 28)
struct dhcp_opt {
uint32_t option; /* Also used for IANA Enterpise Number */
ssize_t dhcp_vendor(char *, size_t);
void dhcp_print_option_encoding(const struct dhcp_opt *opt, int cols);
-#define add_option_mask(var, val) \
+#define add_option_mask(var, val) \
((var)[(val) >> 3] = (uint8_t)((var)[(val) >> 3] | 1 << ((val) & 7)))
-#define del_option_mask(var, val) \
+#define del_option_mask(var, val) \
((var)[(val) >> 3] = (uint8_t)((var)[(val) >> 3] & ~(1 << ((val) & 7))))
-#define has_option_mask(var, val) \
+#define has_option_mask(var, val) \
((var)[(val) >> 3] & (uint8_t)(1 << ((val) & 7)))
int make_option_mask(const struct dhcp_opt *, size_t,
const struct dhcp_opt *, size_t,
i < ifp->ctx->dhcp_opts_len;
i++, opt++)
{
- if (!(opt->type & REQUEST ||
+ if (!(opt->type & OT_REQUEST ||
has_option_mask(ifo->requestmask, opt->option)))
continue;
- if (opt->type & NOREQ)
+ if (opt->type & OT_NOREQ)
continue;
if (type == DHCP_INFORM &&
(opt->option == DHO_RENEWALTIME ||
break;
if (lp < p)
continue;
- if (!(opt->type & REQUEST ||
+ if (!(opt->type & OT_REQUEST ||
has_option_mask(ifo->requestmask, opt->option)))
continue;
- if (opt->type & NOREQ)
+ if (opt->type & OT_NOREQ)
continue;
if (type == DHCP_INFORM &&
(opt->option == DHO_RENEWALTIME ||
}
if (*dhcp->bootfile && !(overl & 1)) {
- print_string(safe, sizeof(safe), STRING,
+ print_string(safe, sizeof(safe), OT_STRING,
dhcp->bootfile, sizeof(dhcp->bootfile));
addvar(ifp->ctx, &ep, prefix, "filename", safe);
}
if (*dhcp->servername && !(overl & 2)) {
- print_string(safe, sizeof(safe), STRING | DOMAIN,
+ print_string(safe, sizeof(safe), OT_STRING | OT_DOMAIN,
dhcp->servername, sizeof(dhcp->servername));
addvar(ifp->ctx, &ep, prefix, "server_name", safe);
}
free(a);
return;
}
- print_string(tmp, tmpl, STRING, (uint8_t *)a, al);
+ print_string(tmp, tmpl, OT_STRING, (uint8_t *)a, al);
free(a);
a = tmp;
}
tfrom = "from";
r = get_option_addr(ifp->ctx, &addr, dhcp, DHO_SERVERID);
if (dhcp->servername[0] && r == 0) {
- print_string(sname, sizeof(sname), STRING,
+ print_string(sname, sizeof(sname), OT_STRING,
dhcp->servername, strlen((const char *)dhcp->servername));
if (a == NULL)
logger(ifp->ctx, lvl, "%s: %s %s %s `%s'",
}
if (n < ifo->dhcp6_override_len)
continue;
- if (!(opt->type & NOREQ) &&
- (opt->type & REQUEST ||
+ if (!(opt->type & OT_NOREQ) &&
+ (opt->type & OT_REQUEST ||
has_option_mask(ifo->requestmask6, opt->option)))
{
n_options++;
l < ifo->dhcp6_override_len;
l++, opt++)
{
- if (!(opt->type & NOREQ) &&
- (opt->type & REQUEST ||
+ if (!(opt->type & OT_NOREQ) &&
+ (opt->type & OT_REQUEST ||
has_option_mask(ifo->requestmask6, opt->option)))
{
n_options++;
}
if (n < ifo->dhcp6_override_len)
continue;
- if (!(opt->type & NOREQ) &&
- (opt->type & REQUEST ||
+ if (!(opt->type & OT_NOREQ) &&
+ (opt->type & OT_REQUEST ||
has_option_mask(ifo->requestmask6,
opt->option)))
{
u16 = htons((uint16_t)opt->option);
memcpy(p, &u16, sizeof(u16));
p += sizeof(u16);
- o->len = (uint16_t)(o->len + sizeof(u16));
+ o->len = (uint16_t)(o->len+sizeof(u16));
}
}
for (l = 0, opt = ifo->dhcp6_override;
l < ifo->dhcp6_override_len;
l++, opt++)
{
- if (!(opt->type & NOREQ) &&
- (opt->type & REQUEST ||
+ if (!(opt->type & OT_NOREQ) &&
+ (opt->type & OT_REQUEST ||
has_option_mask(ifo->requestmask6,
opt->option)))
{
u16 = htons((uint16_t)opt->option);
memcpy(p, &u16, sizeof(u16));
p += sizeof(u16);
- o->len = (uint16_t)(o->len + sizeof(u16));
+ o->len = (uint16_t)(o->len+sizeof(u16));
}
}
if (dhcp6_findselfsla(ifp, NULL)) {
if (ifp->ssid_len) {
ssize_t r;
- r = print_string(pssid, sizeof(pssid), ESCSTRING,
+ r = print_string(pssid, sizeof(pssid), OT_ESCSTRING,
ifp->ssid, ifp->ssid_len);
if (r == -1) {
logger(ifp->ctx, LOG_ERR,
}
t = 0;
if (strcasecmp(arg, "request") == 0) {
- t |= REQUEST;
+ t |= OT_REQUEST;
arg = strskipwhite(fp);
fp = strwhite(arg);
if (fp == NULL) {
}
*fp++ = '\0';
} else if (strcasecmp(arg, "norequest") == 0) {
- t |= NOREQ;
+ t |= OT_NOREQ;
arg = strskipwhite(fp);
fp = strwhite(arg);
if (fp == NULL) {
*fp++ = '\0';
}
if (strcasecmp(arg, "optional") == 0) {
- t |= OPTIONAL;
+ t |= OT_OPTIONAL;
arg = strskipwhite(fp);
fp = strwhite(arg);
if (fp == NULL) {
*fp++ = '\0';
}
if (strcasecmp(arg, "index") == 0) {
- t |= INDEX;
+ t |= OT_INDEX;
arg = strskipwhite(fp);
fp = strwhite(arg);
if (fp == NULL) {
*fp++ = '\0';
}
if (strcasecmp(arg, "array") == 0) {
- t |= ARRAY;
+ t |= OT_ARRAY;
arg = strskipwhite(fp);
fp = strwhite(arg);
if (fp == NULL) {
*fp++ = '\0';
}
if (strcasecmp(arg, "ipaddress") == 0)
- t |= ADDRIPV4;
+ t |= OT_ADDRIPV4;
else if (strcasecmp(arg, "ip6address") == 0)
- t |= ADDRIPV6;
+ t |= OT_ADDRIPV6;
else if (strcasecmp(arg, "string") == 0)
- t |= STRING;
+ t |= OT_STRING;
else if (strcasecmp(arg, "byte") == 0)
- t |= UINT8;
+ t |= OT_UINT8;
else if (strcasecmp(arg, "bitflags") == 0)
- t |= BITFLAG;
+ t |= OT_BITFLAG;
else if (strcasecmp(arg, "uint8") == 0)
- t |= UINT8;
+ t |= OT_UINT8;
else if (strcasecmp(arg, "int8") == 0)
- t |= INT8;
+ t |= OT_INT8;
else if (strcasecmp(arg, "uint16") == 0)
- t |= UINT16;
+ t |= OT_UINT16;
else if (strcasecmp(arg, "int16") == 0)
- t |= INT16;
+ t |= OT_INT16;
else if (strcasecmp(arg, "uint32") == 0)
- t |= UINT32;
+ t |= OT_UINT32;
else if (strcasecmp(arg, "int32") == 0)
- t |= INT32;
+ t |= OT_INT32;
else if (strcasecmp(arg, "flag") == 0)
- t |= FLAG;
+ t |= OT_FLAG;
else if (strcasecmp(arg, "raw") == 0)
- t |= STRING | RAW;
+ t |= OT_STRING | OT_RAW;
else if (strcasecmp(arg, "ascii") == 0)
- t |= STRING | ASCII;
+ t |= OT_STRING | OT_ASCII;
else if (strcasecmp(arg, "domain") == 0)
- t |= STRING | DOMAIN | RFC1035;
+ t |= OT_STRING | OT_DOMAIN | OT_RFC1035;
else if (strcasecmp(arg, "dname") == 0)
- t |= STRING | DOMAIN;
+ t |= OT_STRING | OT_DOMAIN;
else if (strcasecmp(arg, "binhex") == 0)
- t |= STRING | BINHEX;
+ t |= OT_STRING | OT_BINHEX;
else if (strcasecmp(arg, "embed") == 0)
- t |= EMBED;
+ t |= OT_EMBED;
else if (strcasecmp(arg, "encap") == 0)
- t |= ENCAP;
+ t |= OT_ENCAP;
else if (strcasecmp(arg, "rfc3361") ==0)
- t |= STRING | RFC3361;
+ t |= OT_STRING | OT_RFC3361;
else if (strcasecmp(arg, "rfc3442") ==0)
- t |= STRING | RFC3442;
+ t |= OT_STRING | OT_RFC3442;
else if (strcasecmp(arg, "option") == 0)
- t |= OPTION;
+ t |= OT_OPTION;
else {
logger(ctx, LOG_ERR, "unknown type: %s", arg);
return -1;
}
- if (l && !(t & (STRING | BINHEX))) {
+ if (l && !(t & (OT_STRING | OT_BINHEX))) {
logger(ctx, LOG_WARNING,
"ignoring length for type `%s'", arg);
l = 0;
}
- if (t & ARRAY && t & (STRING | BINHEX) &&
- !(t & (RFC1035 | DOMAIN)))
+ if (t & OT_ARRAY && t & (OT_STRING | OT_BINHEX) &&
+ !(t & (OT_RFC1035 | OT_DOMAIN)))
{
logger(ctx, LOG_WARNING, "ignoring array for strings");
- t &= ~ARRAY;
+ t &= ~OT_ARRAY;
}
- if (t & BITFLAG) {
+ if (t & OT_BITFLAG) {
if (bp == NULL)
logger(ctx, LOG_WARNING,
"missing bitflag assignment");
}
/* variable */
if (!fp) {
- if (!(t & OPTION)) {
+ if (!(t & OT_OPTION)) {
logger(ctx, LOG_ERR,
"type %s requires a variable name", arg);
return -1;
}
} else {
np = NULL;
- t |= RESERVED;
+ t |= OT_RESERVED;
}
}
if (opt != O_EMBED) {
ssize_t psl;
pfx_len = strlen(pfx);
- psl = print_string(NULL, 0, ESCSTRING,
+ psl = print_string(NULL, 0, OT_ESCSTRING,
(const uint8_t *)ifp->ssid, ifp->ssid_len);
if (psl != -1) {
EMALLOC(elen, pfx_len + (size_t)psl + 1);
memcpy(env[elen], pfx, pfx_len);
print_string(env[elen] + pfx_len, (size_t)psl + 1,
- ESCSTRING,
+ OT_ESCSTRING,
(const uint8_t *)ifp->ssid, ifp->ssid_len);
elen++;
}