bpfilter: fix building without CONFIG_INET
Subsystems (2)
PATCH 1/1 bpfilter: fix building without CONFIG_INET
bpfilter_process_sockopt is a callback that gets called from ip_setsockopt() and ip_getsockopt(). However, when CONFIG_INET is disabled, it never gets called at all, and assigning a function to the callback pointer results in a link failure:
net/bpfilter/bpfilter_kern.o: In function `__stop_umh':
bpfilter_kern.c:(.text.unlikely+0x3): undefined reference to bpfilter_process_sockopt' net/bpfilter/bpfilter_kern.o: In function load_umh':
bpfilter_kern.c:(.init.text+0x73): undefined reference to `bpfilter_process_sockopt'
Since there is no caller in this configuration, I assume we can simply make the assignment conditional.
---
This happened on last week's linux-next tree. Since there hasn't been an update since, it's possible that this is fixed in another tree already.
--- net/bpfilter/bpfilter_kern.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/bpfilter/bpfilter_kern.c +5 -2
@@ -33,7 +33,8 @@ static void shutdown_umh(struct umh_info *info)static void __stop_umh (void ) { -if (bpfilter_process_sockopt) { +if (IS_ENABLED (CONFIG_INET ) && + bpfilter_process_sockopt) { bpfilter_process_sockopt =NULL ;shutdown_umh (&info); }
@@ -98,7 +99,9 @@ static int __init load_umh(void)stop_umh ();return -EFAULT ; } - bpfilter_process_sockopt = &__bpfilter_process_sockopt; +if (IS_ENABLED (CONFIG_INET )) + bpfilter_process_sockopt = &__bpfilter_process_sockopt; +return 0 ; }
Signature · 1 line
2.9.0
From: Arnd Bergmann <[email protected]>
Date: Tue, 29 May 2018 11:55:06 +0200
Quoted 10 lines
bpfilter_process_sockoptis a callback that gets called fromip_setsockopt()andip_getsockopt(). However, whenCONFIG_INETis disabled, it never gets called at all, and assigning a function to the callback pointer results in a link failure:
net/bpfilter/bpfilter_kern.o: In function `__stop_umh':
bpfilter_kern.c:(.text.unlikely+0x3): undefined reference tobpfilter_process_sockopt' net/bpfilter/bpfilter_kern.o: In functionload_umh':
bpfilter_kern.c:(.init.text+0x73): undefined reference to `bpfilter_process_sockopt'
Quoted 4 lines
Since there is no caller in this configuration, I assume we can simply make the assignment conditional.
Signed-off-by Arnd Bergmann <[email protected]>
Applied, thanks Arnd.