aboutsummaryrefslogtreecommitdiff
path: root/net/bird
diff options
context:
space:
mode:
authorMartin Wilke <miwi@FreeBSD.org>2011-06-26 04:59:02 +0000
committerMartin Wilke <miwi@FreeBSD.org>2011-06-26 04:59:02 +0000
commit867c6ff65cff410714dcb021d7235f3663705216 (patch)
tree7b44f3b3ca214081f658842846685e4f7b522332 /net/bird
parent729f4fa8a4d1fcc6bc6fe79fb673b934fb25f15d (diff)
downloadports-867c6ff65cff410714dcb021d7235f3663705216.tar.gz
ports-867c6ff65cff410714dcb021d7235f3663705216.zip
* Import BGP incorrect attribute patch from git
* Improve multiple fibs support with working patch and warning * Add CONFIG_INCLUDES option/patch permitting including other files in config * Remove LEARN_FIX option due to problems with bird restarts * Bump PORTREVISION PR: 157645 Submitted by: "Alexander V. Chernikov" <melifaro@ipfw.ru>
Notes
Notes: svn path=/head/; revision=276415
Diffstat (limited to 'net/bird')
-rw-r--r--net/bird/Makefile18
-rw-r--r--net/bird/files/extra-config_includes.diff302
-rw-r--r--net/bird/files/fibs.diff251
-rw-r--r--net/bird/files/learn-krt-sock.c11
-rw-r--r--net/bird/files/patch-bgp-packet.c11
5 files changed, 537 insertions, 56 deletions
diff --git a/net/bird/Makefile b/net/bird/Makefile
index d98ad44093f5..bd3b413ec0c7 100644
--- a/net/bird/Makefile
+++ b/net/bird/Makefile
@@ -7,6 +7,7 @@
PORTNAME= bird
PORTVERSION= 1.3.1
+PORTREVISION= 1
CATEGORIES= net
MASTER_SITES= ftp://bird.network.cz/pub/bird/
@@ -18,7 +19,7 @@ USE_GMAKE= yes
GNU_CONFIGURE= yes
OPTIONS= FIBS "Enable multiple fib support" Off \
- LEARN_FIX "Support multiple routing daemons" Off
+ CONFIG_INCLUDES "Permit config 'include' keyword" Off
MAKE_JOBS_UNSAFE= yes
@@ -30,13 +31,24 @@ USE_RC_SUBR= bird
EXTRA_PATCHES+= ${FILESDIR}/fibs.diff
.endif
-.if defined(WITH_LEARN_FIX)
-EXTRA_PATCHES+= ${FILESDIR}/learn-krt-sock.c
+.if defined(WITH_CONFIG_INCLUDES)
+EXTRA_PATCHES+= ${FILESDIR}/extra-config_includes.diff
.endif
post-install:
@if [ ! -f ${PREFIX}/etc/bird.conf ]; then \
${CP} -p ${PREFIX}/etc/bird.conf.example ${PREFIX}/etc/bird.conf ; \
+ ${CHMOD} 0640 ${PREFIX}/etc/bird.conf ; \
fi
+.if defined(WITH_FIBS)
+ @${ECHO_MSG}
+ @${ECHO_MSG} =====================================================================
+ @${ECHO_MSG}
+ @${ECHO_MSG} " WARNING: Please take a look on kern/134931"
+ @${ECHO_MSG} " WARNING: before using multiple fibs in production!"
+ @${ECHO_MSG}
+ @${ECHO_MSG} =====================================================================
+ @${ECHO_MSG}
+.endif
.include <bsd.port.post.mk>
diff --git a/net/bird/files/extra-config_includes.diff b/net/bird/files/extra-config_includes.diff
new file mode 100644
index 000000000000..a8d8fc001a30
--- /dev/null
+++ b/net/bird/files/extra-config_includes.diff
@@ -0,0 +1,302 @@
+Index: conf/conf.c
+===================================================================
+--- conf/conf.c (revision 4873)
++++ conf/conf.c (revision 4875)
+@@ -108,7 +108,7 @@
+ cfg_mem = c->mem;
+ if (setjmp(conf_jmpbuf))
+ return 0;
+- cf_lex_init(0);
++ cf_lex_init(c, 0);
+ sysdep_preconfig(c);
+ protos_preconfig(c);
+ rt_preconfig(c);
+@@ -138,7 +138,7 @@
+ cfg_mem = c->mem;
+ if (setjmp(conf_jmpbuf))
+ return 0;
+- cf_lex_init(1);
++ cf_lex_init(c, 1);
+ cf_parse();
+ return 1;
+ }
+@@ -356,6 +356,7 @@
+ strcpy(buf, "<bug: error message too long>");
+ new_config->err_msg = cfg_strdup(buf);
+ new_config->err_lino = conf_lino;
++ new_config->err_fname = conf_fname;
+ longjmp(conf_jmpbuf, 1);
+ }
+
+Index: conf/cf-lex.l
+===================================================================
+--- conf/cf-lex.l (revision 4873)
++++ conf/cf-lex.l (revision 4875)
+@@ -30,6 +30,9 @@
+ #include <errno.h>
+ #include <stdlib.h>
+ #include <stdarg.h>
++#include <unistd.h>
++#include <fcntl.h>
++#include <libgen.h>
+
+ #define PARSER 1
+
+@@ -64,18 +67,36 @@
+ static struct sym_scope *conf_this_scope;
+
+ int conf_lino;
++char conf_fname[255];
++int conf_fd;
+
++char conf_base[255];
++
+ static int cf_hash(byte *c);
+ static struct symbol *cf_find_sym(byte *c, unsigned int h0);
+
+ linpool *cfg_mem;
+
+-int (*cf_read_hook)(byte *buf, unsigned int max);
++int (*cf_read_hook)(byte *buf, unsigned int max, int fd);
+
+-#define YY_INPUT(buf,result,max) result = cf_read_hook(buf, max);
+-#define YY_NO_UNPUT
++#define YY_INPUT(buf,result,max) result = cf_read_hook(buf, max, STACK(conf_fd));
+ #define YY_FATAL_ERROR(msg) cf_error(msg)
+
++#define MAX_INCLUDE_DEPTH 42
++struct include_file_stack {
++ YY_BUFFER_STATE stack; /* Internal lexer state */
++ unsigned int conf_lino; /* Current file lineno (at include) */
++ char conf_fname[255]; /* Current file name */
++ int conf_fd; /* Current file descriptor */
++};
++
++static struct include_file_stack ifs[MAX_INCLUDE_DEPTH];
++static int ifs_ind; /* Current stack depth */
++#define STACK(x) ifs[ifs_ind].x
++
++static void dispatch_include(void);
++static int check_eof(void);
++
+ %}
+
+ %option noyywrap
+@@ -90,9 +111,12 @@
+ XIGIT [0-9a-fA-F]
+ ALNUM [a-zA-Z_0-9]
+ WHITE [ \t]
++include ^{WHITE}*include{WHITE}*\".*\"{WHITE}*;
+
+ %%
+
++{include} { dispatch_include(); }
++
+ {DIGIT}+\.{DIGIT}+\.{DIGIT}+\.{DIGIT}+ {
+ #ifdef IPV6
+ if (ipv4_pton_u32(yytext, &cf_lval.i32))
+@@ -184,7 +208,7 @@
+
+ ["][^"\n]*\n cf_error("Unterminated string");
+
+-<INITIAL,COMMENT><<EOF>> return END;
++<INITIAL,COMMENT><<EOF>> { if (check_eof()) return END; }
+
+ {WHITE}+
+
+@@ -220,7 +244,67 @@
+
+ %%
+
++/* Open included file with properly swapped buffers */
++static void
++dispatch_include(void)
++{
++ char *fname, *p = NULL, full_name[255];
++ int fd;
++
++ if ((fname = strchr(yytext, '"')) != NULL) {
++ if ((p = strchr(++fname, '"')) != NULL)
++ *p = '\0';
++
++ if (*fname == '/')
++ snprintf(full_name, sizeof(full_name), "%s", fname);
++ else
++ snprintf(full_name, sizeof(full_name), "%s/%s", conf_base, fname);
++
++ if (ifs_ind >= MAX_INCLUDE_DEPTH)
++ cf_error("Max include depth (%d) reached on file %s", MAX_INCLUDE_DEPTH, fname);
++
++ if ((fd = open(full_name, O_RDONLY)) == -1)
++ cf_error("Error opening included file %s", full_name);
++
++ /* Save current stack */
++ STACK(conf_lino) = conf_lino;
++ STACK(stack) = YY_CURRENT_BUFFER;
++ /* Prepare new stack */
++ ifs_ind++;
++ STACK(conf_lino) = 1;
++ strcpy(STACK(conf_fname), fname); /* XXX: strlcpy should be here */
++ STACK(conf_fd) = fd;
++ /* Export to global variables */
++ conf_lino = STACK(conf_lino);
++ conf_fd = STACK(conf_fd);
++ strcpy(conf_fname, STACK(conf_fname));
++
++ yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
++ }
++}
++
+ static int
++check_eof(void)
++{
++ if (ifs_ind > 0)
++ close(STACK(conf_fd));
++ if (--ifs_ind < 0) {
++ /* EOF in main config file */
++ ifs_ind = 0;
++ conf_lino = 1;
++ return 1;
++ }
++
++ /* switch buffer */
++ conf_lino = STACK(conf_lino);
++ conf_fd = STACK(conf_fd);
++ strcpy(conf_fname, STACK(conf_fname));
++ yy_delete_buffer(YY_CURRENT_BUFFER);
++ yy_switch_to_buffer(STACK(stack));
++ return 0;
++}
++
++static int
+ cf_hash(byte *c)
+ {
+ unsigned int h = 13;
+@@ -363,11 +447,28 @@
+ * parsing of a new input.
+ */
+ void
+-cf_lex_init(int is_cli)
++cf_lex_init(struct config *c, int is_cli)
+ {
+ if (!kw_hash_inited)
+ cf_lex_init_kh();
+ conf_lino = 1;
++ /* Zero stack */
++ memset(ifs, 0, sizeof(ifs));
++ memset(conf_base, 0, sizeof(conf_base));
++ ifs_ind = 0;
++ if (!is_cli) {
++ /* Fill in level 0 */
++ STACK(conf_lino) = 1;
++ STACK(conf_fd) = c->file_fd;
++ strcpy(STACK(conf_fname), c->file_name);
++ /* Save config directory path */
++ strcpy(conf_base, dirname(STACK(conf_fname)));
++ }
++ /* Export to global variables */
++ conf_lino = STACK(conf_lino);
++ conf_fd = STACK(conf_fd);
++ strcpy(conf_fname, STACK(conf_fname));
++
+ yyrestart(NULL);
+ if (is_cli)
+ BEGIN(CLI);
+Index: conf/conf.h
+===================================================================
+--- conf/conf.h (revision 4873)
++++ conf/conf.h (revision 4875)
+@@ -38,7 +38,9 @@
+ int cli_debug; /* Tracing of CLI connections and commands */
+ char *err_msg; /* Parser error message */
+ int err_lino; /* Line containing error */
++ char *err_fname; /* File name containing error */
+ char *file_name; /* Name of configuration file */
++ int file_fd; /* Config file descriptor */
+ struct symbol **sym_hash; /* Lexer: symbol hash table */
+ struct symbol **sym_fallback; /* Lexer: fallback symbol hash table */
+ int obstacle_count; /* Number of items blocking freeing of this config */
+@@ -83,7 +85,7 @@
+
+ /* Lexer */
+
+-extern int (*cf_read_hook)(byte *buf, unsigned int max);
++extern int (*cf_read_hook)(byte *buf, unsigned int max, int fd);
+
+ struct symbol {
+ struct symbol *next;
+@@ -107,9 +109,10 @@
+ #define SYM_VARIABLE 0x100 /* 0x100-0x1ff are variable types */
+
+ extern int conf_lino;
++extern char conf_fname[255];
+
+ int cf_lex(void);
+-void cf_lex_init(int is_cli);
++void cf_lex_init(struct config *c, int is_cli);
+ struct symbol *cf_find_symbol(byte *c);
+ struct symbol *cf_default_name(char *template, int *counter);
+ struct symbol *cf_define_symbol(struct symbol *symbol, int type, void *def);
+Index: doc/bird.conf.example
+===================================================================
+--- doc/bird.conf.example (revision 4873)
++++ doc/bird.conf.example (revision 4875)
+@@ -22,6 +22,9 @@
+ # else reject;
+ #}
+
++# Write more filters in included config file(s):
++#include "filters.conf";
++
+ #filter sink { reject; }
+ #filter okay { accept; }
+
+Index: sysdep/unix/main.c
+===================================================================
+--- sysdep/unix/main.c (revision 4873)
++++ sysdep/unix/main.c (revision 4875)
+@@ -122,13 +122,12 @@
+ #endif // PATH_IPROUTE_DIR
+
+
+-static int conf_fd;
+ static char *config_name = PATH_CONFIG;
+
+ static int
+-cf_read(byte *dest, unsigned int len)
++cf_read(byte *dest, unsigned int len, int fd)
+ {
+- int l = read(conf_fd, dest, len);
++ int l = read(fd, dest, len);
+ if (l < 0)
+ cf_error("Read error");
+ return l;
+@@ -158,15 +157,15 @@
+ unix_read_config(struct config **cp, char *name)
+ {
+ struct config *conf = config_alloc(name);
+- int ret;
++ int ret, fd;
+
+ *cp = conf;
+- conf_fd = open(name, O_RDONLY);
+- if (conf_fd < 0)
++ if ((fd = open(name, O_RDONLY)) == -1)
+ return 0;
++ conf->file_fd = fd;
+ cf_read_hook = cf_read;
+ ret = config_parse(conf);
+- close(conf_fd);
++ close(fd);
+ return ret;
+ }
+
+@@ -178,7 +177,7 @@
+ if (!unix_read_config(&conf, config_name))
+ {
+ if (conf->err_msg)
+- die("%s, line %d: %s", config_name, conf->err_lino, conf->err_msg);
++ die("%s, line %d: %s", conf->err_fname, conf->err_lino, conf->err_msg);
+ else
+ die("Unable to open configuration file %s: %m", config_name);
+ }
diff --git a/net/bird/files/fibs.diff b/net/bird/files/fibs.diff
index c2810c6c9672..64ec0be4f966 100644
--- a/net/bird/files/fibs.diff
+++ b/net/bird/files/fibs.diff
@@ -1,14 +1,32 @@
-diff -urN sysdep/bsd/Modules sysdep/bsd/Modules
---- sysdep/bsd/Modules 2011-03-31 12:29:42.000000000 +0400
-+++ sysdep/bsd/Modules 2011-05-10 12:04:30.643950460 +0400
-@@ -4,3 +4,4 @@
- krt-set.h
- krt-sock.c
- krt-sock.h
-+fib.Y
-diff -urN sysdep/bsd/fib.Y sysdep/bsd/fib.Y
---- sysdep/bsd/fib.Y 1970-01-01 03:00:00.000000000 +0300
-+++ sysdep/bsd/fib.Y 2011-05-10 12:04:05.724272679 +0400
+Index: sysdep/unix/krt.h
+===================================================================
+--- sysdep/unix/krt.h (revision 4869)
++++ sysdep/unix/krt.h (working copy)
+@@ -67,6 +67,7 @@
+ #ifdef CONFIG_ALL_TABLES_AT_ONCE
+ node instance_node; /* Node in krt instance list */
+ #endif
++ int rt_sock; /* Routing socket descriptor */
+ int initialized; /* First scan has already been finished */
+ };
+
+Index: sysdep/bsd/krt-sock.h
+===================================================================
+--- sysdep/bsd/krt-sock.h (revision 4869)
++++ sysdep/bsd/krt-sock.h (working copy)
+@@ -42,5 +42,8 @@
+
+ static inline int krt_set_params_same(struct krt_set_params *o UNUSED, struct krt_set_params *n UNUSED) { return 1; }
+ void krt_read_msg(struct proto *p, struct ks_msg *msg, int scan);
++int max_fib_num(void);
++int my_fib_get(void);
++int my_fib_set(int fib);
+
+ #endif
+Index: sysdep/bsd/fib.Y
+===================================================================
+--- sysdep/bsd/fib.Y (revision 0)
++++ sysdep/bsd/fib.Y (revision 0)
@@ -0,0 +1,29 @@
+/*
+ * BIRD -- FreeBSD rtsock configuration
@@ -30,7 +48,7 @@ diff -urN sysdep/bsd/fib.Y sysdep/bsd/fib.Y
+
+rtsock_item:
+ KERNEL TABLE expr {
-+ if ($3 <= 0 || $3 >= max_fib_num())
++ if ($3 < 0 || $3 >= max_fib_num())
+ cf_error("Kernel routing table number out of range");
+ THIS_KRT->scan.table_id = $3;
+ }
@@ -39,9 +57,19 @@ diff -urN sysdep/bsd/fib.Y sysdep/bsd/fib.Y
+CF_CODE
+
+CF_END
-diff -urN sysdep/bsd/krt-scan.h sysdep/bsd/krt-scan.h
---- sysdep/bsd/krt-scan.h 2011-03-31 12:29:42.000000000 +0400
-+++ sysdep/bsd/krt-scan.h 2011-05-10 11:58:54.812942887 +0400
+Index: sysdep/bsd/Modules
+===================================================================
+--- sysdep/bsd/Modules (revision 4869)
++++ sysdep/bsd/Modules (working copy)
+@@ -4,3 +4,4 @@
+ krt-set.h
+ krt-sock.c
+ krt-sock.h
++fib.Y
+Index: sysdep/bsd/krt-scan.h
+===================================================================
+--- sysdep/bsd/krt-scan.h (revision 4869)
++++ sysdep/bsd/krt-scan.h (working copy)
@@ -10,6 +10,7 @@
#define _BIRD_KRT_SCAN_H_
@@ -50,10 +78,20 @@ diff -urN sysdep/bsd/krt-scan.h sysdep/bsd/krt-scan.h
};
struct krt_scan_status {
-diff -urN sysdep/bsd/krt-sock.c sysdep/bsd/krt-sock.c
---- sysdep/bsd/krt-sock.c 2011-05-02 12:13:18.000000000 +0400
-+++ sysdep/bsd/krt-sock.c 2011-05-10 12:25:22.075267568 +0400
-@@ -53,6 +53,21 @@
+Index: sysdep/bsd/krt-sock.c
+===================================================================
+--- sysdep/bsd/krt-sock.c (revision 4869)
++++ sysdep/bsd/krt-sock.c (working copy)
+@@ -33,8 +33,6 @@
+ #include "lib/string.h"
+ #include "lib/socket.h"
+
+-int rt_sock = 0;
+-
+ int
+ krt_capable(rte *e)
+ {
+@@ -53,6 +51,49 @@
);
}
@@ -68,41 +106,169 @@ diff -urN sysdep/bsd/krt-sock.c sysdep/bsd/krt-sock.c
+ return 1;
+ }
+
-+ log(L_TRACE "Max fibs: %d\n", fibs);
++ //log(L_TRACE "Max fibs: %d", fibs);
+ return fibs;
+}
+
++int
++my_fib_get()
++{
++ int fib = 0;
++ size_t fib_len = sizeof(fib);
++ if (sysctlbyname("net.my_fibnum", &fib, &fib_len, NULL, 0) == -1)
++ {
++ log(L_ERR "KRT: unable to get fib number, assuming 0. error: %s", strerror(errno));
++ return 0;
++ }
++
++ return fib;
++}
++
++int
++my_fib_set(int fib)
++{
++ int old_fib = my_fib_get();
++
++ if ((fib != old_fib) && (setfib(fib) == -1))
++ {
++ log(L_ERR "KRT: setfib(%d) failed: %s", fib, strerror(errno));
++ die("Cannot set fib for kernel socket");
++ }
++
++ return old_fib;
++}
++
#define ROUNDUP(a) \
((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
-@@ -219,6 +234,7 @@
+@@ -69,7 +110,7 @@
+ body += l;}
+
+ static void
+-krt_sock_send(int cmd, rte *e)
++krt_sock_send(struct krt_proto *p, int cmd, rte *e)
+ {
+ net *net = e->net;
+ rta *a = e->attrs;
+@@ -180,23 +221,23 @@
+ l = body - (char *)&msg;
+ msg.rtm.rtm_msglen = l;
+
+- if ((l = write(rt_sock, (char *)&msg, l)) < 0) {
++ if ((l = write(p->rt_sock, (char *)&msg, l)) < 0) {
+ log(L_ERR "KRT: Error sending route %I/%d to kernel", net->n.prefix, net->n.pxlen);
+ }
+ }
+
+ void
+-krt_set_notify(struct krt_proto *p UNUSED, net *net, rte *new, rte *old)
++krt_set_notify(struct krt_proto *p, net *net, rte *new, rte *old)
+ {
+ if (old)
+ {
+ DBG("krt_remove_route(%I/%d)\n", net->n.prefix, net->n.pxlen);
+- krt_sock_send(RTM_DELETE, old);
++ krt_sock_send(p, RTM_DELETE, old);
+ }
+ if (new)
+ {
+ DBG("krt_add_route(%I/%d)\n", net->n.prefix, net->n.pxlen);
+- krt_sock_send(RTM_ADD, new);
++ krt_sock_send(p, RTM_ADD, new);
+ }
+ }
+
+@@ -218,25 +259,34 @@
+ krt_set_start(struct krt_proto *x, int first UNUSED)
{
sock *sk_rt;
- static int ks_open_tried = 0;
-+ int fib = 0;
+- static int ks_open_tried = 0;
++ struct krt_config *c;
++ int fib = 0, old_fib = 0;
+
+- if (ks_open_tried)
+- return;
++ if (!strcmp(x->p.proto->name, "Kernel"))
++ {
++ c = (struct krt_config *)x->p.cf;
++ fib = c->scan.table_id;
- if (ks_open_tried)
- return;
-@@ -230,6 +246,16 @@
- if( (rt_sock = socket(PF_ROUTE, SOCK_RAW, AF_UNSPEC)) < 0)
+- ks_open_tried = 1;
++ DBG("KRT: Opening kernel route socket to fib %d\n", fib);
++ if (x->p.debug & D_ROUTES)
++ log(L_TRACE "Opening route socket to fib %d", fib);
+
+- DBG("KRT: Opening kernel socket\n");
+-
+- if( (rt_sock = socket(PF_ROUTE, SOCK_RAW, AF_UNSPEC)) < 0)
++ old_fib = my_fib_set(fib);
++ }
++
++ if( (x->rt_sock = socket(PF_ROUTE, SOCK_RAW, AF_UNSPEC)) < 0)
die("Cannot open kernel socket for routes");
-+ fib = ((struct krt_config *)x)->scan.table_id;
-+ log(L_TRACE "KRT: Setting fib %d", fib);
-+
+ sk_rt = sk_new(krt_pool);
+ sk_rt->type = SK_MAGIC;
+ sk_rt->rx_hook = krt_set_hook;
+- sk_rt->fd = rt_sock;
++ sk_rt->fd = x->rt_sock;
+ sk_rt->data = x;
+ if (sk_open(sk_rt))
+ bug("krt-sock: sk_open failed");
+
-+ if ((fib != 0) && (setsockopt(rt_sock, SOL_SOCKET, SO_SETFIB, &fib, sizeof(fib)) == -1))
++ /* Rollback fib */
++ my_fib_set(old_fib);
+ }
+
+ #define SKIP(ARG...) do { DBG("KRT: Ignoring route - " ARG); return; } while(0)
+@@ -624,6 +674,8 @@
+ size_t obl, needed;
+ struct ks_msg *m;
+ int retries = 3;
++ struct krt_config *c;
++ int fib = 0, old_fib = 0;
+
+ mib[0] = CTL_NET;
+ mib[1] = PF_ROUTE;
+@@ -632,6 +684,17 @@
+ mib[4] = cmd;
+ mib[5] = 0;
+
++ if (!strcmp(p->proto->name, "Kernel"))
+ {
-+ log(L_ERR "KRT: setsockopt() failed for socket %d: %s", rt_sock, strerror(errno));
-+ die("Cannot set fib for kernel socket");
++ c = (struct krt_config *)p->cf;
++ fib = c->scan.table_id;
++
++ DBG("KRT: Setting fib to %d for route dump\n", fib);
++ if (p->debug & D_ROUTES)
++ log(L_TRACE "Setting fib to %d for route dump", fib);
++
++ old_fib = my_fib_set(fib);
+ }
+ try:
+ if (sysctl(mib, 6 , NULL , &needed, NULL, 0) < 0)
+ die("krt_sysctl_scan 1: %m");
+@@ -656,6 +719,7 @@
+ goto try;
+
+ log(L_ERR "KRT: Route scan failed");
++ my_fib_set(old_fib);
+ return;
+ }
+ die("krt_sysctl_scan 2: %m");
+@@ -666,6 +730,8 @@
+ m = (struct ks_msg *)next;
+ krt_read_msg(p, m, 1);
+ }
+
- sk_rt = sk_new(krt_pool);
- sk_rt->type = SK_MAGIC;
- sk_rt->rx_hook = krt_set_hook;
-diff -urN sysdep/cf/bsd-v6.h sysdep/cf/bsd-v6.h
---- sysdep/cf/bsd-v6.h 2011-03-31 12:29:42.000000000 +0400
-+++ sysdep/cf/bsd-v6.h 2011-05-10 11:19:01.394166479 +0400
++ my_fib_set(old_fib);
+ }
+
+ static byte *krt_buffer = NULL;
+Index: sysdep/cf/bsd-v6.h
+===================================================================
+--- sysdep/cf/bsd-v6.h (revision 4869)
++++ sysdep/cf/bsd-v6.h (working copy)
@@ -10,7 +10,7 @@
#define CONFIG_AUTO_ROUTES
@@ -112,9 +278,10 @@ diff -urN sysdep/cf/bsd-v6.h sysdep/cf/bsd-v6.h
#undef CONFIG_UNIX_IFACE
#undef CONFIG_UNIX_SET
-diff -urN sysdep/cf/bsd.h sysdep/cf/bsd.h
---- sysdep/cf/bsd.h 2011-03-31 12:29:42.000000000 +0400
-+++ sysdep/cf/bsd.h 2011-05-10 11:19:01.398182352 +0400
+Index: sysdep/cf/bsd.h
+===================================================================
+--- sysdep/cf/bsd.h (revision 4869)
++++ sysdep/cf/bsd.h (working copy)
@@ -8,7 +8,7 @@
#define CONFIG_AUTO_ROUTES
diff --git a/net/bird/files/learn-krt-sock.c b/net/bird/files/learn-krt-sock.c
deleted file mode 100644
index ed4bfac9f390..000000000000
--- a/net/bird/files/learn-krt-sock.c
+++ /dev/null
@@ -1,11 +0,0 @@
---- sysdep/bsd/krt-sock.c.orig 2011-05-11 10:41:35.432219356 +0400
-+++ sysdep/bsd/krt-sock.c 2011-05-11 10:42:02.483875083 +0400
-@@ -320,7 +320,7 @@
- if ((flags & RTF_GATEWAY) && ipa_zero(igate))
- { log(L_ERR "%s (%I/%d) - missing gateway", errmsg, idst, pxlen); return; }
-
-- u32 self_mask = RTF_PROTO1;
-+ u32 self_mask = 0;
- u32 alien_mask = RTF_STATIC | RTF_PROTO1 | RTF_GATEWAY;
-
- #ifdef RTF_PROTO2
diff --git a/net/bird/files/patch-bgp-packet.c b/net/bird/files/patch-bgp-packet.c
new file mode 100644
index 000000000000..a5035181f045
--- /dev/null
+++ b/net/bird/files/patch-bgp-packet.c
@@ -0,0 +1,11 @@
+--- proto/bgp/packets.c
++++ proto/bgp/packets.c
+@@ -862,7 +862,7 @@ bgp_do_rx_update(struct bgp_conn *conn,
+ if (conn->state != BS_ESTABLISHED) /* fatal error during decoding */
+ return;
+
+- if (a0 && bgp_set_next_hop(p, a0))
++ if (a0 && nlri_len && bgp_set_next_hop(p, a0))
+ a = rta_lookup(a0);
+
+ while (nlri_len)