diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2023-11-18 17:58:10 +0000 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2023-11-18 17:58:10 +0000 |
commit | 14f0eae74a9a9f5c5caebbecb11b136a12e65a22 (patch) | |
tree | 4aaf8168e4879cbf6905195fd6c30573fbb8edfa /sys/src/9/ip/ethermedium.c | |
parent | 04d6a2acecfe4fe44947da8b676f63bcd0f3c0fe (diff) |
devip: have findipifc() return rlock'd interface, allow to use "del" instead of "remove" for route and interface operations
The findipifc() function is kind of useless when
it returns an unlocked interface without also
providing the ifcid as the interface can be
subject to reconfiguration while unlocked.
Instead, we make findipifc() keep the interface
that it returns locked.
This is also needed for v4source() and v6source()
functions, which call ipv4local()/ipv4local()
which in turn walk the local interface chain,
and must do so under the rlock.
Also, accept the "del" verb in addition to
"remove" to keep it consistent, which also
leads to much more consistent naming in the code.
Abbreviating remove to "rem" can collide with
abbreviations for remote.
Diffstat (limited to 'sys/src/9/ip/ethermedium.c')
-rw-r--r-- | sys/src/9/ip/ethermedium.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/src/9/ip/ethermedium.c b/sys/src/9/ip/ethermedium.c index 36bee6bfc..b5ff46337 100644 --- a/sys/src/9/ip/ethermedium.c +++ b/sys/src/9/ip/ethermedium.c @@ -23,7 +23,7 @@ static void etherbind(Ipifc *ifc, int argc, char **argv); static void etherunbind(Ipifc *ifc); static void etherbwrite(Ipifc *ifc, Block *bp, int version, uchar *ip, Routehint *rh); static void etheraddmulti(Ipifc *ifc, uchar *a, uchar *ia); -static void etherremmulti(Ipifc *ifc, uchar *a, uchar *ia); +static void etherdelmulti(Ipifc *ifc, uchar *a, uchar *ia); static void etherareg(Fs *f, Ipifc *ifc, Iplifc *lifc, uchar *ip); static Block* multicastarp(Fs *f, Arpent *a, uchar *mac, Routehint *rh); static Block* newEARP(void); @@ -43,7 +43,7 @@ Medium ethermedium = .unbind= etherunbind, .bwrite= etherbwrite, .addmulti= etheraddmulti, -.remmulti= etherremmulti, +.delmulti= etherdelmulti, .areg= etherareg, .pref2addr= etherpref2addr, }; @@ -59,7 +59,7 @@ Medium gbemedium = .unbind= etherunbind, .bwrite= etherbwrite, .addmulti= etheraddmulti, -.remmulti= etherremmulti, +.delmulti= etherdelmulti, .areg= etherareg, .pref2addr= etherpref2addr, }; @@ -419,7 +419,7 @@ etheraddmulti(Ipifc *ifc, uchar *a, uchar *) } static void -etherremmulti(Ipifc *ifc, uchar *a, uchar *) +etherdelmulti(Ipifc *ifc, uchar *a, uchar *) { uchar mac[6]; char buf[64]; @@ -436,7 +436,7 @@ etherremmulti(Ipifc *ifc, uchar *a, uchar *) devtab[er->cchan6->type]->write(er->cchan6, buf, strlen(buf), 0); break; default: - panic("etherremmulti: version %d", version); + panic("etherdelmulti: version %d", version); } } @@ -734,10 +734,10 @@ etherareg(Fs *f, Ipifc *ifc, Iplifc *lifc, uchar *ip) ipv62smcast(a, ip); addroute(f, a, IPallbits, v6Unspecified, IPallbits, ip, Rmulti, ifc, tdad); if(waserror()){ - remroute(f, a, IPallbits, v6Unspecified, IPallbits, ip, Rmulti, ifc, tdad); + delroute(f, a, IPallbits, v6Unspecified, IPallbits, ip, Rmulti, ifc, tdad); nexterror(); } icmpns6(f, 0, SRC_UNSPEC, ip, TARG_MULTI, ifc->mac, 6); poperror(); - remroute(f, a, IPallbits, v6Unspecified, IPallbits, ip, Rmulti, ifc, tdad); + delroute(f, a, IPallbits, v6Unspecified, IPallbits, ip, Rmulti, ifc, tdad); } |