bird2: Add package
This adds a separate package for the 2.0 branch of Bird, allowing it to co-exist with the bird1 package. The two packages conflict with each other, so they can't be installed at the same time; but in the build system they coexist just fine. Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
This commit is contained in:
parent
ecbdeb0500
commit
688901a664
11 changed files with 894 additions and 0 deletions
128
bird2/Makefile
Normal file
128
bird2/Makefile
Normal file
|
@ -0,0 +1,128 @@
|
|||
#
|
||||
# Copyright (C) 2009-2017 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bird2
|
||||
PKG_VERSION:=2.0.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=bird-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=ftp://bird.network.cz/pub/bird
|
||||
PKG_MD5SUM:=035f91d6f568f8ed438a0814235ac4c5c79147cd2acf201322c307732883480f
|
||||
PKG_BUILD_DEPENDS:=ncurses readline
|
||||
PKG_MAINTAINER:=Toke Høiland-Jørgensen <toke@toke.dk>
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/bird-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/bird2/Default/description
|
||||
BIRD is an internet routing daemon which manages TCP/IP routing tables
|
||||
with support of modern routing protocols, easy to use configuration
|
||||
interface and powerful route filtering language. It is lightweight and
|
||||
efficient and therefore appropriate for small embedded routers.
|
||||
|
||||
endef
|
||||
|
||||
define Package/bird2
|
||||
TITLE:=The BIRD Internet Routing Daemon (v2)
|
||||
URL:=http://bird.network.cz/
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Routing and Redirection
|
||||
DEPENDS:=+libpthread
|
||||
CONFLICTS:=bird1-ipv4 bird1-ipv6 bird4 bird6
|
||||
endef
|
||||
|
||||
define Package/bird2c
|
||||
TITLE:=The BIRD command-line client (v2)
|
||||
URL:=http://bird.network.cz/
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Routing and Redirection
|
||||
DEPENDS:=+bird2 +libreadline +libncurses
|
||||
CONFLICTS:=bird1c-ipv4 bird1c-ipv6 birdc4 birdc6
|
||||
endef
|
||||
|
||||
define Package/bird2cl
|
||||
TITLE:=The BIRD lightweight command-line client (v2)
|
||||
URL:=http://bird.network.cz/
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Routing and Redirection
|
||||
DEPENDS:=+bird2
|
||||
CONFLICTS:=bird1cl-ipv4 bird1cl-ipv6 birdcl4 birdcl6
|
||||
endef
|
||||
|
||||
define Package/bird2/description
|
||||
$(call Package/bird2/Default/description)
|
||||
|
||||
BIRD supports OSPFv2, RIPv2, Babel and BGP protocols for IPv4 and
|
||||
OSPFv3, RIPng, Babel and BGP protocols for IPv6.
|
||||
|
||||
In BGP, BIRD supports communities, multiprotocol extensions, MD5
|
||||
authentication, 32bit AS numbers and could act as a route server or a
|
||||
route reflector. BIRD also supports multiple RIBs, multiple kernel
|
||||
routing tables and redistribution between the protocols with a powerful
|
||||
configuration syntax.
|
||||
|
||||
This is the 2.0 branch of Bird which integrates support for IPv4 and IPv6
|
||||
into a single branch, and also adds support for the Babel routing protocol.
|
||||
endef
|
||||
|
||||
define Package/bird2c/description
|
||||
$(call Package/bird2/Default/description)
|
||||
|
||||
This is a BIRD command-line client. It is used to send commands to BIRD,
|
||||
commands can perform simple actions such as enabling/disabling of
|
||||
protocols, telling BIRD to show various information, telling it to show
|
||||
a routing table filtered by a filter, or asking BIRD to reconfigure.
|
||||
|
||||
Unless you can't afford dependency on ncurses and readline, you
|
||||
should install BIRD command-line client together with BIRD.
|
||||
endef
|
||||
|
||||
define Package/bird2cl/description
|
||||
$(call Package/bird2/Default/description)
|
||||
|
||||
This is a BIRD lightweight command-line client. It is used to send commands
|
||||
to BIRD, commands can perform simple actions such as enabling/disabling of
|
||||
protocols, telling BIRD to show various information, telling it to show
|
||||
a routing table filtered by a filter, or asking BIRD to reconfigure.
|
||||
endef
|
||||
|
||||
CONFIGURE_ARGS += --with-linux-headers="$(LINUX_DIR)"
|
||||
|
||||
define Package/bird2/conffiles
|
||||
/etc/bird.conf
|
||||
/etc/bird4.conf
|
||||
/etc/bird6.conf
|
||||
endef
|
||||
|
||||
define Package/bird2/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bird $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DATA) ./files/bird.conf $(1)/etc/
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/bird.init $(1)/etc/init.d/bird
|
||||
endef
|
||||
|
||||
define Package/bird2c/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/birdc $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/bird2cl/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/birdcl $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bird2))
|
||||
$(eval $(call BuildPackage,bird2c))
|
||||
$(eval $(call BuildPackage,bird2cl))
|
332
bird2/files/bird.conf
Normal file
332
bird2/files/bird.conf
Normal file
|
@ -0,0 +1,332 @@
|
|||
/*
|
||||
* This is an example configuration file for MB-BGP setting
|
||||
*/
|
||||
|
||||
|
||||
log syslog all;
|
||||
# debug protocols all;
|
||||
|
||||
router id 192.168.1.1;
|
||||
|
||||
ipv4 table master4;
|
||||
ipv6 table master6;
|
||||
|
||||
ipv4 table mcast4;
|
||||
ipv6 table mcast6;
|
||||
|
||||
ipv4 table mtab4;
|
||||
ipv6 table mtab6;
|
||||
|
||||
vpn4 table vpntab4;
|
||||
vpn6 table vpntab6;
|
||||
|
||||
vpn4 table vpn4mc;
|
||||
vpn6 table vpn6mc;
|
||||
|
||||
flow4 table flowtab4;
|
||||
flow6 table flowtab6;
|
||||
|
||||
|
||||
protocol device {
|
||||
}
|
||||
|
||||
protocol kernel kernel4 {
|
||||
ipv4 {
|
||||
export all;
|
||||
};
|
||||
}
|
||||
|
||||
protocol kernel kernel6 {
|
||||
ipv6 {
|
||||
export all;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
protocol static static4 {
|
||||
ipv4;
|
||||
|
||||
route 10.10.0.0/24 via 192.168.1.2;
|
||||
route 10.10.1.0/24 via 192.168.1.2 { bgp_large_community.add((10,20,30)); bgp_large_community.add((10,(20*3),10)); };
|
||||
}
|
||||
|
||||
protocol static static6 {
|
||||
ipv6;
|
||||
|
||||
route 2001:db8:10:10::/64 via 2001:db8:1:1::10;
|
||||
route 2001:db8:10:11::/64 via 2001:db8:1:1::10;
|
||||
|
||||
route 2001:db8:1:1::/64 via fe80::ec9b:67ff:fe60:fd5d % ve1;
|
||||
}
|
||||
|
||||
# VPNv4 routes with MPLS labels
|
||||
protocol static statvpn4 {
|
||||
vpn4;
|
||||
|
||||
route 10:10 10.20.0.0/24 via 192.168.1.2 mpls 210;
|
||||
route 10:10 10.20.1.0/24 via 192.168.1.2 mpls 210;
|
||||
route 10:20 10.20.0.0/24 via 192.168.1.2 mpls 220;
|
||||
route 10:20 10.20.1.0/24 via 192.168.1.2 mpls 220;
|
||||
}
|
||||
|
||||
protocol static statvpn6 {
|
||||
vpn6;
|
||||
|
||||
route 10:10 2001:db8:20:10::/64 via 2001:db8:1:1::10 mpls 200/210;
|
||||
route 10:10 2001:db8:20:11::/64 via 2001:db8:1:1::10 mpls 200/210;
|
||||
route 10:20 2001:db8:20:10::/64 via 2001:db8:1:1::10 mpls 200/220;
|
||||
route 10:20 2001:db8:20:11::/64 via 2001:db8:1:1::10 mpls 200/220;
|
||||
}
|
||||
|
||||
# RFC 5575 flow specification
|
||||
protocol static flowstat4 {
|
||||
flow4;
|
||||
|
||||
route flow4 {
|
||||
dst 10.0.0.0/8;
|
||||
proto = 23;
|
||||
dport > 24 && < 30 || 40..50,60..70,80;
|
||||
sport > 24 && < 30 || = 40 || 50,60..70,80;
|
||||
icmp type 80;
|
||||
icmp code 90;
|
||||
tcp flags 0x03/0x0f;
|
||||
length 2048..65535;
|
||||
dscp = 63;
|
||||
fragment dont_fragment, is_fragment || !first_fragment;
|
||||
};
|
||||
|
||||
route flow4 {
|
||||
dst 11.0.0.0/8;
|
||||
proto = 0x12;
|
||||
sport > 0x5678 && < 0x9abc || 0xdef0 || 0x1234,0x5678,0x9abc..0xdef0;
|
||||
dport = 50;
|
||||
tcp flags 0x000/0xf00;
|
||||
};
|
||||
|
||||
route flow4 {
|
||||
dst 12.0.0.0/32;
|
||||
tcp flags ! 0/0x999;
|
||||
};
|
||||
|
||||
route flow4 {
|
||||
dst 220.0.254.0/24;
|
||||
tcp flags 0x99/0x999;
|
||||
};
|
||||
|
||||
route flow4 {
|
||||
dst 220.0.254.192/28;
|
||||
tcp flags ! 0xfff/0xfff;
|
||||
};
|
||||
|
||||
route flow4 {
|
||||
dst 15.0.0.0/8;
|
||||
tcp flags ! 0x999/0x999;
|
||||
};
|
||||
}
|
||||
|
||||
protocol static flowstat6 {
|
||||
flow6;
|
||||
|
||||
route flow6 {
|
||||
dst fec0:1122:3344:5566::1/128;
|
||||
src 0000:0000:0000:0001:1234:5678:9800:0000/101 offset 63;
|
||||
next header = 23;
|
||||
sport 24..30, 42 || 50,60,70..80;
|
||||
dport = 50;
|
||||
tcp flags 0x03/0x0f, !0/0xff || 0x33/0x33;
|
||||
fragment !is_fragment || !first_fragment;
|
||||
label 0xaaaa/0xaaaa && 0x33/0x33;
|
||||
};
|
||||
|
||||
route flow6 {
|
||||
dst fec0:1122:3344:5566::1/128;
|
||||
src ::1:1234:5678:9800:0/101 offset 63;
|
||||
next header = 23;
|
||||
dport = 50;
|
||||
sport > 24 && < 30 || = 40 || = 50 || = 60 || >= 70 && <= 80;
|
||||
tcp flags 0x3/0x3 && 0x0/0xc;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
protocol pipe {
|
||||
table master4;
|
||||
peer table mcast4;
|
||||
import none;
|
||||
export where source = RTS_OSPF;
|
||||
}
|
||||
|
||||
protocol pipe {
|
||||
table master6;
|
||||
peer table mcast6;
|
||||
import none;
|
||||
export where source = RTS_OSPF;
|
||||
}
|
||||
|
||||
protocol ospf v2 ospf4 {
|
||||
ipv4 {
|
||||
import all;
|
||||
# export where source = RTS_STATIC;
|
||||
};
|
||||
|
||||
area 0 {
|
||||
interface "ve0" { stub; };
|
||||
interface "ve1" { hello 5; type ptp; };
|
||||
interface "ve2" { hello 5; type bcast; ttl security; };
|
||||
interface "ve3" { hello 5; type bcast; ttl security; };
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
protocol ospf v3 ospf6 {
|
||||
ipv6 {
|
||||
import all;
|
||||
# export where source = RTS_STATIC;
|
||||
};
|
||||
|
||||
area 0 {
|
||||
interface "ve0" { stub; };
|
||||
interface "ve1" { hello 5; type ptp; };
|
||||
interface "ve2" { hello 5; type bcast; };
|
||||
};
|
||||
}
|
||||
|
||||
protocol bgp {
|
||||
local 192.168.11.1 as 1000;
|
||||
neighbor 192.168.11.2 as 2000;
|
||||
# local 192.168.1.1 as 1000;
|
||||
# neighbor 192.168.2.1 as 2000;
|
||||
# multihop;
|
||||
# rr client;
|
||||
# strict bind;
|
||||
# debug all;
|
||||
|
||||
# regular IPv4 unicast (1/1)
|
||||
ipv4 {
|
||||
# connects to master4 table by default
|
||||
import all;
|
||||
export where source ~ [ RTS_STATIC, RTS_BGP ];
|
||||
};
|
||||
|
||||
# regular IPv6 unicast (2/1)
|
||||
ipv6 {
|
||||
# connects to master6 table by default
|
||||
import all;
|
||||
export where source ~ [ RTS_STATIC, RTS_BGP ];
|
||||
# next hop address 2001:db8:1:1::1;
|
||||
};
|
||||
|
||||
# IPv4 multicast topology (1/2)
|
||||
ipv4 multicast {
|
||||
# explicit IPv4 table
|
||||
table mcast4;
|
||||
import all;
|
||||
export all;
|
||||
};
|
||||
|
||||
# IPv6 multicast topology (2/2)
|
||||
ipv6 multicast {
|
||||
# explicit IPv6 table
|
||||
table mcast6;
|
||||
import all;
|
||||
export all;
|
||||
# next hop address 2001:db8:1:1::1;
|
||||
};
|
||||
|
||||
# IPv4 with MPLS labels (1/4)
|
||||
ipv4 mpls {
|
||||
# explicit IPv4 table
|
||||
table mtab4;
|
||||
import all;
|
||||
export all;
|
||||
};
|
||||
|
||||
# IPv6 with MPLS labels (2/4)
|
||||
ipv6 mpls {
|
||||
# explicit IPv6 table
|
||||
table mtab6;
|
||||
import all;
|
||||
export all;
|
||||
# allows IPv4 next hops (6PE)
|
||||
# extended next hop;
|
||||
};
|
||||
|
||||
# VPNv4 with MPLS labels (1/128)
|
||||
vpn4 mpls {
|
||||
# connects to vpntab4 table by default
|
||||
import all;
|
||||
export all;
|
||||
};
|
||||
|
||||
# VPNv6 with MPLS labels (2/128)
|
||||
vpn6 mpls {
|
||||
# connects to vpntab6 table by default
|
||||
import all;
|
||||
export all;
|
||||
};
|
||||
|
||||
# VPNv4 multicast topology (1/129)
|
||||
vpn4 multicast {
|
||||
table vpn4mc;
|
||||
import all;
|
||||
export all;
|
||||
};
|
||||
|
||||
# VPNv6 multicast topology (2/129)
|
||||
vpn6 multicast {
|
||||
table vpn6mc;
|
||||
import all;
|
||||
export all;
|
||||
};
|
||||
|
||||
# IPv4 Flowspec (1/133)
|
||||
flow4 {
|
||||
# connects to flowtab4 table by default
|
||||
import all;
|
||||
export all;
|
||||
};
|
||||
|
||||
# IPv6 Flowspec (2/133)
|
||||
flow6 {
|
||||
# connects to flowtab6 table by default
|
||||
import all;
|
||||
export all;
|
||||
};
|
||||
}
|
||||
|
||||
protocol bgp {
|
||||
local 192.168.1.1 as 1000;
|
||||
neighbor 192.168.3.1 as 1000;
|
||||
multihop;
|
||||
rr client;
|
||||
|
||||
ipv4 {
|
||||
import all;
|
||||
export where source ~ [ RTS_STATIC, RTS_BGP ];
|
||||
};
|
||||
|
||||
ipv6 {
|
||||
import all;
|
||||
export where source ~ [ RTS_STATIC, RTS_BGP ];
|
||||
next hop address 2001:db8:1:1::1;
|
||||
};
|
||||
}
|
||||
|
||||
protocol bgp {
|
||||
local 2001:db8:1:1::1 as 1000;
|
||||
neighbor 2001:db8:4:1::1 as 1000;
|
||||
multihop;
|
||||
rr client;
|
||||
|
||||
ipv4 {
|
||||
import all;
|
||||
export where source ~ [ RTS_STATIC, RTS_BGP ];
|
||||
next hop address 192.168.4.1;
|
||||
};
|
||||
|
||||
ipv6 {
|
||||
import all;
|
||||
export where source ~ [ RTS_STATIC, RTS_BGP ];
|
||||
};
|
||||
}
|
||||
|
20
bird2/files/bird.init
Normal file
20
bird2/files/bird.init
Normal file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2010-2017 OpenWrt.org
|
||||
|
||||
USE_PROCD=1
|
||||
START=70
|
||||
|
||||
BIRD_BIN="/usr/sbin/bird"
|
||||
BIRD_CONF="/etc/bird.conf"
|
||||
BIRD_PID_FILE="/var/run/bird.pid"
|
||||
|
||||
start_service() {
|
||||
mkdir -p /var/run
|
||||
procd_open_instance
|
||||
procd_set_param command $BIRD_BIN -c $BIRD_CONF -P $BIRD_PID_FILE
|
||||
procd_set_param file "$BIRD_CONF"
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
29
bird2/patches/0001-BGP-Fix-extended-next-hop-handling.patch
Normal file
29
bird2/patches/0001-BGP-Fix-extended-next-hop-handling.patch
Normal file
|
@ -0,0 +1,29 @@
|
|||
From f3a8cf050e6181e158dcde2fe885d7bf220eedc3 Mon Sep 17 00:00:00 2001
|
||||
From: "Ondrej Zajicek (work)" <santiago@crfreenet.org>
|
||||
Date: Thu, 12 Apr 2018 16:55:56 +0200
|
||||
Subject: [PATCH] BGP: Fix extended next hop handling
|
||||
|
||||
For IPv4 with extended next hop, we use MP-BGP format and therefore no
|
||||
independent NEXT_HOP attribute.
|
||||
|
||||
Thanks to Arvin Gan for the bugreport.
|
||||
---
|
||||
proto/bgp/attrs.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c
|
||||
index 0f41f818..9003feb2 100644
|
||||
--- a/proto/bgp/attrs.c
|
||||
+++ b/proto/bgp/attrs.c
|
||||
@@ -295,7 +295,7 @@ bgp_encode_next_hop(struct bgp_write_state *s, eattr *a, byte *buf, uint size)
|
||||
* store it and encode it later by AFI-specific hooks.
|
||||
*/
|
||||
|
||||
- if (s->channel->afi == BGP_AF_IPV4)
|
||||
+ if ((s->channel->afi == BGP_AF_IPV4) && !s->channel->ext_next_hop)
|
||||
{
|
||||
ASSERT(a->u.ptr->length == sizeof(ip_addr));
|
||||
|
||||
--
|
||||
2.17.0
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
From 823ad12191e66e243dd088a81c66e4a518563e40 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Maria Matejka <mq@ucw.cz>
|
||||
Date: Fri, 27 Apr 2018 14:38:41 +0200
|
||||
Subject: [PATCH] Filter: Added missing instruction comparators.
|
||||
|
||||
These instructions caused SIGABORTs on reconfiguration.
|
||||
---
|
||||
filter/filter.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/filter/filter.c b/filter/filter.c
|
||||
index bb3146e7..881ba420 100644
|
||||
--- a/filter/filter.c
|
||||
+++ b/filter/filter.c
|
||||
@@ -1712,7 +1712,10 @@ i_same(struct f_inst *f1, struct f_inst *f2)
|
||||
case FI_EA_SET: ONEARG; A2_SAME; break;
|
||||
|
||||
case FI_RETURN: ONEARG; break;
|
||||
+ case FI_ROA_MAXLEN: ONEARG; break;
|
||||
+ case FI_ROA_ASN: ONEARG; break;
|
||||
case FI_IP: ONEARG; break;
|
||||
+ case FI_IS_V4: ONEARG; break;
|
||||
case FI_ROUTE_DISTINGUISHER: ONEARG; break;
|
||||
case FI_CALL: /* Call rewriting trickery to avoid exponential behaviour */
|
||||
ONEARG;
|
||||
@@ -1735,6 +1738,8 @@ i_same(struct f_inst *f1, struct f_inst *f2)
|
||||
((struct f_inst_roa_check *) f2)->rtc->name))
|
||||
return 0;
|
||||
break;
|
||||
+ case FI_FORMAT: ONEARG; break;
|
||||
+ case FI_ASSERT: ONEARG; break;
|
||||
default:
|
||||
bug( "Unknown instruction %d in same (%c)", f1->fi_code, f1->fi_code & 0xff);
|
||||
}
|
||||
--
|
||||
2.17.0
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
From 40e7bd0e39849a03bd3f6f44d6719a5f8b1dd291 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <toke@toke.dk>
|
||||
Date: Mon, 30 Apr 2018 16:29:20 +0200
|
||||
Subject: [PATCH] babel: Fix type of route entry router ID
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The router ID being assigned to routes was a uint, which discards the upper
|
||||
32 bits. This also has the nice side effect of echoing the wrong router ID
|
||||
back to other routers.
|
||||
|
||||
Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
|
||||
---
|
||||
proto/babel/babel.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/proto/babel/babel.c b/proto/babel/babel.c
|
||||
index 4fd88042..a8eb5ea8 100644
|
||||
--- a/proto/babel/babel.c
|
||||
+++ b/proto/babel/babel.c
|
||||
@@ -2140,7 +2140,7 @@ babel_rt_notify(struct proto *P, struct channel *c UNUSED, struct network *net,
|
||||
uint internal = (new->attrs->src->proto == P);
|
||||
uint rt_seqno = internal ? new->u.babel.seqno : p->update_seqno;
|
||||
uint rt_metric = ea_get_int(attrs, EA_BABEL_METRIC, 0);
|
||||
- uint rt_router_id = internal ? new->u.babel.router_id : p->router_id;
|
||||
+ u64 rt_router_id = internal ? new->u.babel.router_id : p->router_id;
|
||||
|
||||
if (rt_metric > BABEL_INFINITY)
|
||||
{
|
||||
--
|
||||
2.17.0
|
||||
|
118
bird2/patches/0004-Babel-Add-option-to-randomize-router-ID.patch
Normal file
118
bird2/patches/0004-Babel-Add-option-to-randomize-router-ID.patch
Normal file
|
@ -0,0 +1,118 @@
|
|||
From 70fab17837dbb4c5848681e4c6b9b90891891130 Mon Sep 17 00:00:00 2001
|
||||
From: "Ondrej Zajicek (work)" <santiago@crfreenet.org>
|
||||
Date: Thu, 3 May 2018 16:55:11 +0200
|
||||
Subject: [PATCH 1/2] Babel: Add option to randomize router ID
|
||||
|
||||
When a Babel node restarts, it loses its sequence number, which can cause
|
||||
its routes to be rejected by peers until the state is cleared out by other
|
||||
nodes in the network (which can take on the order of minutes).
|
||||
|
||||
There are two ways to fix this: Having stable storage to keep the sequence
|
||||
number across restarts, or picking a different router ID each time.
|
||||
|
||||
This implements the latter, by introducing a new option that will cause
|
||||
BIRD to randomize a high 32 bits of router ID every time it starts up.
|
||||
This avoids the problem at the cost of not having stable router IDs in
|
||||
the network.
|
||||
|
||||
Thanks to Toke Hoiland-Jorgensen for the patch.
|
||||
---
|
||||
doc/bird.sgml | 10 ++++++++++
|
||||
proto/babel/babel.c | 11 +++++++++++
|
||||
proto/babel/babel.h | 1 +
|
||||
proto/babel/config.Y | 3 ++-
|
||||
4 files changed, 24 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/doc/bird.sgml b/doc/bird.sgml
|
||||
index 1191fa03..ae308d4c 100644
|
||||
--- a/doc/bird.sgml
|
||||
+++ b/doc/bird.sgml
|
||||
@@ -1691,6 +1691,7 @@ supports the following per-interface configuration options:
|
||||
protocol babel [<name>] {
|
||||
ipv4 { <channel config> };
|
||||
ipv6 [sadr] { <channel config> };
|
||||
+ randomize router id <switch>;
|
||||
interface <interface pattern> {
|
||||
type <wired|wireless>;
|
||||
rxcost <number>;
|
||||
@@ -1713,6 +1714,15 @@ protocol babel [<name>] {
|
||||
<tag><label id="babel-channel">ipv4 | ipv6 [sadr] <m/channel config/</tag>
|
||||
The supported channels are IPv4, IPv6, and IPv6 SADR.
|
||||
|
||||
+ <tag><label id="babel-random-router-id">randomize router id <m/switch/</tag>
|
||||
+ If enabled, Bird will randomize the top 32 bits of its router ID whenever
|
||||
+ the protocol instance starts up. If a Babel node restarts, it loses its
|
||||
+ sequence number, which can cause its routes to be rejected by peers until
|
||||
+ the state is cleared out by other nodes in the network (which can take on
|
||||
+ the order of minutes). Enabling this option causes Bird to pick a random
|
||||
+ router ID every time it starts up, which avoids this problem at the cost
|
||||
+ of not having stable router IDs in the network. Default: no.
|
||||
+
|
||||
<tag><label id="babel-type">type wired|wireless </tag>
|
||||
This option specifies the interface type: Wired or wireless. On wired
|
||||
interfaces a neighbor is considered unreachable after a small number of
|
||||
diff --git a/proto/babel/babel.c b/proto/babel/babel.c
|
||||
index 797a83d4..ce05191c 100644
|
||||
--- a/proto/babel/babel.c
|
||||
+++ b/proto/babel/babel.c
|
||||
@@ -2226,6 +2226,14 @@ babel_init(struct proto_config *CF)
|
||||
return P;
|
||||
}
|
||||
|
||||
+static inline void
|
||||
+babel_randomize_router_id(struct babel_proto *p)
|
||||
+{
|
||||
+ p->router_id &= (u64) 0xffffffff;
|
||||
+ p->router_id |= ((u64) random()) << 32;
|
||||
+ TRACE(D_EVENTS, "Randomized router ID to %lR", p->router_id);
|
||||
+}
|
||||
+
|
||||
static int
|
||||
babel_start(struct proto *P)
|
||||
{
|
||||
@@ -2244,6 +2252,9 @@ babel_start(struct proto *P)
|
||||
p->update_seqno = 1;
|
||||
p->router_id = proto_get_router_id(&cf->c);
|
||||
|
||||
+ if (cf->randomize_router_id)
|
||||
+ babel_randomize_router_id(p);
|
||||
+
|
||||
p->route_slab = sl_new(P->pool, sizeof(struct babel_route));
|
||||
p->source_slab = sl_new(P->pool, sizeof(struct babel_source));
|
||||
p->msg_slab = sl_new(P->pool, sizeof(struct babel_msg_node));
|
||||
diff --git a/proto/babel/babel.h b/proto/babel/babel.h
|
||||
index b194ce30..e5c9cd5b 100644
|
||||
--- a/proto/babel/babel.h
|
||||
+++ b/proto/babel/babel.h
|
||||
@@ -112,6 +112,7 @@ struct babel_config {
|
||||
struct proto_config c;
|
||||
list iface_list; /* List of iface configs (struct babel_iface_config) */
|
||||
uint hold_time; /* Time to hold stale entries and unreachable routes */
|
||||
+ u8 randomize_router_id;
|
||||
|
||||
struct channel_config *ip4_channel;
|
||||
struct channel_config *ip6_channel;
|
||||
diff --git a/proto/babel/config.Y b/proto/babel/config.Y
|
||||
index 7adfb4bb..205b4e4f 100644
|
||||
--- a/proto/babel/config.Y
|
||||
+++ b/proto/babel/config.Y
|
||||
@@ -25,7 +25,7 @@ CF_DECLS
|
||||
CF_KEYWORDS(BABEL, INTERFACE, METRIC, RXCOST, HELLO, UPDATE, INTERVAL, PORT,
|
||||
TYPE, WIRED, WIRELESS, RX, TX, BUFFER, PRIORITY, LENGTH, CHECK, LINK,
|
||||
NEXT, HOP, IPV4, IPV6, BABEL_METRIC, SHOW, INTERFACES, NEIGHBORS,
|
||||
- ENTRIES)
|
||||
+ ENTRIES, RANDOMIZE, ROUTER, ID)
|
||||
|
||||
CF_GRAMMAR
|
||||
|
||||
@@ -42,6 +42,7 @@ babel_proto_item:
|
||||
proto_item
|
||||
| proto_channel
|
||||
| INTERFACE babel_iface
|
||||
+ | RANDOMIZE ROUTER ID bool { BABEL_CFG->randomize_router_id = $4; }
|
||||
;
|
||||
|
||||
babel_proto_opts:
|
||||
--
|
||||
2.17.0
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
From eaf63d314d50cba5b2cfa8f18de64a91d3131b94 Mon Sep 17 00:00:00 2001
|
||||
From: "Ondrej Zajicek (work)" <santiago@crfreenet.org>
|
||||
Date: Thu, 3 May 2018 17:07:39 +0200
|
||||
Subject: [PATCH 2/2] Better initialization of random generator
|
||||
|
||||
Use full time precision to initialize random generator. The old
|
||||
code was prone to initialize it to the same values in specific
|
||||
circumstances (boot without RTC, multiple VMs starting at once).
|
||||
---
|
||||
sysdep/unix/io.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c
|
||||
index 012deaf0..11a0d6f1 100644
|
||||
--- a/sysdep/unix/io.c
|
||||
+++ b/sysdep/unix/io.c
|
||||
@@ -2144,7 +2144,9 @@ io_init(void)
|
||||
// XXX init_times();
|
||||
// XXX update_times();
|
||||
boot_time = current_time();
|
||||
- srandom((uint) (current_real_time() TO_S));
|
||||
+
|
||||
+ u64 now = (u64) current_real_time();
|
||||
+ srandom((uint) (now ^ (now >> 32)));
|
||||
}
|
||||
|
||||
static int short_loops = 0;
|
||||
--
|
||||
2.17.0
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
From 0ca3156f64a46c52c6d6fc913958f83970d3e57f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <toke@toke.dk>
|
||||
Date: Mon, 30 Apr 2018 11:13:02 +0200
|
||||
Subject: [PATCH] babel: Set onlink flag for IPv4 routes with unreachable next
|
||||
hop
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
If the next hop of a route is not a reachable address, the route should be
|
||||
installed as onlink. This enables a configuration common in mesh networks
|
||||
where the mesh interface is assigned a /32 and babel handles the routing by
|
||||
installing onlink routes.
|
||||
|
||||
Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
|
||||
---
|
||||
proto/babel/babel.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/proto/babel/babel.c b/proto/babel/babel.c
|
||||
index ce05191c..afd2eb19 100644
|
||||
--- a/proto/babel/babel.c
|
||||
+++ b/proto/babel/babel.c
|
||||
@@ -640,6 +640,13 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e)
|
||||
.nh.iface = r->neigh->ifa->iface,
|
||||
};
|
||||
|
||||
+ /* If we cannot find a reachable neighbour, set the entry to be onlink. This
|
||||
+ * makes it possible to, e.g., assign /32 addresses on a mesh interface and
|
||||
+ * have routing work.
|
||||
+ */
|
||||
+ if (!neigh_find2(&p->p, &r->next_hop, r->neigh->ifa->iface, 0))
|
||||
+ a0.nh.flags = RNF_ONLINK;
|
||||
+
|
||||
rta *a = rta_lookup(&a0);
|
||||
rte *rte = rte_get_temp(a);
|
||||
rte->u.babel.seqno = r->seqno;
|
||||
--
|
||||
2.17.0
|
||||
|
28
bird2/patches/0007-Fix-build-version.patch
Normal file
28
bird2/patches/0007-Fix-build-version.patch
Normal file
|
@ -0,0 +1,28 @@
|
|||
diff --git a/Makefile.in b/Makefile.in
|
||||
index c8168bb..eb6cc5c 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -21,11 +21,6 @@ INSTALL=@INSTALL@
|
||||
INSTALL_PROGRAM=@INSTALL_PROGRAM@
|
||||
INSTALL_DATA=@INSTALL_DATA@
|
||||
|
||||
-git-label:=$(strip $(shell git describe --always --dirty=-x 2>/dev/null))
|
||||
-ifneq ($(git-label),)
|
||||
- CFLAGS += -DGIT_LABEL="$(git-label)"
|
||||
-endif
|
||||
-
|
||||
client=$(addprefix $(exedir)/,@CLIENT@)
|
||||
daemon=$(exedir)/bird
|
||||
protocols=@protocols@
|
||||
@@ -42,6 +37,11 @@ srcdir := @srcdir@
|
||||
objdir := @objdir@
|
||||
exedir := @exedir@
|
||||
|
||||
+git-label:=$(strip $(shell cd $(srcdir) && [ "$$(git rev-parse --show-toplevel)" = "$$(readlink -f .)" ] && git describe --always --dirty=-x 2>/dev/null))
|
||||
+ifneq ($(git-label),)
|
||||
+ CFLAGS += -DGIT_LABEL="$(git-label)"
|
||||
+endif
|
||||
+
|
||||
ifeq ($(objdir),.)
|
||||
objdir := $(realpath .)
|
||||
endif
|
|
@ -0,0 +1,99 @@
|
|||
From b24b781117179f301116837f0a39468343e4805b Mon Sep 17 00:00:00 2001
|
||||
From: "Ondrej Zajicek (work)" <santiago@crfreenet.org>
|
||||
Date: Wed, 16 May 2018 11:19:29 +0200
|
||||
Subject: [PATCH] Filter: Add support for src filter op to access SADR source
|
||||
prefix
|
||||
|
||||
The patch allows to use 'net.src' to access SADR source prefix
|
||||
from filters.
|
||||
|
||||
Thanks to Toke Hoiland-Jorgensen for the original patch for srclen.
|
||||
---
|
||||
filter/config.Y | 3 ++-
|
||||
filter/filter.c | 15 +++++++++++++++
|
||||
filter/filter.h | 1 +
|
||||
lib/net.h | 2 ++
|
||||
4 files changed, 20 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/filter/config.Y b/filter/config.Y
|
||||
index f8170a83..e01e02ef 100644
|
||||
--- a/filter/config.Y
|
||||
+++ b/filter/config.Y
|
||||
@@ -411,7 +411,7 @@ CF_KEYWORDS(FUNCTION, PRINT, PRINTN, UNSET, RETURN,
|
||||
TRUE, FALSE, RT, RO, UNKNOWN, GENERIC,
|
||||
FROM, GW, NET, MASK, PROTO, SOURCE, SCOPE, DEST, IFNAME, IFINDEX,
|
||||
PREFERENCE,
|
||||
- ROA_CHECK, ASN,
|
||||
+ ROA_CHECK, ASN, SRC,
|
||||
IS_V4, IS_V6,
|
||||
LEN, MAXLEN,
|
||||
DEFINED,
|
||||
@@ -898,6 +898,7 @@ term:
|
||||
| term '.' LEN { $$ = f_new_inst(FI_LENGTH); $$->a1.p = $1; }
|
||||
| term '.' MAXLEN { $$ = f_new_inst(FI_ROA_MAXLEN); $$->a1.p = $1; }
|
||||
| term '.' ASN { $$ = f_new_inst(FI_ROA_ASN); $$->a1.p = $1; }
|
||||
+ | term '.' SRC { $$ = f_new_inst(FI_SADR_SRC); $$->a1.p = $1; }
|
||||
| term '.' MASK '(' term ')' { $$ = f_new_inst(FI_IP_MASK); $$->a1.p = $1; $$->a2.p = $5; }
|
||||
| term '.' FIRST { $$ = f_new_inst(FI_AS_PATH_FIRST); $$->a1.p = $1; }
|
||||
| term '.' LAST { $$ = f_new_inst(FI_AS_PATH_LAST); $$->a1.p = $1; }
|
||||
diff --git a/filter/filter.c b/filter/filter.c
|
||||
index 881ba420..3d7b5c9f 100644
|
||||
--- a/filter/filter.c
|
||||
+++ b/filter/filter.c
|
||||
@@ -1241,6 +1241,20 @@ interpret(struct f_inst *what)
|
||||
default: runtime( "Prefix, path, clist or eclist expected" );
|
||||
}
|
||||
break;
|
||||
+ case FI_SADR_SRC: /* Get SADR src prefix */
|
||||
+ ONEARG;
|
||||
+ if (v1.type != T_NET || !net_is_sadr(v1.val.net))
|
||||
+ runtime( "SADR expected" );
|
||||
+
|
||||
+ {
|
||||
+ net_addr_ip6_sadr *net = (void *) v1.val.net;
|
||||
+ net_addr *src = lp_alloc(f_pool, sizeof(net_addr_ip6));
|
||||
+ net_fill_ip6(src, net->src_prefix, net->src_pxlen);
|
||||
+
|
||||
+ res.type = T_NET;
|
||||
+ res.val.net = src;
|
||||
+ }
|
||||
+ break;
|
||||
case FI_ROA_MAXLEN: /* Get ROA max prefix length */
|
||||
ONEARG;
|
||||
if (v1.type != T_NET || !net_is_roa(v1.val.net))
|
||||
@@ -1714,6 +1728,7 @@ i_same(struct f_inst *f1, struct f_inst *f2)
|
||||
case FI_RETURN: ONEARG; break;
|
||||
case FI_ROA_MAXLEN: ONEARG; break;
|
||||
case FI_ROA_ASN: ONEARG; break;
|
||||
+ case FI_SADR_SRC: ONEARG; break;
|
||||
case FI_IP: ONEARG; break;
|
||||
case FI_IS_V4: ONEARG; break;
|
||||
case FI_ROUTE_DISTINGUISHER: ONEARG; break;
|
||||
diff --git a/filter/filter.h b/filter/filter.h
|
||||
index d347924a..982276f0 100644
|
||||
--- a/filter/filter.h
|
||||
+++ b/filter/filter.h
|
||||
@@ -55,6 +55,7 @@
|
||||
F(FI_LENGTH, 0, 'L') \
|
||||
F(FI_ROA_MAXLEN, 'R', 'M') \
|
||||
F(FI_ROA_ASN, 'R', 'A') \
|
||||
+ F(FI_SADR_SRC, 'n', 's') \
|
||||
F(FI_IP, 'c', 'p') \
|
||||
F(FI_ROUTE_DISTINGUISHER, 'R', 'D') \
|
||||
F(FI_AS_PATH_FIRST, 'a', 'f') \
|
||||
diff --git a/lib/net.h b/lib/net.h
|
||||
index ad4000fd..0cd5f735 100644
|
||||
--- a/lib/net.h
|
||||
+++ b/lib/net.h
|
||||
@@ -268,6 +268,8 @@ static inline int net_is_roa(const net_addr *a)
|
||||
static inline int net_is_flow(const net_addr *a)
|
||||
{ return (a->type == NET_FLOW4) || (a->type == NET_FLOW6); }
|
||||
|
||||
+static inline int net_is_sadr(const net_addr *a)
|
||||
+{ return (a->type == NET_IP6_SADR); }
|
||||
|
||||
static inline ip4_addr net4_prefix(const net_addr *a)
|
||||
{ return ((net_addr_ip4 *) a)->prefix; }
|
||||
--
|
||||
2.17.0
|
||||
|
Loading…
Reference in a new issue