From: Jan Engelhardt Date: Sun, 22 Nov 2020 16:45:37 +0000 (+0100) Subject: build: cure overall build failure when CONFIG_NF_NAT=n X-Git-Tag: v3.14~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a35feefa0f0d7080a0d1fc91bec495d6973c3e30;p=thirdparty%2Fxtables-addons.git build: cure overall build failure when CONFIG_NF_NAT=n --- diff --git a/extensions/xt_DNETMAP.c b/extensions/xt_DNETMAP.c index e3114d9..b850918 100644 --- a/extensions/xt_DNETMAP.c +++ b/extensions/xt_DNETMAP.c @@ -19,9 +19,10 @@ */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include +#ifdef CONFIG_NF_NAT #include #include -#include #include #include #include @@ -36,12 +37,6 @@ #include "compat_xtables.h" #include "xt_DNETMAP.h" -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Marek Kierdelewicz "); -MODULE_DESCRIPTION( - "Xtables: dynamic two-way 1:1 NAT mapping of IPv4 addresses"); -MODULE_ALIAS("ipt_DNETMAP"); - static unsigned int default_ttl = 600; static unsigned int proc_perms = S_IRUGO | S_IWUSR; static unsigned int proc_uid; @@ -921,6 +916,18 @@ static void __exit dnetmap_tg_exit(void) xt_unregister_target(&dnetmap_tg_reg); unregister_pernet_subsys(&dnetmap_net_ops); } +#else /* CONFIG_NF_NAT */ +static int __init dnetmap_tg_init(void) +{ + pr_err("CONFIG_NF_NAT is not available in your kernel, hence this module cannot function."); + return -EINVAL; +} +static void __exit dnetmap_tg_exit(void) {} +#endif module_init(dnetmap_tg_init); module_exit(dnetmap_tg_exit); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Marek Kierdelewicz "); +MODULE_DESCRIPTION("Xtables: dynamic two-way 1:1 NAT mapping of IPv4 addresses"); +MODULE_ALIAS("ipt_DNETMAP");