From: k0ga@shike2.com
To: 9front@9front.org
Subject: Patch for 6in4
Date: Sat, 19 Mar 2016 19:18:06 +0100 [thread overview]
Message-ID: <caae6e9d961ffcc7c7afd5e9bb1c4aa9@shike2.com> (raw)
[-- 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
reply other threads:[~2016-03-19 18:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=caae6e9d961ffcc7c7afd5e9bb1c4aa9@shike2.com \
--to=k0ga@shike2.com \
--cc=9front@9front.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).