{
buf_printf(&out, "%s", print_in_addr_t(maddr.v4mappedv6.addr,
IA_NET_ORDER, gc));
- /* we only print port numbers for v4mapped v6 as of
- * today, because "v6addr:port" is too ambiguous
- */
- if (maddr.type & MR_WITH_PORT)
- {
- buf_printf(&out, ":%d", ntohs(maddr.v6.port));
- }
+ }
+ else if (maddr.type & MR_WITH_PORT)
+ {
+ buf_printf(&out, "[%s]", print_in6_addr(maddr.v6.addr, 0, gc));
}
else
{
buf_printf(&out, "%s", print_in6_addr(maddr.v6.addr, 0, gc));
}
+ if (maddr.type & MR_WITH_PORT)
+ {
+ buf_printf(&out, ":%d", ntohs(maddr.v6.port));
+ }
if (maddr.type & MR_WITH_NETBITS)
{
buf_printf(&out, "/%d", maddr.netbits);