[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(usagi-users 03069) [Patch] Port nf_conntrack_ftp to use moduleparam macros
- To: usagi-users@xxxxxxxxxxxxxx
- Subject: (usagi-users 03069) [Patch] Port nf_conntrack_ftp to use moduleparam macros
- From: Michal Rokos <michal@xxxxxxxxxx>
- Date: Thu, 14 Oct 2004 22:45:40 +0200
- Reply-to: usagi-users@xxxxxxxxxxxxxx
- Resent-date: Fri, 15 Oct 2004 09:56:37 +0900
- Resent-from: sekiya@xxxxxxxxxxxxxx
- Resent-message-id: <200410150956.FMLAAB10985.usagi-users@linux-ipv6.org>
- Resent-to: usagi-users@xxxxxxxxxxxxxx (moderated)
- User-agent: KMail/1.7
Hi,
as last for today, make nf_conntrack_ftp to use moduleparam macros.
Michal
PS: Is it OK to send those patches here?
Does anybody care about there?
(Or is it OK to send them directly (and only) to Yasuyuki KOZAKAI?)
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/10/14 22:38:55+02:00 michal@xxxxxxxxxxxxxxxxx
# Port nf_conntrack_ftp to use moduleparam API.
#
# net/netfilter/nf_conntrack_ftp.c
# 2004/10/14 22:38:38+02:00 michal@xxxxxxxxxxxxxxxxx +12 -16
# Port nf_conntrack_ftp to use moduleparam API.
#
diff -Nru a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_ftp.c
--- a/net/netfilter/nf_conntrack_ftp.c 2004-10-14 22:41:14 +02:00
+++ b/net/netfilter/nf_conntrack_ftp.c 2004-10-14 22:41:14 +02:00
@@ -17,13 +17,13 @@
#include <linux/config.h>
#include <linux/module.h>
+#include <linux/moduleparam.h>
#include <linux/netfilter.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
#include <linux/ctype.h>
#include <net/checksum.h>
#include <net/tcp.h>
-#include <linux/kernel.h>
#include <linux/netfilter/nf_conntrack.h>
#include <linux/netfilter_ipv4/lockhelp.h>
@@ -37,16 +37,16 @@
/* This is slow, but it's simple. --RR */
static char ftp_buffer[65536];
-DECLARE_LOCK(nf_ftp_lock);
+static DECLARE_LOCK(nf_ftp_lock);
struct module *nf_conntrack_ftp = THIS_MODULE;
#define MAX_PORTS 8
static int ports[MAX_PORTS];
static int ports_c;
-MODULE_PARM(ports, "1-" __MODULE_STRING(MAX_PORTS) "i");
+module_param_array(ports, int, ports_c, 0400);
static int loose;
-MODULE_PARM(loose, "i");
+module_param(loose, int, 0600);
#if 0
#define DEBUGP printk
@@ -245,16 +245,16 @@
u_int16_t tmp_port = 0;
int i;
- for(i = start; i < dlen; i++) {
+ for (i = start; i < dlen; i++) {
/* Finished? */
- if(data[i] == delim){
+ if (data[i] == delim) {
if (tmp_port == 0)
break;
*port = htons(tmp_port);
DEBUGP("get_port: return %d\n", tmp_port);
return i + 1;
}
- else if(data[i] >= '0' && data[i] <= '9')
+ else if (data[i] >= '0' && data[i] <= '9')
tmp_port = tmp_port*10 + data[i] - '0';
else { /* Some other crap */
DEBUGP("get_port: invalid char.\n");
@@ -264,7 +264,7 @@
return 0;
}
-/* Returns 0, or length of numbers: |1|3ffe::1|6275| or |2|132.235.1.2|6275| */
+/* Returns 0, or length of numbers: |1|132.235.1.2|6275| or |2|3ffe::1|6275| */
static int try_eprt(const char *data, size_t dlen, struct nf_conntrack_man *cmd,
char term)
{
@@ -472,7 +472,7 @@
if (found == -1) {
/* We don't usually drop packets. After all, this is
connection tracking, not packet filtering.
- However, it is neccessary for accurate tracking in
+ However, it is necessary for accurate tracking in
this case. */
if (net_ratelimit())
printk("conntrack_ftp: partial %s %u+%u\n",
@@ -582,12 +582,12 @@
int i, ret;
char *tmpname;
- if (ports[0] == 0)
- ports[0] = FTP_PORT;
+ if (ports_c == 0)
+ ports[ports_c++] = FTP_PORT;
/* FIXME should be configurable whether IPv4 and IPv6 FTP connections
are tracked or not - YK */
- for (i = 0; (i < MAX_PORTS) && ports[i]; i++) {
+ for (i = 0; i < ports_c; i++) {
memset(&ftp[i], 0, sizeof(struct nf_conntrack_helper));
ftp[i].tuple.src.u.tcp.port = htons(ports[i]);
ftp[i].tuple.dst.protonum = IPPROTO_TCP;
@@ -614,15 +614,11 @@
fini();
return ret;
}
-
- ports_c++;
}
return 0;
}
-
PROVIDES_CONNTRACK(ftp);
-EXPORT_SYMBOL(nf_ftp_lock);
module_init(init);
module_exit(fini);