static void vlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) { struct ifla_vlan_flags *flags; SPRINT_BUF(b1); if (!tb) return; if (tb[IFLA_VLAN_PROTOCOL] && RTA_PAYLOAD(tb[IFLA_VLAN_PROTOCOL]) < sizeof(__u16)) return; if (!tb[IFLA_VLAN_ID] || RTA_PAYLOAD(tb[IFLA_VLAN_ID]) < sizeof(__u16)) return; if (tb[IFLA_VLAN_PROTOCOL]) fprintf(f, "protocol %s ", ll_proto_n2a(rta_getattr_u16(tb[IFLA_VLAN_PROTOCOL]), b1, sizeof(b1))); else fprintf(f, "protocol 802.1q "); fprintf(f, "id %u ", rta_getattr_u16(tb[IFLA_VLAN_ID])); if (tb[IFLA_VLAN_FLAGS]) { if (RTA_PAYLOAD(tb[IFLA_VLAN_FLAGS]) < sizeof(*flags)) return; flags = RTA_DATA(tb[IFLA_VLAN_FLAGS]); vlan_print_flags(f, flags->flags); } if (tb[IFLA_VLAN_INGRESS_QOS]) vlan_print_map(f, "ingress-qos-map", tb[IFLA_VLAN_INGRESS_QOS]); if (tb[IFLA_VLAN_EGRESS_QOS]) vlan_print_map(f, "egress-qos-map", tb[IFLA_VLAN_EGRESS_QOS]); }
static void vlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) { struct ifla_vlan_flags *flags; if (!tb) return; if (!tb[IFLA_VLAN_ID] || RTA_PAYLOAD(tb[IFLA_VLAN_ID]) < sizeof(__u16)) return; fprintf(f, "id %u ", *(__u16 *)RTA_DATA(tb[IFLA_VLAN_ID])); if (tb[IFLA_VLAN_FLAGS]) { if (RTA_PAYLOAD(tb[IFLA_VLAN_FLAGS]) < sizeof(*flags)) return; flags = RTA_DATA(tb[IFLA_VLAN_FLAGS]); vlan_print_flags(f, flags->flags); } if (tb[IFLA_VLAN_INGRESS_QOS]) vlan_print_map(f, "ingress-qos-map", tb[IFLA_VLAN_INGRESS_QOS]); if (tb[IFLA_VLAN_EGRESS_QOS]) vlan_print_map(f, "egress-qos-map", tb[IFLA_VLAN_EGRESS_QOS]); }