Removed the `async' switch which was used for debugging only anyway.
Don't moan when netlink reports lost packets.
This commit is contained in:
parent
d0126f0bf0
commit
b6c9d8eb2e
3 changed files with 20 additions and 11 deletions
|
@ -22,7 +22,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct krt_scan_params {
|
struct krt_scan_params {
|
||||||
int async; /* Allow asynchronous events */
|
|
||||||
int table_id; /* Kernel table ID we sync with */
|
int table_id; /* Kernel table ID we sync with */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -32,7 +31,7 @@ struct krt_scan_status {
|
||||||
|
|
||||||
static inline int krt_scan_params_same(struct krt_scan_params *o, struct krt_scan_params *n)
|
static inline int krt_scan_params_same(struct krt_scan_params *o, struct krt_scan_params *n)
|
||||||
{
|
{
|
||||||
return o->async == n->async && o->table_id == n->table_id;
|
return o->table_id == n->table_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* BIRD -- Linux Netlink Configuration
|
* BIRD -- Linux Netlink Configuration
|
||||||
*
|
*
|
||||||
* (c) 1999 Martin Mares <mj@ucw.cz>
|
* (c) 1999--2000 Martin Mares <mj@ucw.cz>
|
||||||
*
|
*
|
||||||
* Can be freely distributed and used under the terms of the GNU GPL.
|
* Can be freely distributed and used under the terms of the GNU GPL.
|
||||||
*/
|
*/
|
||||||
|
@ -17,8 +17,7 @@ CF_GRAMMAR
|
||||||
CF_ADDTO(kern_proto, kern_proto nl_item ';')
|
CF_ADDTO(kern_proto, kern_proto nl_item ';')
|
||||||
|
|
||||||
nl_item:
|
nl_item:
|
||||||
ASYNC bool { THIS_KRT->scan.async = $2; }
|
KERNEL TABLE expr {
|
||||||
| KERNEL TABLE expr {
|
|
||||||
if ($3 <= 0 || $3 >= NL_NUM_TABLES)
|
if ($3 <= 0 || $3 >= NL_NUM_TABLES)
|
||||||
cf_error("Kernel routing table number out of range");
|
cf_error("Kernel routing table number out of range");
|
||||||
THIS_KRT->scan.table_id = $3;
|
THIS_KRT->scan.table_id = $3;
|
||||||
|
|
|
@ -768,7 +768,16 @@ nl_async_hook(sock *sk, int size)
|
||||||
x = recvmsg(sk->fd, &m, 0);
|
x = recvmsg(sk->fd, &m, 0);
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
{
|
{
|
||||||
if (errno != EWOULDBLOCK)
|
if (errno == ENOBUFS)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Netlink reports some packets have been thrown away.
|
||||||
|
* One day we might react to it by asking for route table
|
||||||
|
* scan in near future.
|
||||||
|
*/
|
||||||
|
return 1; /* More data are likely to be ready */
|
||||||
|
}
|
||||||
|
else if (errno != EWOULDBLOCK)
|
||||||
log(L_ERR "Netlink recvmsg: %m");
|
log(L_ERR "Netlink recvmsg: %m");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -800,6 +809,11 @@ nl_open_async(void)
|
||||||
sock *sk;
|
sock *sk;
|
||||||
struct sockaddr_nl sa;
|
struct sockaddr_nl sa;
|
||||||
int fd;
|
int fd;
|
||||||
|
static int nl_open_tried = 0;
|
||||||
|
|
||||||
|
if (nl_open_tried)
|
||||||
|
return;
|
||||||
|
nl_open_tried = 1;
|
||||||
|
|
||||||
DBG("KRT: Opening async netlink socket\n");
|
DBG("KRT: Opening async netlink socket\n");
|
||||||
|
|
||||||
|
@ -859,11 +873,9 @@ krt_scan_postconfig(struct krt_config *x)
|
||||||
void
|
void
|
||||||
krt_scan_construct(struct krt_config *x)
|
krt_scan_construct(struct krt_config *x)
|
||||||
{
|
{
|
||||||
x->scan.async = 1;
|
|
||||||
#ifndef IPV6
|
#ifndef IPV6
|
||||||
x->scan.table_id = RT_TABLE_MAIN;
|
x->scan.table_id = RT_TABLE_MAIN;
|
||||||
#endif
|
#endif
|
||||||
/* FIXME: Use larger defaults for scanning times? */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -874,7 +886,6 @@ krt_scan_start(struct krt_proto *p, int first)
|
||||||
if (first)
|
if (first)
|
||||||
{
|
{
|
||||||
nl_open();
|
nl_open();
|
||||||
if (KRT_CF->scan.async) /* FIXME: Async is for debugging only. Get rid of it some day. */
|
|
||||||
nl_open_async();
|
nl_open_async();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -888,5 +899,5 @@ void
|
||||||
krt_if_start(struct kif_proto *p)
|
krt_if_start(struct kif_proto *p)
|
||||||
{
|
{
|
||||||
nl_open();
|
nl_open();
|
||||||
/* FIXME: nl_open_async() after scan.async is gone */
|
nl_open_async();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue