static void
list_attributes(struct switch_dev *dev)
{
- printf("Switch %d: %s(%s), ports: %d, vlans: %d\n", dev->id, dev->dev_name, dev->name, dev->ports, dev->vlans);
+ printf("Switch %d: %s(%s), ports: %d (cpu @ %d), vlans: %d\n", dev->id, dev->dev_name, dev->name, dev->ports, dev->cpu_port, dev->vlans);
printf(" --switch\n");
print_attrs(dev->ops);
printf(" --vlan\n");
dev->ports = nla_get_u32(tb[SWITCH_ATTR_PORTS]);
if (tb[SWITCH_ATTR_VLANS])
dev->vlans = nla_get_u32(tb[SWITCH_ATTR_VLANS]);
+ if (tb[SWITCH_ATTR_CPU_PORT])
+ dev->cpu_port = nla_get_u32(tb[SWITCH_ATTR_CPU_PORT]);
if (!sa->head) {
sa->head = dev;
const char *dev_name;
int ports;
int vlans;
+ int cpu_port;
struct switch_attr *ops;
struct switch_attr *port_ops;
struct switch_attr *vlan_ops;
NLA_PUT_STRING(msg, SWITCH_ATTR_DEV_NAME, dev->devname);
NLA_PUT_U32(msg, SWITCH_ATTR_VLANS, dev->vlans);
NLA_PUT_U32(msg, SWITCH_ATTR_PORTS, dev->ports);
+ NLA_PUT_U32(msg, SWITCH_ATTR_CPU_PORT, dev->cpu_port);
return genlmsg_end(msg, hdr);
nla_put_failure:
SWITCH_ATTR_DEV_NAME,
SWITCH_ATTR_VLANS,
SWITCH_ATTR_PORTS,
+ SWITCH_ATTR_CPU_PORT,
/* attributes */
SWITCH_ATTR_OP_ID,
SWITCH_ATTR_OP_TYPE,