ref: 5655f2e28e077e38c64425a61b2394cdfbbe8af8
parent: bd6cae6a10c11221864bf4ee92ccd97bf733c733
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat May 27 15:59:57 EDT 2023
ip/ipconfig: add -y flag to ipconfig to set proxy-arp for an interface
--- a/sys/man/8/ipconfig
+++ b/sys/man/8/ipconfig
@@ -5,7 +5,7 @@
.in +0.25i
.ti -0.25i
.B ip/ipconfig
-.RB [ -6DGNOPdnprtuX ]
+.RB [ -6DGNOPdnprtuXy ]
.RB [ -U
.IR duid ]
.RB [ -b
@@ -268,6 +268,12 @@
.TP
.B X
don't fork a process to keep the DHCP lease alive.
+.TP
+.B y
+When adding an address,
+ARP proxy the new network on other interfaces
+if the sub-net falls within a super-net
+on the other interface.
.TP
.B o
adds
--- a/sys/src/cmd/ip/ipconfig/ipconfig.h
+++ b/sys/src/cmd/ip/ipconfig/ipconfig.h
@@ -110,6 +110,7 @@
extern int plan9;
extern int Oflag;
+extern int yflag;
extern int dupl_disc;
--- a/sys/src/cmd/ip/ipconfig/ipv6.c
+++ b/sys/src/cmd/ip/ipconfig/ipv6.c
@@ -376,6 +376,8 @@
maskip(conf.laddr, conf.mask, conf.raddr);
n += snprint(buf+n, sizeof buf-n, " %I", conf.raddr);
n += snprint(buf+n, sizeof buf-n, " %d", conf.mtu);
+ if(yflag)
+ n += snprint(buf+n, sizeof buf-n, " proxy");
DEBUG("ip6cfg: %.*s", n, buf);
if(write(conf.cfd, buf, n) < 0){
--- a/sys/src/cmd/ip/ipconfig/main.c
+++ b/sys/src/cmd/ip/ipconfig/main.c
@@ -24,6 +24,7 @@
int Oflag;
int rflag;
int tflag;
+int yflag;
int dodhcp;
int nodhcpwatch;
@@ -54,7 +55,7 @@
void
usage(void)
{
- fprint(2, "usage: %s [-6dDGnNOpPrtuX][-b baud][-c ctl]* [-U duid] [-g gw]"
+ fprint(2, "usage: %s [-6dDGnNOpPrtuXy][-b baud][-c ctl]* [-U duid] [-g gw]"
"[-h host][-m mtu][-s dns]...\n"
"\t[-f dbfile][-x mtpt][-o dhcpopt] type dev [verb] [laddr [mask "
"[raddr [fs [auth]]]]]\n", argv0);
@@ -438,6 +439,9 @@
case 'X':
nodhcpwatch = 1;
break;
+ case 'y':
+ yflag = 1;
+ break;
default:
usage();
} ARGEND;
@@ -657,8 +661,10 @@
maskip(conf.laddr, conf.mask, conf.raddr);
n += snprint(buf+n, sizeof buf-n, " %I", conf.raddr);
n += snprint(buf+n, sizeof buf-n, " %d", conf.mtu);
+ if(yflag)
+ n += snprint(buf+n, sizeof buf-n, " proxy");
if(tflag)
- n += snprint(buf+n, sizeof buf-n, " trans");
+ n += snprint(buf+n, sizeof buf-n, "%strans", yflag? ",": " ");
DEBUG("ip4cfg: %.*s", n, buf);
if(write(conf.cfd, buf, n) < 0){