diff options
author | Kozlov Dmitry <xeb@mail.ru> | 2011-08-28 22:38:22 +0400 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2011-08-28 22:38:22 +0400 |
commit | 47c8e0517c037231335cdc1595acf2d53f8c6e22 (patch) | |
tree | 4f6dde6159d8904f019e771e445cf93c6aa6bc85 /accel-pppd/ipv6/dhcpv6_packet.c | |
parent | 3e9cb77429b07a0317c7f394c22cf5cb78b59136 (diff) | |
download | accel-ppp-47c8e0517c037231335cdc1595acf2d53f8c6e22.tar.gz accel-ppp-47c8e0517c037231335cdc1595acf2d53f8c6e22.zip |
ipv6_dhcp: implemented DNS,DNSSL,IA_PD options
Diffstat (limited to 'accel-pppd/ipv6/dhcpv6_packet.c')
-rw-r--r-- | accel-pppd/ipv6/dhcpv6_packet.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/accel-pppd/ipv6/dhcpv6_packet.c b/accel-pppd/ipv6/dhcpv6_packet.c index 9a709963..e0e348d4 100644 --- a/accel-pppd/ipv6/dhcpv6_packet.c +++ b/accel-pppd/ipv6/dhcpv6_packet.c @@ -30,6 +30,7 @@ static void print_status(struct dhcpv6_option *opt, void (*print)(const char *fm 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, ...)); static struct dict_option known_options[] = { { D6_OPTION_CLIENTID, "Client-ID", 1, 0, print_clientid }, @@ -53,6 +54,8 @@ static struct dict_option known_options[] = { { D6_OPTION_RECONF_ACCEPT, "Reconfigure-Accept", 1, 0 }, { D6_OPTION_DNS_SERVERS, "DNS", 1, 0, print_ipv6addr_array }, { D6_OPTION_DOMAIN_LIST, "DNSSL", 1, 0, print_dnssl }, + { D6_OPTION_IA_PD, "IA-PD", 1, sizeof(struct dhcpv6_opt_ia_na), print_ia_na }, + { D6_OPTION_IAPREFIX, "IA-Prefix", 1, sizeof(struct dhcpv6_opt_ia_prefix), print_ia_prefix }, { 0 } }; @@ -337,7 +340,7 @@ 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, ...)) { struct dhcpv6_opt_ia_addr *o = (struct dhcpv6_opt_ia_addr *)opt->hdr; - char str[50]; + char str[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, &o->addr, str, sizeof(str)); print(" %s pref_lifetime=%i valid_lifetime=%i", str, ntohl(o->pref_lifetime), ntohl(o->valid_lifetime)); @@ -382,7 +385,7 @@ 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, ...)) { - char str[50]; + char str[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, opt->hdr->data, str, sizeof(str)); @@ -391,7 +394,7 @@ static void print_ipv6addr(struct dhcpv6_option *opt, void (*print)(const char * static void print_ipv6addr_array(struct dhcpv6_option *opt, void (*print)(const char *fmt, ...)) { - char str[50]; + char str[INET6_ADDRSTRLEN]; int i; int f = 0; struct in6_addr *addr = (struct in6_addr *)opt->hdr->data; @@ -436,3 +439,12 @@ 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, ...)) +{ + struct dhcpv6_opt_ia_prefix *o = (struct dhcpv6_opt_ia_prefix *)opt->hdr; + char str[INET6_ADDRSTRLEN]; + + inet_ntop(AF_INET6, &o->prefix, str, sizeof(str)); + print(" %s/%i pref_lifetime=%i valid_lifetime=%i", str, o->prefix_len, ntohl(o->pref_lifetime), ntohl(o->valid_lifetime)); +} + |