Caching loopback interface.
This commit is contained in:
parent
a8bb459a3f
commit
77772dbc65
1 changed files with 11 additions and 6 deletions
|
@ -107,6 +107,7 @@ krt_sock_send(int cmd, rte *e, char *name)
|
|||
struct ks_msg msg;
|
||||
char *body = (char *)msg.buf;
|
||||
sockaddr gate, mask, dst;
|
||||
static struct iface *loop = NULL;
|
||||
|
||||
DBG("krt-sock: send %I/%d via %I", net->n.prefix, net->n.pxlen, a->gw);
|
||||
|
||||
|
@ -145,16 +146,20 @@ krt_sock_send(int cmd, rte *e, char *name)
|
|||
*/
|
||||
if(!i)
|
||||
{
|
||||
i = HEAD(iface_list);
|
||||
|
||||
WALK_LIST(j, iface_list)
|
||||
if(!loop)
|
||||
{
|
||||
if (j->flags & IF_LOOPBACK)
|
||||
i = HEAD(iface_list);
|
||||
|
||||
WALK_LIST(j, iface_list)
|
||||
{
|
||||
i = j;
|
||||
break;
|
||||
if (j->flags & IF_LOOPBACK)
|
||||
{
|
||||
i = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
i = loop;
|
||||
}
|
||||
|
||||
switch (a->dest)
|
||||
|
|
Loading…
Reference in a new issue