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
3 files changed, 6 insertions, 4 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; }