Annotation of embedaddon/bird2/proto/bfd/config.Y, revision 1.1
1.1 ! misho 1: /*
! 2: * BIRD -- Router Advertisement Configuration
! 3: *
! 4: *
! 5: * Can be freely distributed and used under the terms of the GNU GPL.
! 6: */
! 7:
! 8: CF_HDR
! 9:
! 10: #include "proto/bfd/bfd.h"
! 11:
! 12: CF_DEFINES
! 13:
! 14: #define BFD_CFG ((struct bfd_config *) this_proto)
! 15: #define BFD_IFACE ((struct bfd_iface_config *) this_ipatt)
! 16: #define BFD_NEIGHBOR this_bfd_neighbor
! 17:
! 18: static struct bfd_neighbor *this_bfd_neighbor;
! 19:
! 20: extern struct bfd_config *bfd_cf;
! 21:
! 22: CF_DECLS
! 23:
! 24: CF_KEYWORDS(BFD, MIN, IDLE, RX, TX, INTERVAL, MULTIPLIER, PASSIVE,
! 25: INTERFACE, MULTIHOP, NEIGHBOR, DEV, LOCAL, AUTHENTICATION,
! 26: NONE, SIMPLE, METICULOUS, KEYED, MD5, SHA1)
! 27:
! 28: %type <iface> bfd_neigh_iface
! 29: %type <a> bfd_neigh_local
! 30: %type <i> bfd_neigh_multihop bfd_auth_type
! 31:
! 32: CF_GRAMMAR
! 33:
! 34: proto: bfd_proto ;
! 35:
! 36: bfd_proto_start: proto_start BFD
! 37: {
! 38: this_proto = proto_config_new(&proto_bfd, $1);
! 39: init_list(&BFD_CFG->patt_list);
! 40: init_list(&BFD_CFG->neigh_list);
! 41: };
! 42:
! 43: bfd_proto_item:
! 44: proto_item
! 45: | INTERFACE bfd_iface
! 46: | MULTIHOP bfd_multihop
! 47: | NEIGHBOR bfd_neighbor
! 48: ;
! 49:
! 50: bfd_proto_opts:
! 51: /* empty */
! 52: | bfd_proto_opts bfd_proto_item ';'
! 53: ;
! 54:
! 55: bfd_proto:
! 56: bfd_proto_start proto_name '{' bfd_proto_opts '}';
! 57:
! 58:
! 59: bfd_iface_start:
! 60: {
! 61: this_ipatt = cfg_allocz(sizeof(struct bfd_iface_config));
! 62: add_tail(&BFD_CFG->patt_list, NODE this_ipatt);
! 63: init_list(&this_ipatt->ipn_list);
! 64:
! 65: BFD_IFACE->min_rx_int = BFD_DEFAULT_MIN_RX_INT;
! 66: BFD_IFACE->min_tx_int = BFD_DEFAULT_MIN_TX_INT;
! 67: BFD_IFACE->idle_tx_int = BFD_DEFAULT_IDLE_TX_INT;
! 68: BFD_IFACE->multiplier = BFD_DEFAULT_MULTIPLIER;
! 69:
! 70: reset_passwords();
! 71: };
! 72:
! 73: bfd_iface_finish:
! 74: {
! 75: BFD_IFACE->passwords = get_passwords();
! 76:
! 77: if (!BFD_IFACE->auth_type != !BFD_IFACE->passwords)
! 78: log(L_WARN "Authentication and password options should be used together");
! 79:
! 80: if (BFD_IFACE->passwords)
! 81: {
! 82: struct password_item *pass;
! 83: WALK_LIST(pass, *BFD_IFACE->passwords)
! 84: {
! 85: if (pass->alg)
! 86: cf_error("Password algorithm option not available in BFD protocol");
! 87:
! 88: pass->alg = bfd_auth_type_to_hash_alg[BFD_IFACE->auth_type];
! 89: }
! 90: }
! 91: };
! 92:
! 93: bfd_iface_item:
! 94: INTERVAL expr_us { BFD_IFACE->min_rx_int = BFD_IFACE->min_tx_int = $2; }
! 95: | MIN RX INTERVAL expr_us { BFD_IFACE->min_rx_int = $4; }
! 96: | MIN TX INTERVAL expr_us { BFD_IFACE->min_tx_int = $4; }
! 97: | IDLE TX INTERVAL expr_us { BFD_IFACE->idle_tx_int = $4; }
! 98: | MULTIPLIER expr { BFD_IFACE->multiplier = $2; }
! 99: | PASSIVE bool { BFD_IFACE->passive = $2; }
! 100: | AUTHENTICATION bfd_auth_type { BFD_IFACE->auth_type = $2; }
! 101: | password_list {}
! 102: ;
! 103:
! 104: bfd_auth_type:
! 105: NONE { $$ = BFD_AUTH_NONE; }
! 106: | SIMPLE { $$ = BFD_AUTH_SIMPLE; }
! 107: | KEYED MD5 { $$ = BFD_AUTH_KEYED_MD5; }
! 108: | KEYED SHA1 { $$ = BFD_AUTH_KEYED_SHA1; }
! 109: | METICULOUS KEYED MD5 { $$ = BFD_AUTH_METICULOUS_KEYED_MD5; }
! 110: | METICULOUS KEYED SHA1 { $$ = BFD_AUTH_METICULOUS_KEYED_SHA1; }
! 111: ;
! 112:
! 113: bfd_iface_opts:
! 114: /* empty */
! 115: | bfd_iface_opts bfd_iface_item ';'
! 116: ;
! 117:
! 118: bfd_iface_opt_list:
! 119: /* empty */
! 120: | '{' bfd_iface_opts '}'
! 121: ;
! 122:
! 123: bfd_iface:
! 124: bfd_iface_start iface_patt_list_nopx bfd_iface_opt_list bfd_iface_finish;
! 125:
! 126: bfd_multihop:
! 127: bfd_iface_start bfd_iface_opt_list bfd_iface_finish
! 128: { BFD_CFG->multihop = BFD_IFACE; };
! 129:
! 130:
! 131: bfd_neigh_iface:
! 132: /* empty */ { $$ = NULL; }
! 133: | '%' symbol { $$ = if_get_by_name($2->name); }
! 134: | DEV text { $$ = if_get_by_name($2); }
! 135: ;
! 136:
! 137: bfd_neigh_local:
! 138: /* empty */ { $$ = IPA_NONE; }
! 139: | LOCAL ipa { $$ = $2; }
! 140: ;
! 141:
! 142: bfd_neigh_multihop:
! 143: /* empty */ { $$ = 0; }
! 144: | MULTIHOP bool { $$ = $2; }
! 145: ;
! 146:
! 147: bfd_neighbor: ipa bfd_neigh_iface bfd_neigh_local bfd_neigh_multihop
! 148: {
! 149: this_bfd_neighbor = cfg_allocz(sizeof(struct bfd_neighbor));
! 150: add_tail(&BFD_CFG->neigh_list, NODE this_bfd_neighbor);
! 151:
! 152: BFD_NEIGHBOR->addr = $1;
! 153: BFD_NEIGHBOR->local = $3;
! 154: BFD_NEIGHBOR->iface = $2;
! 155: BFD_NEIGHBOR->multihop = $4;
! 156:
! 157: if ($4 && $2)
! 158: cf_error("Neighbor cannot set both interface and multihop");
! 159:
! 160: if ($4 && ipa_zero($3))
! 161: cf_error("Multihop neighbor requires specified local address");
! 162: };
! 163:
! 164:
! 165: CF_CLI_HELP(SHOW BFD, ..., [[Show information about BFD protocol]]);
! 166: CF_CLI(SHOW BFD SESSIONS, optproto, [<name>], [[Show information about BFD sessions]])
! 167: { bfd_show_sessions(proto_get_named($4, &proto_bfd)); };
! 168:
! 169: CF_CODE
! 170:
! 171: CF_END
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>