]> git.ipfire.org Git - thirdparty/bird.git/blame - proto/bgp/config.Y
More BGP. This time it connects, but the state machine still isn't complete.
[thirdparty/bird.git] / proto / bgp / config.Y
CommitLineData
2638249d
MM
1/*
2 * BIRD -- Border Gateway Protocol Configuration
3 *
4 * (c) 2000 Martin Mares <mj@ucw.cz>
5 *
6 * Can be freely distributed and used under the terms of the GNU GPL.
7 */
8
9CF_HDR
10
11#include "proto/bgp/bgp.h"
12
13#define BGP_CFG ((struct bgp_config *) this_proto)
14
15CF_DECLS
16
c01e3741 17CF_KEYWORDS(BGP, LOCAL, NEIGHBOR, AS, HOLD, TIME, CONNECT, RETRY, KEEPALIVE,
3fdbafb6 18 MULTIHOP, STARTUP)
2638249d
MM
19
20CF_GRAMMAR
21
22CF_ADDTO(proto, bgp_proto '}' { bgp_check(BGP_CFG); } )
23
24bgp_proto_start: proto_start BGP {
25 this_proto = proto_config_new(&proto_bgp, sizeof(struct bgp_config));
26 this_proto->preference = DEF_PREF_BGP;
c01e3741
MM
27 BGP_CFG->hold_time = 240;
28 BGP_CFG->connect_retry_time = 120;
3fdbafb6 29 BGP_CFG->initial_hold_time = 300;
2638249d
MM
30 }
31 ;
32
33bgp_proto:
34 bgp_proto_start proto_name '{'
35 | bgp_proto proto_item ';'
36 | bgp_proto LOCAL AS NUM ';' {
37 if ($4 < 0 || $4 > 65535) cf_error("AS number out of range");
38 BGP_CFG->local_as = $4;
39 }
40 | bgp_proto NEIGHBOR IPA AS NUM ';' {
41 if ($5 < 0 || $5 > 65535) cf_error("AS number out of range");
42 BGP_CFG->remote_ip = $3;
43 BGP_CFG->remote_as = $5;
44 }
c01e3741 45 | bgp_proto HOLD TIME NUM ';' { BGP_CFG->hold_time = $4; }
3fdbafb6 46 | bgp_proto STARTUP HOLD TIME NUM ';' { BGP_CFG->initial_hold_time = $5; }
c01e3741
MM
47 | bgp_proto CONNECT RETRY TIME NUM ';' { BGP_CFG->connect_retry_time = $5; }
48 | bgp_proto KEEPALIVE TIME NUM ';' { BGP_CFG->connect_retry_time = $4; }
49 | bgp_proto MULTIHOP NUM ';' { BGP_CFG->multihop = $3; }
2638249d
MM
50 ;
51
52CF_CODE
53
54CF_END