diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-11-10 19:50:46 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-11-10 19:50:46 +0100 |
commit | b638c7753d8498eaec90f06a7c140ffe0ed76cdb (patch) | |
tree | e20dbe46127376074017b11119c4b9cd7112fc27 /sys/src/9/ip/arp.c | |
parent | d72a4043993d02b56873dfe40767cef9336685fc (diff) |
devip: use the routing table for local source ip address selection
when making outgoing connections, the source ip was selected
by just iterating from the first to the last interface and
trying each local address until a route was found. the result
was kind of hard to predict as it depends on the interface
order.
this change replaces the algorithm with the route lookup algorithm
that we already have which takes more specific desination and
source prefixes into account. so the order of interfaces does
not matter anymore.
Diffstat (limited to 'sys/src/9/ip/arp.c')
-rw-r--r-- | sys/src/9/ip/arp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/src/9/ip/arp.c b/sys/src/9/ip/arp.c index f71b0bad6..9c1a0cfc7 100644 --- a/sys/src/9/ip/arp.c +++ b/sys/src/9/ip/arp.c @@ -401,7 +401,7 @@ arpwrite(Fs *fs, char *s, int len) if((ifc = findipifc(fs, ia, ia, Runi)) == nil) error("no interface"); rlock(ifc); - if(!ipv6local(ifc, ia, ip) || arpenter(fs, V6, ip, mac, n, ia, ifc, 0) < 0){ + if(!ipv6local(ifc, ia, 0, ip) || arpenter(fs, V6, ip, mac, n, ia, ifc, 0) < 0){ runlock(ifc); error("destination unreachable"); } @@ -450,7 +450,7 @@ arpread(Arp *arp, char *s, ulong offset, int len) qlock(arp); state = arpstate[a->state]; ipmove(ip, a->ip); - if(ifc->m == nil || a->ifcid != ifc->ifcid || !ipv6local(ifc, ia, ip)){ + if(ifc->m == nil || a->ifcid != ifc->ifcid || !ipv6local(ifc, ia, 0, ip)){ qunlock(arp); runlock(ifc); continue; @@ -507,7 +507,7 @@ ndpsendsol(Fs *f, Ipifc *ifc, Arpent *a) } else { arprelease(f->arp, a); } - if(!ipv6local(ifc, src, targ)) + if(!ipv6local(ifc, src, 0, targ)) return; send: if(!waserror()){ |