mptcp: allow privileged operations from user namespaces
GENL_ADMIN_PERM checks that the user has CAP_NET_ADMIN in the initial namespace by calling netlink_capable(). Instead, use GENL_UNS_ADMIN_PERM which uses netlink_ns_capable(). This checks that the caller has CAP_NET_ADMIN in the current user namespace. See also commit4a92602aa1
("openvswitch: allow management from inside user namespaces") which introduced this mechanism. See also commit5617c6cd6f
("nl80211: Allow privileged operations from user namespaces") which introduced this for nl80211. Signed-off-by: Thomas Haller <thaller@redhat.com> Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
Родитель
0522b424c4
Коммит
d156971854
|
@ -2218,17 +2218,17 @@ static const struct genl_small_ops mptcp_pm_ops[] = {
|
||||||
{
|
{
|
||||||
.cmd = MPTCP_PM_CMD_ADD_ADDR,
|
.cmd = MPTCP_PM_CMD_ADD_ADDR,
|
||||||
.doit = mptcp_nl_cmd_add_addr,
|
.doit = mptcp_nl_cmd_add_addr,
|
||||||
.flags = GENL_ADMIN_PERM,
|
.flags = GENL_UNS_ADMIN_PERM,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = MPTCP_PM_CMD_DEL_ADDR,
|
.cmd = MPTCP_PM_CMD_DEL_ADDR,
|
||||||
.doit = mptcp_nl_cmd_del_addr,
|
.doit = mptcp_nl_cmd_del_addr,
|
||||||
.flags = GENL_ADMIN_PERM,
|
.flags = GENL_UNS_ADMIN_PERM,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = MPTCP_PM_CMD_FLUSH_ADDRS,
|
.cmd = MPTCP_PM_CMD_FLUSH_ADDRS,
|
||||||
.doit = mptcp_nl_cmd_flush_addrs,
|
.doit = mptcp_nl_cmd_flush_addrs,
|
||||||
.flags = GENL_ADMIN_PERM,
|
.flags = GENL_UNS_ADMIN_PERM,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = MPTCP_PM_CMD_GET_ADDR,
|
.cmd = MPTCP_PM_CMD_GET_ADDR,
|
||||||
|
@ -2238,7 +2238,7 @@ static const struct genl_small_ops mptcp_pm_ops[] = {
|
||||||
{
|
{
|
||||||
.cmd = MPTCP_PM_CMD_SET_LIMITS,
|
.cmd = MPTCP_PM_CMD_SET_LIMITS,
|
||||||
.doit = mptcp_nl_cmd_set_limits,
|
.doit = mptcp_nl_cmd_set_limits,
|
||||||
.flags = GENL_ADMIN_PERM,
|
.flags = GENL_UNS_ADMIN_PERM,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = MPTCP_PM_CMD_GET_LIMITS,
|
.cmd = MPTCP_PM_CMD_GET_LIMITS,
|
||||||
|
@ -2247,27 +2247,27 @@ static const struct genl_small_ops mptcp_pm_ops[] = {
|
||||||
{
|
{
|
||||||
.cmd = MPTCP_PM_CMD_SET_FLAGS,
|
.cmd = MPTCP_PM_CMD_SET_FLAGS,
|
||||||
.doit = mptcp_nl_cmd_set_flags,
|
.doit = mptcp_nl_cmd_set_flags,
|
||||||
.flags = GENL_ADMIN_PERM,
|
.flags = GENL_UNS_ADMIN_PERM,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = MPTCP_PM_CMD_ANNOUNCE,
|
.cmd = MPTCP_PM_CMD_ANNOUNCE,
|
||||||
.doit = mptcp_nl_cmd_announce,
|
.doit = mptcp_nl_cmd_announce,
|
||||||
.flags = GENL_ADMIN_PERM,
|
.flags = GENL_UNS_ADMIN_PERM,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = MPTCP_PM_CMD_REMOVE,
|
.cmd = MPTCP_PM_CMD_REMOVE,
|
||||||
.doit = mptcp_nl_cmd_remove,
|
.doit = mptcp_nl_cmd_remove,
|
||||||
.flags = GENL_ADMIN_PERM,
|
.flags = GENL_UNS_ADMIN_PERM,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = MPTCP_PM_CMD_SUBFLOW_CREATE,
|
.cmd = MPTCP_PM_CMD_SUBFLOW_CREATE,
|
||||||
.doit = mptcp_nl_cmd_sf_create,
|
.doit = mptcp_nl_cmd_sf_create,
|
||||||
.flags = GENL_ADMIN_PERM,
|
.flags = GENL_UNS_ADMIN_PERM,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = MPTCP_PM_CMD_SUBFLOW_DESTROY,
|
.cmd = MPTCP_PM_CMD_SUBFLOW_DESTROY,
|
||||||
.doit = mptcp_nl_cmd_sf_destroy,
|
.doit = mptcp_nl_cmd_sf_destroy,
|
||||||
.flags = GENL_ADMIN_PERM,
|
.flags = GENL_UNS_ADMIN_PERM,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче