PERFORCE change 139812 for review
Paolo Pisati
piso at FreeBSD.org
Fri Apr 11 14:44:31 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=139812
Change 139812 by piso at piso_ferret on 2008/04/11 14:44:02
Reduce diff against head.
Affected files ...
.. //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_irc.c#28 edit
Differences ...
==== //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_irc.c#28 (text+ko) ====
@@ -176,14 +176,12 @@
struct tcphdr *tc;
int i; /* Iterator through the source */
- printf("here\n");
/* Calculate data length of TCP packet */
tc = (struct tcphdr *)ip_next(pip);
hlen = (pip->ip_hl + tc->th_off) << 2;
tlen = ntohs(pip->ip_len);
dlen = tlen - hlen;
- printf("here2\n");
/*
* Return if data length is too short - assume an entire PRIVMSG in
* each packet.
@@ -191,14 +189,12 @@
if (dlen < (int)sizeof(":A!a at n.n PRIVMSG A :aDCC 1 1a") - 1)
return;
- printf("here3\n");
/* Place string pointer at beginning of data */
sptr = (char *)pip;
sptr += hlen;
maxsize -= hlen; /* We're interested in maximum size of
* data, not packet */
- printf("here4\n");
/* Search for a CTCP command [Note 1] */
for (i = 0; i < dlen; i++) {
if (sptr[i] == '\001')
@@ -239,7 +235,6 @@
newpacket[iCopy++] = 'C';
newpacket[iCopy++] = 'C';
newpacket[iCopy++] = ' ';
- printf("here7\n");
DBprintf(("Found DCC\n"));
/*
* Skip any extra spaces (should not occur according to
@@ -251,7 +246,6 @@
goto lPACKET_DONE;
}
}
- printf("here8\n");
DBprintf(("Transferring command...\n"));
while (sptr[i] != ' ') {
newpacket[iCopy++] = sptr[i];
@@ -260,12 +254,10 @@
goto lPACKET_DONE;
}
}
- printf("here9\n");
/* Copy _one_ space */
if (i + 1 < dlen && iCopy < PKTSIZE)
newpacket[iCopy++] = sptr[i++];
- printf("here10\n");
DBprintf(("Done command - removing spaces\n"));
/*
* Skip any extra spaces (should not occur according to
@@ -277,7 +269,6 @@
goto lPACKET_DONE;
}
}
- printf("here11\n");
DBprintf(("Transferring filename...\n"));
while (sptr[i] != ' ') {
newpacket[iCopy++] = sptr[i];
@@ -286,12 +277,10 @@
goto lPACKET_DONE;
}
}
- printf("here12\n");
/* Copy _one_ space */
if (i + 1 < dlen && iCopy < PKTSIZE)
newpacket[iCopy++] = sptr[i++];
- printf("here13\n");
DBprintf(("Done filename - removing spaces\n"));
/*
* Skip any extra spaces (should not occur according to
@@ -303,7 +292,6 @@
goto lPACKET_DONE;
}
}
- printf("here14\n");
DBprintf(("Fetching IP address\n"));
/* Fetch IP address */
org_addr = 0;
@@ -315,13 +303,11 @@
org_addr *= 10;
org_addr += sptr[i++] - '0';
}
- printf("here15\n");
DBprintf(("Skipping space\n"));
if (i + 1 >= dlen || sptr[i] != ' ') {
DBprintf(("Overflow (%d >= %d) or bad character (%02x) terminating IP address\n", i + 1, dlen, sptr[i]));
goto lBAD_CTCP;
}
- printf("here16\n");
/*
* Skip any extra spaces (should not occur according to
* protocol, but DCC breaks CTCP protocol anyway, so we
@@ -333,7 +319,6 @@
goto lPACKET_DONE;
}
}
- printf("here17\n");
DBprintf(("Fetching port number\n"));
/* Fetch source port */
org_port = 0;
@@ -346,13 +331,11 @@
org_port *= 10;
org_port += sptr[i++] - '0';
}
- printf("here18\n");
/* Skip illegal addresses (or early termination) */
if (i >= dlen || (sptr[i] != '\001' && sptr[i] != ' ')) {
DBprintf(("Bad port termination\n"));
goto lBAD_CTCP;
}
- printf("here19\n");
DBprintf(("Got IP %lu and port %u\n", org_addr, (unsigned)org_port));
/* We've got the address and port - now alias it */
@@ -370,7 +353,6 @@
pip->ip_src.s_addr != true_addr.s_addr ||
org_port < IPPORT_RESERVED)
goto lBAD_CTCP;
- printf("here20\n");
/*
* Steal the FTP_DATA_PORT - it doesn't really
* matter, and this would probably allow it through
@@ -380,14 +362,12 @@
true_port, 0,
IPPROTO_TCP, 1);
DBprintf(("Got a DCC link\n"));
- printf("here21\n");
if (dcc_lnk) {
struct in_addr alias_address; /* Address from aliasing */
u_short alias_port; /* Port given by
* aliasing */
int n;
- printf("here22\n");
#ifndef NO_FW_PUNCH
/* Generate firewall hole as appropriate */
PunchFWHole(dcc_lnk);
@@ -419,11 +399,9 @@
* Done - truncated cases will be taken
* care of by lBAD_CTCP
*/
- printf("here24\n");
DBprintf(("Aliased IP %lu and port %u\n", alias_address.s_addr, (unsigned)alias_port));
}
}
- printf("here25\n");
/*
* An uninteresting CTCP - state entered right after '\001'
* has been pushed. Also used to copy the rest of a DCC,
@@ -436,7 +414,6 @@
goto lNORMAL_TEXT;
}
}
- printf("here26\n");
goto lPACKET_DONE;
/* Normal text */
lNORMAL_TEXT:
@@ -446,13 +423,11 @@
goto lCTCP_START;
}
}
- printf("here27\n");
/* Handle the end of a packet */
lPACKET_DONE:
iCopy = iCopy > maxsize - copyat ? maxsize - copyat : iCopy;
memcpy(sptr + copyat, newpacket, iCopy);
- printf("here28\n");
/* Save information regarding modified seq and ack numbers */
{
int delta;
@@ -462,7 +437,6 @@
delta = GetDeltaSeqOut(tc->th_seq, lnk);
AddSeq(lnk, delta + copyat + iCopy - dlen, pip->ip_hl,
pip->ip_len, tc->th_seq, tc->th_off);
- printf("here29\n");
}
/* Revise IP header */
@@ -475,7 +449,6 @@
&pip->ip_len,
1);
pip->ip_len = new_len;
- printf("here30\n");
}
/* Compute TCP checksum for revised packet */
@@ -485,7 +458,6 @@
#else
tc->th_sum = TcpChecksum(pip);
#endif
- printf("here31\n");
return;
}
}
More information about the p4-projects
mailing list