ref: ffc267c831a8f31591d5ee35dfb0796cf0efee79
parent: 4e3e6f11a5771c15d9083ab6bdfd2286eb53a8e4
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat May 27 17:23:08 EDT 2023
ip/ppp: bring back arp proxy, but with explicit -y flag
--- a/sys/man/8/ppp
+++ b/sys/man/8/ppp
@@ -4,7 +4,7 @@
.SH SYNOPSIS
.B ip/ppp
[
-.B -CPSacdfu
+.B -CPSacdfuy
] [
.B -b
.I baud
@@ -190,6 +190,11 @@
.B x
use the IP stack mounted at
.I netmntpt
+.TP
+.B y
+ARP proxy the interface.
+(see
+.IR ipconfig (8)).
.PD
.PP
If both the
--- a/sys/src/cmd/ip/ppp/ppp.c
+++ b/sys/src/cmd/ip/ppp/ppp.c
@@ -20,6 +20,7 @@
static int noauth;
static int dying; /* flag to signal to all threads its time to go */
static int primary;
+static int proxy;
static char *chatfile;
int debug;
@@ -1572,7 +1573,7 @@
}
static void
-ipconfig(int shell, char *net, char *dev, int mtu, Ipaddr gate, Ipaddr dns[2], char *duid)
+ipconfig(int shell, char *net, char *dev, int mtu, int proxy, Ipaddr gate, Ipaddr dns[2], char *duid)
{
fprint(shell, "ip/ipconfig -x %q ", net);
if(!primary){
@@ -1597,6 +1598,8 @@
fprint(shell, "-dU %q ", duid);
if(mtu > 0)
fprint(shell, "-m %d ", mtu);
+ if(proxy)
+ fprint(shell, "-y ");
fprint(shell, "pkt %q ", dev);
}
@@ -1604,10 +1607,10 @@
addip(int shell, char *net, char *dev, Ipaddr local, Ipaddr remote, int mtu, Ipaddr *dns)
{
if(validv4(local) && validv4(remote)){
- ipconfig(shell, net, dev, mtu, remote, dns, nil);
+ ipconfig(shell, net, dev, mtu, proxy, remote, dns, nil);
fprint(shell, "add %I 255.255.255.255 %I\n", local, remote);
} else if(validv6(local)){
- ipconfig(shell, net, dev, mtu, nil, nil, nil);
+ ipconfig(shell, net, dev, mtu, 0, nil, nil, nil);
fprint(shell, "add %I /64\n", local);
}
}
@@ -1616,10 +1619,10 @@
removeip(int shell, char *net, char *dev, Ipaddr local, Ipaddr remote)
{
if(validv4(local) && validv4(remote)){
- ipconfig(shell, net, dev, 0, remote, nil, nil);
+ ipconfig(shell, net, dev, 0, 0, remote, nil, nil);
fprint(shell, "remove %I 255.255.255.255\n", local);
} else if(validv6(local)){
- ipconfig(shell, net, dev, 0, nil, nil, nil);
+ ipconfig(shell, net, dev, 0, 0, nil, nil, nil);
fprint(shell, "remove %I /64\n", local);
}
}
@@ -1629,7 +1632,7 @@
{
if(server || !validv6(remote))
return;
- ipconfig(shell, net, dev, 0, remote, nil, duid);
+ ipconfig(shell, net, dev, 0, proxy, remote, nil, duid);
fprint(shell, "ra6 recvra 1\n");
}
@@ -2806,7 +2809,7 @@
void
usage(void)
{
- fprint(2, "usage: ppp [-CPSacdfu] [-b baud] [-k keyspec] [-m mtu] "
+ fprint(2, "usage: ppp [-CPSacdfuy] [-b baud] [-k keyspec] [-m mtu] "
"[-M chatfile] [-p dev] [-x netmntpt] [-t modemcmd] [-U duid] "
"[local-addr [remote-addr]]\n");
exits("usage");
@@ -2899,6 +2902,9 @@
break;
case 'x':
setnetmtpt(net, sizeof net, EARGF(usage()));
+ break;
+ case 'y':
+ proxy = 1;
break;
default:
fprint(2, "unknown option %c\n", ARGC());