mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-25 04:43:33 +00:00
Add several experimental patches to the port.
Add special 'EXP' option (off by default) to use these patches. Reviewed by: az
This commit is contained in:
parent
1bf88ee8d8
commit
f3eeb09561
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=377621
@ -3,7 +3,7 @@
|
||||
|
||||
PORTNAME?= bird
|
||||
PORTVERSION= 1.4.5
|
||||
PORTREVISION= 1
|
||||
PORTREVISION= 2
|
||||
CATEGORIES= net
|
||||
MASTER_SITES= ftp://bird.network.cz/pub/bird/ \
|
||||
http://bird.mpls.in/distfiles/bird/
|
||||
@ -18,9 +18,10 @@ GNU_CONFIGURE= yes
|
||||
CONFIGURE_ARGS+= --localstatedir=/var
|
||||
USE_CSTD= gnu89
|
||||
|
||||
OPTIONS_DEFINE?= FIREWALL AGG
|
||||
OPTIONS_DEFINE?= FIREWALL AGG EXP
|
||||
FIREWALL_DESC= Enable firewall protocol
|
||||
AGG_DESC= Enable aggregation protocol (EXPERIMENTAL)
|
||||
EXP_DESC= Enable some experimental patches
|
||||
NO_OPTIONS_SORT= yes
|
||||
|
||||
MAKE_JOBS_UNSAFE= yes
|
||||
@ -33,6 +34,7 @@ PLIST_SUB?= VER=""
|
||||
|
||||
FIREWALL_EXTRA_PATCHES+= ${FILESDIR}/firewall_support.patch
|
||||
AGG_EXTRA_PATCHES+= ${FILESDIR}/agg_support.patch
|
||||
EXP_EXTRA_PATCHES+= ${FILESDIR}/exp-templates.patch ${FILESDIR}/exp-ll.patch ${FILESDIR}/exp-locks.patch
|
||||
|
||||
.include <bsd.port.options.mk>
|
||||
|
||||
|
164
net/bird/files/exp-ll.patch
Normal file
164
net/bird/files/exp-ll.patch
Normal file
@ -0,0 +1,164 @@
|
||||
From d4d9c7fb4c74485b603026aaa35a528160c87ed4 Mon Sep 17 00:00:00 2001
|
||||
From: "Alexander V. Chernikov" <melifaro@yandex-team.ru>
|
||||
Date: Fri, 19 Dec 2014 15:44:45 +0000
|
||||
Subject: [PATCH 2/3] Improve link-local nexthops handling for link-local
|
||||
BGP-IPv6 sessions.
|
||||
|
||||
---
|
||||
doc/bird.sgml | 9 +++++++++
|
||||
proto/bgp/bgp.h | 6 ++++++
|
||||
proto/bgp/config.Y | 8 +++++++-
|
||||
proto/bgp/packets.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++----
|
||||
4 files changed, 70 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git doc/bird.sgml doc/bird.sgml
|
||||
index e9e5920..2951f13 100644
|
||||
--- doc/bird.sgml
|
||||
+++ doc/bird.sgml
|
||||
@@ -1668,6 +1668,15 @@ using the following configuration parameters:
|
||||
local address should be used instead, like when the route is sent to an
|
||||
interface with a different subnet. Default: disabled.
|
||||
|
||||
+ <tag>next hop lladdr both|only|empty</tag>
|
||||
+ Different BGP-IPv6 implementations sends/receives link-local nexthops
|
||||
+ for link-local BGP sessions in different formats. This option specifies
|
||||
+ exact format understood by particular peer. <cf/both/ means that BIRD
|
||||
+ sends both addresses in next-hop as link-local. <cf/only/ means that BIRD
|
||||
+ sends single link-local address as next-hop. <cf/empty/ means that BIRD
|
||||
+ sends empty global address and original link-local address as next-hop.
|
||||
+ Default: <cf/empty/.
|
||||
+
|
||||
<tag>missing lladdr self|drop|ignore</tag>
|
||||
Next Hop attribute in BGP-IPv6 sometimes contains just the global IPv6
|
||||
address, but sometimes it has to contain both global and link-local IPv6
|
||||
diff --git proto/bgp/bgp.h proto/bgp/bgp.h
|
||||
index 0fd3a73..5a53559 100644
|
||||
--- proto/bgp/bgp.h
|
||||
+++ proto/bgp/bgp.h
|
||||
@@ -51,6 +51,7 @@ struct bgp_config {
|
||||
int allow_local_as; /* Allow that number of local ASNs in incoming AS_PATHs */
|
||||
int gr_mode; /* Graceful restart mode (BGP_GR_*) */
|
||||
unsigned gr_time; /* Graceful restart timeout */
|
||||
+ int nhop_lladdr; /* Expected link-local nhop format, see NLL_* */
|
||||
unsigned connect_retry_time;
|
||||
unsigned hold_time, initial_hold_time;
|
||||
unsigned keepalive_time;
|
||||
@@ -69,6 +70,11 @@ struct bgp_config {
|
||||
#define MLL_DROP 2
|
||||
#define MLL_IGNORE 3
|
||||
|
||||
+#define NLL_BOTH 1
|
||||
+#define NLL_ONLY 2
|
||||
+#define NLL_EMPTYGLOBAL 3
|
||||
+#define NLL_TRANSPARENT 4
|
||||
+
|
||||
#define GW_DIRECT 1
|
||||
#define GW_RECURSIVE 2
|
||||
|
||||
diff --git proto/bgp/config.Y proto/bgp/config.Y
|
||||
index d04c16d..5c9e826 100644
|
||||
--- proto/bgp/config.Y
|
||||
+++ proto/bgp/config.Y
|
||||
@@ -26,7 +26,8 @@ CF_KEYWORDS(BGP, LOCAL, REMOTE, NEIGHBOR, AS, HOLD, TIME, CONNECT, RETRY,
|
||||
PREFER, OLDER, MISSING, LLADDR, DROP, IGNORE, ROUTE, REFRESH,
|
||||
INTERPRET, COMMUNITIES, BGP_ORIGINATOR_ID, BGP_CLUSTER_LIST, IGP,
|
||||
TABLE, GATEWAY, DIRECT, RECURSIVE, MED, TTL, SECURITY, DETERMINISTIC,
|
||||
- SECONDARY, ALLOW, BFD, ADD, PATHS, RX, TX, GRACEFUL, RESTART, AWARE)
|
||||
+ SECONDARY, ALLOW, BFD, ADD, PATHS, RX, TX, GRACEFUL, RESTART, AWARE,
|
||||
+ BOTH)
|
||||
|
||||
CF_GRAMMAR
|
||||
|
||||
@@ -53,6 +54,7 @@ bgp_proto_start: proto_start BGP {
|
||||
BGP_CFG->gr_mode = BGP_GR_AWARE;
|
||||
BGP_CFG->gr_time = 120;
|
||||
BGP_CFG->remote_port = BGP_PORT;
|
||||
+ BGP_CFG->nhop_lladdr = NLL_EMPTYGLOBAL;
|
||||
}
|
||||
;
|
||||
|
||||
@@ -88,6 +90,10 @@ bgp_proto:
|
||||
| bgp_proto MULTIHOP expr ';' { BGP_CFG->multihop = $3; if (($3<1) || ($3>255)) cf_error("Multihop must be in range 1-255"); }
|
||||
| bgp_proto NEXT HOP SELF ';' { BGP_CFG->next_hop_self = 1; BGP_CFG->next_hop_keep = 0; }
|
||||
| bgp_proto NEXT HOP KEEP ';' { BGP_CFG->next_hop_keep = 1; BGP_CFG->next_hop_self = 0; }
|
||||
+ | bgp_proto NEXT HOP LLADDR BOTH ';' { BGP_CFG->nhop_lladdr = NLL_BOTH; }
|
||||
+ | bgp_proto NEXT HOP LLADDR ONLY ';' { BGP_CFG->nhop_lladdr = NLL_ONLY; }
|
||||
+ | bgp_proto NEXT HOP LLADDR EMPTY ';' { BGP_CFG->nhop_lladdr = NLL_EMPTYGLOBAL; }
|
||||
+ | bgp_proto NEXT HOP LLADDR TRANSPARENT ';' { BGP_CFG->nhop_lladdr = NLL_TRANSPARENT; }
|
||||
| bgp_proto MISSING LLADDR SELF ';' { BGP_CFG->missing_lladdr = MLL_SELF; }
|
||||
| bgp_proto MISSING LLADDR DROP ';' { BGP_CFG->missing_lladdr = MLL_DROP; }
|
||||
| bgp_proto MISSING LLADDR IGNORE ';' { BGP_CFG->missing_lladdr = MLL_IGNORE; }
|
||||
diff --git proto/bgp/packets.c proto/bgp/packets.c
|
||||
index 0b9de8c..0744fab 100644
|
||||
--- proto/bgp/packets.c
|
||||
+++ proto/bgp/packets.c
|
||||
@@ -522,8 +522,36 @@ bgp_create_update(struct bgp_conn *conn, byte *buf)
|
||||
*tmp++ = BGP_AF_IPV6;
|
||||
*tmp++ = 1;
|
||||
|
||||
- if (ipa_has_link_scope(ip))
|
||||
- ip = IPA_NONE;
|
||||
+ /*
|
||||
+ * Handle different nexthops schemes for link-local BGP:
|
||||
+ * Possible cases:
|
||||
+ * [ ::, fe80::XX ]: bird default
|
||||
+ * [ fe80::XX, fe80::XX ]: used in JunoOS
|
||||
+ * [ fe80:XX ]: used by some Huawei implementations
|
||||
+ */
|
||||
+ if ((ipa_zero(ip) || ipa_has_link_scope(ip)) && ipa_nonzero(ip_ll))
|
||||
+ {
|
||||
+ switch (p->cf->nhop_lladdr)
|
||||
+ {
|
||||
+ case NLL_EMPTYGLOBAL:
|
||||
+ /* Leave link-local, but reset global address to :: */
|
||||
+ if (ipa_has_link_scope(ip))
|
||||
+ ip = IPA_NONE;
|
||||
+ break;
|
||||
+ case NLL_ONLY:
|
||||
+ /* Link-local address only */
|
||||
+ ip = ip_ll;
|
||||
+ ip_ll = IPA_NONE;
|
||||
+ break;
|
||||
+ case NLL_BOTH:
|
||||
+ /* Both addresses are link-local */
|
||||
+ ip = ip_ll;
|
||||
+ break;
|
||||
+ case NLL_TRANSPARENT:
|
||||
+ /* Leave as is */
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
if (ipa_nonzero(ip_ll))
|
||||
{
|
||||
@@ -1033,9 +1061,25 @@ bgp_set_next_hop(struct bgp_proto *p, rta *a)
|
||||
#ifdef IPV6
|
||||
int second = (nh->u.ptr->length == NEXT_HOP_LENGTH) && ipa_nonzero(nexthop[1]);
|
||||
|
||||
- /* First address should not be link-local, but may be zero in direct mode */
|
||||
+ /*
|
||||
+ * There are different ways of sending link-local nexthop address:
|
||||
+ * some implementation pass single entry with link-local address, e.g. [ fe80::xx ]
|
||||
+ * some may pass dual nexthops, e.g. [ aa::bb fe80::xx ].
|
||||
+ *
|
||||
+ * We need to convert both cases to internally used [ :: fe80:xx ] scheme.
|
||||
+ */
|
||||
if (ipa_has_link_scope(*nexthop))
|
||||
- *nexthop = IPA_NONE;
|
||||
+ {
|
||||
+ if (second)
|
||||
+ *nexthop = IPA_NONE;
|
||||
+ else
|
||||
+ {
|
||||
+ /* We have received single link-local nexthop */
|
||||
+ nexthop = alloca(sizeof(ip_addr) * 2);
|
||||
+ *nexthop = IPA_NONE;
|
||||
+ nexthop[1] = *((ip_addr *) nh->u.ptr->data);
|
||||
+ }
|
||||
+ }
|
||||
#else
|
||||
int second = 0;
|
||||
#endif
|
||||
--
|
||||
2.1.2
|
||||
|
25
net/bird/files/exp-locks.patch
Normal file
25
net/bird/files/exp-locks.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From 72eb25c26107f31bcf6d8cd02e47ec16a69082ce Mon Sep 17 00:00:00 2001
|
||||
From: "Alexander V. Chernikov" <melifaro@yandex-team.ru>
|
||||
Date: Wed, 21 Jan 2015 19:12:33 +0000
|
||||
Subject: [PATCH 3/3] Locks fix from list.
|
||||
|
||||
---
|
||||
nest/locks.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git nest/locks.c nest/locks.c
|
||||
index 7044d6a..8ee5898 100644
|
||||
--- nest/locks.c
|
||||
+++ nest/locks.c
|
||||
@@ -68,7 +68,7 @@ olock_free(resource *r)
|
||||
DBG("olock: -> %p becomes locked\n", n);
|
||||
q = SKIP_BACK(struct object_lock, n, n);
|
||||
rem_node(n);
|
||||
- add_tail_list(&l->waiters, &q->waiters);
|
||||
+ add_tail_list(&q->waiters, &l->waiters);
|
||||
q->state = OLOCK_STATE_EVENT;
|
||||
add_head(&olock_list, n);
|
||||
ev_schedule(olock_event);
|
||||
--
|
||||
2.1.2
|
||||
|
140
net/bird/files/exp-templates.patch
Normal file
140
net/bird/files/exp-templates.patch
Normal file
@ -0,0 +1,140 @@
|
||||
From 80d3b227f32679332957299a9c01da66cce54427 Mon Sep 17 00:00:00 2001
|
||||
From: "Alexander V. Chernikov" <melifaro@yandex-team.ru>
|
||||
Date: Fri, 19 Dec 2014 15:36:40 +0000
|
||||
Subject: [PATCH 1/3] Simplify using templates for BGP:
|
||||
|
||||
Permit specifying remote as via 'remote as' statement.
|
||||
Permit specifying interface for link-local sessions via 'interface'
|
||||
statement.
|
||||
Relax 'neighbor' statement: do not require specifying as.
|
||||
---
|
||||
conf/confbase.Y | 3 +--
|
||||
doc/bird.sgml | 11 ++++++++++-
|
||||
proto/bgp/bgp.c | 11 +++++++++++
|
||||
proto/bgp/config.Y | 19 ++++++++++++-------
|
||||
4 files changed, 34 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git conf/confbase.Y conf/confbase.Y
|
||||
index 49831b1..ccc9e10 100644
|
||||
--- conf/confbase.Y
|
||||
+++ conf/confbase.Y
|
||||
@@ -162,8 +162,7 @@ ipa_scope:
|
||||
;
|
||||
|
||||
ipa_port:
|
||||
- /* empty */ { $$ = 0; }
|
||||
- | PORT expr {
|
||||
+ PORT expr {
|
||||
if (($2 < 1) || ($2 > 65535)) cf_error("Invalid port number");
|
||||
$$ = $2;
|
||||
}
|
||||
diff --git doc/bird.sgml doc/bird.sgml
|
||||
index 31b1d6f..e9e5920 100644
|
||||
--- doc/bird.sgml
|
||||
+++ doc/bird.sgml
|
||||
@@ -1620,7 +1620,11 @@ using the following configuration parameters:
|
||||
address, equivalent to the <cf/source address/ option (see below). This
|
||||
parameter is mandatory.
|
||||
|
||||
- <tag>neighbor <m/ip/ [port <m/number/] as <m/number/</tag>
|
||||
+ <tag>remote as <m/number/</tag>
|
||||
+ Define neighboring AS number. AS number can also be specified inside
|
||||
+ <cf/neighbor/ statement. In that case, this paremeter is optional.
|
||||
+
|
||||
+ <tag>neighbor <m/ip/ [port <m/number/] [as <m/number/]</tag>
|
||||
Define neighboring router this instance will be talking to and what AS
|
||||
it's located in. In case the neighbor is in the same AS as we are, we
|
||||
automatically switch to iBGP. This parameter is mandatory.
|
||||
@@ -1649,6 +1653,11 @@ using the following configuration parameters:
|
||||
source address for the BGP session. Default: the address of the local
|
||||
end of the interface our neighbor is connected to.
|
||||
|
||||
+ <tag>interface <m/iface/</tag>
|
||||
+ Define interface we should use for link-local BGP IPv6 sessions. Interface
|
||||
+ can also be specified inside <cf/neighbor address/. It is an error to use
|
||||
+ this parameter for non link-local sessions. This parameter is optional.
|
||||
+
|
||||
<tag>next hop self</tag>
|
||||
Avoid calculation of the Next Hop attribute and always advertise our own
|
||||
source address as a next hop. This needs to be used only occasionally to
|
||||
diff --git proto/bgp/bgp.c proto/bgp/bgp.c
|
||||
index e233911..3fbedad 100644
|
||||
--- proto/bgp/bgp.c
|
||||
+++ proto/bgp/bgp.c
|
||||
@@ -1157,6 +1157,9 @@ bgp_check_config(struct bgp_config *c)
|
||||
if (!c->remote_as)
|
||||
cf_error("Neighbor must be configured");
|
||||
|
||||
+ if (!c->remote_port)
|
||||
+ cf_error("Correct BGP port must be set");
|
||||
+
|
||||
if (!(c->capabilities && c->enable_as4) && (c->remote_as > 0xFFFF))
|
||||
cf_error("Neighbor AS number out of range (AS4 not available)");
|
||||
|
||||
@@ -1176,6 +1179,14 @@ bgp_check_config(struct bgp_config *c)
|
||||
if (c->multihop && c->bfd && ipa_zero(c->source_addr))
|
||||
cf_error("Multihop BGP with BFD requires specified source address");
|
||||
|
||||
+ if (!c->iface && (ipa_has_link_scope(c->remote_ip) ||
|
||||
+ ipa_has_link_scope(c->source_addr)))
|
||||
+ cf_error("Link-local BGP requires specifying interface");
|
||||
+
|
||||
+ if (c->iface && (!ipa_has_link_scope(c->remote_ip) &&
|
||||
+ !ipa_has_link_scope(c->source_addr)))
|
||||
+ cf_error("Explicit interface specified for global addresses");
|
||||
+
|
||||
if ((c->gw_mode == GW_RECURSIVE) && c->c.table->sorted)
|
||||
cf_error("BGP in recursive mode prohibits sorted table");
|
||||
|
||||
diff --git proto/bgp/config.Y proto/bgp/config.Y
|
||||
index 8e0b241..d04c16d 100644
|
||||
--- proto/bgp/config.Y
|
||||
+++ proto/bgp/config.Y
|
||||
@@ -16,7 +16,7 @@ CF_DEFINES
|
||||
|
||||
CF_DECLS
|
||||
|
||||
-CF_KEYWORDS(BGP, LOCAL, NEIGHBOR, AS, HOLD, TIME, CONNECT, RETRY,
|
||||
+CF_KEYWORDS(BGP, LOCAL, REMOTE, NEIGHBOR, AS, HOLD, TIME, CONNECT, RETRY,
|
||||
KEEPALIVE, MULTIHOP, STARTUP, VIA, NEXT, HOP, SELF, DEFAULT,
|
||||
PATH, METRIC, ERROR, START, DELAY, FORGET, WAIT, ENABLE,
|
||||
DISABLE, AFTER, BGP_PATH, BGP_LOCAL_PREF, BGP_MED, BGP_ORIGIN,
|
||||
@@ -52,24 +52,29 @@ bgp_proto_start: proto_start BGP {
|
||||
BGP_CFG->default_local_pref = 100;
|
||||
BGP_CFG->gr_mode = BGP_GR_AWARE;
|
||||
BGP_CFG->gr_time = 120;
|
||||
+ BGP_CFG->remote_port = BGP_PORT;
|
||||
}
|
||||
;
|
||||
|
||||
+bpg_neighbor_opts:
|
||||
+ | ipa_port { if ($1 != 0) BGP_CFG->remote_port = $1; }
|
||||
+ | AS expr { BGP_CFG->remote_as = $2; }
|
||||
+ ;
|
||||
+
|
||||
bgp_proto:
|
||||
bgp_proto_start proto_name '{'
|
||||
| bgp_proto proto_item ';'
|
||||
| bgp_proto LOCAL AS expr ';' { BGP_CFG->local_as = $4; }
|
||||
| bgp_proto LOCAL ipa AS expr ';' { BGP_CFG->source_addr = $3; BGP_CFG->local_as = $5; }
|
||||
- | bgp_proto NEIGHBOR ipa ipa_scope ipa_port AS expr ';' {
|
||||
+ | bgp_proto REMOTE AS expr ';' { BGP_CFG->remote_as = $4; }
|
||||
+ | bgp_proto INTERFACE SYM ';' { BGP_CFG->iface = if_get_by_name($3->name); }
|
||||
+ | bgp_proto NEIGHBOR ipa ipa_scope bpg_neighbor_opts ';' {
|
||||
if (ipa_nonzero(BGP_CFG->remote_ip))
|
||||
cf_error("Only one neighbor per BGP instance is allowed");
|
||||
- if (!ipa_has_link_scope($3) != !$4)
|
||||
- cf_error("Link-local address and interface scope must be used together");
|
||||
|
||||
BGP_CFG->remote_ip = $3;
|
||||
- BGP_CFG->iface = $4;
|
||||
- BGP_CFG->remote_port = ($5 > 0) ? $5 : BGP_PORT;
|
||||
- BGP_CFG->remote_as = $7;
|
||||
+ if ($4 != NULL)
|
||||
+ BGP_CFG->iface = $4;
|
||||
}
|
||||
| bgp_proto RR CLUSTER ID idval ';' { BGP_CFG->rr_cluster_id = $5; }
|
||||
| bgp_proto RR CLIENT ';' { BGP_CFG->rr_client = 1; }
|
||||
--
|
||||
2.1.2
|
||||
|
@ -7,7 +7,7 @@ DISTNAME= bird-${PORTVERSION}
|
||||
|
||||
MASTERDIR= ${.CURDIR}/../bird
|
||||
|
||||
OPTIONS_DEFINE=
|
||||
OPTIONS_DEFINE= EXP
|
||||
|
||||
USE_RC_SUBR= ${PORTNAME}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user