patch-2.1.50 linux/include/net/tcp.h
Next file: linux/kernel/fork.c
Previous file: linux/include/linux/pci.h
Back to the patch index
Back to the overall index
-  Lines: 23
-  Date:
Thu Aug 14 14:49:15 1997
-  Orig file: 
v2.1.49/linux/include/net/tcp.h
-  Orig date: 
Mon Aug 11 14:47:05 1997
diff -u --recursive --new-file v2.1.49/linux/include/net/tcp.h linux/include/net/tcp.h
@@ -60,6 +60,22 @@
 	return (lport ^ (lport >> 7)) & (TCP_BHTABLE_SIZE - 1);
 }
 
+/* Find the next port that hashes h that is larger than lport.
+ * If you change the hash, change this function to match, or you will
+ * break TCP port selection. This function must also NOT wrap around
+ * when the next number exceeds the largest possible port (2^16-1).
+ */
+static __inline__ int tcp_bhashnext(__u16 short lport, __u16 h)
+{
+        __u32 s;	/* don't change this to a smaller type! */
+
+        s = (lport ^ (h ^ tcp_bhashfn(lport)));
+        if (s > lport)
+                return s;
+        s = lport + TCP_BHTABLE_SIZE;
+        return (s ^ (h ^ tcp_bhashfn(s)));
+}
+
 static __inline__ int tcp_sk_bhashfn(struct sock *sk)
 {
 	__u16 lport = sk->num;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov