summaryrefslogtreecommitdiff
path: root/sys/src/9/ip/arp.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2022-12-18 00:40:23 +0000
committercinap_lenrek <cinap_lenrek@felloff.net>2022-12-18 00:40:23 +0000
commit834b7f36cf4da1f4c08d27f1db9e0eed8717c542 (patch)
treea5e139487e292868516c463d9d080c35052419a4 /sys/src/9/ip/arp.c
parent73e115aab038880a68c9f73b5c49d8fa12d0e5e2 (diff)
devip: fix icmp bugs
icmpdontfrag() was not working properly, need to pass the gating source interface. in fact, we now always pass the source interface to all icmp*() functions, which is used to determine source ip address of the icmp reply. also dont generate a icmp response for packets going to non-unicast addresses (such as broadcast). increase the amount of icmp response payload, but keep icmp responses below the minimum ipv4 mtu (68 bytes). regularize icmpv6 function names. move icmp unreachable codes to icmpv6.c. provide the mtu value for icmppkttoobig6(). dont advise announced udp connections. avoid code duplication in icmp.c and icmpv6.c, by having single send function with type, code and arg parameters. maintain statistics for sent ipv4 icmp types. avoid route lookup in ipout*() by passing Routehint* to icmpnohost*(). iladvise()... more like ill advice.
Diffstat (limited to 'sys/src/9/ip/arp.c')
-rw-r--r--sys/src/9/ip/arp.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/src/9/ip/arp.c b/sys/src/9/ip/arp.c
index c1dce39c0..74d36b1ee 100644
--- a/sys/src/9/ip/arp.c
+++ b/sys/src/9/ip/arp.c
@@ -562,7 +562,7 @@ ndpsendsol(Fs *f, Arpent *a)
return;
send:
if(!waserror()){
- icmpns(f, src, SRC_UNI, targ, TARG_MULTI, ifc->mac);
+ icmpns6(f, src, SRC_UNI, targ, TARG_MULTI, ifc->mac);
poperror();
}
}
@@ -606,24 +606,27 @@ rxmt(Arp *arp)
static void
drop(Fs *f, Block *bp)
{
- Block *next;
- Ipifc *ifc;
+ Routehint rh;
Route *r;
+ Ipifc *ifc;
+ Block *next;
for(; bp != nil; bp = next){
next = bp->list;
bp->list = nil;
+ rh.r = nil;
+ rh.a = nil;
if((bp->rp[0]&0xF0) == IP_VER4)
- r = v4lookup(f, ((Ip4hdr*)bp->rp)->src, ((Ip4hdr*)bp->rp)->dst, nil);
+ r = v4lookup(f, ((Ip4hdr*)bp->rp)->src, ((Ip4hdr*)bp->rp)->dst, &rh);
else
- r = v6lookup(f, ((Ip6hdr*)bp->rp)->src, ((Ip6hdr*)bp->rp)->dst, nil);
+ r = v6lookup(f, ((Ip6hdr*)bp->rp)->src, ((Ip6hdr*)bp->rp)->dst, &rh);
if(r != nil && (ifc = r->ifc) != nil && canrlock(ifc)){
if(!waserror()){
if((bp->rp[0]&0xF0) == IP_VER4)
- icmpnohost(f, ifc, bp);
+ icmpnohost(f, ifc, bp, &rh);
else
- icmphostunr6(f, ifc, bp, Icmp6_adr_unreach, (r->type & Runi) != 0);
+ icmpnohost6(f, ifc, bp, &rh);
poperror();
}
runlock(ifc);