diff options
author | Vladislav Grishenko <themiron@mail.ru> | 2016-05-12 21:07:50 +0500 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2017-12-05 13:06:21 +0300 |
commit | 91952064d67c2c71bb75065977071e2a860f3171 (patch) | |
tree | ec4732f050f579939332f80f8b2f40ac3a6f78e9 | |
parent | 66f63b92f2f3c110384863b0539e10019b4e9838 (diff) | |
download | accel-ppp-91952064d67c2c71bb75065977071e2a860f3171.tar.gz accel-ppp-91952064d67c2c71bb75065977071e2a860f3171.zip |
ipv6: dhcpv6: fix Vendor-Class, Vendor-Specific and Interface-ID options print parsing
-rw-r--r-- | accel-pppd/ipv6/dhcpv6_packet.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/accel-pppd/ipv6/dhcpv6_packet.c b/accel-pppd/ipv6/dhcpv6_packet.c index 16db5cb9..e77a89bc 100644 --- a/accel-pppd/ipv6/dhcpv6_packet.c +++ b/accel-pppd/ipv6/dhcpv6_packet.c @@ -22,12 +22,12 @@ static void print_ia_na(struct dhcpv6_option *opt, void (*print)(const char *fmt static void print_ia_ta(struct dhcpv6_option *opt, void (*print)(const char *fmt, ...)); static void print_ia_addr(struct dhcpv6_option *opt, void (*print)(const char *fmt, ...)); static void print_oro(struct dhcpv6_option *opt, void (*print)(const char *fmt, ...)); +static void print_hex_array(struct dhcpv6_option *opt, void (*print)(const char *fmt, ...)); static void print_uint8(struct dhcpv6_option *opt, void (*print)(const char *fmt, ...)); static void print_time(struct dhcpv6_option *opt, void (*print)(const char *fmt, ...)); static void print_ipv6addr(struct dhcpv6_option *opt, void (*print)(const char *fmt, ...)); static void print_ipv6addr_array(struct dhcpv6_option *opt, void (*print)(const char *fmt, ...)); static void print_status(struct dhcpv6_option *opt, void (*print)(const char *fmt, ...)); -static void print_uint64(struct dhcpv6_option *opt, void (*print)(const char *fmt, ...)); static void print_reconf(struct dhcpv6_option *opt, void (*print)(const char *fmt, ...)); static void print_dnssl(struct dhcpv6_option *opt, void (*print)(const char *fmt, ...)); static void print_ia_prefix(struct dhcpv6_option *opt, void (*print)(const char *fmt, ...)); @@ -47,9 +47,9 @@ static struct dict_option known_options[] = { { D6_OPTION_STATUS_CODE, "Status", 0, 0, print_status }, { D6_OPTION_RAPID_COMMIT, "Rapid-Commit", 1, 0 }, { D6_OPTION_USER_CLASS, "User-Class", 1, 0 }, - { D6_OPTION_VENDOR_CLASS, "Vendor-Class", 1, 0, print_uint64 }, - { D6_OPTION_VENDOR_SPECIFIC, "Vendor-Specific", 1, 0, print_uint64 }, - { D6_OPTION_INTERFACE_ID, "Interface-ID", 1, 0, print_uint64 }, + { D6_OPTION_VENDOR_CLASS, "Vendor-Class", 1, 0, print_hex_array }, + { D6_OPTION_VENDOR_SPECIFIC, "Vendor-Specific", 1, 0, print_hex_array }, + { D6_OPTION_INTERFACE_ID, "Interface-ID", 1, 0, print_hex_array }, { D6_OPTION_RECONF_MSG, "Reconfigure", 0, 0, print_reconf }, { D6_OPTION_RECONF_ACCEPT, "Reconfigure-Accept", 1, 0 }, { D6_OPTION_DNS_SERVERS, "DNS", 1, 0, print_ipv6addr_array }, @@ -375,6 +375,15 @@ static void print_oro(struct dhcpv6_option *opt, void (*print)(const char *fmt, } } +static void print_hex_array(struct dhcpv6_option *opt, void (*print)(const char *fmt, ...)) +{ + int i; + + print(" "); + for (i = 0; i < ntohs(opt->hdr->len); i++) + print("%02x", opt->hdr->data[i]); +} + static void print_uint8(struct dhcpv6_option *opt, void (*print)(const char *fmt, ...)) { print(" %i", *(uint8_t *)opt->hdr->data); @@ -427,11 +436,6 @@ static void print_status(struct dhcpv6_option *opt, void (*print)(const char *fm print(" %s", status_name[ntohs(o->code)]); } -static void print_uint64(struct dhcpv6_option *opt, void (*print)(const char *fmt, ...)) -{ - print(" %llu", *(uint64_t *)opt->hdr->data); -} - static void print_reconf(struct dhcpv6_option *opt, void (*print)(const char *fmt, ...)) { |