ip_vs_ftp cleanups
Subsystems (3)
cover ip_vs_ftp cleanups
Hi,
This series of four patches has several minor cleanups for the options to the ip_vs_ftp modules.
Signature · 3 lines
Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/
PATCH 1/4 Document the ports option to ip_vs_ftp in kernel-parameters.txt
I'm not sure if documenting this here is appropriate, but if it is, here is some text to put there.
Documentation/kernel-parameters.txt +6 -0
@@ -697,6 +697,12 @@ ips= [HW,SCSI] Adaptec / IBM ServeRAID controller See header of drivers/scsi/ips.c. + ports= [IP_VS_FTP] IPVS ftp helper module + Default is 21. + Up to 8 (IP_VS_APP_MAX_PORTS) ports + may be specified. + Format: <port>,<port>.... + irqfixup [HW] When an interrupt is not handled search all handlers for it. Intended to get systems with badly broken
--
Signature · 3 lines
Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/
PATCH 2/4 auto-help for ip_vs_ftp
In reply to HormsFill in a help message for the ports option to ip_vs_ftp
net/ipv4/ipvs/ip_vs_ftp.c +1 -0
@@ -46,6 +46,7 @@*/ static int ports[IP_VS_APP_MAX_PORTS ] = {21 ,0 };module_param_array (ports, int,NULL ,0 ); +MODULE_PARM_DESC (ports,"Ports to monitor for FTP control commands" );/* * Debug level
--
Signature · 3 lines
Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/
PATCH 3/4 Make sure ip_vs_ftp ports are valid
In reply to HormsI'm not entirely sure what happens in the case of a valid port, at best it'll be silently ignored. This patch ignores them a little more verbosely.
net/ipv4/ipvs/ip_vs_ftp.c +6 -0
@@ -373,6 +373,12 @@for (i=0 ; i<IP_VS_APP_MAX_PORTS ; i++) {if (!ports[i])continue ; +if (ports[i] <0 || ports[i] >0xffff ) { +IP_VS_WARNING ("ip_vs_ftp: Ignoring invalid " +"configuration port[%d] = %d\n" , + i, ports[i]); +continue ; + } ret =register_ip_vs_app_inc (app, app->protocol, ports[i]);if (ret)break ;
--
Signature · 3 lines
Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/
Re: [patch 3/4] Make sure ip_vs_ftp ports are valid
Quoted 10 lines · Horms
I'm not entirely sure what happens in the case of a valid port, at best it'll be silently ignored. This patch ignores them a little more verbosely.
Signed-off-by Simon Horman <[email protected]>Index:
linux-2.6/net/ipv4/ipvs/ip_vs_ftp.c
===================================================================
net/ipv4/ipvs/ip_vs_ftp.c line 381
Quoted 9 lines
net/ipv4/ipvs/ip_vs_ftp.c +6
-0@@ -373,6 +373,12 @@for (i=0 ; i<IP_VS_APP_MAX_PORTS ; i++) {if (!ports[i])continue ; +if (ports[i] <0 || ports[i] >0xffff ) { +IP_VS_WARNING ("ip_vs_ftp: Ignoring invalid " +"configuration port[%d] = %d\n" , + i, ports[i]); +continue ; + }
How about just changing the module parameter type to ushort, similar to what ip_conntrack_ftp does?
# modprobe ip_conntrack_ftp ports=999392 ip_conntrack_ftp: `999392' invalid for parameter `ports'
Signature · 1 line
VGER BF report: H 0.41558
Re: [patch 3/4] Make sure ip_vs_ftp ports are valid
Quoted 15 lines · Patrick McHardy
Quoted 14 lines · Horms
I'm not entirely sure what happens in the case of a valid port, at best it'll be silently ignored. This patch ignores them a little more verbosely.
Signed-off-by Simon Horman <[email protected]>Index:
linux-2.6/net/ipv4/ipvs/ip_vs_ftp.c
===================================================================net/ipv4/ipvs/ip_vs_ftp.c +1
-0@@ -373,6 +373,12 @@for (i=0 ; i<IP_VS_APP_MAX_PORTS ; i++) {if (!ports[i])continue ; +if (ports[i] <0 || ports[i] >0xffff ) {
Quoted 8 lines
net/ipv4/ipvs/ip_vs_ftp.c line 381
Quoted 5 lines
net/ipv4/ipvs/ip_vs_ftp.c +5
-0+IP_VS_WARNING ("ip_vs_ftp: Ignoring invalid " +"configuration port[%d] = %d\n" , + i, ports[i]); +continue ; + }How about just changing the module parameter type to ushort, similar to what
ip_conntrack_ftpdoes?
Sure. I wasn't sure if that was possible or not.
But as it is, I will make it so.
Signature · 7 lines
Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/ -- VGER BF report: U 0.575956
Re: [patch 3/4] Make sure ip_vs_ftp ports are valid
Quoted 25 lines · Horms
Quoted 15 lines · Patrick McHardy
Quoted 14 lines · Horms
I'm not entirely sure what happens in the case of a valid port, at best it'll be silently ignored. This patch ignores them a little more verbosely.
Signed-off-by Simon Horman <[email protected]>Index:
linux-2.6/net/ipv4/ipvs/ip_vs_ftp.c
===================================================================net/ipv4/ipvs/ip_vs_ftp.c +1
-0@@ -373,6 +373,12 @@for (i=0 ; i<IP_VS_APP_MAX_PORTS ; i++) {if (!ports[i])continue ; +if (ports[i] <0 || ports[i] >0xffff ) {Quoted 8 lines
net/ipv4/ipvs/ip_vs_ftp.c line 381
Quoted 5 lines
net/ipv4/ipvs/ip_vs_ftp.c +5
-0+IP_VS_WARNING ("ip_vs_ftp: Ignoring invalid " +"configuration port[%d] = %d\n" , + i, ports[i]); +continue ; + }How about just changing the module parameter type to ushort, similar to what
ip_conntrack_ftpdoes?
Quoted 2 lines
Sure. I wasn't sure if that was possible or not.
But as it is, I will make it so.
Here is the revised patch.
Signature · 31 lines
Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/ [IPVS] Make sure ip_vs_ftp ports are valid I'm not entirely sure what happens in the case of a valid port, at best it'll be silently ignored. This patch ensures that the port values are unsigned short values, and thus always valid. Cc: Patrick McHardy <[email protected]> Signed-Off-By: Simon Horman <[email protected]> Index: linux-2.6/net/ipv4/ipvs/ip_vs_ftp.c =================================================================== --- linux-2.6.orig/net/ipv4/ipvs/ip_vs_ftp.c 2006-09-04 10:47:09.000000000 +0900 +++ linux-2.6/net/ipv4/ipvs/ip_vs_ftp.c 2006-09-04 10:59:30.000000000 +0900 @@ -44,8 +44,8 @@ * List of ports (up to IP_VS_APP_MAX_PORTS) to be handled by helper * First port is set to the default port. */ -static int ports[IP_VS_APP_MAX_PORTS] = {21, 0}; -module_param_array(ports, int, NULL, 0); +static unsigned short ports[IP_VS_APP_MAX_PORTS] = {21, 0}; +module_param_array(ports, ushort, NULL, 0); MODULE_PARM_DESC(ports, "Ports to monitor for FTP control commands"); /* -- VGER BF report: U 0.832414
Re: [patch 3/4] Make sure ip_vs_ftp ports are valid
Quoted 9 lines · Horms
Here is the revised patch.
[IPVS] Make sure
ip_vs_ftpports are validI'm not entirely sure what happens in the case of a valid port, at best it'll be silently ignored. This patch ensures that the port values are unsigned short values, and thus always valid.
Quoted 6 lines
Cc Patrick McHardy <[email protected]>Signed-off-by Simon Horman <[email protected]>Index:
linux-2.6/net/ipv4/ipvs/ip_vs_ftp.c
===================================================================
---linux-2.6.orig/net/ipv4/ipvs/ip_vs_ftp.c2006-09-04
10:47:09.000000000 +0900
Quoted 1 line
+++
linux-2.6/net/ipv4/ipvs/ip_vs_ftp.c2006-09-04 10:59:30.000000000
+0900
Review line 51
Quoted 11 lines
(quoted diff) +2
-2@@ -44,8 +44,8 @@ * List of ports (up to IP_VS_APP_MAX_PORTS) to be handled by helper * First port is set to the default port. */ -static int ports[IP_VS_APP_MAX_PORTS] = {21, 0}; -module_param_array(ports, int, NULL, 0); +static unsigned short ports[IP_VS_APP_MAX_PORTS] = {21, 0}; +module_param_array(ports, ushort, NULL, 0); MODULE_PARM_DESC(ports, "Ports to monitor for FTP control commands"); /*
It looks like the wrong patch went in:
http://marc.theaimsgroup.com/?l=git-commits-head&m=115862407021941&w=2
Re: [patch 3/4] Make sure ip_vs_ftp ports are valid
Quoted 29 lines · Patrick McHardy
Quoted 9 lines · Horms
Here is the revised patch.
[IPVS] Make sure
ip_vs_ftpports are validI'm not entirely sure what happens in the case of a valid port, at best it'll be silently ignored. This patch ensures that the port values are unsigned short values, and thus always valid.
Quoted 6 lines
Cc Patrick McHardy <[email protected]>Signed-off-by Simon Horman <[email protected]>Index:
linux-2.6/net/ipv4/ipvs/ip_vs_ftp.c
===================================================================
---linux-2.6.orig/net/ipv4/ipvs/ip_vs_ftp.c2006-09-0410:47:09.000000000 +0900
Quoted 1 line
+++
linux-2.6/net/ipv4/ipvs/ip_vs_ftp.c2006-09-04 10:59:30.000000000+0900
Quoted 10 lines
(quoted diff) +2
-2@@ -44,8 +44,8 @@ * List of ports (up to IP_VS_APP_MAX_PORTS) to be handled by helper * First port is set to the default port. */ -static int ports[IP_VS_APP_MAX_PORTS] = {21, 0}; -module_param_array(ports, int, NULL, 0); +static unsigned short ports[IP_VS_APP_MAX_PORTS] = {21, 0}; +module_param_array(ports, ushort, NULL, 0); MODULE_PARM_DESC(ports, "Ports to monitor for FTP control commands");
Quoted 5 lines
Review line 51
Quoted 1 line
(quoted diff) +0
-0/*It looks like the wrong patch went in:
http://marc.theaimsgroup.com/?l=git-commits-head&m=115862407021941&w=2
Thanks for pointing that out. I'll send out patches to reverse the committed change, and add the newer incarntation.
Signature · 3 lines
Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/
PATCH 4/4 remove the debug option go ip_vs_ftp
In reply to HormsThis patch makes the debuging behaviour of this code more consistent with the rest of IPVS.
net/ipv4/ipvs/ip_vs_ftp.c +6 -14
@@ -48,14 +48,6 @@module_param_array (ports, int,NULL ,0 );MODULE_PARM_DESC (ports,"Ports to monitor for FTP control commands" ); -/* -* Debug level -*/ -#ifdef CONFIG_IP_VS_DEBUG -static int debug=0 ; -module_param (debug, int,0 ); -#endif -/* Dummy variable */ static int ip_vs_ftp_pasv;
@@ -178,7 +170,7 @@ &start, &end) != 1)return 1 ; -IP_VS_DBG (1 -debug,"PASV response (%u.%u.%u.%u:%d) -> " +IP_VS_DBG (7 ,"PASV response (%u.%u.%u.%u:%d) -> " "%u.%u.%u.%u:%d detected\n" ,NIPQUAD (from),ntohs (port),NIPQUAD (cp->caddr),0 );
@@ -281,7 +273,7 @@while (data <= data_limit -6 ) {if (strnicmp (data,"PASV\r\n" ,6 ) ==0 ) {/* Passive mode on */ -IP_VS_DBG (1 -debug,"got PASV at %zd of %zd\n" , +IP_VS_DBG (7 ,"got PASV at %zd of %zd\n" , data - data_start, data_limit - data_start); cp->app_data = &ip_vs_ftp_pasv;
@@ -303,7 +295,7 @@ &start, &end) != 1)return 1 ; -IP_VS_DBG (1 -debug,"PORT %u.%u.%u.%u:%d detected\n" , +IP_VS_DBG (7 ,"PORT %u.%u.%u.%u:%d detected\n" ,NIPQUAD (to),ntohs (port));/* Passive mode off */
@@ -312,7 +304,7 @@/* * Now update or create a connection entry for it */ -IP_VS_DBG (1 -debug,"protocol %s %u.%u.%u.%u:%d %u.%u.%u.%u:%d\n" , +IP_VS_DBG (7 ,"protocol %s %u.%u.%u.%u:%d %u.%u.%u.%u:%d\n" ,ip_vs_proto_name (iph->protocol),NIPQUAD (to),ntohs (port),NIPQUAD (cp->vaddr),0 );
@@ -382,8 +374,8 @@ ret =register_ip_vs_app_inc (app, app->protocol, ports[i]);if (ret)break ; -IP_VS_DBG (1 -debug,"%s: loaded support on port[%d] = %d\n" , - app->name, i, ports[i]); +IP_VS_INFO ("%s: loaded support on port[%d] = %d\n" , + app->name, i, ports[i]); }if (ret)
--
Signature · 3 lines
Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/