Commit 47a2527a authored by Harald Welte's avatar Harald Welte Committed by David S. Miller

[NETFILTER]: Forward port cosmetic fixes from 2.4.x

parent 54dd43a6
...@@ -19,9 +19,10 @@ ...@@ -19,9 +19,10 @@
#define NF_REPEAT 4 #define NF_REPEAT 4
#define NF_MAX_VERDICT NF_REPEAT #define NF_MAX_VERDICT NF_REPEAT
/* Generic cache responses from hook functions. */ /* Generic cache responses from hook functions.
#define NFC_ALTERED 0x8000 <= 0x2000 is used for protocol-flags. */
#define NFC_UNKNOWN 0x4000 #define NFC_UNKNOWN 0x4000
#define NFC_ALTERED 0x8000
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/config.h> #include <linux/config.h>
......
...@@ -258,9 +258,7 @@ static void remove_expectations(struct ip_conntrack *ct) ...@@ -258,9 +258,7 @@ static void remove_expectations(struct ip_conntrack *ct)
DEBUGP("remove_expectations(%p)\n", ct); DEBUGP("remove_expectations(%p)\n", ct);
for (exp_entry = ct->sibling_list.next; list_for_each_safe(exp_entry, next, &ct->sibling_list) {
exp_entry != &ct->sibling_list; exp_entry = next) {
next = exp_entry->next;
exp = list_entry(exp_entry, struct ip_conntrack_expect, exp = list_entry(exp_entry, struct ip_conntrack_expect,
expected_list); expected_list);
...@@ -307,7 +305,7 @@ destroy_conntrack(struct nf_conntrack *nfct) ...@@ -307,7 +305,7 @@ destroy_conntrack(struct nf_conntrack *nfct)
IP_NF_ASSERT(atomic_read(&nfct->use) == 0); IP_NF_ASSERT(atomic_read(&nfct->use) == 0);
IP_NF_ASSERT(!timer_pending(&ct->timeout)); IP_NF_ASSERT(!timer_pending(&ct->timeout));
if (ct->master && master_ct(ct)) if (master_ct(ct))
ip_conntrack_put(master_ct(ct)); ip_conntrack_put(master_ct(ct));
/* To make sure we don't get any weird locking issues here: /* To make sure we don't get any weird locking issues here:
...@@ -675,9 +673,6 @@ init_conntrack(const struct ip_conntrack_tuple *tuple, ...@@ -675,9 +673,6 @@ init_conntrack(const struct ip_conntrack_tuple *tuple,
INIT_LIST_HEAD(&conntrack->sibling_list); INIT_LIST_HEAD(&conntrack->sibling_list);
/* Mark clearly that it's not in the hash table. */
conntrack->tuplehash[IP_CT_DIR_ORIGINAL].list.next = NULL;
WRITE_LOCK(&ip_conntrack_lock); WRITE_LOCK(&ip_conntrack_lock);
/* Need finding and deleting of expected ONLY if we win race */ /* Need finding and deleting of expected ONLY if we win race */
READ_LOCK(&ip_conntrack_expect_tuple_lock); READ_LOCK(&ip_conntrack_expect_tuple_lock);
...@@ -1015,18 +1010,11 @@ int ip_conntrack_expect_related(struct ip_conntrack *related_to, ...@@ -1015,18 +1010,11 @@ int ip_conntrack_expect_related(struct ip_conntrack *related_to,
return -ENOMEM; return -ENOMEM;
} }
/* Zero out the new structure, then fill out it with the data */
DEBUGP("new expectation %p of conntrack %p\n", new, related_to); DEBUGP("new expectation %p of conntrack %p\n", new, related_to);
memset(new, 0, sizeof(*expect));
INIT_LIST_HEAD(&new->list);
INIT_LIST_HEAD(&new->expected_list);
memcpy(new, expect, sizeof(*expect)); memcpy(new, expect, sizeof(*expect));
new->expectant = related_to; new->expectant = related_to;
new->sibling = NULL; new->sibling = NULL;
/* increase usage count. This sucks. The memset above overwrites atomic_set(&new->use, 1);
* old usage count [if still present] and we increase to one. Only
* works because everything is done under ip_conntrack_lock() */
atomic_inc(&new->use);
/* add to expected list for this connection */ /* add to expected list for this connection */
list_add(&new->expected_list, &related_to->sibling_list); list_add(&new->expected_list, &related_to->sibling_list);
...@@ -1476,8 +1464,10 @@ int __init ip_conntrack_init(void) ...@@ -1476,8 +1464,10 @@ int __init ip_conntrack_init(void)
ip_ct_attach = ip_conntrack_attach; ip_ct_attach = ip_conntrack_attach;
return ret; return ret;
#ifdef CONFIG_SYSCTL
err_free_ct_cachep: err_free_ct_cachep:
kmem_cache_destroy(ip_conntrack_cachep); kmem_cache_destroy(ip_conntrack_cachep);
#endif /*CONFIG_SYSCTL*/
err_free_hash: err_free_hash:
vfree(ip_conntrack_hash); vfree(ip_conntrack_hash);
err_unreg_sockopt: err_unreg_sockopt:
......
...@@ -406,7 +406,6 @@ static int __init init(void) ...@@ -406,7 +406,6 @@ static int __init init(void)
ports[0] = FTP_PORT; ports[0] = FTP_PORT;
for (i = 0; (i < MAX_PORTS) && ports[i]; i++) { for (i = 0; (i < MAX_PORTS) && ports[i]; i++) {
memset(&ftp[i], 0, sizeof(struct ip_conntrack_helper));
ftp[i].tuple.src.u.tcp.port = htons(ports[i]); ftp[i].tuple.src.u.tcp.port = htons(ports[i]);
ftp[i].tuple.dst.protonum = IPPROTO_TCP; ftp[i].tuple.dst.protonum = IPPROTO_TCP;
ftp[i].mask.src.u.tcp.port = 0xFFFF; ftp[i].mask.src.u.tcp.port = 0xFFFF;
......
...@@ -243,8 +243,6 @@ static int __init init(void) ...@@ -243,8 +243,6 @@ static int __init init(void)
for (i = 0; (i < MAX_PORTS) && ports[i]; i++) { for (i = 0; (i < MAX_PORTS) && ports[i]; i++) {
hlpr = &irc_helpers[i]; hlpr = &irc_helpers[i];
memset(hlpr, 0,
sizeof(struct ip_conntrack_helper));
hlpr->tuple.src.u.tcp.port = htons(ports[i]); hlpr->tuple.src.u.tcp.port = htons(ports[i]);
hlpr->tuple.dst.protonum = IPPROTO_TCP; hlpr->tuple.dst.protonum = IPPROTO_TCP;
hlpr->mask.src.u.tcp.port = 0xFFFF; hlpr->mask.src.u.tcp.port = 0xFFFF;
......
...@@ -306,9 +306,6 @@ static int __init init(void) ...@@ -306,9 +306,6 @@ static int __init init(void)
ports[0] = FTP_PORT; ports[0] = FTP_PORT;
for (i = 0; (i < MAX_PORTS) && ports[i]; i++) { for (i = 0; (i < MAX_PORTS) && ports[i]; i++) {
memset(&ftp[i], 0, sizeof(struct ip_nat_helper));
ftp[i].tuple.dst.protonum = IPPROTO_TCP; ftp[i].tuple.dst.protonum = IPPROTO_TCP;
ftp[i].tuple.src.u.tcp.port = htons(ports[i]); ftp[i].tuple.src.u.tcp.port = htons(ports[i]);
ftp[i].mask.dst.protonum = 0xFFFF; ftp[i].mask.dst.protonum = 0xFFFF;
......
...@@ -243,9 +243,6 @@ static int __init init(void) ...@@ -243,9 +243,6 @@ static int __init init(void)
for (i = 0; (i < MAX_PORTS) && ports[i] != 0; i++) { for (i = 0; (i < MAX_PORTS) && ports[i] != 0; i++) {
hlpr = &ip_nat_irc_helpers[i]; hlpr = &ip_nat_irc_helpers[i];
memset(hlpr, 0,
sizeof(struct ip_nat_helper));
hlpr->tuple.dst.protonum = IPPROTO_TCP; hlpr->tuple.dst.protonum = IPPROTO_TCP;
hlpr->tuple.src.u.tcp.port = htons(ports[i]); hlpr->tuple.src.u.tcp.port = htons(ports[i]);
hlpr->mask.src.u.tcp.port = 0xFFFF; hlpr->mask.src.u.tcp.port = 0xFFFF;
......
...@@ -325,7 +325,6 @@ static int __init init(void) ...@@ -325,7 +325,6 @@ static int __init init(void)
/* initialize ulog_buffers */ /* initialize ulog_buffers */
for (i = 0; i < ULOG_MAXNLGROUPS; i++) { for (i = 0; i < ULOG_MAXNLGROUPS; i++) {
memset(&ulog_buffers[i], 0, sizeof(ulog_buff_t));
init_timer(&ulog_buffers[i].timer); init_timer(&ulog_buffers[i].timer);
ulog_buffers[i].timer.function = ulog_timer; ulog_buffers[i].timer.function = ulog_timer;
ulog_buffers[i].timer.data = i; ulog_buffers[i].timer.data = i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment