* Patch for 6in4
@ 2016-03-19 18:18 k0ga
0 siblings, 0 replies; only message in thread
From: k0ga @ 2016-03-19 18:18 UTC (permalink / raw)
To: 9front
[-- Attachment #1: Type: text/plain, Size: 276 bytes --]
Hi,
I was having a problem with 6in4 because it takes as local ipv4 of the
tunnel the first valid ip of the stack, that in my case is not the
public ipv4 I am using in the tunnel. This patch adds a new flag that
allows to set what is the local IPv4 in the tunnel.
Regards,
[-- Attachment #2: 6in4.patch --]
[-- Type: text/plain, Size: 1414 bytes --]
diff -r 3e63050481a8 sys/src/cmd/ip/6in4.c
--- a/sys/src/cmd/ip/6in4.c Sat Mar 05 07:44:02 2016 +0100
+++ b/sys/src/cmd/ip/6in4.c Sat Mar 19 19:10:14 2016 +0100
@@ -240,10 +240,12 @@
main(int argc, char **argv)
{
int tunnel, v6net;
+ char *local4;
fmtinstall('I', eipfmt);
fmtinstall('V', eipfmt);
fmtinstall('M', eipfmt);
+ local4 = nil;
ARGBEGIN {
case 'a':
@@ -261,12 +263,20 @@
case 'o':
outside = EARGF(usage());
break;
+ case 'i':
+ local4 = EARGF(usage());
+ break;
default:
usage();
} ARGEND
- if (myipaddr(myip, outside) < 0)
- sysfatal("can't find my ipv4 address on %s", outside);
+ if (!local4) {
+ if (myipaddr(myip, outside) < 0)
+ sysfatal("can't find my ipv4 address on %s", outside);
+ } else {
+ if (parseip(myip, local4) == -1)
+ sysfatal("bad local v4 address %s", local4);
+ }
if (!isv4(myip))
sysfatal("my ip, %I, is not a v4 address", myip);
diff -r 3e63050481a8 sys/man/8/6in4
--- a/sys/man/8/6in4 Sat Mar 05 07:44:02 2016 +0100
+++ b/sys/man/8/6in4 Sat Mar 19 19:10:41 2016 +0100
@@ -92,6 +92,13 @@
permit any remote IPv4 address as the far end of a tunnel.
This is likely to be useful for the server side of a tunnel.
.TP
+.B -i
+for
+.IR 6in4 ,
+define what is the local IPv4,
+otherwise it takes
+the first valid IP address in the IP stack rooted at net.
+.TP
.B -g
use the tunnel as the default route for global IPv6 addresses
.TP
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-03-19 18:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-19 18:18 Patch for 6in4 k0ga
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).