1998-11-27 21:09:57 +00:00
|
|
|
/*
|
|
|
|
* BIRD -- RIP Configuration
|
|
|
|
*
|
|
|
|
* Can be freely distributed and used under the terms of the GNU GPL.
|
|
|
|
*/
|
|
|
|
|
1998-12-22 19:41:04 +00:00
|
|
|
/*
|
|
|
|
To add:
|
|
|
|
|
1999-01-12 16:40:55 +00:00
|
|
|
version1 switch
|
1998-12-22 19:41:04 +00:00
|
|
|
|
1999-01-12 16:40:55 +00:00
|
|
|
*/
|
1998-12-22 19:41:04 +00:00
|
|
|
|
|
|
|
|
1998-11-27 21:09:57 +00:00
|
|
|
CF_HDR
|
|
|
|
|
|
|
|
#include "proto/rip/rip.h"
|
1998-12-04 11:45:51 +00:00
|
|
|
#include "nest/iface.h"
|
|
|
|
|
2000-04-28 15:11:10 +00:00
|
|
|
CF_DEFINES
|
|
|
|
|
1999-03-01 21:18:01 +00:00
|
|
|
#define RIP_CFG ((struct rip_proto_config *) this_proto)
|
1999-08-03 19:30:49 +00:00
|
|
|
#define RIP_IPATT ((struct rip_patt *) this_ipatt)
|
1998-11-27 21:09:57 +00:00
|
|
|
|
2013-07-31 14:16:48 +00:00
|
|
|
static inline int rip_cfg_is_old(void) { return RIP_CFG->c.protocol == &proto_rip; }
|
|
|
|
static inline int rip_cfg_is_ng(void) { return RIP_CFG->c.protocol == &proto_ripng; }
|
2013-06-25 13:33:00 +00:00
|
|
|
|
1998-11-27 21:09:57 +00:00
|
|
|
CF_DECLS
|
|
|
|
|
2012-06-25 00:56:09 +00:00
|
|
|
CF_KEYWORDS(RIP, RIPNG, INFINITY, METRIC, PORT, PERIOD, GARBAGE, TIMEOUT,
|
2000-05-10 11:40:30 +00:00
|
|
|
MODE, BROADCAST, MULTICAST, QUIET, NOLISTEN, VERSION1,
|
2013-06-25 13:33:00 +00:00
|
|
|
AUTHENTICATION, NONE, PLAINTEXT, MD5, TTL, SECURITY,
|
|
|
|
HONOR, NEVER, NEIGHBOR, ALWAYS, TX, PRIORITY, ONLY,
|
2000-03-01 11:32:23 +00:00
|
|
|
RIP_METRIC, RIP_TAG)
|
1999-01-12 16:40:55 +00:00
|
|
|
|
1999-05-11 09:53:45 +00:00
|
|
|
%type <i> rip_mode rip_auth
|
1998-11-27 21:09:57 +00:00
|
|
|
|
|
|
|
CF_GRAMMAR
|
|
|
|
|
2008-11-08 16:24:23 +00:00
|
|
|
CF_ADDTO(proto, rip_cfg '}' { RIP_CFG->passwords = get_passwords(); } )
|
1998-11-27 21:09:57 +00:00
|
|
|
|
2000-05-04 20:08:34 +00:00
|
|
|
rip_cfg_start: proto_start RIP {
|
2011-11-06 23:31:23 +00:00
|
|
|
this_proto = proto_config_new(&proto_rip, sizeof(struct rip_proto_config), $1);
|
1999-03-01 21:18:01 +00:00
|
|
|
rip_init_config(RIP_CFG);
|
2012-06-25 00:56:09 +00:00
|
|
|
RIP_CFG->port = RIP_PORT_V2;
|
|
|
|
}
|
|
|
|
;
|
|
|
|
|
|
|
|
ripng_cfg_start: proto_start RIPNG {
|
|
|
|
this_proto = proto_config_new(&proto_ripng, sizeof(struct rip_proto_config), $1);
|
|
|
|
rip_init_config(RIP_CFG);
|
|
|
|
RIP_CFG->port = RIP_PORT_NG;
|
1998-11-27 21:09:57 +00:00
|
|
|
}
|
|
|
|
;
|
|
|
|
|
2000-05-04 20:08:34 +00:00
|
|
|
rip_cfg:
|
|
|
|
rip_cfg_start proto_name '{'
|
2012-06-25 00:56:09 +00:00
|
|
|
| ripng_cfg_start proto_name '{'
|
2000-05-04 20:08:34 +00:00
|
|
|
| rip_cfg proto_item ';'
|
|
|
|
| rip_cfg INFINITY expr ';' { RIP_CFG->infinity = $3; }
|
|
|
|
| rip_cfg PORT expr ';' { RIP_CFG->port = $3; }
|
|
|
|
| rip_cfg PERIOD expr ';' { RIP_CFG->period = $3; }
|
2000-05-30 11:15:19 +00:00
|
|
|
| rip_cfg GARBAGE TIME expr ';' { RIP_CFG->garbage_time = $4; }
|
|
|
|
| rip_cfg TIMEOUT TIME expr ';' { RIP_CFG->timeout_time = $4; }
|
2000-05-04 20:08:34 +00:00
|
|
|
| rip_cfg AUTHENTICATION rip_auth ';' {RIP_CFG->authtype = $3; }
|
2008-11-08 16:24:23 +00:00
|
|
|
| rip_cfg password_list ';'
|
2000-05-04 20:08:34 +00:00
|
|
|
| rip_cfg HONOR ALWAYS ';' { RIP_CFG->honor = HO_ALWAYS; }
|
|
|
|
| rip_cfg HONOR NEIGHBOR ';' { RIP_CFG->honor = HO_NEIGHBOR; }
|
|
|
|
| rip_cfg HONOR NEVER ';' { RIP_CFG->honor = HO_NEVER; }
|
2009-05-06 20:02:45 +00:00
|
|
|
| rip_cfg INTERFACE rip_iface ';'
|
1998-12-04 11:45:51 +00:00
|
|
|
;
|
|
|
|
|
1999-05-11 09:53:45 +00:00
|
|
|
rip_auth:
|
|
|
|
PLAINTEXT { $$=AT_PLAINTEXT; }
|
|
|
|
| MD5 { $$=AT_MD5; }
|
|
|
|
| NONE { $$=AT_NONE; }
|
|
|
|
;
|
1999-01-12 16:40:55 +00:00
|
|
|
|
2009-05-06 20:02:45 +00:00
|
|
|
|
1999-01-12 16:40:55 +00:00
|
|
|
rip_mode:
|
1999-05-31 20:30:16 +00:00
|
|
|
BROADCAST { $$=IM_BROADCAST; }
|
2000-05-10 11:40:30 +00:00
|
|
|
| MULTICAST { $$=0; }
|
1999-05-31 20:30:16 +00:00
|
|
|
| QUIET { $$=IM_QUIET; }
|
|
|
|
| NOLISTEN { $$=IM_NOLISTEN; }
|
|
|
|
| VERSION1 { $$=IM_VERSION1 | IM_BROADCAST; }
|
1999-01-12 16:40:55 +00:00
|
|
|
;
|
|
|
|
|
1998-12-04 11:45:51 +00:00
|
|
|
rip_iface_item:
|
1999-08-03 19:30:49 +00:00
|
|
|
| METRIC expr { RIP_IPATT->metric = $2; }
|
|
|
|
| MODE rip_mode { RIP_IPATT->mode |= $2; }
|
2013-06-24 14:37:30 +00:00
|
|
|
| TX tos { RIP_IPATT->tx_tos = $2; }
|
|
|
|
| TX PRIORITY expr { RIP_IPATT->tx_priority = $3; }
|
2013-06-25 13:33:00 +00:00
|
|
|
| TTL SECURITY bool { RIP_IPATT->ttl_security = $3; }
|
|
|
|
| TTL SECURITY TX ONLY { RIP_IPATT->ttl_security = 2; }
|
1998-12-04 11:45:51 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
rip_iface_opts:
|
2009-05-06 20:02:45 +00:00
|
|
|
/* empty */
|
1998-12-04 11:45:51 +00:00
|
|
|
| rip_iface_opts rip_iface_item ';'
|
|
|
|
;
|
|
|
|
|
2009-05-06 20:02:45 +00:00
|
|
|
rip_iface_opt_list:
|
|
|
|
/* empty */
|
|
|
|
| '{' rip_iface_opts '}'
|
|
|
|
;
|
1998-12-04 11:45:51 +00:00
|
|
|
|
1999-08-03 19:30:49 +00:00
|
|
|
rip_iface_init:
|
|
|
|
/* EMPTY */ {
|
2009-05-06 20:02:45 +00:00
|
|
|
this_ipatt = cfg_allocz(sizeof(struct rip_patt));
|
|
|
|
add_tail(&RIP_CFG->iface_list, NODE this_ipatt);
|
|
|
|
init_list(&this_ipatt->ipn_list);
|
|
|
|
RIP_IPATT->metric = 1;
|
2013-06-24 14:37:30 +00:00
|
|
|
RIP_IPATT->tx_tos = IP_PREC_INTERNET_CONTROL;
|
|
|
|
RIP_IPATT->tx_priority = sk_priority_control;
|
2013-07-31 14:16:48 +00:00
|
|
|
RIP_IPATT->ttl_security = rip_cfg_is_ng() ? 1 : 0;
|
1999-08-03 19:30:49 +00:00
|
|
|
}
|
1998-11-27 21:09:57 +00:00
|
|
|
;
|
|
|
|
|
1999-08-03 19:30:49 +00:00
|
|
|
rip_iface:
|
2009-05-06 20:02:45 +00:00
|
|
|
rip_iface_init iface_patt_list rip_iface_opt_list
|
1999-08-03 19:30:49 +00:00
|
|
|
;
|
1998-12-04 11:45:51 +00:00
|
|
|
|
2000-04-12 14:02:04 +00:00
|
|
|
CF_ADDTO(dynamic_attr, RIP_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_RIP_METRIC); })
|
|
|
|
CF_ADDTO(dynamic_attr, RIP_TAG { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_RIP_TAG); })
|
2000-03-01 11:32:23 +00:00
|
|
|
|
1999-08-03 19:30:49 +00:00
|
|
|
CF_CODE
|
1998-12-04 11:45:51 +00:00
|
|
|
|
1998-11-27 21:09:57 +00:00
|
|
|
CF_END
|