Commit be6e39eb authored by Ondřej Zajíček's avatar Ondřej Zajíček

Passive option.

parent 2d507e64
...@@ -868,6 +868,11 @@ for each neighbor using the following configuration parameters: ...@@ -868,6 +868,11 @@ for each neighbor using the following configuration parameters:
of BGP sessions. Default: no authentication. Password has to be set by of BGP sessions. Default: no authentication. Password has to be set by
external utility (e.g. setkey(8)) on BSD systems. external utility (e.g. setkey(8)) on BSD systems.
<tag>passive <m/switch/</tag> Standard BGP behavior is both
initiating outgoing connections and accepting incoming
connections. In passive mode, outgoing connections are not
initiated. Default: off.
<tag>rr client</tag> Be a route reflector and treat the neighbor as <tag>rr client</tag> Be a route reflector and treat the neighbor as
a route reflection client. Default: disabled. a route reflection client. Default: disabled.
......
...@@ -120,7 +120,9 @@ bgp_startup(struct bgp_proto *p) ...@@ -120,7 +120,9 @@ bgp_startup(struct bgp_proto *p)
{ {
BGP_TRACE(D_EVENTS, "Started"); BGP_TRACE(D_EVENTS, "Started");
p->start_state = p->cf->capabilities ? BSS_CONNECT : BSS_CONNECT_NOCAP; p->start_state = p->cf->capabilities ? BSS_CONNECT : BSS_CONNECT_NOCAP;
bgp_active(p);
if (!p->cf->passive)
bgp_active(p);
} }
static void static void
...@@ -292,7 +294,8 @@ bgp_decision(void *vp) ...@@ -292,7 +294,8 @@ bgp_decision(void *vp)
DBG("BGP: Decision start\n"); DBG("BGP: Decision start\n");
if ((p->p.proto_state == PS_START) if ((p->p.proto_state == PS_START)
&& (p->outgoing_conn.state == BS_IDLE)) && (p->outgoing_conn.state == BS_IDLE)
&& (!p->cf->passive))
bgp_active(p); bgp_active(p);
if ((p->p.proto_state == PS_STOP) if ((p->p.proto_state == PS_STOP)
......
...@@ -33,6 +33,7 @@ struct bgp_config { ...@@ -33,6 +33,7 @@ struct bgp_config {
int rs_client; /* Whether neighbor is RS client of me */ int rs_client; /* Whether neighbor is RS client of me */
int advertise_ipv4; /* Whether we should add IPv4 capability advertisement to OPEN message */ int advertise_ipv4; /* Whether we should add IPv4 capability advertisement to OPEN message */
u32 route_limit; /* Number of routes that may be imported, 0 means disable limit */ u32 route_limit; /* Number of routes that may be imported, 0 means disable limit */
int passive; /* Do not initiate outgoing connection */
unsigned connect_retry_time; unsigned connect_retry_time;
unsigned hold_time, initial_hold_time; unsigned hold_time, initial_hold_time;
unsigned keepalive_time; unsigned keepalive_time;
......
...@@ -22,7 +22,7 @@ CF_KEYWORDS(BGP, LOCAL, NEIGHBOR, AS, HOLD, TIME, CONNECT, RETRY, KEEPALIVE, ...@@ -22,7 +22,7 @@ CF_KEYWORDS(BGP, LOCAL, NEIGHBOR, AS, HOLD, TIME, CONNECT, RETRY, KEEPALIVE,
BGP_PATH, BGP_LOCAL_PREF, BGP_MED, BGP_ORIGIN, BGP_NEXT_HOP, BGP_PATH, BGP_LOCAL_PREF, BGP_MED, BGP_ORIGIN, BGP_NEXT_HOP,
BGP_ATOMIC_AGGR, BGP_AGGREGATOR, BGP_COMMUNITY, SOURCE, ADDRESS, BGP_ATOMIC_AGGR, BGP_AGGREGATOR, BGP_COMMUNITY, SOURCE, ADDRESS,
PASSWORD, RR, RS, CLIENT, CLUSTER, ID, AS4, ADVERTISE, IPV4, PASSWORD, RR, RS, CLIENT, CLUSTER, ID, AS4, ADVERTISE, IPV4,
CAPABILITIES, LIMIT) CAPABILITIES, LIMIT, PASSIVE)
CF_GRAMMAR CF_GRAMMAR
...@@ -34,7 +34,6 @@ bgp_proto_start: proto_start BGP { ...@@ -34,7 +34,6 @@ bgp_proto_start: proto_start BGP {
BGP_CFG->hold_time = 240; BGP_CFG->hold_time = 240;
BGP_CFG->connect_retry_time = 120; BGP_CFG->connect_retry_time = 120;
BGP_CFG->initial_hold_time = 240; BGP_CFG->initial_hold_time = 240;
BGP_CFG->default_med = 0;
BGP_CFG->compare_path_lengths = 1; BGP_CFG->compare_path_lengths = 1;
BGP_CFG->start_delay_time = 5; BGP_CFG->start_delay_time = 5;
BGP_CFG->error_amnesia_time = 300; BGP_CFG->error_amnesia_time = 300;
...@@ -78,6 +77,7 @@ bgp_proto: ...@@ -78,6 +77,7 @@ bgp_proto:
| bgp_proto ADVERTISE IPV4 bool ';' { BGP_CFG->advertise_ipv4 = $4; } | bgp_proto ADVERTISE IPV4 bool ';' { BGP_CFG->advertise_ipv4 = $4; }
| bgp_proto PASSWORD TEXT ';' { BGP_CFG->password = $3; } | bgp_proto PASSWORD TEXT ';' { BGP_CFG->password = $3; }
| bgp_proto ROUTE LIMIT expr ';' { BGP_CFG->route_limit = $4; } | bgp_proto ROUTE LIMIT expr ';' { BGP_CFG->route_limit = $4; }
| bgp_proto PASSIVE bool ';' { BGP_CFG->passive = $3; }
; ;
CF_ADDTO(dynamic_attr, BGP_PATH CF_ADDTO(dynamic_attr, BGP_PATH
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment