X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Fipv4%2Fnetfilter%2Fip_conntrack_tftp.c;h=d132a3c48d8d8778dc842c0236fedd60b468999e;hb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;hp=ddee7378209d324257d01e8611c076136b06de69;hpb=a2c21200f1c81b08cb55e417b68150bba439b646;p=linux-2.6.git diff --git a/net/ipv4/netfilter/ip_conntrack_tftp.c b/net/ipv4/netfilter/ip_conntrack_tftp.c index ddee73782..d132a3c48 100644 --- a/net/ipv4/netfilter/ip_conntrack_tftp.c +++ b/net/ipv4/netfilter/ip_conntrack_tftp.c @@ -19,6 +19,7 @@ #include #include #include +#include MODULE_AUTHOR("Magnus Boden "); MODULE_DESCRIPTION("tftp connection tracking helper"); @@ -27,7 +28,7 @@ MODULE_LICENSE("GPL"); #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); MODULE_PARM_DESC(ports, "port numbers of tftp servers"); #if 0 @@ -41,14 +42,16 @@ static int tftp_help(struct sk_buff *skb, struct ip_conntrack *ct, enum ip_conntrack_info ctinfo) { - struct tftphdr tftph; + struct tftphdr _tftph, *tfh; struct ip_conntrack_expect *exp; - if (skb_copy_bits(skb, skb->nh.iph->ihl * 4 + sizeof(struct udphdr), - &tftph, sizeof(tftph)) != 0) + tfh = skb_header_pointer(skb, + skb->nh.iph->ihl * 4 + sizeof(struct udphdr), + sizeof(_tftph), &_tftph); + if (tfh == NULL) return NF_ACCEPT; - switch (ntohs(tftph.opcode)) { + switch (ntohs(tfh->opcode)) { /* RRQ and WRQ works the same way */ case TFTP_OPCODE_READ: case TFTP_OPCODE_WRITE: @@ -104,10 +107,10 @@ static int __init init(void) int i, ret; char *tmpname; - if (!ports[0]) - ports[0]=TFTP_PORT; + if (ports_c == 0) + ports[ports_c++] = TFTP_PORT; - for (i = 0 ; (i < MAX_PORTS) && ports[i] ; i++) { + for (i = 0; i < ports_c; i++) { /* Create helper structure */ memset(&tftp[i], 0, sizeof(struct ip_conntrack_helper)); @@ -137,7 +140,6 @@ static int __init init(void) fini(); return(ret); } - ports_c++; } return(0); }