From ea943effcb875a959fcdeda386207eaea3741bf8 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Fri, 29 Oct 1999 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1999-10-29 --- ip/ipifc.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/ip/ipifc.c b/ip/ipifc.c index ced0d0b1c2f6891c3a316e654371fb04eaabc347..c6fe4f95251beaf7fd3a12c9581daee09ca90b07 100644 --- a/ip/ipifc.c +++ b/ip/ipifc.c @@ -475,15 +475,27 @@ ipifcrem(Ipifc *ifc, char **argv, int argc, int dolock) if(dolock) wlock(ifc); - /* find address on this interface and remove from chain */ - lifc = nil; - for(l = &ifc->lifc; *l; l = &(*l)->next) - if(memcmp(ip, (*l)->local, IPaddrlen) == 0) - if(memcmp(mask, (*l)->mask, IPaddrlen) == 0){ - lifc = *l; + /* Are we point to point */ + type = 0; + if(ipcmp(mask, IPallbits) == 0) + type = Rptpt; + + /* + * find address on this interface and remove from chain. + * for pt to pt we actually specify the remote address at the + * addresss to remove. + */ + l = &ifc->lifc; + for(lifc = *l; lifc != nil; lifc = lifc->next) { + addr = lifc->local; + if(type == Rptpt) + addr = lifc->remote; + if(memcmp(ip, addr, IPaddrlen) == 0 && memcmp(mask, lifc->mask, IPaddrlen) == 0) { *l = lifc->next; break; } + l = &lifc->next; + } if(lifc == nil){ if(dolock)