patch-2.1.93 linux/net/ipv4/syncookies.c

Next file: linux/net/ipv4/sysctl_net_ipv4.c
Previous file: linux/net/ipv4/proc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.92/linux/net/ipv4/syncookies.c linux/net/ipv4/syncookies.c
@@ -9,11 +9,9 @@
  *      as published by the Free Software Foundation; either version
  *      2 of the License, or (at your option) any later version.
  * 
- *  $Id: syncookies.c,v 1.4 1998/03/08 05:56:34 davem Exp $
+ *  $Id: syncookies.c,v 1.5 1998/04/03 09:49:46 freitag Exp $
  *
  *  Missing: IPv6 support. 
- *           Some counter so that the Administrator can see when the machine
- *           is under a syn flood attack.
  */
 
 #include <linux/config.h>
@@ -88,6 +86,8 @@
 found:
 	*mssp = w[-1]; 
 
+	net_statistics.SyncookiesSent++;
+
 	isn |= i; 
 	return isn; 
 }
@@ -110,8 +110,9 @@
 	__u32 seq; 
 
   	if ((jiffies - tcp_lastsynq_overflow) > TCP_TIMEOUT_INIT
-	    && tcp_lastsynq_overflow) 
+	    && tcp_lastsynq_overflow) {
 		return 0; 
+	}
 
 	mssind = cookie & 7;
 	cookie &= ~7;
@@ -157,8 +158,12 @@
 		return sk; 
 
 	mss = cookie_check(skb, cookie);
-	if (mss == 0) 
+	if (mss == 0) {
+	 	net_statistics.SyncookiesFailed++;
 		return sk;
+	}
+
+	net_statistics.SyncookiesRecv++;
 
 	req = tcp_openreq_alloc();
 	if (req == NULL)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov