From c5be5a163c2a7b640cb3d0942de44ec87de0f25b Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Wed, 12 Aug 2009 10:26:42 +0200 Subject: NEWS and version update. --- sysdep/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sysdep') diff --git a/sysdep/config.h b/sysdep/config.h index 54f3674..34f48f5 100644 --- a/sysdep/config.h +++ b/sysdep/config.h @@ -7,7 +7,7 @@ #define _BIRD_CONFIG_H_ /* BIRD version */ -#define BIRD_VERSION "1.1.0" +#define BIRD_VERSION "1.1.1" /* Include parameters determined by configure script */ #include "sysdep/autoconf.h" -- cgit v1.2.3 From 86975e584eeabbc4f3111f2d100f05ca00579d31 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Fri, 21 Aug 2009 09:43:31 +0200 Subject: Allow more kernel routing tables in IPv6. --- sysdep/linux/netlink/netlink.Y | 5 ----- 1 file changed, 5 deletions(-) (limited to 'sysdep') diff --git a/sysdep/linux/netlink/netlink.Y b/sysdep/linux/netlink/netlink.Y index c448d89..c5dcf62 100644 --- a/sysdep/linux/netlink/netlink.Y +++ b/sysdep/linux/netlink/netlink.Y @@ -18,13 +18,8 @@ CF_ADDTO(kern_proto, kern_proto nl_item ';') nl_item: KERNEL TABLE expr { -#ifndef IPV6 if ($3 <= 0 || $3 >= NL_NUM_TABLES) cf_error("Kernel routing table number out of range"); -#else - if ($3 != 254) - cf_error("Linux implementation of IPv6 doesn't support multiple routing tables"); -#endif THIS_KRT->scan.table_id = $3; } ; -- cgit v1.2.3 From a0c405501fa6a0df8472f1598256e725cec753fd Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Sun, 23 Aug 2009 23:04:59 +0200 Subject: Version 1.1.2 --- sysdep/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sysdep') diff --git a/sysdep/config.h b/sysdep/config.h index 34f48f5..3e6d63d 100644 --- a/sysdep/config.h +++ b/sysdep/config.h @@ -7,7 +7,7 @@ #define _BIRD_CONFIG_H_ /* BIRD version */ -#define BIRD_VERSION "1.1.1" +#define BIRD_VERSION "1.1.2" /* Include parameters determined by configure script */ #include "sysdep/autoconf.h" -- cgit v1.2.3 From daeeb8e982a3463f4a866e805b64f214d9f44160 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Fri, 4 Sep 2009 11:24:08 +0200 Subject: Clear memory allocated by ralloc(). This also fixes bug that timer->recurrent was not cleared in tm_new() and unexpected recurrence of startup timer in BGP confused state machine and caused crash. --- sysdep/unix/io.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'sysdep') diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c index a5e0522..99d3393 100644 --- a/sysdep/unix/io.c +++ b/sysdep/unix/io.c @@ -205,10 +205,6 @@ timer * tm_new(pool *p) { timer *t = ralloc(p, &tm_class); - t->hook = NULL; - t->data = NULL; - t->randomize = 0; - t->expires = 0; return t; } @@ -595,22 +591,9 @@ sk_new(pool *p) { sock *s = ralloc(p, &sk_class); s->pool = p; - s->data = NULL; - s->saddr = s->daddr = IPA_NONE; - s->sport = s->dport = 0; + // s->saddr = s->daddr = IPA_NONE; s->tos = s->ttl = -1; - s->flags = 0; - s->iface = NULL; - s->rbuf = NULL; - s->rx_hook = NULL; - s->rbsize = 0; - s->tbuf = NULL; - s->tx_hook = NULL; - s->tbsize = 0; - s->err_hook = NULL; s->fd = -1; - s->rbuf_alloc = s->tbuf_alloc = NULL; - s->password = NULL; return s; } -- cgit v1.2.3 From 5eb4d0180ed92cee31d962fbc4d0175a7e1d5933 Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Fri, 11 Sep 2009 12:20:30 +0200 Subject: New release 1.1.3 --- sysdep/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sysdep') diff --git a/sysdep/config.h b/sysdep/config.h index 3e6d63d..d9d7411 100644 --- a/sysdep/config.h +++ b/sysdep/config.h @@ -7,7 +7,7 @@ #define _BIRD_CONFIG_H_ /* BIRD version */ -#define BIRD_VERSION "1.1.2" +#define BIRD_VERSION "1.1.3" /* Include parameters determined by configure script */ #include "sysdep/autoconf.h" -- cgit v1.2.3 From 2d507e64b7d7029906aac30dbea317795b5339de Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Thu, 24 Sep 2009 19:08:14 +0200 Subject: Do not allow gateway routes with NULL iface. --- sysdep/bsd/krt-sock.c | 5 ++++- sysdep/linux/krt-scan.c | 6 ++++-- sysdep/linux/netlink/netlink.c | 6 ++++-- 3 files changed, 12 insertions(+), 5 deletions(-) (limited to 'sysdep') diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c index 2e8f1b8..29ebe20 100644 --- a/sysdep/bsd/krt-sock.c +++ b/sysdep/bsd/krt-sock.c @@ -339,7 +339,10 @@ krt_read_rt(struct ks_msg *msg, struct krt_proto *p, int scan) if (ng && ng->scope) a.iface = ng->iface; else - log(L_WARN "Kernel told us to use non-neighbor %I for %I/%d", igate, net->n.prefix, net->n.pxlen); + { + log(L_WARN "Kernel told us to use non-neighbor %I for %I/%d", ra.gw, net->n.prefix, net->n.pxlen); + return; + } a.dest = RTD_ROUTER; a.gw = igate; diff --git a/sysdep/linux/krt-scan.c b/sysdep/linux/krt-scan.c index b7fc129..374cf01 100644 --- a/sysdep/linux/krt-scan.c +++ b/sysdep/linux/krt-scan.c @@ -103,8 +103,10 @@ krt_parse_entry(byte *ent, struct krt_proto *p) if (ng && ng->scope) a.iface = ng->iface; else - /* FIXME: Remove this warning? Handle it somehow... */ - log(L_WARN "Kernel told us to use non-neighbor %I for %I/%d", gw, net->n.prefix, net->n.pxlen); + { + log(L_WARN "Kernel told us to use non-neighbor %I for %I/%d", ra.gw, net->n.prefix, net->n.pxlen); + return; + } a.dest = RTD_ROUTER; a.gw = gw; } diff --git a/sysdep/linux/netlink/netlink.c b/sysdep/linux/netlink/netlink.c index 2e85f54..9f839af 100644 --- a/sysdep/linux/netlink/netlink.c +++ b/sysdep/linux/netlink/netlink.c @@ -686,8 +686,10 @@ nl_parse_route(struct nlmsghdr *h, int scan) if (ng && ng->scope) ra.iface = ng->iface; else - /* FIXME: Remove this warning? Handle it somehow... */ - log(L_WARN "Kernel told us to use non-neighbor %I for %I/%d", ra.gw, net->n.prefix, net->n.pxlen); + { + log(L_WARN "Kernel told us to use non-neighbor %I for %I/%d", ra.gw, net->n.prefix, net->n.pxlen); + return; + } } else { -- cgit v1.2.3 From aa7088fe2646e53b5168f7ea4e5bd098f891951c Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Wed, 30 Sep 2009 16:34:47 +0200 Subject: Fixes one previous commit. --- sysdep/bsd/krt-sock.c | 2 +- sysdep/linux/krt-scan.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'sysdep') diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c index 29ebe20..4842a6b 100644 --- a/sysdep/bsd/krt-sock.c +++ b/sysdep/bsd/krt-sock.c @@ -340,7 +340,7 @@ krt_read_rt(struct ks_msg *msg, struct krt_proto *p, int scan) a.iface = ng->iface; else { - log(L_WARN "Kernel told us to use non-neighbor %I for %I/%d", ra.gw, net->n.prefix, net->n.pxlen); + log(L_WARN "Kernel told us to use non-neighbor %I for %I/%d", igate, net->n.prefix, net->n.pxlen); return; } diff --git a/sysdep/linux/krt-scan.c b/sysdep/linux/krt-scan.c index 374cf01..feb128e 100644 --- a/sysdep/linux/krt-scan.c +++ b/sysdep/linux/krt-scan.c @@ -104,7 +104,7 @@ krt_parse_entry(byte *ent, struct krt_proto *p) a.iface = ng->iface; else { - log(L_WARN "Kernel told us to use non-neighbor %I for %I/%d", ra.gw, net->n.prefix, net->n.pxlen); + log(L_WARN "Kernel told us to use non-neighbor %I for %I/%d", gw, net->n.prefix, net->n.pxlen); return; } a.dest = RTD_ROUTER; -- cgit v1.2.3 From 43c7a1ffa07dda2a9f37c046e1cd9a75242db2b7 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Wed, 30 Sep 2009 18:48:38 +0200 Subject: New version. --- sysdep/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sysdep') diff --git a/sysdep/config.h b/sysdep/config.h index d9d7411..dcb4b17 100644 --- a/sysdep/config.h +++ b/sysdep/config.h @@ -7,7 +7,7 @@ #define _BIRD_CONFIG_H_ /* BIRD version */ -#define BIRD_VERSION "1.1.3" +#define BIRD_VERSION "1.1.4" /* Include parameters determined by configure script */ #include "sysdep/autoconf.h" -- cgit v1.2.3 From ea89da381fc682155e7d08d6ad3d4ac8aa5fe115 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Sun, 11 Oct 2009 18:56:16 +0200 Subject: Workaround for stupid callback scheduler. There is no reak callback scheduler and previous behavior causes bad things during hard congestion (like BGP hold timeouts). Smart callback scheduler is still missing, but main loop was changed such that it first processes all tx callbacks (which are fast enough) (but max 4* per socket) + rx callbacks for CLI, and in the second phase it processes one rx callback per socket up to four sockets (as rx callback can be slow when there are too many protocols, because route redistribution is done synchronously inside rx callback). If there is event callback ready, second phase is skipped in 90% of iterations (to speed up CLI during congestion). --- sysdep/unix/io.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 72 insertions(+), 5 deletions(-) (limited to 'sysdep') diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c index 99d3393..330aea4 100644 --- a/sysdep/unix/io.c +++ b/sysdep/unix/io.c @@ -30,12 +30,17 @@ #include "lib/unix.h" #include "lib/sysio.h" -/* Maximum number of calls of rx/tx handler for one socket in one +/* Maximum number of calls of tx handler for one socket in one * select iteration. Should be small enough to not monopolize CPU by * one protocol instance. */ #define MAX_STEPS 4 +/* Maximum number of calls of rx handler for all sockets in one select + iteration. RX callbacks are often much more costly so we limit + this to gen small latencies */ +#define MAX_RX_STEPS 4 + /* * Tracked Files */ @@ -493,6 +498,7 @@ tm_format_reltime(char *x, bird_clock_t t) static list sock_list; static struct birdsock *current_sock; +static struct birdsock *stored_sock; static int sock_recalc_fdsets_p; static inline sock * @@ -541,6 +547,8 @@ sk_free(resource *r) close(s->fd); if (s == current_sock) current_sock = sk_next(s); + if (s == stored_sock) + stored_sock = sk_next(s); rem_node(&s->n); sock_recalc_fdsets_p = 1; } @@ -1071,6 +1079,29 @@ sk_maybe_write(sock *s) } } +int +sk_rx_ready(sock *s) +{ + fd_set rd, wr; + struct timeval timo; + int rv; + + FD_ZERO(&rd); + FD_ZERO(&wr); + FD_SET(s->fd, &rd); + + timo.tv_sec = 0; + timo.tv_usec = 0; + + redo: + rv = select(s->fd+1, &rd, &wr, NULL, &timo); + + if ((rv < 0) && (errno == EINTR || errno == EAGAIN)) + goto redo; + + return rv; +} + /** * sk_send - send data to a socket * @s: socket @@ -1239,6 +1270,9 @@ io_init(void) srandom((int) now_real); } +static int short_loops = 0; +#define SHORT_LOOP_MAX 10 + void io_loop(void) { @@ -1317,8 +1351,8 @@ io_loop(void) } /* And finally enter select() to find active sockets */ - hi = select(hi+1, &rd, &wr, NULL, &timo); + if (hi < 0) { if (errno == EINTR || errno == EAGAIN) @@ -1327,13 +1361,17 @@ io_loop(void) } if (hi) { - current_sock = SKIP_BACK(sock, n, HEAD(sock_list)); /* guaranteed to be non-empty */ + /* guaranteed to be non-empty */ + current_sock = SKIP_BACK(sock, n, HEAD(sock_list)); + while (current_sock) { sock *s = current_sock; int e; - int steps = MAX_STEPS; - if (FD_ISSET(s->fd, &rd) && s->rx_hook) + int steps; + + steps = MAX_STEPS; + if ((s->type >= SK_MAGIC) && FD_ISSET(s->fd, &rd) && s->rx_hook) do { steps--; @@ -1356,6 +1394,35 @@ io_loop(void) current_sock = sk_next(s); next: ; } + + short_loops++; + if (events && (short_loops < SHORT_LOOP_MAX)) + continue; + short_loops = 0; + + int count = 0; + current_sock = stored_sock; + if (current_sock == NULL) + current_sock = SKIP_BACK(sock, n, HEAD(sock_list)); + + while (current_sock && count < MAX_RX_STEPS) + { + sock *s = current_sock; + int e; + int steps; + + if ((s->type < SK_MAGIC) && FD_ISSET(s->fd, &rd) && s->rx_hook) + { + count++; + e = sk_read(s); + if (s != current_sock) + goto next2; + } + current_sock = sk_next(s); + next2: ; + } + + stored_sock = current_sock; } } } -- cgit v1.2.3 From bff74c7aa3ce4d407cb18b48c9df7b670c3c7a3d Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Tue, 20 Oct 2009 19:04:28 +0200 Subject: Allows importing 'onlink' routes. --- sysdep/linux/netlink/netlink.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'sysdep') diff --git a/sysdep/linux/netlink/netlink.c b/sysdep/linux/netlink/netlink.c index 9f839af..03d4388 100644 --- a/sysdep/linux/netlink/netlink.c +++ b/sysdep/linux/netlink/netlink.c @@ -682,13 +682,29 @@ nl_parse_route(struct nlmsghdr *h, int scan) ra.dest = RTD_ROUTER; memcpy(&ra.gw, RTA_DATA(a[RTA_GATEWAY]), sizeof(ra.gw)); ipa_ntoh(ra.gw); - ng = neigh_find(&p->p, &ra.gw, 0); - if (ng && ng->scope) - ra.iface = ng->iface; + + if (i->rtm_flags & RTNH_F_ONLINK) + { + /* route with 'onlink' attribute */ + ra.iface = if_find_by_index(oif); + if (ra.iface == NULL) + { + log(L_WARN "Kernel told us to use unknown interface %u for %I/%d", + oif, net->n.prefix, net->n.pxlen); + return; + } + } else { - log(L_WARN "Kernel told us to use non-neighbor %I for %I/%d", ra.gw, net->n.prefix, net->n.pxlen); - return; + /* standard route */ + ng = neigh_find(&p->p, &ra.gw, 0); + if (ng && ng->scope) + ra.iface = ng->iface; + else + { + log(L_WARN "Kernel told us to use non-neighbor %I for %I/%d", ra.gw, net->n.prefix, net->n.pxlen); + return; + } } } else -- cgit v1.2.3 From b5332824ea4108d62cb559205391fd2c530348e4 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Wed, 28 Oct 2009 20:33:08 +0100 Subject: New version. --- sysdep/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sysdep') diff --git a/sysdep/config.h b/sysdep/config.h index dcb4b17..03399bd 100644 --- a/sysdep/config.h +++ b/sysdep/config.h @@ -7,7 +7,7 @@ #define _BIRD_CONFIG_H_ /* BIRD version */ -#define BIRD_VERSION "1.1.4" +#define BIRD_VERSION "1.1.5" /* Include parameters determined by configure script */ #include "sysdep/autoconf.h" -- cgit v1.2.3