summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_syncache.c
diff options
context:
space:
mode:
authorrpaulo <rpaulo@FreeBSD.org>2008-07-31 15:10:09 +0000
committerrpaulo <rpaulo@FreeBSD.org>2008-07-31 15:10:09 +0000
commit10a841cbfb0cea3932ca2727dc675944e91b7f3c (patch)
tree8b911acf57ec2b96a01e7db35ef80bd6af6601a0 /sys/netinet/tcp_syncache.c
parent7818f3ed80d17fe337ebaa5b51ecf26b785c41c7 (diff)
downloadFreeBSD-src-10a841cbfb0cea3932ca2727dc675944e91b7f3c.zip
FreeBSD-src-10a841cbfb0cea3932ca2727dc675944e91b7f3c.tar.gz
MFp4 (//depot/projects/tcpecn/):
TCP ECN support. Merge of my GSoC 2006 work for NetBSD. TCP ECN is defined in RFC 3168. Partly reviewed by: dwmalone, silby Obtained from: NetBSD
Diffstat (limited to 'sys/netinet/tcp_syncache.c')
-rw-r--r--sys/netinet/tcp_syncache.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index 3b5ae20..9578781 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -129,7 +129,7 @@ struct syncache {
u_int8_t sc_ip_tos; /* IPv4 TOS */
u_int8_t sc_requested_s_scale:4,
sc_requested_r_scale:4;
- u_int8_t sc_flags;
+ u_int16_t sc_flags;
#define SCF_NOOPT 0x01 /* no TCP options */
#define SCF_WINSCALE 0x02 /* negotiated window scaling */
#define SCF_TIMESTAMP 0x04 /* negotiated timestamps */
@@ -137,6 +137,7 @@ struct syncache {
#define SCF_UNREACH 0x10 /* icmp unreachable received */
#define SCF_SIGNATURE 0x20 /* send MD5 digests */
#define SCF_SACK 0x80 /* send SACK option */
+#define SCF_ECN 0x100 /* send ECN setup packet */
#ifndef TCP_OFFLOAD_DISABLE
struct toe_usrreqs *sc_tu; /* TOE operations */
void *sc_toepcb; /* TOE protocol block */
@@ -807,6 +808,9 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m)
tp->t_flags |= TF_SACK_PERMIT;
}
+ if (sc->sc_flags & SCF_ECN)
+ tp->t_flags |= TF_ECN_PERMIT;
+
/*
* Set up MSS and get cached values from tcp_hostcache.
* This might overwrite some of the defaults we just set.
@@ -1231,6 +1235,8 @@ _syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
sc->sc_peer_mss = to->to_mss; /* peer mss may be zero */
if (noopt)
sc->sc_flags |= SCF_NOOPT;
+ if ((th->th_flags & (TH_ECE|TH_CWR)) && tcp_do_ecn)
+ sc->sc_flags |= SCF_ECN;
if (tcp_syncookies) {
syncookie_generate(sch, sc, &flowtmp);
@@ -1369,6 +1375,11 @@ syncache_respond(struct syncache *sc)
th->th_win = htons(sc->sc_wnd);
th->th_urp = 0;
+ if (sc->sc_flags & SCF_ECN) {
+ th->th_flags |= TH_ECE;
+ tcpstat.tcps_ecn_shs++;
+ }
+
/* Tack on the TCP options. */
if ((sc->sc_flags & SCF_NOOPT) == 0) {
to.to_flags = 0;
OpenPOWER on IntegriCloud