mirror of
git://git.9front.org/plan9front/plan9front
synced 2025-01-12 11:10:06 +00:00
devip: add gratious arp ctl message to /net/arp
writing "garp <ip>" will send a gratious arp for the provided ip address (if it can be found on any interface).
This commit is contained in:
parent
8a1c1c9510
commit
934d81ae4e
1 changed files with 22 additions and 2 deletions
|
@ -501,9 +501,9 @@ arpwrite(Fs *fs, char *s, int len)
|
|||
}
|
||||
runlock(ifc);
|
||||
} else if(strcmp(f[0], "del") == 0){
|
||||
if (n != 2)
|
||||
if(n != 2)
|
||||
error(Ebadarg);
|
||||
if (parseip(ip, f[1]) == -1)
|
||||
if(parseip(ip, f[1]) == -1)
|
||||
error(Ebadip);
|
||||
wlock(arp);
|
||||
for(a = arp->hash[hashipa(ip)]; a != nil; a = x){
|
||||
|
@ -512,6 +512,26 @@ arpwrite(Fs *fs, char *s, int len)
|
|||
cleanarpent(arp, a);
|
||||
}
|
||||
wunlock(arp);
|
||||
} else if(strcmp(f[0], "garp") == 0){
|
||||
Iplifc *lifc;
|
||||
|
||||
if(n != 2)
|
||||
error(Ebadarg);
|
||||
if(parseip(ip, f[1]) == -1)
|
||||
error(Ebadip);
|
||||
|
||||
if((ifc = findipifc(fs, ip, ip, Runi)) == nil)
|
||||
error("no interface");
|
||||
|
||||
rlock(ifc);
|
||||
if(waserror()){
|
||||
runlock(ifc);
|
||||
nexterror();
|
||||
}
|
||||
if(ifc->m != nil && ifc->m->areg != nil && (lifc = iplocalonifc(ifc, ip)) != nil)
|
||||
(*ifc->m->areg)(fs, ifc, lifc, ip);
|
||||
runlock(ifc);
|
||||
poperror();
|
||||
} else
|
||||
error(Ebadarp);
|
||||
|
||||
|
|
Loading…
Reference in a new issue