]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
tests: correctly encode civic address for SNMP tests
authorVincent Bernat <vincent@bernat.im>
Fri, 18 Mar 2016 11:04:41 +0000 (12:04 +0100)
committerVincent Bernat <vincent@bernat.im>
Fri, 18 Mar 2016 18:34:54 +0000 (19:34 +0100)
For some reason "\x02F" was interpreted as "\x2f", not as "\x02"
"F". Use separate strings to ensure correctness.

tests/check_snmp.c

index 7ff6d1340cae6221d6f877240a06f194b2642f2a..e697798fb5a593ec8ef8a135d39196bb4f1221e6 100644 (file)
@@ -174,7 +174,7 @@ struct lldpd_hardware hardware1 = {
                        { .format = 0 }, {
                                .format = LLDP_MED_LOCFORMAT_CIVIC,
                                /* 2:FR:6:Commercial Rd:19:4 */
-                               .data = "\x15\x02FR\x06\x0dCommercial Rd\x13\x014",
+                               .data = "\x15" "\x02" "FR" "\x06" "\x0d" "Commercial Rd" "\x13" "\x01" "4",
                                .data_len = 22,
                        }, { .format = 0 }
                },
@@ -694,7 +694,7 @@ struct tree_node snmp_tree[] = {
 
        /* lldpXMedLocLocationInfo */
        { {1, 5, 4795, 1, 2, 9, 1, 2, 3, 3}, 10, ASN_OCTET_STR,
-         { .string = { .octet = "\x15\x02FR\x06\x0dCommercial Rd\x13\x014", .len = 22 }} },
+         { .string = { .octet = "\x15" "\x02" "FR" "\x06" "\x0d" "Commercial Rd" "\x13" "\x01" "4", .len = 22 }} },
        { {1, 5, 4795, 1, 2, 9, 1, 2, 4, 2}, 10, ASN_OCTET_STR,
          { .string = { .octet = "Not interpreted", .len = 15 }} },
 
@@ -782,7 +782,7 @@ struct tree_node snmp_tree[] = {
        { {1, 5, 4795, 1, 3, 4, 1, 2, 0, 3, 1, 2}, 12, ASN_OCTET_STR,
          { .string = { .octet = "Not interpreted", .len = 15 }} },
        { {1, 5, 4795, 1, 3, 4, 1, 2, 10000, 4, 1, 3}, 12, ASN_OCTET_STR,
-         { .string = { .octet = "\x15\x02FR\x06\x0dCommercial Rd\x13\x014", .len = 22 }} },
+         { .string = { .octet = "\x15" "\x02" "FR" "\x06" "\x0d" "Commercial Rd" "\x13" "\x01" "4", .len = 22 }} },
 
        /* lldpXMedRemXPoEDeviceType */
        { {1, 5, 4795, 1, 3, 5, 1, 1, 0, 3, 1}, 11, ASN_INTEGER, { .integer = 4 }},