ip/ipconfig: setup per local address default routes

front
cinap_lenrek 2018-04-11 22:57:16 +02:00
parent 874701d193
commit 780c5dfd1a
2 changed files with 10 additions and 1 deletions

View File

@ -548,6 +548,7 @@ static void
recvrahost(uchar buf[], int pktlen)
{
int m, n, optype;
uchar src[IPaddrlen];
Lladdropt *llao;
Mtuopt *mtuo;
Prefixopt *prfo;
@ -616,13 +617,17 @@ recvrahost(uchar buf[], int pktlen)
conf.validlt = nhgetl(prfo->validlt);
conf.preflt = nhgetl(prfo->preflt);
issueadd6(&conf);
if(conf.routerlt == 0)
break;
if((prfo->lar & RFMASK) != 0)
ipmove(conf.gaddr, prfo->pref);
else
ipmove(conf.gaddr, ra->src);
adddefroute(conf.gaddr, conf.laddr, conf.v6pref, conf.mask);
memmove(src, conf.v6pref, 8);
memmove(src+8, conf.laddr+8, 8);
adddefroute(conf.gaddr, conf.laddr, src, conf.mask);
break;
}
}

View File

@ -737,6 +737,10 @@ adddefroute(uchar *gaddr, uchar *laddr, uchar *src, uchar *smask)
smask = IPnoaddr;
}
addroute(dst, mask, gaddr, laddr, src, smask);
/* also add a source specific route */
if(ipcmp(src, IPnoaddr) != 0 && ipcmp(src, v4prefix) != 0)
addroute(dst, mask, gaddr, laddr, src, IPallbits);
}