Restrict minimum and maximum values that are allowed to be set by the
administrator for force_mld_version into sysctl:
0 - No enforcement of any MLD version
1 - Enforce to use MLD version 1
2 - Enforce to use MLD version 2
Signed-off-by: Daniel Borkmann <redacted>
Cc: Hannes Frederic Sowa <redacted>
---
net/ipv6/addrconf.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index a7183fc..dde76d4 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -106,6 +106,9 @@
#define INFINITY_LIFE_TIME 0xFFFFFFFF
+static int zero = 0;
+static int two = 2;
+
static inline u32 cstamp_delta(unsigned long cstamp)
{
return (cstamp - INITIAL_JIFFIES) * 100UL / HZ;@@ -4842,7 +4845,9 @@ static struct addrconf_sysctl_table
.data = &ipv6_devconf.force_mld_version,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = &zero,
+ .extra2 = &two,
},
{
.procname = "mldv1_unsolicited_report_interval",--
1.7.11.7