Skip to content

Commit 11707d8

Browse files
Geliang Tangintel-lab-lkp
authored andcommitted
mptcp: sysctl: map path_manager to pm_type
This patch maps the newly added path manager sysctl "path_manager" to the old one "pm_type". path_manager pm_type "kernel" -> MPTCP_PM_TYPE_KERNEL "userspace" -> MPTCP_PM_TYPE_USERSPACE others -> __MPTCP_PM_TYPE_NR Signed-off-by: Geliang Tang <[email protected]>
1 parent e293102 commit 11707d8

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

net/mptcp/ctrl.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ static int mptcp_set_path_manager(char *path_manager, const char *name)
200200
static int proc_path_manager(const struct ctl_table *ctl, int write,
201201
void *buffer, size_t *lenp, loff_t *ppos)
202202
{
203+
struct mptcp_pernet *pernet = container_of(ctl->data,
204+
struct mptcp_pernet,
205+
path_manager);
203206
char (*path_manager)[MPTCP_PM_NAME_MAX] = ctl->data;
204207
char pm_name[MPTCP_PM_NAME_MAX];
205208
const struct ctl_table tbl = {
@@ -211,8 +214,16 @@ static int proc_path_manager(const struct ctl_table *ctl, int write,
211214
strscpy(pm_name, *path_manager, MPTCP_PM_NAME_MAX);
212215

213216
ret = proc_dostring(&tbl, write, buffer, lenp, ppos);
214-
if (write && ret == 0)
217+
if (write && ret == 0) {
218+
u8 pm_type = __MPTCP_PM_TYPE_NR;
219+
220+
if (strncmp(pm_name, "kernel", MPTCP_PM_NAME_MAX) == 0)
221+
pm_type = MPTCP_PM_TYPE_KERNEL;
222+
else if (strncmp(pm_name, "userspace", MPTCP_PM_NAME_MAX) == 0)
223+
pm_type = MPTCP_PM_TYPE_USERSPACE;
224+
pernet->pm_type = pm_type;
215225
ret = mptcp_set_path_manager(*path_manager, pm_name);
226+
}
216227

217228
return ret;
218229
}

0 commit comments

Comments
 (0)