monitor: Add support for attributes containing signed 32-bit integers

This commit is contained in:
Marcel Holtmann 2014-08-06 04:01:49 +02:00
parent 080338ba41
commit 477682ad5d
1 changed files with 8 additions and 0 deletions

View File

@ -112,6 +112,7 @@ enum attr_type {
ATTR_U16,
ATTR_U32,
ATTR_U64,
ATTR_S32,
ATTR_STRING,
ATTR_ADDRESS,
ATTR_BINARY,
@ -597,6 +598,7 @@ static void print_attributes(int indent, const struct attr_entry *table,
uint32_t val32;
uint16_t val16;
uint8_t val8;
int32_t val_s32;
uint8_t *ptr;
char addr[18];
@ -654,6 +656,12 @@ static void print_attributes(int indent, const struct attr_entry *table,
if (NLA_PAYLOAD(nla) != 8)
printf("malformed packet\n");
break;
case ATTR_S32:
val_s32 = *((int32_t *) NLA_DATA(nla));
printf("%*c%s: %d\n", indent, ' ', str, val_s32);
if (NLA_PAYLOAD(nla) != 4)
printf("malformed packet\n");
break;
case ATTR_STRING:
printf("%*c%s: %s\n", indent, ' ', str,
(char *) NLA_DATA(nla));