3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-01 15:49:49 +01:00

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

View File

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