diff options
-rw-r--r-- | sys/man/8/6in4 | 11 | ||||
-rw-r--r-- | sys/src/cmd/ip/6in4.c | 11 | ||||
-rw-r--r-- | sys/src/cmd/ip/ayiya.c | 11 |
3 files changed, 27 insertions, 6 deletions
diff --git a/sys/man/8/6in4 b/sys/man/8/6in4 index 6e44d2a96..d34c652ac 100644 --- a/sys/man/8/6in4 +++ b/sys/man/8/6in4 @@ -6,6 +6,9 @@ [ .B -ag ] [ +.B -m +.I mtu +] [ .B -x .I netmtpt ] [ @@ -26,6 +29,9 @@ [ .B -g ] [ +.B -m +.I mtu +] [ .B -x .I netmtpt ] [ @@ -104,6 +110,11 @@ non-loopback address of the outside IP stack. .B -g use the tunnel as the default route for global IPv6 addresses .TP +.B -m +.I mtu +specifies the outside MTU in bytes from which the inside +tunnel MTU is derived. Deaults to 1500 - 8 (Ethernet - PPPoE). +.TP .B -x use the network mounted at .I netmtpt diff --git a/sys/src/cmd/ip/6in4.c b/sys/src/cmd/ip/6in4.c index 7ef633fed..f7e27be62 100644 --- a/sys/src/cmd/ip/6in4.c +++ b/sys/src/cmd/ip/6in4.c @@ -46,6 +46,8 @@ struct Iphdr #define STFHDR offsetof(Iphdr, payload[0]) +int mtu = 1500-8; + int anysender; int gateway; int debug; @@ -71,7 +73,7 @@ static void tunnel2ip(int, int); static void usage(void) { - fprint(2, "usage: %s [-ag] [-x mtpt] [-o mtpt] [-i local4] [local6[/mask]] [remote4 [remote6]]\n", + fprint(2, "usage: %s [-ag] [-m mtu] [-x mtpt] [-o mtpt] [-i local4] [local6[/mask]] [remote4 [remote6]]\n", argv0); exits("Usage"); } @@ -191,8 +193,8 @@ setup(int *v6net, int *tunp) *v6net = open(path, ORDWR); if (*v6net < 0 || fprint(cfd, "bind pkt") < 0) sysfatal("can't bind packet interface: %r"); - /* 1280 is MTU, apparently from rfc2460 */ - if (fprint(cfd, "add %I %M %I 1280", local6, localmask, remote6) <= 0) + if (fprint(cfd, "add %I %M %I %d", local6, localmask, remote6, + mtu - IPV4HDR_LEN) <= 0) sysfatal("can't set local ipv6 address: %r"); close(cfd); if (debug) @@ -255,6 +257,9 @@ main(int argc, char **argv) case 'g': gateway++; break; + case 'm': + mtu = atoi(EARGF(usage())); + break; case 'x': outside = inside = EARGF(usage()); break; diff --git a/sys/src/cmd/ip/ayiya.c b/sys/src/cmd/ip/ayiya.c index 052d0640f..76d90bc17 100644 --- a/sys/src/cmd/ip/ayiya.c +++ b/sys/src/cmd/ip/ayiya.c @@ -76,6 +76,8 @@ struct AYIYA AYIYA conf; +int mtu = 1500-8; + int gateway; int debug; @@ -283,7 +285,7 @@ ayiyarquery(char *q) static void usage(void) { - fprint(2, "usage: %s [-g] [-x mtpt] [-k secret] local6[/mask] remote4 remote6\n", + fprint(2, "usage: %s [-g] [-m mtu] [-x mtpt] [-k secret] local6[/mask] remote4 remote6\n", argv0); exits("Usage"); } @@ -363,8 +365,8 @@ setup(int *v6net) *v6net = open(path, ORDWR); if (*v6net < 0 || fprint(cfd, "bind pkt") < 0) sysfatal("can't bind packet interface: %r"); - /* 1280 is MTU, apparently from rfc2460 */ - if (fprint(cfd, "add %I %M %I 1280", local6, localmask, remote6) <= 0) + if (fprint(cfd, "add %I %M %I %d", local6, localmask, remote6, + mtu - (IPV4HDR_LEN+8) - (8+conf.idlen+conf.siglen)) <= 0) sysfatal("can't set local ipv6 address: %r"); close(cfd); if (debug) @@ -424,6 +426,9 @@ main(int argc, char **argv) case 'g': gateway++; break; + case 'm': + mtu = atoi(EARGF(usage())); + break; case 'x': inside = EARGF(usage()); break; |