diff -ru linux-2.4.20-up/include/linux/sysctl.h linux-2.4.20-up-rude_tcp/include/linux/sysctl.h --- linux-2.4.20-up/include/linux/sysctl.h 2003-04-11 00:12:15.000000000 -0600 +++ linux-2.4.20-up-rude_tcp/include/linux/sysctl.h 2003-04-20 01:41:11.000000000 -0600 @@ -292,7 +292,9 @@ NET_IPV4_NONLOCAL_BIND=88, NET_IPV4_ICMP_RATELIMIT=89, NET_IPV4_ICMP_RATEMASK=90, - NET_TCP_TW_REUSE=91 + NET_TCP_TW_REUSE=91, + NET_TCP_RUDE=92, /* EWEWEW */ + NET_TCP_DROPEV=93 /* EWEWEW */ }; enum { diff -ru linux-2.4.20-up/include/linux/tcp.h linux-2.4.20-up-rude_tcp/include/linux/tcp.h --- linux-2.4.20-up/include/linux/tcp.h 2003-04-11 00:12:36.000000000 -0600 +++ linux-2.4.20-up-rude_tcp/include/linux/tcp.h 2003-04-20 01:24:05.000000000 -0600 @@ -26,7 +26,8 @@ __u32 seq; __u32 ack_seq; #if defined(__LITTLE_ENDIAN_BITFIELD) - __u16 res1:4, + __u16 rude:1, /* EWEWEW */ + res1:3, doff:4, fin:1, syn:1, @@ -38,7 +39,8 @@ cwr:1; #elif defined(__BIG_ENDIAN_BITFIELD) __u16 doff:4, - res1:4, + res1:3, + rude:1, /* EWEWEW */ cwr:1, ece:1, urg:1, @@ -127,6 +129,7 @@ #define TCP_WINDOW_CLAMP 10 /* Bound advertised window */ #define TCP_INFO 11 /* Information about this connection. */ #define TCP_QUICKACK 12 /* Block/reenable quick acks */ +#define TCP_RUDE 13 /* EWEWEW No congestion control */ #define TCPI_OPT_TIMESTAMPS 1 #define TCPI_OPT_SACK 2 diff -ru linux-2.4.20-up/include/net/sock.h linux-2.4.20-up-rude_tcp/include/net/sock.h --- linux-2.4.20-up/include/net/sock.h 2003-04-11 00:12:39.000000000 -0600 +++ linux-2.4.20-up-rude_tcp/include/net/sock.h 2003-04-20 01:24:05.000000000 -0600 @@ -354,6 +354,8 @@ __u8 snd_wscale; /* Window scaling received from sender */ __u8 rcv_wscale; /* Window scaling to send to receiver */ __u8 nonagle; /* Disable Nagle algorithm? */ + /* EWEWEW: This is really a flag, but want to keep alignment. May use the bits later. */ + __u32 rude; /* EWEWEW Run without congestion control? */ __u8 keepalive_probes; /* num of allowed keep alive probes */ /* PAWS/RTTM data */ diff -ru linux-2.4.20-up/include/net/tcp.h linux-2.4.20-up-rude_tcp/include/net/tcp.h --- linux-2.4.20-up/include/net/tcp.h 2003-04-11 00:13:13.000000000 -0600 +++ linux-2.4.20-up-rude_tcp/include/net/tcp.h 2003-04-20 01:39:38.000000000 -0600 @@ -460,6 +460,8 @@ extern int sysctl_tcp_app_win; extern int sysctl_tcp_adv_win_scale; extern int sysctl_tcp_tw_reuse; +extern int sysctl_tcp_rude; /* EWEWEW */ +extern int sysctl_tcp_dropev; /* EWEWEW */ extern atomic_t tcp_memory_allocated; extern atomic_t tcp_sockets_allocated; @@ -1108,6 +1110,9 @@ static inline void tcp_cwnd_validate(struct sock *sk, struct tcp_opt *tp) { + /* if (!tp->rude && tp->packets_out >= tp->snd_cwnd) + * Not doing this check; this function only causes changes to cwnd + * based on network behavior; we want that */ if (tp->packets_out >= tp->snd_cwnd) { /* Network is feed fully. */ tp->snd_cwnd_used = 0; @@ -1215,9 +1220,10 @@ /* Don't be strict about the congestion window for the * final FIN frame. -DaveM */ + /* EWEWEW: allow rudeness */ return ((nonagle==1 || tp->urg_mode || !tcp_nagle_check(tp, skb, cur_mss, nonagle)) && - ((tcp_packets_in_flight(tp) < tp->snd_cwnd) || + ((tp->rude || (tcp_packets_in_flight(tp) < tp->snd_cwnd)) || (TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN)) && !after(TCP_SKB_CB(skb)->end_seq, tp->snd_una + tp->snd_wnd)); } diff -ru linux-2.4.20-up/net/ipv4/sysctl_net_ipv4.c linux-2.4.20-up-rude_tcp/net/ipv4/sysctl_net_ipv4.c --- linux-2.4.20-up/net/ipv4/sysctl_net_ipv4.c 2002-08-02 18:39:46.000000000 -0600 +++ linux-2.4.20-up-rude_tcp/net/ipv4/sysctl_net_ipv4.c 2003-04-20 01:40:40.000000000 -0600 @@ -221,6 +221,12 @@ &sysctl_icmp_ratemask, sizeof(int), 0644, NULL, &proc_dointvec}, {NET_TCP_TW_REUSE, "tcp_tw_reuse", &sysctl_tcp_tw_reuse, sizeof(int), 0644, NULL, &proc_dointvec}, + /* EWEWEW */ + {NET_TCP_RUDE, "tcp_rude", + &sysctl_tcp_rude, sizeof(int), 0644, NULL, &proc_dointvec}, + /* EWEWEW */ + {NET_TCP_DROPEV, "tcp_dropev", + &sysctl_tcp_dropev, sizeof(int), 0644, NULL, &proc_dointvec}, {0} }; diff -ru linux-2.4.20-up/net/ipv4/tcp.c linux-2.4.20-up-rude_tcp/net/ipv4/tcp.c --- linux-2.4.20-up/net/ipv4/tcp.c 2002-11-28 16:53:15.000000000 -0700 +++ linux-2.4.20-up-rude_tcp/net/ipv4/tcp.c 2003-04-20 01:24:05.000000000 -0600 @@ -2390,6 +2390,25 @@ } } break; + case TCP_RUDE: /* EWEWEW */ + if (val) { + if (!sysctl_tcp_rude) { + err = -EINVAL; + } else { + tp->rude = 1; + } + } else { + if (tp->rude) { + /* no redemption for the lost */ + /* TODO: figure out how to do this... + * maybe just set cwnd=in_flight+1 + * (and pretend we see a loss event?) */ + err = -EINVAL; + } else { + tp->rude = 0; + } + } + break; default: err = -ENOPROTOOPT; @@ -2515,6 +2534,9 @@ case TCP_QUICKACK: val = !tp->ack.pingpong; break; + case TCP_RUDE: + val = tp->rude; /* EWEWEW */ + break; default: return -ENOPROTOOPT; }; diff -ru linux-2.4.20-up/net/ipv4/tcp_input.c linux-2.4.20-up-rude_tcp/net/ipv4/tcp_input.c --- linux-2.4.20-up/net/ipv4/tcp_input.c 2002-11-28 16:53:15.000000000 -0700 +++ linux-2.4.20-up-rude_tcp/net/ipv4/tcp_input.c 2003-04-20 01:24:05.000000000 -0600 @@ -2952,7 +2952,8 @@ { struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp); - if (tp->packets_out < tp->snd_cwnd && + /* EWEWEW */ + if ((tp->rude || (tp->packets_out < tp->snd_cwnd)) && !(sk->userlocks&SOCK_SNDBUF_LOCK) && !tcp_memory_pressure && atomic_read(&tcp_memory_allocated) < sysctl_tcp_mem[0]) { @@ -2960,6 +2961,9 @@ sndmem = tp->mss_clamp+MAX_TCP_HEADER+16+sizeof(struct sk_buff); demanded = max_t(unsigned int, tp->snd_cwnd, tp->reordering+1); + /* EWEWEW rude; packets out may be above snd_cwnd */ + demanded = max_t(unsigned int, tp->packets_out+1, demanded); + sndmem *= 2*demanded; if (sndmem > sk->sndbuf) sk->sndbuf = min(sndmem, sysctl_tcp_wmem[2]); @@ -2984,8 +2988,9 @@ { struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp); + /* EWEWEW rude check */ if (after(TCP_SKB_CB(skb)->end_seq, tp->snd_una + tp->snd_wnd) || - tcp_packets_in_flight(tp) >= tp->snd_cwnd || + (!tp->rude && tcp_packets_in_flight(tp) >= tp->snd_cwnd) || tcp_write_xmit(sk, tp->nonagle)) tcp_check_probe_timer(sk, tp); } diff -ru linux-2.4.20-up/net/ipv4/tcp_ipv4.c linux-2.4.20-up-rude_tcp/net/ipv4/tcp_ipv4.c --- linux-2.4.20-up/net/ipv4/tcp_ipv4.c 2002-11-28 16:53:15.000000000 -0700 +++ linux-2.4.20-up-rude_tcp/net/ipv4/tcp_ipv4.c 2003-04-20 01:46:57.000000000 -0600 @@ -66,6 +66,8 @@ extern int sysctl_ip_dynaddr; extern int sysctl_ip_default_ttl; int sysctl_tcp_tw_reuse = 0; +int sysctl_tcp_rude = 0; /* EWEWEW; not rude to start with */ +int sysctl_tcp_dropev = 0; /* EWEWEW; drop nothing to start with */ /* Check TCP sequence numbers in ICMP packets. */ #define ICMP_MIN_LENGTH 8 diff -ru linux-2.4.20-up/net/ipv4/tcp_output.c linux-2.4.20-up-rude_tcp/net/ipv4/tcp_output.c --- linux-2.4.20-up/net/ipv4/tcp_output.c 2002-11-28 16:53:15.000000000 -0700 +++ linux-2.4.20-up-rude_tcp/net/ipv4/tcp_output.c 2003-04-20 02:25:02.000000000 -0600 @@ -43,6 +43,7 @@ /* People can turn this off for buggy TCP's found in printers etc. */ int sysctl_tcp_retrans_collapse = 1; +int sysctl_tcp_dropev_cnt = 0; static __inline__ void update_send_head(struct sock *sk, struct tcp_opt *tp, struct sk_buff *skb) @@ -199,6 +200,14 @@ #define SYSCTL_FLAG_TSTAMPS 0x1 #define SYSCTL_FLAG_WSCALE 0x2 #define SYSCTL_FLAG_SACK 0x4 + /* Drop every NTh outgoing packet */ + sysctl_tcp_dropev_cnt++; + if (sysctl_tcp_dropev && sysctl_tcp_dropev_cnt>sysctl_tcp_dropev) { + kfree_skb(skb); + sysctl_tcp_dropev_cnt=0; + return 0; /* don't report error; lost "in network" */ + } + /* END of drop code */ sysctl_flags = 0; if (tcb->flags & TCPCB_FLAG_SYN) { @@ -249,6 +258,8 @@ th->urg_ptr = htons(tp->snd_up-tcb->seq); th->urg = 1; } + /* EWEWEW */ + th->rude= (tp->rude ? 1 : 0); if (tcb->flags & TCPCB_FLAG_SYN) { tcp_syn_build_options((__u32 *)(th + 1), @@ -919,7 +930,8 @@ for_retrans_queue(skb, sk, tp) { __u8 sacked = TCP_SKB_CB(skb)->sacked; - if (tcp_packets_in_flight(tp) >= tp->snd_cwnd) + /* EWEWEW */ + if (!tp->rude && (tcp_packets_in_flight(tp) >= tp->snd_cwnd)) return; if (sacked&TCPCB_LOST) { @@ -967,7 +979,8 @@ if(++packet_cnt > tp->fackets_out) break; - if (tcp_packets_in_flight(tp) >= tp->snd_cwnd) + /* EWEWEW */ + if (!tp->rude && (tcp_packets_in_flight(tp) >= tp->snd_cwnd)) break; if(TCP_SKB_CB(skb)->sacked & TCPCB_TAGBITS)