diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-09-29 19:10:50 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2007-09-29 19:10:50 +0000 |
commit | 441097af93882803bbb3296dd1fdbdd4a7773deb (patch) | |
tree | a221d657b763bcf793ea407fcd8b81d91ac06a5a /resolv | |
parent | 62beba6902f315a14113c26ed3e068342e101399 (diff) | |
download | glibc-441097af93882803bbb3296dd1fdbdd4a7773deb.tar.gz |
Updated to fedora-glibc-20070929T1859cvs/fedora-glibc-2_6_90-16
Diffstat (limited to 'resolv')
-rw-r--r-- | resolv/ns_print.c | 49 |
1 files changed, 45 insertions, 4 deletions
diff --git a/resolv/ns_print.c b/resolv/ns_print.c index 12b2e67ea6..b0b7a1046e 100644 --- a/resolv/ns_print.c +++ b/resolv/ns_print.c @@ -112,6 +112,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen, const char *comment; char tmp[100]; + char errbuf[40]; int len, x; /* @@ -174,11 +175,11 @@ ns_sprintrrf(const u_char *msg, size_t msglen, rdata += len; T(addstr(" ", 1, &buf, &buflen)); - + /* Second word, optional in ISDN records. */ if (type == ns_t_isdn && rdata == edata) break; - + T(len = charstr(rdata, edata, &buf, &buflen)); if (len == 0) goto formerr; @@ -596,7 +597,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen, } else leader = " "; - + for (n = 0; n < len; n += 48) { T(addstr(leader, strlen(leader), &buf, &buflen)); @@ -625,8 +626,48 @@ ns_sprintrrf(const u_char *msg, size_t msglen, break; } + case ns_t_a6: { + struct in6_addr a; + int pbyte, pbit; + + /* prefix length */ + if (rdlen == 0U) goto formerr; + len = SPRINTF((tmp, "%d ", *rdata)); + T(addstr(tmp, len, &buf, &buflen)); + pbit = *rdata; + if (pbit > 128) goto formerr; + pbyte = (pbit & ~7) / 8; + rdata++; + + /* address suffix: provided only when prefix len != 128 */ + if (pbit < 128) { + if (rdata + pbyte >= edata) goto formerr; + memset(&a, 0, sizeof(a)); + memcpy(&a.s6_addr[pbyte], rdata, sizeof(a) - pbyte); + (void) inet_ntop(AF_INET6, &a, buf, buflen); + addlen(strlen(buf), &buf, &buflen); + rdata += sizeof(a) - pbyte; + } + + /* prefix name: provided only when prefix len > 0 */ + if (pbit == 0) + break; + if (rdata >= edata) goto formerr; + T(addstr(" ", 1, &buf, &buflen)); + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + + break; + } + + case ns_t_opt: { + len = SPRINTF((tmp, "%u bytes", class)); + T(addstr(tmp, len, &buf, &buflen)); + break; + } + default: - comment = "unknown RR type"; + snprintf (errbuf, sizeof (errbuf), "unknown RR type %d", type); + comment = errbuf; goto hexify; } return (buf - obuf); |