linux-stable/net/batman-adv
Linus Lüssing c7e4004b38 batman-adv: allow netlink usage in unprivileged containers
[ Upstream commit 9057d6c23e ]

Currently, creating a batman-adv interface in an unprivileged LXD
container and attaching secondary interfaces to it with "ip" or "batctl"
works fine. However all batctl debug and configuration commands
fail:

  root@container:~# batctl originators
  Error received: Operation not permitted
  root@container:~# batctl orig_interval
  1000
  root@container:~# batctl orig_interval 2000
  root@container:~# batctl orig_interval
  1000

To fix this change the generic netlink permissions from GENL_ADMIN_PERM
to GENL_UNS_ADMIN_PERM. This way a batman-adv interface is fully
maintainable as root from within a user namespace, from an unprivileged
container.

All except one batman-adv netlink setting are per interface and do not
leak information or change settings from the host system and are
therefore save to retrieve or modify as root from within an unprivileged
container.

"batctl routing_algo" / BATADV_CMD_GET_ROUTING_ALGOS is the only
exception: It provides the batman-adv kernel module wide default routing
algorithm. However it is read-only from netlink and an unprivileged
container is still not allowed to modify
/sys/module/batman_adv/parameters/routing_algo. Instead it is advised to
use the newly introduced "batctl if create routing_algo RA_NAME" /
IFLA_BATADV_ALGO_NAME to set the routing algorithm on interface
creation, which already works fine in an unprivileged container.

Cc: Tycho Andersen <tycho@tycho.pizza>
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-01-27 09:19:41 +01:00
..
Kconfig net: Fix Kconfig indentation 2019-09-26 08:56:17 +02:00
Makefile batman-adv: Make sysfs support optional 2019-03-25 10:01:11 +01:00
bat_algo.c batman-adv: Drop license boilerplate 2019-03-25 09:31:35 +01:00
bat_algo.h batman-adv: Use includes instead of fwdecls 2019-05-25 12:59:53 +02:00
bat_iv_ogm.c batman-adv: Avoid WARN_ON timing related checks 2021-06-23 14:41:23 +02:00
bat_iv_ogm.h batman-adv: Drop license boilerplate 2019-03-25 09:31:35 +01:00
bat_v.c batman-adv: BATMAN_V: introduce per hard-iface OGMv2 queues 2019-08-04 22:22:00 +02:00
bat_v.h batman-adv: Drop license boilerplate 2019-03-25 09:31:35 +01:00
bat_v_elp.c batman-adv: Revert "disable ethtool link speed detection when auto negotiation off" 2020-06-22 09:30:56 +02:00
bat_v_elp.h batman-adv: Use includes instead of fwdecls 2019-05-25 12:59:53 +02:00
bat_v_ogm.c batman-adv: Fix own OGM check in aggregated OGMs 2020-09-09 19:12:23 +02:00
bat_v_ogm.h batman-adv: BATMAN_V: introduce per hard-iface OGMv2 queues 2019-08-04 22:22:00 +02:00
bitarray.c batman-adv: Drop license boilerplate 2019-03-25 09:31:35 +01:00
bitarray.h batman-adv: Drop license boilerplate 2019-03-25 09:31:35 +01:00
bridge_loop_avoidance.c net: batman-adv: fix error handling 2021-11-02 19:46:14 +01:00
bridge_loop_avoidance.h batman-adv: mcast: fix duplicate mcast packets in BLA backbone from mesh 2020-10-01 13:18:19 +02:00
debugfs.c batman-adv: no need to check return value of debugfs_create functions 2019-06-27 19:25:04 +02:00
debugfs.h batman-adv: no need to check return value of debugfs_create functions 2019-06-27 19:25:04 +02:00
distributed-arp-table.c batman-adv: Fix DAT candidate selection on little endian systems 2020-01-23 08:22:49 +01:00
distributed-arp-table.h batman-adv: Use includes instead of fwdecls 2019-05-25 12:59:53 +02:00
fragmentation.c batman-adv: Don't always reallocate the fragmentation skb head 2021-11-26 10:47:22 +01:00
fragmentation.h batman-adv: Use includes instead of fwdecls 2019-05-25 12:59:53 +02:00
gateway_client.c batman-adv: Avoid uninitialized chaddr when handling DHCP 2020-09-09 19:12:23 +02:00
gateway_client.h batman-adv: Use includes instead of fwdecls 2019-05-25 12:59:53 +02:00
gateway_common.c batman-adv: Fix includes for *_MAX constants 2019-05-25 12:59:53 +02:00
gateway_common.h batman-adv: Use includes instead of fwdecls 2019-05-25 12:59:53 +02:00
hard-interface.c batman-adv: Consider fragmentation for needed_headroom 2021-11-26 10:47:22 +01:00
hard-interface.h batman-adv: Use includes instead of fwdecls 2019-05-25 12:59:53 +02:00
hash.c batman-adv: Drop license boilerplate 2019-03-25 09:31:35 +01:00
hash.h batman-adv: Use includes instead of fwdecls 2019-05-25 12:59:53 +02:00
icmp_socket.c batman-adv: no need to check return value of debugfs_create functions 2019-06-27 19:25:04 +02:00
icmp_socket.h batman-adv: no need to check return value of debugfs_create functions 2019-06-27 19:25:04 +02:00
log.c batman-adv: set .owner to THIS_MODULE 2020-12-02 08:49:50 +01:00
log.h batman-adv: Add missing include for atomic functions 2019-05-25 12:59:53 +02:00
main.c net: batman-adv: fix error handling 2021-11-02 19:46:14 +01:00
main.h batman-adv: Start new development cycle 2019-07-22 21:34:14 +02:00
multicast.c batman-adv: mcast: don't send link-local multicast to mcast routers 2022-01-11 15:23:32 +01:00
multicast.h batman-adv: mcast: don't send link-local multicast to mcast routers 2022-01-11 15:23:32 +01:00
netlink.c batman-adv: allow netlink usage in unprivileged containers 2022-01-27 09:19:41 +01:00
netlink.h batman-adv: Use includes instead of fwdecls 2019-05-25 12:59:53 +02:00
network-coding.c net: batman-adv: fix error handling 2021-11-02 19:46:14 +01:00
network-coding.h batman-adv: no need to check return value of debugfs_create functions 2019-06-27 19:25:04 +02:00
originator.c batman-adv: mcast: detect, distribute and maintain multicast router presence 2019-06-27 19:25:05 +02:00
originator.h batman-adv: Use includes instead of fwdecls 2019-05-25 12:59:53 +02:00
routing.c batman-adv: mcast/TT: fix wrongly dropped or rerouted packets 2020-10-01 13:18:17 +02:00
routing.h batman-adv: Use includes instead of fwdecls 2019-05-25 12:59:53 +02:00
send.c batman-adv: Drop license boilerplate 2019-03-25 09:31:35 +01:00
send.h batman-adv: Use includes instead of fwdecls 2019-05-25 12:59:53 +02:00
soft-interface.c batman-adv: mcast: don't send link-local multicast to mcast routers 2022-01-11 15:23:32 +01:00
soft-interface.h batman-adv: Use includes instead of fwdecls 2019-05-25 12:59:53 +02:00
sysfs.c batman-adv: Fix refcnt leak in batadv_store_throughput_override 2020-05-14 07:58:28 +02:00
sysfs.h batman-adv: Use includes instead of fwdecls 2019-05-25 12:59:53 +02:00
tp_meter.c batman-adv: Fix includes for *_MAX constants 2019-05-25 12:59:53 +02:00
tp_meter.h batman-adv: Use includes instead of fwdecls 2019-05-25 12:59:53 +02:00
trace.c batman-adv: Drop license boilerplate 2019-03-25 09:31:35 +01:00
trace.h batman-adv: Drop license boilerplate 2019-03-25 09:31:35 +01:00
translation-table.c net: batman-adv: fix error handling 2021-11-02 19:46:14 +01:00
translation-table.h batman-adv: Use includes instead of fwdecls 2019-05-25 12:59:53 +02:00
tvlv.c batman-adv: Drop license boilerplate 2019-03-25 09:31:35 +01:00
tvlv.h batman-adv: Use includes instead of fwdecls 2019-05-25 12:59:53 +02:00
types.h batman-adv: Avoid free/alloc race when handling OGM buffer 2019-10-13 21:00:07 +02:00