}
static noinline_for_stack
-char *ip6_addr_string_sa(char *buf, char *end, const struct sockaddr_in6 *sa,
- struct printf_spec spec, const char *fmt)
+char *ip6_addr_string_sa(struct printf_state *ps, const struct sockaddr_in6 *sa)
{
bool have_p = false, have_s = false, have_f = false, have_c = false;
char ip6_addr[sizeof("[xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:255.255.255.255]") +
sizeof("%1234567890")];
char *p = ip6_addr, *pend = ip6_addr + sizeof(ip6_addr);
const u8 *addr = (const u8 *) &sa->sin6_addr;
- char fmt6[2] = { fmt[0], '6' };
+ char fmt6[2] = { ps->fmt[0], '6' };
u8 off = 0;
- fmt++;
- while (isalpha(*++fmt)) {
- switch (*fmt) {
+ ps->fmt++;
+ while (isalpha(*++ps->fmt)) {
+ switch (*ps->fmt) {
case 'p':
have_p = true;
break;
if (have_p) {
*p++ = ':';
- p = number(p, pend, ntohs(sa->sin6_port), spec);
+ p = number(p, pend, ntohs(sa->sin6_port), ps->spec);
}
if (have_f) {
*p++ = '/';
p = number(p, pend, ntohl(sa->sin6_flowinfo &
- IPV6_FLOWINFO_MASK), spec);
+ IPV6_FLOWINFO_MASK), ps->spec);
}
if (have_s) {
*p++ = '%';
- p = number(p, pend, sa->sin6_scope_id, spec);
+ p = number(p, pend, sa->sin6_scope_id, ps->spec);
}
*p = '\0';
- return string(buf, end, ip6_addr, spec);
+ printf_string(ps, ip6_addr);
+ return ps->buf;
}
static noinline_for_stack
case AF_INET:
return ip4_addr_string_sa(buf, end, &sa->v4, spec, fmt);
case AF_INET6:
- return ip6_addr_string_sa(buf, end, &sa->v6, spec, fmt);
+ return ip6_addr_string_sa(ps, &sa->v6);
default:
- return string(buf, end, "(invalid address)", spec);
+ printf_string(ps, "(invalid address)");
+ return ps->buf;
}}
}
break;