merge
This commit is contained in:
commit
4d496b3c7a
2 changed files with 14 additions and 5 deletions
|
@ -449,6 +449,7 @@ sendarp(Ipifc *ifc, Arpent *a)
|
||||||
Block *bp;
|
Block *bp;
|
||||||
Etherarp *e;
|
Etherarp *e;
|
||||||
Etherrock *er = ifc->arg;
|
Etherrock *er = ifc->arg;
|
||||||
|
uchar targ[IPv4addrlen], src[IPv4addrlen];
|
||||||
|
|
||||||
/* don't do anything if it's been less than a second since the last */
|
/* don't do anything if it's been less than a second since the last */
|
||||||
if(NOW - a->ctime < 1000){
|
if(NOW - a->ctime < 1000){
|
||||||
|
@ -456,6 +457,9 @@ sendarp(Ipifc *ifc, Arpent *a)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* try to keep it around for a second more */
|
||||||
|
a->ctime = NOW;
|
||||||
|
|
||||||
/* remove all but the last message */
|
/* remove all but the last message */
|
||||||
while((bp = a->hold) != nil){
|
while((bp = a->hold) != nil){
|
||||||
if(bp == a->last)
|
if(bp == a->last)
|
||||||
|
@ -464,18 +468,20 @@ sendarp(Ipifc *ifc, Arpent *a)
|
||||||
freeblist(bp);
|
freeblist(bp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* try to keep it around for a second more */
|
memmove(targ, a->ip+IPv4off, IPv4addrlen);
|
||||||
a->ctime = NOW;
|
|
||||||
arprelease(er->f->arp, a);
|
arprelease(er->f->arp, a);
|
||||||
|
|
||||||
|
if(!ipv4local(ifc, src, targ))
|
||||||
|
return;
|
||||||
|
|
||||||
n = sizeof(Etherarp);
|
n = sizeof(Etherarp);
|
||||||
if(n < ifc->m->mintu)
|
if(n < ifc->m->mintu)
|
||||||
n = ifc->m->mintu;
|
n = ifc->m->mintu;
|
||||||
bp = allocb(n);
|
bp = allocb(n);
|
||||||
memset(bp->rp, 0, n);
|
memset(bp->rp, 0, n);
|
||||||
e = (Etherarp*)bp->rp;
|
e = (Etherarp*)bp->rp;
|
||||||
memmove(e->tpa, a->ip+IPv4off, sizeof(e->tpa));
|
memmove(e->tpa, targ, sizeof(e->tpa));
|
||||||
ipv4local(ifc, e->spa, e->tpa);
|
memmove(e->spa, src, sizeof(e->spa));
|
||||||
memmove(e->sha, ifc->mac, sizeof(e->sha));
|
memmove(e->sha, ifc->mac, sizeof(e->sha));
|
||||||
memset(e->d, 0xff, sizeof(e->d)); /* ethernet broadcast */
|
memset(e->d, 0xff, sizeof(e->d)); /* ethernet broadcast */
|
||||||
memmove(e->s, ifc->mac, sizeof(e->s));
|
memmove(e->s, ifc->mac, sizeof(e->s));
|
||||||
|
|
|
@ -1274,7 +1274,7 @@ ipv4local(Ipifc *ifc, uchar *local, uchar *remote)
|
||||||
|
|
||||||
b = -1;
|
b = -1;
|
||||||
for(lifc = ifc->lifc; lifc != nil; lifc = lifc->next){
|
for(lifc = ifc->lifc; lifc != nil; lifc = lifc->next){
|
||||||
if((lifc->type & Rv4) == 0)
|
if((lifc->type & Rv4) == 0 || ipcmp(lifc->local, IPnoaddr) == 0)
|
||||||
continue;
|
continue;
|
||||||
a = comprefixlen(lifc->local+IPv4off, remote, IPv4addrlen);
|
a = comprefixlen(lifc->local+IPv4off, remote, IPv4addrlen);
|
||||||
if(a > b){
|
if(a > b){
|
||||||
|
@ -1466,6 +1466,9 @@ ipifcaddmulti(Conv *c, uchar *ma, uchar *ia)
|
||||||
Ipifc *ifc;
|
Ipifc *ifc;
|
||||||
Fs *f;
|
Fs *f;
|
||||||
|
|
||||||
|
if(isv4(ma) != isv4(ia))
|
||||||
|
error("incompatible multicast/interface ip address");
|
||||||
|
|
||||||
for(l = &c->multi; *l != nil; l = &(*l)->next)
|
for(l = &c->multi; *l != nil; l = &(*l)->next)
|
||||||
if(ipcmp(ma, (*l)->ma) == 0 && ipcmp(ia, (*l)->ia) == 0)
|
if(ipcmp(ma, (*l)->ma) == 0 && ipcmp(ia, (*l)->ia) == 0)
|
||||||
return; /* it's already there */
|
return; /* it's already there */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue