bonding: add netlink support for sys prio, actor sys mac, and port key
Adds netlink support for the following bonding options: * BOND_OPT_AD_ACTOR_SYS_PRIO * BOND_OPT_AD_ACTOR_SYSTEM * BOND_OPT_AD_USER_PORT_KEY When setting the actor system mac address we assume the netlink message contains a binary mac and not a string representation of a mac. Signed-off-by: Andy Gospodarek <gospo@cumulusnetworks.com> [jt: completed the setting side of the netlink attributes] Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com> Signed-off-by: Nikolay Aleksandrov <razor@blackwall.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
d22a5fc0c3
commit
171a42c38c
@@ -1394,7 +1394,7 @@ static int bond_option_tlb_dynamic_lb_set(struct bonding *bond,
|
||||
static int bond_option_ad_actor_sys_prio_set(struct bonding *bond,
|
||||
const struct bond_opt_value *newval)
|
||||
{
|
||||
netdev_info(bond->dev, "Setting ad_actor_sys_prio to (%llu)\n",
|
||||
netdev_info(bond->dev, "Setting ad_actor_sys_prio to %llu\n",
|
||||
newval->value);
|
||||
|
||||
bond->params.ad_actor_sys_prio = newval->value;
|
||||
@@ -1405,24 +1405,36 @@ static int bond_option_ad_actor_system_set(struct bonding *bond,
|
||||
const struct bond_opt_value *newval)
|
||||
{
|
||||
u8 macaddr[ETH_ALEN];
|
||||
u8 *mac;
|
||||
int i;
|
||||
|
||||
i = sscanf(newval->string, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
|
||||
&macaddr[0], &macaddr[1], &macaddr[2],
|
||||
&macaddr[3], &macaddr[4], &macaddr[5]);
|
||||
if (i != ETH_ALEN || !is_valid_ether_addr(macaddr)) {
|
||||
netdev_err(bond->dev, "Invalid MAC address.\n");
|
||||
return -EINVAL;
|
||||
if (newval->string) {
|
||||
i = sscanf(newval->string, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
|
||||
&macaddr[0], &macaddr[1], &macaddr[2],
|
||||
&macaddr[3], &macaddr[4], &macaddr[5]);
|
||||
if (i != ETH_ALEN)
|
||||
goto err;
|
||||
mac = macaddr;
|
||||
} else {
|
||||
mac = (u8 *)&newval->value;
|
||||
}
|
||||
|
||||
ether_addr_copy(bond->params.ad_actor_system, macaddr);
|
||||
if (!is_valid_ether_addr(mac))
|
||||
goto err;
|
||||
|
||||
netdev_info(bond->dev, "Setting ad_actor_system to %pM\n", mac);
|
||||
ether_addr_copy(bond->params.ad_actor_system, mac);
|
||||
return 0;
|
||||
|
||||
err:
|
||||
netdev_err(bond->dev, "Invalid MAC address.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int bond_option_ad_user_port_key_set(struct bonding *bond,
|
||||
const struct bond_opt_value *newval)
|
||||
{
|
||||
netdev_info(bond->dev, "Setting ad_user_port_key to (%llu)\n",
|
||||
netdev_info(bond->dev, "Setting ad_user_port_key to %llu\n",
|
||||
newval->value);
|
||||
|
||||
bond->params.ad_user_port_key = newval->value;
|
||||
|
Reference in New Issue
Block a user