diff options
| -rw-r--r-- | drivers/net/bonding/bond_netlink.c | 14 | ||||
| -rw-r--r-- | drivers/net/bonding/bond_options.c | 11 | ||||
| -rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 16 | ||||
| -rw-r--r-- | drivers/net/bonding/bonding.h | 1 | ||||
| -rw-r--r-- | include/uapi/linux/if_link.h | 1 |
5 files changed, 37 insertions, 6 deletions
diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c index 8588cb91caa9..d7d84db9eed7 100644 --- a/drivers/net/bonding/bond_netlink.c +++ b/drivers/net/bonding/bond_netlink.c | |||
| @@ -31,6 +31,7 @@ static const struct nla_policy bond_policy[IFLA_BOND_MAX + 1] = { | |||
| 31 | [IFLA_BOND_ARP_INTERVAL] = { .type = NLA_U32 }, | 31 | [IFLA_BOND_ARP_INTERVAL] = { .type = NLA_U32 }, |
| 32 | [IFLA_BOND_ARP_IP_TARGET] = { .type = NLA_NESTED }, | 32 | [IFLA_BOND_ARP_IP_TARGET] = { .type = NLA_NESTED }, |
| 33 | [IFLA_BOND_ARP_VALIDATE] = { .type = NLA_U32 }, | 33 | [IFLA_BOND_ARP_VALIDATE] = { .type = NLA_U32 }, |
| 34 | [IFLA_BOND_ARP_ALL_TARGETS] = { .type = NLA_U32 }, | ||
| 34 | }; | 35 | }; |
| 35 | 36 | ||
| 36 | static int bond_validate(struct nlattr *tb[], struct nlattr *data[]) | 37 | static int bond_validate(struct nlattr *tb[], struct nlattr *data[]) |
| @@ -145,6 +146,14 @@ static int bond_changelink(struct net_device *bond_dev, | |||
| 145 | if (err) | 146 | if (err) |
| 146 | return err; | 147 | return err; |
| 147 | } | 148 | } |
| 149 | if (data[IFLA_BOND_ARP_ALL_TARGETS]) { | ||
| 150 | int arp_all_targets = | ||
| 151 | nla_get_u32(data[IFLA_BOND_ARP_ALL_TARGETS]); | ||
| 152 | |||
| 153 | err = bond_option_arp_all_targets_set(bond, arp_all_targets); | ||
| 154 | if (err) | ||
| 155 | return err; | ||
| 156 | } | ||
| 148 | return 0; | 157 | return 0; |
| 149 | } | 158 | } |
| 150 | 159 | ||
| @@ -172,6 +181,7 @@ static size_t bond_get_size(const struct net_device *bond_dev) | |||
| 172 | /* IFLA_BOND_ARP_IP_TARGET */ | 181 | /* IFLA_BOND_ARP_IP_TARGET */ |
| 173 | nla_total_size(sizeof(u32)) * BOND_MAX_ARP_TARGETS + | 182 | nla_total_size(sizeof(u32)) * BOND_MAX_ARP_TARGETS + |
| 174 | nla_total_size(sizeof(u32)) + /* IFLA_BOND_ARP_VALIDATE */ | 183 | nla_total_size(sizeof(u32)) + /* IFLA_BOND_ARP_VALIDATE */ |
| 184 | nla_total_size(sizeof(u32)) + /* IFLA_BOND_ARP_ALL_TARGETS */ | ||
| 175 | 0; | 185 | 0; |
| 176 | } | 186 | } |
| 177 | 187 | ||
| @@ -227,6 +237,10 @@ static int bond_fill_info(struct sk_buff *skb, | |||
| 227 | if (nla_put_u32(skb, IFLA_BOND_ARP_VALIDATE, bond->params.arp_validate)) | 237 | if (nla_put_u32(skb, IFLA_BOND_ARP_VALIDATE, bond->params.arp_validate)) |
| 228 | goto nla_put_failure; | 238 | goto nla_put_failure; |
| 229 | 239 | ||
| 240 | if (nla_put_u32(skb, IFLA_BOND_ARP_ALL_TARGETS, | ||
| 241 | bond->params.arp_all_targets)) | ||
| 242 | goto nla_put_failure; | ||
| 243 | |||
| 230 | return 0; | 244 | return 0; |
| 231 | 245 | ||
| 232 | nla_put_failure: | 246 | nla_put_failure: |
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index 698079e94e74..dfef673d53d1 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c | |||
| @@ -458,3 +458,14 @@ int bond_option_arp_validate_set(struct bonding *bond, int arp_validate) | |||
| 458 | 458 | ||
| 459 | return 0; | 459 | return 0; |
| 460 | } | 460 | } |
| 461 | |||
| 462 | int bond_option_arp_all_targets_set(struct bonding *bond, int arp_all_targets) | ||
| 463 | { | ||
| 464 | pr_info("%s: setting arp_all_targets to %s (%d).\n", | ||
| 465 | bond->dev->name, arp_all_targets_tbl[arp_all_targets].modename, | ||
| 466 | arp_all_targets); | ||
| 467 | |||
| 468 | bond->params.arp_all_targets = arp_all_targets; | ||
| 469 | |||
| 470 | return 0; | ||
| 471 | } | ||
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index bda00a01393a..dad9bea95122 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
| @@ -399,7 +399,7 @@ static ssize_t bonding_store_arp_all_targets(struct device *d, | |||
| 399 | const char *buf, size_t count) | 399 | const char *buf, size_t count) |
| 400 | { | 400 | { |
| 401 | struct bonding *bond = to_bond(d); | 401 | struct bonding *bond = to_bond(d); |
| 402 | int new_value; | 402 | int new_value, ret; |
| 403 | 403 | ||
| 404 | new_value = bond_parse_parm(buf, arp_all_targets_tbl); | 404 | new_value = bond_parse_parm(buf, arp_all_targets_tbl); |
| 405 | if (new_value < 0) { | 405 | if (new_value < 0) { |
| @@ -407,13 +407,17 @@ static ssize_t bonding_store_arp_all_targets(struct device *d, | |||
| 407 | bond->dev->name, buf); | 407 | bond->dev->name, buf); |
| 408 | return -EINVAL; | 408 | return -EINVAL; |
| 409 | } | 409 | } |
| 410 | pr_info("%s: setting arp_all_targets to %s (%d).\n", | ||
| 411 | bond->dev->name, arp_all_targets_tbl[new_value].modename, | ||
| 412 | new_value); | ||
| 413 | 410 | ||
| 414 | bond->params.arp_all_targets = new_value; | 411 | if (!rtnl_trylock()) |
| 412 | return restart_syscall(); | ||
| 415 | 413 | ||
| 416 | return count; | 414 | ret = bond_option_arp_all_targets_set(bond, new_value); |
| 415 | if (!ret) | ||
| 416 | ret = count; | ||
| 417 | |||
| 418 | rtnl_unlock(); | ||
| 419 | |||
| 420 | return ret; | ||
| 417 | } | 421 | } |
| 418 | 422 | ||
| 419 | static DEVICE_ATTR(arp_all_targets, S_IRUGO | S_IWUSR, | 423 | static DEVICE_ATTR(arp_all_targets, S_IRUGO | S_IWUSR, |
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index cef10adac6e6..8283cbdec50a 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
| @@ -449,6 +449,7 @@ int bond_option_arp_ip_targets_set(struct bonding *bond, __be32 *targets, | |||
| 449 | int bond_option_arp_ip_target_add(struct bonding *bond, __be32 target); | 449 | int bond_option_arp_ip_target_add(struct bonding *bond, __be32 target); |
| 450 | int bond_option_arp_ip_target_rem(struct bonding *bond, __be32 target); | 450 | int bond_option_arp_ip_target_rem(struct bonding *bond, __be32 target); |
| 451 | int bond_option_arp_validate_set(struct bonding *bond, int arp_validate); | 451 | int bond_option_arp_validate_set(struct bonding *bond, int arp_validate); |
| 452 | int bond_option_arp_all_targets_set(struct bonding *bond, int arp_all_targets); | ||
| 452 | struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond); | 453 | struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond); |
| 453 | struct net_device *bond_option_active_slave_get(struct bonding *bond); | 454 | struct net_device *bond_option_active_slave_get(struct bonding *bond); |
| 454 | 455 | ||
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h index 3ba16fa9ad6c..a897b7e22541 100644 --- a/include/uapi/linux/if_link.h +++ b/include/uapi/linux/if_link.h | |||
| @@ -338,6 +338,7 @@ enum { | |||
| 338 | IFLA_BOND_ARP_INTERVAL, | 338 | IFLA_BOND_ARP_INTERVAL, |
| 339 | IFLA_BOND_ARP_IP_TARGET, | 339 | IFLA_BOND_ARP_IP_TARGET, |
| 340 | IFLA_BOND_ARP_VALIDATE, | 340 | IFLA_BOND_ARP_VALIDATE, |
| 341 | IFLA_BOND_ARP_ALL_TARGETS, | ||
| 341 | __IFLA_BOND_MAX, | 342 | __IFLA_BOND_MAX, |
| 342 | }; | 343 | }; |
| 343 | 344 | ||
