#!/bin/sh -v
exit   # do nothing for now!
. get_root
# the following window size and other stuff might be unnecessary...
# 
##win_size=256960
##win_size=1048576
#win_size=2560000

while true; do

mtu=1400
#mtu=1500

#echo $win_size > /proc/sys/net/core/rmem_default
#echo $win_size > /proc/sys/net/core/rmem_max
#echo $win_size > /proc/sys/net/core/wmem_default
#echo $win_size > /proc/sys/net/core/wmem_max
#echo 0 > /proc/sys/net/ipv4/tcp_timestamps 

#echo 0 > /proc/sys/net/ipv4/tcp_moderate_rcvbuf
#echo $win_size $win_size $win_size > /proc/sys/net/ipv4/tcp_rmem
#echo $win_size $win_size $win_size > /proc/sys/net/ipv4/tcp_wmem

# echo 1 > /proc/sys/net/ipv4/tcp_ecn

# echo pages pages pages > /proc/sys/net/ipv4/tcp_mem

# *** this is the one that actually fixes it ***
ifconfig ppp0 mtu $mtu
ifconfig wlan0 mtu $mtu

# not sure if the following is helpful or no:
# no it's seems to be actively unhelpful!

# I assume pmtu does not work or something.

# # iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS  --clamp-mss-to-pmtu

#wondershaper ppp0 2000 360
##wondershaper ppp0 1024 384
#wondershaper wlan0 384 384

# # iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 128

# iptables -F

#/home/sam/multilink/multilink.sh

cp /etc/resolv.conf.my /etc/resolv.conf

#echo ; echo 'finished - press ^C to stop test'
#/home/sam/x/pingifs

# do NAT

#modprobe iptable_nat
#iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
#echo 1 > /proc/sys/net/ipv4/ip_forward

sleep 30
done
