Updated bond_fill_info() to support extended arp_ip_target format.
Forward and backward compatibility between the kernel and iproute2 is preserved.
Signed-off-by: David Wilder wilder@us.ibm.com --- drivers/net/bonding/bond_netlink.c | 34 ++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-)
diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c index 15782745fa4d..ba6a48901255 100644 --- a/drivers/net/bonding/bond_netlink.c +++ b/drivers/net/bonding/bond_netlink.c @@ -16,6 +16,11 @@ #include <net/bonding.h> #include <net/ipv6.h>
+struct bond_arp_ip_target_payload { + __be32 addr; + struct bond_vlan_tag vlans[BOND_MAX_VLAN_TAGS + 1]; +} __packed; + static size_t bond_get_slave_size(const struct net_device *bond_dev, const struct net_device *slave_dev) { @@ -626,7 +631,7 @@ static size_t bond_get_size(const struct net_device *bond_dev) nla_total_size(sizeof(u32)) + /* IFLA_BOND_ARP_INTERVAL */ /* IFLA_BOND_ARP_IP_TARGET */ nla_total_size(sizeof(struct nlattr)) + - nla_total_size(sizeof(u32)) * BOND_MAX_ARP_TARGETS + + nla_total_size(sizeof(struct bond_arp_ip_target_payload)) * BOND_MAX_ARP_TARGETS + nla_total_size(sizeof(u32)) + /* IFLA_BOND_ARP_VALIDATE */ nla_total_size(sizeof(u32)) + /* IFLA_BOND_ARP_ALL_TARGETS */ nla_total_size(sizeof(u32)) + /* IFLA_BOND_PRIMARY */ @@ -678,6 +683,7 @@ static int bond_fill_info(struct sk_buff *skb, const struct net_device *bond_dev) { struct bonding *bond = netdev_priv(bond_dev); + struct bond_arp_target *arptargets; unsigned int packets_per_slave; int ifindex, i, targets_added; struct nlattr *targets; @@ -716,12 +722,28 @@ static int bond_fill_info(struct sk_buff *skb, goto nla_put_failure;
targets_added = 0; - for (i = 0; i < BOND_MAX_ARP_TARGETS; i++) { - if (bond->params.arp_targets[i].target_ip) { - if (nla_put_be32(skb, i, bond->params.arp_targets[i].target_ip)) - goto nla_put_failure; - targets_added = 1; + + arptargets = bond->params.arp_targets; + for (i = 0; i < BOND_MAX_ARP_TARGETS && arptargets[i].target_ip ; i++) { + struct bond_arp_ip_target_payload data = {}; + int level, size; + + data.addr = arptargets[i].target_ip; + size = sizeof(__be32); + targets_added = 1; + + if (arptargets[i].flags & BOND_TARGET_USERTAGS) { + for (level = 0; level < BOND_MAX_VLAN_TAGS + 1 ; level++) { + data.vlans[level].vlan_proto = arptargets[i].tags[level].vlan_proto; + data.vlans[level].vlan_id = arptargets[i].tags[level].vlan_id; + size = size + sizeof(struct bond_vlan_tag); + if (arptargets[i].tags[level].vlan_proto == BOND_VLAN_PROTO_NONE) + break; + } } + + if (nla_put(skb, i, size, &data)) + goto nla_put_failure; }
if (targets_added)