bin/50310: natd / libalias fix to allow dcc resume in irc

Ignacio Solis isolis at igso.net
Wed Mar 26 06:10:15 PST 2003


>Number:         50310
>Category:       bin
>Synopsis:       natd / libalias fix to allow dcc resume in irc
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 25 22:10:12 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Ignacio Solis
>Release:        FreeBSD 5.0-RELEASE i386
>Organization:
UC Santa Cruz, California, US
>Environment:
System: FreeBSD imperial.casa.igso.net 5.0-RELEASE FreeBSD 5.0-RELEASE #5: Tue
Jan 28 23:31:36 PST 2003 isolis at imperial.casa.igso.net:/usr/obj/usr/src/sys/IMPERIAL i386
        Machine running natd as router/firewall, clients trying to do DCC RESUME while downloading files from irc

>Description:

	The current implementation of libalias has a simple way of doing NAT
for irc connections. It assumes that DCC messages all have the same format,
namely "DCC command file ip port .... etc". The RESUME command has a different
structure, and hence the simple assumptions of libalias make RESUME fail,
sending out erroneously translated messages. The format of RESUME is: "DCC
RESUME port size", where port is the port of the sender of the file (where we
connect), hence no translation is necesary.  The problem can be clearly seen
with 2 tcpdumps (with packet contents) at the sides of the nat box.

>How-To-Repeat:

Enable natd on the firewall/router. Have a client connect to IRC. Download a
piece of a file. Now try to download the rest of the file with a RESUME.

>Fix:

        This is a simple fix that just passes the packet through if it sees
it's a RESUME command.

--- libalias_dcc_resume.diff begins here ---
--- alias_irc.c.backup  Tue Mar 25 01:28:12 2003
+++ alias_irc.c Tue Mar 25 02:39:39 2003
@@ -140,6 +140,20 @@
                         }
                 }

+
+                if( sptr[i+0] == 'R' &&
+                    sptr[i+1] == 'E' &&
+                    sptr[i+2] == 'S' &&
+                    sptr[i+3] == 'U' &&
+                    sptr[i+4] == 'M' &&
+                    sptr[i+5] == 'E' &&
+                    sptr[i+6] == ' '){
+                        /* It's a resume packet, let it through, lBAD_CTCP
+                         * will copy the rest of the packet */
+                        DBprintf(("RESUME command...\n"));
+                        goto lBAD_CTCP;
+                }
+
                 DBprintf(("Transferring command...\n"));
                 while(sptr[i] != ' ') {
                         newpacket[iCopy++] = sptr[i];
--- libalias_dcc_resume.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list