]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
bareudp: use ipv6_mod_enabled to check if IPv6 enabled
authorHangbin Liu <liuhangbin@gmail.com>
Tue, 15 Mar 2022 06:26:18 +0000 (14:26 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 20 May 2022 12:39:13 +0000 (14:39 +0200)
commit6836ec7cdc13da5fcdf5a35b41120526d5220d54
tree4bc13d0d5eb0b4debe8983d81c4c94554b9b403a
parent36104d778a7cecb6b09b3505a6d86044bb8ac8b2
bareudp: use ipv6_mod_enabled to check if IPv6 enabled

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit e077ed58c243afc197bc2a2ba0e1ff61135e4ec2 ]

bareudp_create_sock() use AF_INET6 by default if IPv6 CONFIG enabled.
But if user start kernel with ipv6.disable=1, the bareudp sock will
created failed, which cause the interface open failed even with ethertype
ip. e.g.

 # ip link add bareudp1 type bareudp dstport 2 ethertype ip
 # ip link set bareudp1 up
 RTNETLINK answers: Address family not supported by protocol

Fix it by using ipv6_mod_enabled() to check if IPv6 enabled. There is
no need to check IS_ENABLED(CONFIG_IPV6) as ipv6_mod_enabled() will
return false when CONFIG_IPV6 no enabled in include/linux/ipv6.h.

Reported-by: Jianlin Shi <jishi@redhat.com>
Fixes: 571912c69f0e ("net: UDP tunnel encapsulation module for tunnelling different protocols like MPLS, IP, NSH etc.")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Link: https://lore.kernel.org/r/20220315062618.156230-1-liuhangbin@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 3f798111077a0890126af595daf9b81528ffda8a)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/net/bareudp.c