diff options
Diffstat (limited to 'ppp/ip-up.ipv6to4')
-rw-r--r-- | ppp/ip-up.ipv6to4 | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/ppp/ip-up.ipv6to4 b/ppp/ip-up.ipv6to4 index da0ba48e..be45e488 100644 --- a/ppp/ip-up.ipv6to4 +++ b/ppp/ip-up.ipv6to4 @@ -9,7 +9,7 @@ # You will find more information in the IPv6-HowTo for Linux at # http://www.bieringer.de/linux/IPv6/ # -# Version 2002-11-02 +# Version 2002-11-12a # # Calling parameters: # $1: interface name @@ -27,6 +27,7 @@ # IPV6TO4INIT=yes|no: controls configuration # IPV6TO4_IPV4ADDR=<IPv4 address>: special local address for 6to4 tunneling (only needed behind a NAT gateway) # IPV6TO4_RELAY=<IPv4 address>: remote 6to4 relay router address (default: 192.88.99.1) +# IPV6TO4_MTU=<MTU for IPv6>: controls IPv6 MTU for the 6to4 link (optional, default is MTU of interface - 20) # IPV6TO4_ROUTING="<device>-<suffix>/<prefix length> ...": information to setup local subnetting # Example: IPV6TO4_ROUTING="eth0-:f101::0/64 eth1-:f102::0/64" # @@ -119,8 +120,23 @@ if [ "$IPV6TO4INIT" = "yes" ]; then # Cleanup all old data (needed, if "ip-down.ipv6to4" wasn't executed), delete all configured 6to4 address ipv6_cleanup_6to4_tunnels tun6to4 + # Get MTU of master device + ipv4mtu="`ipv6_exec_ip link show dev $DEVICE | grep -w "mtu" | awk '{ print $5 }'`" + if [ -n "$ipv4mtu" ]; then + # IPv6 tunnel MTU is IPv4 MTU minus 20 for IPv4 header + tunnelmtu=$[ $ipv4mtu - 20 ] + fi + + if [ -n "$IPV6TO4_MTU" ]; then + if [ $IPV6TO4_MTU -gt $tunnelmtu ]; then + echo $"Warning: configured MTU '$IPV6TO4_MTU' for 6to4 exceeds maximum limit of '$tunnelmtu', ignored" + else + tunnelmtu=$IPV6TO4_MTU + fi + fi + # Setup new data - ipv6_add_6to4_tunnel tun6to4 $ipv4addr || exit 1 + ipv6_add_6to4_tunnel tun6to4 $ipv4addr "" $tunnelmtu || exit 1 # Add default route, if device matches if [ "$IPV6_DEFAULTDEV" = "tun6to4" ]; then |