if (opt->type & ARRAY)
printf(" array");
if (opt->type & UINT8)
- printf(" byte");
+ printf(" uint8");
+ else if (opt->type & INT8)
+ printf(" int8");
else if (opt->type & UINT16)
printf(" uint16");
- else if (opt->type & SINT16)
- printf(" sint16");
+ else if (opt->type & INT16)
+ printf(" int16");
else if (opt->type & UINT32)
printf(" uint32");
- else if (opt->type & SINT32)
- printf(" sint32");
+ else if (opt->type & INT32)
+ printf(" int32");
else if (opt->type & ADDRIPV4)
printf(" ipaddress");
else if (opt->type & ADDRIPV6)
if (opt->type & ADDRIPV6)
sz = ADDR6SZ;
- else if (opt->type & (UINT32 | ADDRIPV4))
+ else if (opt->type & (INT32 | UINT32 | ADDRIPV4))
sz = sizeof(uint32_t);
- else if (opt->type & UINT16)
+ else if (opt->type & (INT16 | UINT16))
sz = sizeof(uint16_t);
- else if (opt->type & (UINT8 | BITFLAG))
+ else if (opt->type & (INT8 | UINT8 | BITFLAG))
sz = sizeof(uint8_t);
else if (opt->type & FLAG)
return 0;
if (!s) {
if (opt->type & UINT8)
l = 3;
+ else if (opt->type & INT8)
+ l = 4;
else if (opt->type & UINT16) {
l = 5;
dl /= 2;
- } else if (opt->type & SINT16) {
+ } else if (opt->type & INT16) {
l = 6;
dl /= 2;
} else if (opt->type & UINT32) {
l = 10;
dl /= 4;
- } else if (opt->type & SINT32) {
+ } else if (opt->type & INT32) {
l = 11;
dl /= 4;
} else if (opt->type & ADDRIPV4) {
if (opt->type & UINT8) {
sl = snprintf(s, len, "%u", *data);
data++;
+ } else if (opt->type & INT8) {
+ sl = snprintf(s, len, "%d", *data);
+ data++;
} else if (opt->type & UINT16) {
memcpy(&u16, data, sizeof(u16));
u16 = ntohs(u16);
sl = snprintf(s, len, "%u", u16);
data += sizeof(u16);
- } else if (opt->type & SINT16) {
+ } else if (opt->type & INT16) {
memcpy(&u16, data, sizeof(u16));
s16 = (int16_t)ntohs(u16);
sl = snprintf(s, len, "%d", s16);
u32 = ntohl(u32);
sl = snprintf(s, len, "%u", u32);
data += sizeof(u32);
- } else if (opt->type & SINT32) {
+ } else if (opt->type & INT32) {
memcpy(&u32, data, sizeof(u32));
s32 = (int32_t)ntohl(u32);
sl = snprintf(s, len, "%d", s32);
#define REQUEST (1 << 0)
#define UINT8 (1 << 1)
-#define UINT16 (1 << 2)
-#define SINT16 (1 << 3)
-#define UINT32 (1 << 4)
-#define SINT32 (1 << 5)
-#define ADDRIPV4 (1 << 6)
-#define STRING (1 << 7)
-#define ARRAY (1 << 8)
-#define RFC3361 (1 << 9)
-#define RFC1035 (1 << 10)
-#define RFC3442 (1 << 11)
-#define OPTIONAL (1 << 12)
-#define ADDRIPV6 (1 << 13)
-#define BINHEX (1 << 14)
-#define FLAG (1 << 15)
-#define NOREQ (1 << 16)
-#define EMBED (1 << 17)
-#define ENCAP (1 << 18)
-#define INDEX (1 << 19)
-#define OPTION (1 << 20)
-#define DOMAIN (1 << 21)
-#define ASCII (1 << 22)
-#define RAW (1 << 23)
-#define ESCSTRING (1 << 24)
-#define ESCFILE (1 << 25)
-#define BITFLAG (1 << 26)
-#define RESERVED (1 << 27)
+#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)
struct dhcp_opt {
uint32_t option; /* Also used for IANA Enterpise Number */
t |= UINT8;
else if (strcasecmp(arg, "bitflags") == 0)
t |= BITFLAG;
+ else if (strcasecmp(arg, "uint8") == 0)
+ t |= UINT8;
+ else if (strcasecmp(arg, "int8") == 0)
+ t |= INT8;
else if (strcasecmp(arg, "uint16") == 0)
t |= UINT16;
else if (strcasecmp(arg, "int16") == 0)
- t |= SINT16;
+ t |= INT16;
else if (strcasecmp(arg, "uint32") == 0)
t |= UINT32;
else if (strcasecmp(arg, "int32") == 0)
- t |= SINT32;
+ t |= INT32;
else if (strcasecmp(arg, "flag") == 0)
t |= FLAG;
else if (strcasecmp(arg, "raw") == 0)