{
__u32 vni;
__u8 ttl = 0;
- __u8 tos;
+ __u8 tos = 0;
if (!tb)
return;
else
print_string(PRINT_FP, NULL, "ttl %s ", "inherit");
- if (tb[IFLA_GENEVE_TOS] &&
- (tos = rta_getattr_u8(tb[IFLA_GENEVE_TOS]))) {
- if (is_json_context()) {
- print_0xhex(PRINT_JSON, "tos", "%#x", tos);
- } else {
- if (tos == 1) {
- print_string(PRINT_FP,
- "tos",
- "tos %s ",
- "inherit");
- } else {
- fprintf(f, "tos %#x ", tos);
- }
- }
+ if (tb[IFLA_GENEVE_TOS])
+ tos = rta_getattr_u8(tb[IFLA_GENEVE_TOS]);
+ if (tos) {
+ if (is_json_context() || tos != 1)
+ print_0xhex(PRINT_ANY, "tos", "tos 0x%x ", tos);
+ else
+ print_string(PRINT_FP, NULL, "tos %s ", "inherit");
}
if (tb[IFLA_GENEVE_LABEL]) {
{
__u32 vni;
__u8 ttl = 0;
- __u8 tos;
+ __u8 tos = 0;
__u32 maxaddr;
if (!tb)
if (tb[IFLA_VXLAN_L3MISS] && rta_getattr_u8(tb[IFLA_VXLAN_L3MISS]))
print_bool(PRINT_ANY, "l3miss", "l3miss ", true);
- if (tb[IFLA_VXLAN_TOS] &&
- (tos = rta_getattr_u8(tb[IFLA_VXLAN_TOS]))) {
- if (is_json_context()) {
- print_0xhex(PRINT_JSON, "tos", "%#x", tos);
- } else {
- if (tos == 1)
- fprintf(f, "tos %s ", "inherit");
- else
- fprintf(f, "tos %#x ", tos);
- }
+ if (tb[IFLA_VXLAN_TOS])
+ tos = rta_getattr_u8(tb[IFLA_VXLAN_TOS]);
+ if (tos) {
+ if (is_json_context() || tos != 1)
+ print_0xhex(PRINT_ANY, "tos", "tos 0x%x ", tos);
+ else
+ print_string(PRINT_FP, NULL, "tos %s ", "inherit");
}
if (tb[IFLA_VXLAN_TTL])
unsigned int iflags = 0;
unsigned int oflags = 0;
__u8 ttl = 0;
+ __u8 tos = 0;
if (tb[IFLA_GRE_REMOTE]) {
unsigned int addr = rta_getattr_u32(tb[IFLA_GRE_REMOTE]);
else
print_string(PRINT_FP, NULL, "ttl %s ", "inherit");
- if (tb[IFLA_GRE_TOS] && rta_getattr_u8(tb[IFLA_GRE_TOS])) {
- int tos = rta_getattr_u8(tb[IFLA_GRE_TOS]);
-
- if (is_json_context()) {
- SPRINT_BUF(b1);
-
- snprintf(b1, sizeof(b1), "0x%x", tos);
- print_string(PRINT_JSON, "tos", NULL, b1);
- } else {
- fputs("tos ", f);
- if (tos == 1)
- fputs("inherit ", f);
- else
- fprintf(f, "0x%x ", tos);
- }
+ if (tb[IFLA_GRE_TOS])
+ tos = rta_getattr_u8(tb[IFLA_GRE_TOS]);
+ if (tos) {
+ if (is_json_context() || tos != 1)
+ print_0xhex(PRINT_ANY, "tos", "tos 0x%x ", tos);
+ else
+ print_string(PRINT_FP, NULL, "tos %s ", "inherit");
}
if (tb[IFLA_GRE_PMTUDISC]) {
const char *remote = "any";
__u16 prefixlen, type;
__u8 ttl = 0;
+ __u8 tos = 0;
if (!tb)
return;
else
print_string(PRINT_FP, NULL, "ttl %s ", "inherit");
- if (tb[IFLA_IPTUN_TOS]) {
- int tos = rta_getattr_u8(tb[IFLA_IPTUN_TOS]);
-
- if (tos) {
- if (is_json_context()) {
- print_0xhex(PRINT_JSON, "tos", "%#x", tos);
- } else {
- fputs("tos ", f);
- if (tos == 1)
- fputs("inherit ", f);
- else
- fprintf(f, "0x%x ", tos);
- }
- }
+ if (tb[IFLA_IPTUN_TOS])
+ tos = rta_getattr_u8(tb[IFLA_IPTUN_TOS]);
+ if (tos) {
+ if (is_json_context() || tos != 1)
+ print_0xhex(PRINT_ANY, "tos", "tos 0x%x ", tos);
+ else
+ print_string(PRINT_FP, NULL, "tos %s ", "inherit");
}
if (tb[IFLA_IPTUN_PMTUDISC] && rta_getattr_u8(tb[IFLA_IPTUN_PMTUDISC]))