summaryrefslogtreecommitdiff
path: root/sys/src/cmd
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2016-03-31 20:35:02 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2016-03-31 20:35:02 +0200
commit137533bd69847030d716658e1772c6320f9282bb (patch)
tree10ec546011363c1e31bec733d091dd00bd1b4faf /sys/src/cmd
parenteed13a5c22662fe4c77b8587e7a53c9b1ae96acb (diff)
6in4: allow setting the local IPv4 address with -i flag (thanks k0ga)
Diffstat (limited to 'sys/src/cmd')
-rw-r--r--sys/src/cmd/ip/6in4.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/src/cmd/ip/6in4.c b/sys/src/cmd/ip/6in4.c
index 3d3759af4..ae591a607 100644
--- a/sys/src/cmd/ip/6in4.c
+++ b/sys/src/cmd/ip/6in4.c
@@ -71,7 +71,7 @@ static void tunnel2ip(int, int);
static void
usage(void)
{
- fprint(2, "usage: %s [-ag] [-x mtpt] [-o mtpt] [local6[/mask]] [remote4 [remote6]]\n",
+ fprint(2, "usage: %s [-ag] [-x mtpt] [-o mtpt] [-i local4] [local6[/mask]] [remote4 [remote6]]\n",
argv0);
exits("Usage");
}
@@ -261,11 +261,14 @@ main(int argc, char **argv)
case 'o':
outside = EARGF(usage());
break;
+ case 'i':
+ parseip(myip, EARGF(usage()));
+ break;
default:
usage();
} ARGEND
- if (myipaddr(myip, outside) < 0)
+ if (ipcmp(myip, IPnoaddr) == 0 && myipaddr(myip, outside) < 0)
sysfatal("can't find my ipv4 address on %s", outside);
if (!isv4(myip))
sysfatal("my ip, %I, is not a v4 address", myip);