summaryrefslogtreecommitdiff
path: root/sys/src/9/ip/ethermedium.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2023-04-15 18:00:34 +0000
committercinap_lenrek <cinap_lenrek@felloff.net>2023-04-15 18:00:34 +0000
commita4fa14a9d8f604d3e1eb409091b4f0d879f9cf97 (patch)
tree025f770c4e149e7aceb29218e0530f5906ef8678 /sys/src/9/ip/ethermedium.c
parentb76d35401c0a056911aa192d4e4e6d86a15efa50 (diff)
ip: generalize Rproxy route handling, allowing non point-to-point arp proxy
Generalize the arp proxy code, so one can create specific routes for ip ranges that we want to arp proxy for, not just for point-to-point interface routes. as we have source specific routes, this also gives some control over which requester we will reply to. one example for this is a vps where we booked another ip address on the ethernet, that we want to route into a vpn tunnel. the new ip is in subnet of the public ethernet interface, so all we now need todo is add a route for that ip into the vpn tunnel and set the proxy flag "y", and we will respond to arp for that ip on the public ethernet interface.
Diffstat (limited to 'sys/src/9/ip/ethermedium.c')
-rw-r--r--sys/src/9/ip/ethermedium.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sys/src/9/ip/ethermedium.c b/sys/src/9/ip/ethermedium.c
index 999a65b5f..b2e04947a 100644
--- a/sys/src/9/ip/ethermedium.c
+++ b/sys/src/9/ip/ethermedium.c
@@ -508,7 +508,6 @@ recvarp(Ipifc *ifc)
int forme;
Block *ebp, *rbp;
Etherarp *e, *r;
- uchar ip[IPaddrlen];
static uchar eprinted[4];
Etherrock *er = ifc->arg;
@@ -529,8 +528,7 @@ recvarp(Ipifc *ifc)
break;
/* check for machine using my ip address */
- v4tov6(ip, e->spa);
- if(iplocalonifc(ifc, ip) != nil || ipproxyifc(er->f, ifc, ip)){
+ if(arpforme(er->f, V4, e->spa, e->tpa, ifc)){
if(memcmp(e->sha, ifc->mac, sizeof(e->sha)) != 0){
print("arprep: 0x%E/0x%E also has ip addr %V\n",
e->s, e->sha, e->spa);
@@ -552,8 +550,7 @@ recvarp(Ipifc *ifc)
break;
/* check for machine using my ip or ether address */
- v4tov6(ip, e->spa);
- if(iplocalonifc(ifc, ip) != nil || ipproxyifc(er->f, ifc, ip)){
+ if(arpforme(er->f, V4, e->spa, e->tpa, ifc)){
if(memcmp(e->sha, ifc->mac, sizeof(e->sha)) != 0){
if(memcmp(eprinted, e->spa, sizeof(e->spa)) != 0){
/* print only once */
@@ -576,8 +573,7 @@ recvarp(Ipifc *ifc)
* enter senders address into arp table and reply, otherwise just
* refresh the senders address.
*/
- v4tov6(ip, e->tpa);
- forme = iplocalonifc(ifc, ip) != nil || ipproxyifc(er->f, ifc, ip);
+ forme = arpforme(er->f, V4, e->tpa, e->spa, ifc);
if(arpenter(er->f, V4, e->spa, e->sha, sizeof(e->sha), e->tpa, ifc, !forme) < 0 || !forme)
break;