summaryrefslogtreecommitdiff
path: root/proto/bgp
diff options
context:
space:
mode:
Diffstat (limited to 'proto/bgp')
-rw-r--r--proto/bgp/bgp.c4
-rw-r--r--proto/bgp/bgp.h1
-rw-r--r--proto/bgp/config.Y5
-rw-r--r--proto/bgp/packets.c3
4 files changed, 8 insertions, 5 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index b6239971..e2339112 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -680,8 +680,8 @@ bgp_connect(struct bgp_proto *p) /* Enter Connect state and start establishing c
s->type = SK_TCP_ACTIVE;
s->saddr = p->source_addr;
s->daddr = p->cf->remote_ip;
+ s->dport = p->cf->remote_port;
s->iface = p->neigh ? p->neigh->iface : NULL;
- s->dport = BGP_PORT;
s->ttl = p->cf->ttl_security ? 255 : hops;
s->rbsize = BGP_RX_BUFFER_SIZE;
s->tbsize = BGP_TX_BUFFER_SIZE;
@@ -1016,9 +1016,9 @@ bgp_start(struct proto *P)
lock = p->lock = olock_new(P->pool);
lock->addr = p->cf->remote_ip;
+ lock->port = p->cf->remote_port;
lock->iface = p->cf->iface;
lock->type = OBJLOCK_TCP;
- lock->port = BGP_PORT;
lock->hook = bgp_start_locked;
lock->data = p;
olock_acquire(lock);
diff --git a/proto/bgp/bgp.h b/proto/bgp/bgp.h
index da0114c2..0fd3a73c 100644
--- a/proto/bgp/bgp.h
+++ b/proto/bgp/bgp.h
@@ -23,6 +23,7 @@ struct bgp_config {
ip_addr remote_ip;
ip_addr source_addr; /* Source address to use */
struct iface *iface; /* Interface for link-local addresses */
+ u16 remote_port; /* Neighbor destination port */
int multihop; /* Number of hops if multihop */
int ttl_security; /* Enable TTL security [RFC5082] */
int next_hop_self; /* Always set next hop to local IP address */
diff --git a/proto/bgp/config.Y b/proto/bgp/config.Y
index 4d085d42..8e0b2412 100644
--- a/proto/bgp/config.Y
+++ b/proto/bgp/config.Y
@@ -60,7 +60,7 @@ bgp_proto:
| 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 AS expr ';' {
+ | bgp_proto NEIGHBOR ipa ipa_scope ipa_port AS expr ';' {
if (ipa_nonzero(BGP_CFG->remote_ip))
cf_error("Only one neighbor per BGP instance is allowed");
if (!ipa_has_link_scope($3) != !$4)
@@ -68,7 +68,8 @@ bgp_proto:
BGP_CFG->remote_ip = $3;
BGP_CFG->iface = $4;
- BGP_CFG->remote_as = $6;
+ BGP_CFG->remote_port = ($5 > 0) ? $5 : BGP_PORT;
+ BGP_CFG->remote_as = $7;
}
| bgp_proto RR CLUSTER ID idval ';' { BGP_CFG->rr_cluster_id = $5; }
| bgp_proto RR CLIENT ';' { BGP_CFG->rr_client = 1; }
diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c
index 4464523d..0b9de8c1 100644
--- a/proto/bgp/packets.c
+++ b/proto/bgp/packets.c
@@ -22,7 +22,8 @@
#include "bgp.h"
-static struct rate_limit rl_rcv_update, rl_snd_update;
+static struct tbf rl_rcv_update = TBF_DEFAULT_LOG_LIMITS;
+static struct tbf rl_snd_update = TBF_DEFAULT_LOG_LIMITS;
/* Table for state -> RFC 6608 FSM error subcodes */
static byte fsm_err_subcode[BS_MAX] = {