#!/usr/bin/perl

# Achtung: Es muß die passende MTU beim pppd eingestellt werden!

@route = `/sbin/route -n`;
# Da steht sowas:
# Kernel IP routing table
# Destination     Gateway        Genmask         Flags Metric Ref    Use Iface
# 172.16.0.135    0.0.0.0        255.255.255.255 UH    0      0        0 dummy0
# 127.0.0.1       0.0.0.0        255.255.255.255 UH    0      0        0 lo
# 131.159.1.1     0.0.0.0        255.255.255.255 UH    0      0        0 ppp0
# 127.0.0.0       0.0.0.0        255.0.0.0       U     0      0        4 lo
# 0.0.0.0         131.159.1.1    0.0.0.0         UG    0      0        3 ppp0

foreach (@route)
{
  next unless /^0\.0\.0\.0/;
  /^0\.0\.0\.0\s+(\d+\.\d+\.\d+\.\d+)\s+.+ppp/;
  $gateway = $1;
  print "Gateway ist: $gateway\n";
  system("route del 0.0.0.0");
  system("route add default gw $gateway mss 256 window 768");
  system("route del $gateway");
  system("route add -host $gateway mss 256 window 768");
}

# Linux:
#  MTU 296
#  TCP RWIN ???
#  TCP MSS 536
#  TCP RTO Max 10

# Das RWin sollte genau 3-4mal MSS sein, also 1608 oder 2144
# Trumpet Winsock: 1536 oder 2048
# MSS = MTU-40

#  Trumpet Winsock Einstellungen: 
#  MTU 552
#  TCP RWIN 2048
#  TCP MSS 512
#  TCP RTO Max 10
#  (oder auch 60)

# Klein:
# MTU  = 296
# MSS  = 296-40 = 256
# RWIN = 4*256  = 1024

# Kleinst-möglich:
# MTU  = 296
# MSS  = 296-40 = 256
# RWIN = 3*256  = 768
