-----BEGIN PGP SIGNED MESSAGE-----
Hi!
For some time now, I've been having problems with the ip_masq_irc module.
Although DCC CHAT worked just fine, DCC SEND wouldn't work at all. I think
I have a fix for it, and I've included it as a kernel patch.
The problem turns out to be that the module expected a single parameter
(filesize) after the address and port parameters. According to the CTCP
spec, this is correct. However, some irc clients (bX and ircII-epic are
confirmed) add extra parameters, like file description or checksum
information.
I've made a couple of modifications to this behaviour:
1) The module no longer looks for the trailing 0x01 ctcp quoting
character; it now looks for the leading quoting character before DCC.
2) Parsing of the packet stops after address and port, as this is the only
part we're really interested in.
I've tested it on my own system, and it appears to work fine. Even though
it's a simple change, I'd like to see at least a couple people try it out.
This is my first attempt at a kernel patch. I believe it's in the proper
format, but any suggestions would be welcome.
The file is also available at
http://www.escape.ca/~sshore/ip_masq_irc.c.patch.gz
Scottie Shore | "Experience is the worst teacher -
<[EMAIL PROTECTED]> | it teaches you what you need to know
| after you needed to know it."
- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
My current valid PGP keys are available on public PGP keyservers:
PGP 2.6.2 0x9DEF8D2F - RSA, PGP 5.0 0xB5E1D683 - DSS
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 5.0i for non-commercial use
Charset: noconv
iQCVAwUBN2++4S9e4K2d740vAQHkDgP/VBNvhi/QUK59PiLPksE+9PLwPMjJN5CL
I8ti59fyUgbZ4Z0K12kaMnSkAh+b6CqLmBpuyVXQDej2bvYsaZKRSH+kMvt8bEJN
S2+6/QYKxGg9WAZoTSXsmDAAiXgSWPuBAbA+oyZUoRLKJEg/XGUs5oKpdyUe1f1y
q54cXUhDtbM=
=/B2V
-----END PGP SIGNATURE-----
--- linux/net/ipv4/ip_masq_irc.c Wed Jun 2 04:08:53 1999
+++ linux/net/ipv4/ip_masq_irc.c Sat Jun 19 22:18:15 1999
@@ -2,7 +2,7 @@
* IP_MASQ_IRC irc masquerading module
*
*
- * Version: @(#)ip_masq_irc.c 0.03 97/11/30
+ * Version: @(#)ip_masq_irc.c 0.04 99/06/19
*
* Author: Juan Jose Ciarlante
*
@@ -18,6 +18,8 @@
* Oliver Wagner : more IRC cmds processing
* <[EMAIL PROTECTED]>
* Juan Jose Ciarlante : put new ms entry to listen()
+ * Scottie Shore : added support for clients that add extra args
+ * <[EMAIL PROTECTED]>
*
* FIXME:
* - detect also previous "PRIVMSG" string ?.
@@ -82,15 +84,14 @@
{
char *match;
int matchlen;
- int xtra_args;
};
struct dccproto dccprotos[NUM_DCCPROTO] = {
- { "SEND ", 5, 1 },
- { "CHAT ", 5, 0, },
- { "MOVE ", 5, 1 },
- { "TSEND ", 6, 1, },
- { "SCHAT ", 6, 0, }
+ { "SEND ", 5 },
+ { "CHAT ", 5 },
+ { "MOVE ", 5 },
+ { "TSEND ", 6 },
+ { "SCHAT ", 6 }
};
#define MAXMATCHLEN 6
@@ -121,7 +122,6 @@
char buf[20]; /* "m_addr m_port" (dec base)*/
unsigned buf_len;
int diff;
- int xtra_args = 0; /* extra int args wanted after addr */
char *dcc_p, *addr_beg_p, *addr_end_p;
skb = *skb_p;
@@ -132,12 +132,11 @@
/*
* Hunt irc DCC string, the _shortest_:
*
- * strlen("DCC CHAT chat AAAAAAAA P\x01\n")=26
- * strlen("DCC SCHAT chat AAAAAAAA P\x01\n")=27
- * strlen("DCC SEND F AAAAAAAA P S\x01\n")=25
- * strlen("DCC MOVE F AAAAAAAA P S\x01\n")=25
- * strlen("DCC TSEND F AAAAAAAA P S\x01\n")=26
- * strlen("DCC MOVE F AAAAAAAA P S\x01\n")=25
+ * strlen("\1DCC CHAT chat AAAAAAAA P\1\n")=27
+ * strlen("\1DCC SCHAT chat AAAAAAAA P\1\n")=28
+ * strlen("\1DCC SEND F AAAAAAAA P S\1\n")=26
+ * strlen("\1DCC MOVE F AAAAAAAA P S\1\n")=26
+ * strlen("\1DCC TSEND F AAAAAAAA P S\1\n")=27
* AAAAAAAAA: bound addr (1.0.0.0==16777216, min 8 digits)
* P: bound port (min 1 d )
* F: filename (min 1 d )
@@ -147,16 +146,16 @@
data_limit = skb->h.raw + skb->len;
- while (data < (data_limit - ( 21 + MAXMATCHLEN ) ) )
+ while (data < (data_limit - ( 22 + MAXMATCHLEN ) ) )
{
int i;
- if (memcmp(data,"DCC ",4)) {
+ if (memcmp(data,"\1DCC ",5)) {
data ++;
continue;
}
dcc_p = data;
- data += 4; /* point to DCC cmd */
+ data += 5; /* point to DCC cmd */
for(i=0; i<NUM_DCCPROTO; i++)
{
@@ -166,7 +165,6 @@
if( memcmp(data, dccprotos[i].match, dccprotos[i].matchlen )
== 0 )
{
- xtra_args = dccprotos[i].xtra_args;
data += dccprotos[i].matchlen;
/*
@@ -176,7 +174,7 @@
while( *data++ != ' ')
/*
- * must still parse, at least, "AAAAAAAA
P\x01\n",
+ * must still parse, at least, "AAAAAAAA
+P\1\n",
* 12 bytes left.
*/
if (data > (data_limit-12)) return 0;
@@ -200,29 +198,6 @@
addr_end_p = data;
/*
- * should check args consistency?
- */
-
- while(xtra_args) {
- if (*data != ' ')
- break;
- data++;
- simple_strtoul(data,&data,10);
- xtra_args--;
- }
-
- if (xtra_args != 0) continue;
-
- /*
- * terminators.
- */
-
- if (data[0] != 0x01)
- continue;
- if (data[1]!='\r' && data[1]!='\n')
- continue;
-
- /*
* Now create an masquerade entry for it
* must set NO_DPORT and NO_DADDR because
* connection is requested by another client.