git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
net
/
ipv4
/
ipvs
/
ip_vs_ftp.c
diff --git
a/net/ipv4/ipvs/ip_vs_ftp.c
b/net/ipv4/ipvs/ip_vs_ftp.c
index
1241058
..
687c1de
100644
(file)
--- a/
net/ipv4/ipvs/ip_vs_ftp.c
+++ b/
net/ipv4/ipvs/ip_vs_ftp.c
@@
-25,12
+25,14
@@
*/
#include <linux/module.h>
*/
#include <linux/module.h>
+#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/skbuff.h>
#include <linux/in.h>
#include <linux/ip.h>
#include <net/protocol.h>
#include <net/tcp.h>
#include <linux/kernel.h>
#include <linux/skbuff.h>
#include <linux/in.h>
#include <linux/ip.h>
#include <net/protocol.h>
#include <net/tcp.h>
+#include <asm/unaligned.h>
#include <net/ip_vs.h>
#include <net/ip_vs.h>
@@
-43,17
+45,10
@@
* List of ports (up to IP_VS_APP_MAX_PORTS) to be handled by helper
* First port is set to the default port.
*/
* 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};
+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");
-/*
- * Debug level
- */
-#ifdef CONFIG_IP_VS_DEBUG
-static int debug=0;
-MODULE_PARM(debug, "i");
-#endif
-
-MODULE_PARM(ports, "1-" __MODULE_STRING(IP_VS_APP_MAX_PORTS) "i");
/* Dummy variable */
static int ip_vs_ftp_pasv;
/* Dummy variable */
static int ip_vs_ftp_pasv;
@@
-80,7
+75,7
@@
ip_vs_ftp_done_conn(struct ip_vs_app *app, struct ip_vs_conn *cp)
*/
static int ip_vs_ftp_get_addrport(char *data, char *data_limit,
const char *pattern, size_t plen, char term,
*/
static int ip_vs_ftp_get_addrport(char *data, char *data_limit,
const char *pattern, size_t plen, char term,
- __
u32 *addr, __u
16 *port,
+ __
be32 *addr, __be
16 *port,
char **start, char **end)
{
unsigned char p[6];
char **start, char **end)
{
unsigned char p[6];
@@
-120,8
+115,8
@@
static int ip_vs_ftp_get_addrport(char *data, char *data_limit,
if (i != 5)
return -1;
if (i != 5)
return -1;
- *addr =
(p[3]<<24) | (p[2]<<16) | (p[1]<<8) | p[0]
;
- *port =
(p[5]<<8) | p[4]
;
+ *addr =
get_unaligned((__be32 *)p)
;
+ *port =
get_unaligned((__be16 *)(p + 4))
;
return 1;
}
return 1;
}
@@
-146,8
+141,8
@@
static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
struct tcphdr *th;
char *data, *data_limit;
char *start, *end;
struct tcphdr *th;
char *data, *data_limit;
char *start, *end;
- __
u
32 from;
- __
u
16 port;
+ __
be
32 from;
+ __
be
16 port;
struct ip_vs_conn *n_cp;
char buf[24]; /* xxx.xxx.xxx.xxx,ppp,ppp\000 */
unsigned buf_len;
struct ip_vs_conn *n_cp;
char buf[24]; /* xxx.xxx.xxx.xxx,ppp,ppp\000 */
unsigned buf_len;
@@
-176,7
+171,7
@@
static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
&start, &end) != 1)
return 1;
&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);
"%u.%u.%u.%u:%d detected\n",
NIPQUAD(from), ntohs(port), NIPQUAD(cp->caddr), 0);
@@
-205,7
+200,7
@@
static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
from = n_cp->vaddr;
port = n_cp->vport;
sprintf(buf,"%d,%d,%d,%d,%d,%d", NIPQUAD(from),
from = n_cp->vaddr;
port = n_cp->vport;
sprintf(buf,"%d,%d,%d,%d,%d,%d", NIPQUAD(from),
-
port&255, (port>>8
)&255);
+
(ntohs(port)>>8)&255, ntohs(port
)&255);
buf_len = strlen(buf);
/*
buf_len = strlen(buf);
/*
@@
-249,8
+244,8
@@
static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
struct tcphdr *th;
char *data, *data_start, *data_limit;
char *start, *end;
struct tcphdr *th;
char *data, *data_start, *data_limit;
char *start, *end;
- __
u
32 to;
- __
u
16 port;
+ __
be
32 to;
+ __
be
16 port;
struct ip_vs_conn *n_cp;
/* no diff required for incoming packets */
struct ip_vs_conn *n_cp;
/* no diff required for incoming packets */
@@
-279,7
+274,7
@@
static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
while (data <= data_limit - 6) {
if (strnicmp(data, "PASV\r\n", 6) == 0) {
/* Passive mode on */
while (data <= data_limit - 6) {
if (strnicmp(data, "PASV\r\n", 6) == 0) {
/* Passive mode on */
- IP_VS_DBG(
1-debug, "got PASV at %d of %
d\n",
+ IP_VS_DBG(
7, "got PASV at %td of %t
d\n",
data - data_start,
data_limit - data_start);
cp->app_data = &ip_vs_ftp_pasv;
data - data_start,
data_limit - data_start);
cp->app_data = &ip_vs_ftp_pasv;
@@
-301,7
+296,7
@@
static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
&start, &end) != 1)
return 1;
&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 */
NIPQUAD(to), ntohs(port));
/* Passive mode off */
@@
-310,7
+305,7
@@
static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
/*
* Now update or create a connection entry for it
*/
/*
* 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);
ip_vs_proto_name(iph->protocol),
NIPQUAD(to), ntohs(port), NIPQUAD(cp->vaddr), 0);
@@
-374,8
+369,8
@@
static int __init ip_vs_ftp_init(void)
ret = register_ip_vs_app_inc(app, app->protocol, ports[i]);
if (ret)
break;
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)
}
if (ret)