static void
port_update_bond_compat(struct port *port)
{
+ struct compat_bond_hash compat_hashes[BOND_MASK + 1];
struct compat_bond bond;
size_t i;
bond.up = false;
bond.updelay = port->updelay;
bond.downdelay = port->downdelay;
+
+ bond.n_hashes = 0;
+ bond.hashes = compat_hashes;
+ if (port->bond_hash) {
+ const struct bond_entry *e;
+ for (e = port->bond_hash; e <= &port->bond_hash[BOND_MASK]; e++) {
+ if (e->iface_idx >= 0 && e->iface_idx < port->n_ifaces) {
+ struct compat_bond_hash *cbh = &bond.hashes[bond.n_hashes++];
+ cbh->hash = e - port->bond_hash;
+ cbh->netdev_name = port->ifaces[e->iface_idx]->name;
+ }
+ }
+ }
+
bond.n_slaves = port->n_ifaces;
bond.slaves = xmalloc(port->n_ifaces * sizeof *bond.slaves);
for (i = 0; i < port->n_ifaces; i++) {
}
memcpy(slave->mac, iface->mac, ETH_ADDR_LEN);
}
+
proc_net_compat_update_bond(port->name, &bond);
free(bond.slaves);
}
"\n"
"Source load balancing info:\n",
bond->up ? "up" : "down", bond->updelay, bond->downdelay);
+
+ for (i = 0; i < bond->n_hashes; i++) {
+ const struct compat_bond_hash *cbh = &bond->hashes[i];
+ ds_put_format(&ds, " [%03d] = %s\n", cbh->hash, cbh->netdev_name);
+ }
+
for (i = 0; i < bond->n_slaves; i++) {
const struct compat_bond_slave *slave = &bond->slaves[i];
ds_put_format(
bool up;
int updelay;
int downdelay;
+
+ int n_hashes;
+ struct compat_bond_hash *hashes;
+
int n_slaves;
struct compat_bond_slave *slaves;
};
+struct compat_bond_hash {
+ int hash;
+ const char *netdev_name;
+};
+
struct compat_bond_slave {
const char *name;
bool up;