summaryrefslogtreecommitdiff
path: root/net/ipv6
diff options
context:
space:
mode:
authorIdo Schimmel <idosch@nvidia.com>2021-05-19 15:08:18 +0300
committerDavid S. Miller <davem@davemloft.net>2021-05-19 22:47:47 +0300
commiteb0e4d59b6edbe678ecfc5d5b77608b634057f08 (patch)
tree1aae634352e8eafd3f571a6dac294c583b102dec /net/ipv6
parent340f42f7ff0b87a92e69b50706a6c872da756c89 (diff)
downloadlinux-eb0e4d59b6edbe678ecfc5d5b77608b634057f08.tar.xz
net: Add notifications when multipath hash field change
In-kernel notifications are already sent when the multipath hash policy itself changes, but not when the multipath hash fields change. Add these notifications, so that interested listeners (e.g., switch ASIC drivers) could perform the necessary configuration. Signed-off-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: Petr Machata <petrm@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/sysctl_net_ipv6.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c
index 160bea5db973..d7cf26f730d7 100644
--- a/net/ipv6/sysctl_net_ipv6.c
+++ b/net/ipv6/sysctl_net_ipv6.c
@@ -44,6 +44,22 @@ static int proc_rt6_multipath_hash_policy(struct ctl_table *table, int write,
return ret;
}
+static int
+proc_rt6_multipath_hash_fields(struct ctl_table *table, int write, void *buffer,
+ size_t *lenp, loff_t *ppos)
+{
+ struct net *net;
+ int ret;
+
+ net = container_of(table->data, struct net,
+ ipv6.sysctl.multipath_hash_fields);
+ ret = proc_douintvec_minmax(table, write, buffer, lenp, ppos);
+ if (write && ret == 0)
+ call_netevent_notifiers(NETEVENT_IPV6_MPATH_HASH_UPDATE, net);
+
+ return ret;
+}
+
static struct ctl_table ipv6_table_template[] = {
{
.procname = "bindv6only",
@@ -160,7 +176,7 @@ static struct ctl_table ipv6_table_template[] = {
.data = &init_net.ipv6.sysctl.multipath_hash_fields,
.maxlen = sizeof(u32),
.mode = 0644,
- .proc_handler = proc_douintvec_minmax,
+ .proc_handler = proc_rt6_multipath_hash_fields,
.extra1 = SYSCTL_ONE,
.extra2 = &rt6_multipath_hash_fields_all_mask,
},