From 1e0ee5aa53be2e57ffe5f71b0f7eb0bea41d74ed Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Thu, 22 May 2003 09:53:37 -0700 Subject: [TIMERS]: No more SMP_TIMER_* users, kill it. --- include/linux/interrupt.h | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'include/linux') diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 503c72da8c47..da2eaeb18118 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -213,24 +213,6 @@ extern void tasklet_kill(struct tasklet_struct *t); extern void tasklet_init(struct tasklet_struct *t, void (*func)(unsigned long), unsigned long data); -#ifdef CONFIG_SMP - -#define SMP_TIMER_NAME(name) name##__thr - -#define SMP_TIMER_DEFINE(name, task) \ -DECLARE_TASKLET(task, name##__thr, 0); \ -static void name (unsigned long dummy) \ -{ \ - tasklet_schedule(&(task)); \ -} - -#else /* CONFIG_SMP */ - -#define SMP_TIMER_NAME(name) name -#define SMP_TIMER_DEFINE(name, task) - -#endif /* CONFIG_SMP */ - /* * Autoprobing for irqs: * -- cgit v1.2.3 From 59d0eec5af1b868972718bab5a0604a29b2d92d5 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 22 May 2003 10:53:52 -0700 Subject: [NETFILTER]: Make nat helper modules use symbols to force conntrack modules. NAT helpers almost always require the matching conntrack helper to work at all: this should be forced at load time, rather than at runtime (which only works via kmod, and is icky). Convenient macros allow this. --- include/linux/netfilter_ipv4/ip_conntrack.h | 12 +++++++ include/linux/netfilter_ipv4/ip_nat_helper.h | 3 +- net/ipv4/netfilter/ip_conntrack_amanda.c | 1 + net/ipv4/netfilter/ip_conntrack_ftp.c | 1 + net/ipv4/netfilter/ip_conntrack_irc.c | 1 + net/ipv4/netfilter/ip_conntrack_tftp.c | 2 ++ net/ipv4/netfilter/ip_nat_amanda.c | 2 +- net/ipv4/netfilter/ip_nat_ftp.c | 2 ++ net/ipv4/netfilter/ip_nat_helper.c | 53 ---------------------------- net/ipv4/netfilter/ip_nat_irc.c | 1 + net/ipv4/netfilter/ip_nat_snmp_basic.c | 4 +-- 11 files changed, 24 insertions(+), 58 deletions(-) (limited to 'include/linux') diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h index 1dc2e0d5ce5e..44daac8cde2a 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack.h +++ b/include/linux/netfilter_ipv4/ip_conntrack.h @@ -7,6 +7,7 @@ #include #include #include +#include #include enum ip_conntrack_info @@ -266,5 +267,16 @@ static inline int is_confirmed(struct ip_conntrack *ct) } extern unsigned int ip_conntrack_htable_size; + +/* eg. PROVIDES_CONNTRACK(ftp); */ +#define PROVIDES_CONNTRACK(name) \ + int needs_ip_conntrack_##name; \ + EXPORT_SYMBOL(needs_ip_conntrack_##name) + +/*. eg. NEEDS_CONNTRACK(ftp); */ +#define NEEDS_CONNTRACK(name) \ + extern int needs_ip_conntrack_##name; \ + static int *need_ip_conntrack_##name __attribute_used__ = &needs_ip_conntrack_##name + #endif /* __KERNEL__ */ #endif /* _IP_CONNTRACK_H */ diff --git a/include/linux/netfilter_ipv4/ip_nat_helper.h b/include/linux/netfilter_ipv4/ip_nat_helper.h index 633a9c37170d..185a24a6a047 100644 --- a/include/linux/netfilter_ipv4/ip_nat_helper.h +++ b/include/linux/netfilter_ipv4/ip_nat_helper.h @@ -3,14 +3,13 @@ /* NAT protocol helper routines. */ #include +#include struct sk_buff; /* Flags */ /* NAT helper must be called on every packet (for TCP) */ #define IP_NAT_HELPER_F_ALWAYS 0x01 -/* Standalone NAT helper, without a conntrack part */ -#define IP_NAT_HELPER_F_STANDALONE 0x02 struct ip_nat_helper { diff --git a/net/ipv4/netfilter/ip_conntrack_amanda.c b/net/ipv4/netfilter/ip_conntrack_amanda.c index 4ab6a5fa6ca9..9c30e71d56f6 100644 --- a/net/ipv4/netfilter/ip_conntrack_amanda.c +++ b/net/ipv4/netfilter/ip_conntrack_amanda.c @@ -207,6 +207,7 @@ static int __init init(void) return 0; } +PROVIDES_CONNTRACK(amanda); EXPORT_SYMBOL(ip_amanda_lock); module_init(init); diff --git a/net/ipv4/netfilter/ip_conntrack_ftp.c b/net/ipv4/netfilter/ip_conntrack_ftp.c index 9a0fca610442..2109464dd0bf 100644 --- a/net/ipv4/netfilter/ip_conntrack_ftp.c +++ b/net/ipv4/netfilter/ip_conntrack_ftp.c @@ -437,6 +437,7 @@ static int __init init(void) return 0; } +PROVIDES_CONNTRACK(ftp); EXPORT_SYMBOL(ip_ftp_lock); MODULE_LICENSE("GPL"); diff --git a/net/ipv4/netfilter/ip_conntrack_irc.c b/net/ipv4/netfilter/ip_conntrack_irc.c index f75422bdfbbf..6f4ea9db1217 100644 --- a/net/ipv4/netfilter/ip_conntrack_irc.c +++ b/net/ipv4/netfilter/ip_conntrack_irc.c @@ -289,6 +289,7 @@ static void fini(void) } } +PROVIDES_CONNTRACK(irc); EXPORT_SYMBOL(ip_irc_lock); module_init(init); diff --git a/net/ipv4/netfilter/ip_conntrack_tftp.c b/net/ipv4/netfilter/ip_conntrack_tftp.c index 2bd9c4b1dea3..8a7e1711d14f 100644 --- a/net/ipv4/netfilter/ip_conntrack_tftp.c +++ b/net/ipv4/netfilter/ip_conntrack_tftp.c @@ -130,5 +130,7 @@ static int __init init(void) return(0); } +PROVIDES_CONNTRACK(tftp); + module_init(init); module_exit(fini); diff --git a/net/ipv4/netfilter/ip_nat_amanda.c b/net/ipv4/netfilter/ip_nat_amanda.c index d3e9ccb80641..4cc24ad19c5d 100644 --- a/net/ipv4/netfilter/ip_nat_amanda.c +++ b/net/ipv4/netfilter/ip_nat_amanda.c @@ -221,6 +221,6 @@ static int __init init(void) return ret; } - +NEEDS_CONNTRACK(amanda); module_init(init); module_exit(fini); diff --git a/net/ipv4/netfilter/ip_nat_ftp.c b/net/ipv4/netfilter/ip_nat_ftp.c index d232a72f8f00..b14459eb71a5 100644 --- a/net/ipv4/netfilter/ip_nat_ftp.c +++ b/net/ipv4/netfilter/ip_nat_ftp.c @@ -341,6 +341,8 @@ static int __init init(void) return ret; } +NEEDS_CONNTRACK(ftp); + module_init(init); module_exit(fini); MODULE_LICENSE("GPL"); diff --git a/net/ipv4/netfilter/ip_nat_helper.c b/net/ipv4/netfilter/ip_nat_helper.c index 173294f34473..bea707e946e3 100644 --- a/net/ipv4/netfilter/ip_nat_helper.c +++ b/net/ipv4/netfilter/ip_nat_helper.c @@ -404,44 +404,6 @@ int ip_nat_helper_register(struct ip_nat_helper *me) { int ret = 0; - if (me->me && !(me->flags & IP_NAT_HELPER_F_STANDALONE)) { - struct ip_conntrack_helper *ct_helper; - - if ((ct_helper = ip_ct_find_helper(&me->tuple))) { - if (!try_module_get(ct_helper->me)) - return -EBUSY; - } else { - /* We are a NAT helper for protocol X. If we need - * respective conntrack helper for protoccol X, compute - * conntrack helper name and try to load module */ - char name[MODULE_NAME_LEN]; - const char *tmp = module_name(me->me); - - if (strlen(tmp) + 6 > MODULE_NAME_LEN) { - printk("%s: unable to " - "compute conntrack helper name " - "from %s\n", __FUNCTION__, tmp); - return -EBUSY; - } - tmp += 6; - sprintf(name, "ip_conntrack%s", tmp); -#ifdef CONFIG_KMOD - if (!request_module("ip_conntrack%s", tmp) - && (ct_helper = ip_ct_find_helper(&me->tuple))) { - if (!try_module_get(ct_helper->me)) - return -EBUSY; - } else { - printk("unable to load module %s\n", name); - return -EBUSY; - } -#else - printk("unable to load module %s automatically " - "because kernel was compiled without kernel " - "module loader support\n", name); - return -EBUSY; -#endif - } - } WRITE_LOCK(&ip_nat_lock); if (LIST_FIND(&helpers, helper_cmp, struct ip_nat_helper *,&me->tuple)) ret = -EBUSY; @@ -484,19 +446,4 @@ void ip_nat_helper_unregister(struct ip_nat_helper *me) which is just a long-winded way of making things worse. --RR */ ip_ct_selective_cleanup(kill_helper, me); - - /* If we are no standalone NAT helper, we need to decrement usage count - * on our conntrack helper */ - if (me->me && !(me->flags & IP_NAT_HELPER_F_STANDALONE)) { - struct ip_conntrack_helper *ct_helper; - - if ((ct_helper = ip_ct_find_helper(&me->tuple))) - module_put(ct_helper->me); -#ifdef CONFIG_MODULES - else - printk("%s: unable to decrement usage count" - " of conntrack helper %s\n", - __FUNCTION__, me->me->name); -#endif - } } diff --git a/net/ipv4/netfilter/ip_nat_irc.c b/net/ipv4/netfilter/ip_nat_irc.c index 50d0ec8d82f0..666a661f4932 100644 --- a/net/ipv4/netfilter/ip_nat_irc.c +++ b/net/ipv4/netfilter/ip_nat_irc.c @@ -279,6 +279,7 @@ static int __init init(void) return ret; } +NEEDS_CONNTRACK(irc); module_init(init); module_exit(fini); diff --git a/net/ipv4/netfilter/ip_nat_snmp_basic.c b/net/ipv4/netfilter/ip_nat_snmp_basic.c index 5e99951afa67..d5587b0863fb 100644 --- a/net/ipv4/netfilter/ip_nat_snmp_basic.c +++ b/net/ipv4/netfilter/ip_nat_snmp_basic.c @@ -1306,7 +1306,7 @@ static unsigned int nat_help(struct ip_conntrack *ct, static struct ip_nat_helper snmp = { { NULL, NULL }, "snmp", - IP_NAT_HELPER_F_STANDALONE, + 0, THIS_MODULE, { { 0, { __constant_htons(SNMP_PORT) } }, { 0, { 0 }, IPPROTO_UDP } }, @@ -1317,7 +1317,7 @@ static struct ip_nat_helper snmp = { static struct ip_nat_helper snmp_trap = { { NULL, NULL }, "snmp_trap", - IP_NAT_HELPER_F_STANDALONE, + 0, THIS_MODULE, { { 0, { __constant_htons(SNMP_TRAP_PORT) } }, { 0, { 0 }, IPPROTO_UDP } }, -- cgit v1.2.3