All of lore.kernel.org
 help / color / mirror / Atom feed
* ip_conntrack_amanda, passing amanda udp port as parameter
@ 2004-09-21  6:34 Jean-Philippe Rey
  0 siblings, 0 replies; only message in thread
From: Jean-Philippe Rey @ 2004-09-21  6:34 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 525 bytes --]

Hello Folks,

We are using netfilter and ip_conntrack_amanda. However for historical
reasons, amanda is using a different port than 10080. As the port is hard
coded in ip_conntrack_amanda, I wrote a patch in order to be able to select
the port through a parameter.

As I think this may be helpfull to others I send you this patch here. Feel
free to do wathever you like with it.

-- 
Jean-Philippe Rey          Professeur informatique - École Centrale Paris
jprey@ecp.fr               92295 Châtenay-Malabry Cedex - France

[-- Attachment #2: amanda_port.patch --]
[-- Type: text/plain, Size: 3646 bytes --]

diff -ur kernel-source-2.4.27/net/ipv4/netfilter/ip_conntrack_amanda.c kernel-source-2.4.27-1/net/ipv4/netfilter/ip_conntrack_amanda.c
--- kernel-source-2.4.27/net/ipv4/netfilter/ip_conntrack_amanda.c	2004-02-18 14:36:32.000000000 +0100
+++ kernel-source-2.4.27-1/net/ipv4/netfilter/ip_conntrack_amanda.c	2004-09-06 23:50:49.000000000 +0200
@@ -8,11 +8,11 @@
  *      2 of the License, or (at your option) any later version.
  *
  *	Module load syntax:
- * 	insmod ip_conntrack_amanda.o [master_timeout=n]
+ * 	insmod ip_conntrack_amanda.o [master_timeout=n][master_port=m]
  *	
  *	Where master_timeout is the timeout (in seconds) of the master
- *	connection (port 10080).  This defaults to 5 minutes but if
- *	your clients take longer than 5 minutes to do their work
+ *	connection (port m, default to 10080).  This defaults to 5 minutes
+ *	but if your clients take longer than 5 minutes to do their work
  *	before getting back to the Amanda server, you can increase
  *	this value.
  *
@@ -29,12 +29,15 @@
 #include <linux/netfilter_ipv4/ip_conntrack_amanda.h>
 
 static unsigned int master_timeout = 300;
+static unsigned int master_port = 10080;
 
 MODULE_AUTHOR("Brian J. Murrell <netfilter@interlinx.bc.ca>");
 MODULE_DESCRIPTION("Amanda connection tracking module");
 MODULE_LICENSE("GPL");
 MODULE_PARM(master_timeout, "i");
+MODULE_PARM(master_port, "i");
 MODULE_PARM_DESC(master_timeout, "timeout for the master connection");
+MODULE_PARM_DESC(master_port, "udp port for the master connection");
 
 static struct { char *match; int len; } conns[] = {
 	{ "DATA ", 5},
@@ -126,7 +129,7 @@
 
 static int __init init(void)
 {
-	amanda_helper.tuple.src.u.udp.port = htons(10080);
+	amanda_helper.tuple.src.u.udp.port = htons(master_port);
 	amanda_helper.tuple.dst.protonum = IPPROTO_UDP;
 	amanda_helper.mask.src.u.udp.port = 0xFFFF;
 	amanda_helper.mask.dst.protonum = 0xFFFF;
@@ -137,6 +140,9 @@
 	amanda_helper.help = help;
 	amanda_helper.name = "amanda";
 
+	printk(KERN_INFO "ip_conntrack_amanda: port=%d, timeout=%ds\n",
+		master_port, master_timeout);
+
 	return ip_conntrack_helper_register(&amanda_helper);
 }
 
diff -ur kernel-source-2.4.27/net/ipv4/netfilter/ip_nat_amanda.c kernel-source-2.4.27-1/net/ipv4/netfilter/ip_nat_amanda.c
--- kernel-source-2.4.27/net/ipv4/netfilter/ip_nat_amanda.c	2004-02-18 14:36:32.000000000 +0100
+++ kernel-source-2.4.27-1/net/ipv4/netfilter/ip_nat_amanda.c	2004-09-06 23:50:57.000000000 +0200
@@ -8,7 +8,7 @@
  *      2 of the License, or (at your option) any later version.
  *
  *	Module load syntax:
- * 	insmod ip_nat_amanda.o
+ * 	insmod ip_nat_amanda.o [master_port=m]
  */
 
 #include <linux/kernel.h>
@@ -26,10 +26,13 @@
 #include <linux/netfilter_ipv4/ip_conntrack_helper.h>
 #include <linux/netfilter_ipv4/ip_conntrack_amanda.h>
 
+static unsigned int master_port = 10080;
 
 MODULE_AUTHOR("Brian J. Murrell <netfilter@interlinx.bc.ca>");
 MODULE_DESCRIPTION("Amanda NAT helper");
 MODULE_LICENSE("GPL");
+MODULE_PARM(master_port, "i");
+MODULE_PARM_DESC(master_port, "udp port for the master connection");
 
 static unsigned int
 amanda_nat_expected(struct sk_buff **pskb,
@@ -132,7 +135,7 @@
 	struct ip_nat_helper *hlpr = &ip_nat_amanda_helper;
 
 	hlpr->tuple.dst.protonum = IPPROTO_UDP;
-	hlpr->tuple.src.u.udp.port = htons(10080);
+	hlpr->tuple.src.u.udp.port = htons(master_port);
 	hlpr->mask.src.u.udp.port = 0xFFFF;
 	hlpr->mask.dst.protonum = 0xFFFF;
 	hlpr->help = help;
@@ -141,6 +144,8 @@
 	hlpr->expect = amanda_nat_expected;
 	hlpr->name = "amanda";
 
+	printk(KERN_INFO, "ip_nat_amanda: port=%d\n", master_port);
+
 	return ip_nat_helper_register(hlpr);
 }
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-09-21  6:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-21  6:34 ip_conntrack_amanda, passing amanda udp port as parameter Jean-Philippe Rey

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.