@@ -222,7 +222,7 @@ static void vti6_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
remote = format_host(AF_INET6, 16, &daddr);
}
- fprintf(f, "remote %s ", remote);
+ print_string(PRINT_ANY, "remote", "remote %s ", remote);
if (tb[IFLA_VTI_LOCAL]) {
memcpy(&saddr, RTA_DATA(tb[IFLA_VTI_LOCAL]), sizeof(saddr));
@@ -230,29 +230,35 @@ static void vti6_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
local = format_host(AF_INET6, 16, &saddr);
}
- fprintf(f, "local %s ", local);
+ print_string(PRINT_ANY, "local", "local %s ", local);
if (tb[IFLA_VTI_LINK] && (link = rta_getattr_u32(tb[IFLA_VTI_LINK]))) {
const char *n = if_indextoname(link, s2);
if (n)
- fprintf(f, "dev %s ", n);
+ print_string(PRINT_ANY, "link", "dev %s ", n);
else
- fprintf(f, "dev %u ", link);
+ print_uint(PRINT_ANY, "link_index", "dev %u ", link);
}
if (tb[IFLA_VTI_IKEY]) {
inet_ntop(AF_INET, RTA_DATA(tb[IFLA_VTI_IKEY]), s2, sizeof(s2));
- fprintf(f, "ikey %s ", s2);
+ print_string(PRINT_ANY, "ikey", "ikey %s ", s2);
}
if (tb[IFLA_VTI_OKEY]) {
inet_ntop(AF_INET, RTA_DATA(tb[IFLA_VTI_OKEY]), s2, sizeof(s2));
- fprintf(f, "okey %s ", s2);
+ print_string(PRINT_ANY, "okey", "okey %s ", s2);
}
- if (tb[IFLA_VTI_FWMARK] && rta_getattr_u32(tb[IFLA_VTI_FWMARK])) {
- fprintf(f, "fwmark 0x%x ", rta_getattr_u32(tb[IFLA_VTI_FWMARK]));
+ if (tb[IFLA_VTI_FWMARK]) {
+ __u32 fwmark = rta_getattr_u32(tb[IFLA_VTI_FWMARK]);
+
+ if (fwmark) {
+ snprintf(s2, sizeof(s2), "0x%x", fwmark);
+
+ print_string(PRINT_ANY, "fwmark", "fwmark %s ", s2);
+ }
}
}