From c96845a3119d3c326ba0a878ff3092f53e38d403 Mon Sep 17 00:00:00 2001 From: Peter Volkov Date: Fri, 19 Feb 2010 14:46:17 +0300 Subject: [PATCH] SYSRQ: make IPv6 optional In case the kernel is built without IPv6 support the compilation of this module fails as it assumes IPv6. This patch makes kernel support conditional on kernel .config. --- extensions/xt_SYSRQ.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/extensions/xt_SYSRQ.c b/extensions/xt_SYSRQ.c index 3cd223b..95c1184 100644 --- a/extensions/xt_SYSRQ.c +++ b/extensions/xt_SYSRQ.c @@ -23,6 +23,10 @@ #include #include "compat_xtables.h" +#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) +# define WITH_IPV6 1 +#endif + static bool sysrq_once; static char sysrq_password[64]; static char sysrq_hash[16] = "sha1"; @@ -214,6 +218,7 @@ sysrq_tg4(struct sk_buff **pskb, const struct xt_target_param *par) return sysrq_tg((void *)udph + sizeof(struct udphdr), len); } +#ifdef WITH_IPV6 static unsigned int sysrq_tg6(struct sk_buff **pskb, const struct xt_target_param *par) { @@ -242,6 +247,7 @@ sysrq_tg6(struct sk_buff **pskb, const struct xt_target_param *par) ntohs(udph->dest), len); return sysrq_tg(udph + sizeof(struct udphdr), len); } +#endif static bool sysrq_tg_check(const struct xt_tgchk_param *par) { @@ -278,6 +284,7 @@ static struct xt_target sysrq_tg_reg[] __read_mostly = { .checkentry = sysrq_tg_check, .me = THIS_MODULE, }, +#ifdef WITH_IPV6 { .name = "SYSRQ", .revision = 1, @@ -286,6 +293,7 @@ static struct xt_target sysrq_tg_reg[] __read_mostly = { .checkentry = sysrq_tg_check, .me = THIS_MODULE, }, +#endif }; static int __init sysrq_tg_init(void)