Commit 744ee140 authored by Matthieu Baerts's avatar Matthieu Baerts Committed by Jakub Kicinski
Browse files

mptcp: restrict values of 'enabled' sysctl



To avoid confusions, it seems better to parse this sysctl parameter as a
boolean. We use it as a boolean, no need to parse an integer and bring
confusions if we see a value different from 0 and 1, especially with
this parameter name: enabled.

It seems fine to do this modification because the default value is 1
(enabled). Then the only other interesting value to set is 0 (disabled).
All other values would not have changed the default behaviour.

Suggested-by: default avatarFlorian Westphal <fw@strlen.de>
Acked-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 804c72ee
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -7,13 +7,13 @@ MPTCP Sysfs variables
/proc/sys/net/mptcp/* Variables
===============================

enabled - INTEGER
enabled - BOOLEAN
	Control whether MPTCP sockets can be created.

	MPTCP sockets can be created if the value is nonzero. This is
	a per-namespace sysctl.
	MPTCP sockets can be created if the value is 1. This is a
	per-namespace sysctl.

	Default: 1
	Default: 1 (enabled)

add_addr_timeout - INTEGER (seconds)
	Set the timeout after which an ADD_ADDR control message will be
+5 −3
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ struct mptcp_pernet {
	struct ctl_table_header *ctl_table_hdr;
#endif

	int mptcp_enabled;
	u8 mptcp_enabled;
	unsigned int add_addr_timeout;
};

@@ -50,12 +50,14 @@ static void mptcp_pernet_set_defaults(struct mptcp_pernet *pernet)
static struct ctl_table mptcp_sysctl_table[] = {
	{
		.procname = "enabled",
		.maxlen = sizeof(int),
		.maxlen = sizeof(u8),
		.mode = 0644,
		/* users with CAP_NET_ADMIN or root (not and) can change this
		 * value, same as other sysctl or the 'net' tree.
		 */
		.proc_handler = proc_dointvec,
		.proc_handler = proc_dou8vec_minmax,
		.extra1       = SYSCTL_ZERO,
		.extra2       = SYSCTL_ONE
	},
	{
		.procname = "add_addr_timeout",