Annotation of embedaddon/bird/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: CF_ADDTO(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:   if (bfd_cf)
        !            43:     cf_error("Only one BFD instance allowed");
        !            44:   bfd_cf = BFD_CFG;
        !            45: };
        !            46: 
        !            47: bfd_proto_item:
        !            48:    proto_item
        !            49:  | INTERFACE bfd_iface
        !            50:  | MULTIHOP bfd_multihop
        !            51:  | NEIGHBOR bfd_neighbor
        !            52:  ;
        !            53: 
        !            54: bfd_proto_opts:
        !            55:    /* empty */
        !            56:  | bfd_proto_opts bfd_proto_item ';'
        !            57:  ;
        !            58: 
        !            59: bfd_proto:
        !            60:    bfd_proto_start proto_name '{' bfd_proto_opts '}';
        !            61: 
        !            62: 
        !            63: bfd_iface_start:
        !            64: {
        !            65:   this_ipatt = cfg_allocz(sizeof(struct bfd_iface_config));
        !            66:   add_tail(&BFD_CFG->patt_list, NODE this_ipatt);
        !            67:   init_list(&this_ipatt->ipn_list);
        !            68: 
        !            69:   BFD_IFACE->min_rx_int = BFD_DEFAULT_MIN_RX_INT;
        !            70:   BFD_IFACE->min_tx_int = BFD_DEFAULT_MIN_TX_INT;
        !            71:   BFD_IFACE->idle_tx_int = BFD_DEFAULT_IDLE_TX_INT;
        !            72:   BFD_IFACE->multiplier = BFD_DEFAULT_MULTIPLIER;
        !            73: 
        !            74:   reset_passwords();
        !            75: };
        !            76: 
        !            77: bfd_iface_finish:
        !            78: {
        !            79:   BFD_IFACE->passwords = get_passwords();
        !            80: 
        !            81:   if (!BFD_IFACE->auth_type != !BFD_IFACE->passwords)
        !            82:     log(L_WARN "Authentication and password options should be used together");
        !            83: 
        !            84:   if (BFD_IFACE->passwords)
        !            85:   {
        !            86:     struct password_item *pass;
        !            87:     WALK_LIST(pass, *BFD_IFACE->passwords)
        !            88:     {
        !            89:       if (pass->alg)
        !            90:         cf_error("Password algorithm option not available in BFD protocol");
        !            91: 
        !            92:       pass->alg = bfd_auth_type_to_hash_alg[BFD_IFACE->auth_type];
        !            93:     }
        !            94:   }
        !            95: };
        !            96: 
        !            97: bfd_iface_item:
        !            98:    INTERVAL expr_us { BFD_IFACE->min_rx_int = BFD_IFACE->min_tx_int = $2; }
        !            99:  | MIN RX INTERVAL expr_us { BFD_IFACE->min_rx_int = $4; }
        !           100:  | MIN TX INTERVAL expr_us { BFD_IFACE->min_tx_int = $4; }
        !           101:  | IDLE TX INTERVAL expr_us { BFD_IFACE->idle_tx_int = $4; }
        !           102:  | MULTIPLIER expr { BFD_IFACE->multiplier = $2; }
        !           103:  | PASSIVE bool { BFD_IFACE->passive = $2; }
        !           104:  | AUTHENTICATION bfd_auth_type { BFD_IFACE->auth_type = $2; }
        !           105:  | password_list {}
        !           106:  ;
        !           107: 
        !           108: bfd_auth_type:
        !           109:    NONE                         { $$ = BFD_AUTH_NONE; }
        !           110:  | SIMPLE               { $$ = BFD_AUTH_SIMPLE; }
        !           111:  | KEYED MD5            { $$ = BFD_AUTH_KEYED_MD5; }
        !           112:  | KEYED SHA1           { $$ = BFD_AUTH_KEYED_SHA1; }
        !           113:  | METICULOUS KEYED MD5         { $$ = BFD_AUTH_METICULOUS_KEYED_MD5; }
        !           114:  | METICULOUS KEYED SHA1 { $$ = BFD_AUTH_METICULOUS_KEYED_SHA1; }
        !           115:  ;
        !           116: 
        !           117: bfd_iface_opts:
        !           118:    /* empty */
        !           119:  | bfd_iface_opts bfd_iface_item ';'
        !           120:  ;
        !           121: 
        !           122: bfd_iface_opt_list:
        !           123:    /* empty */
        !           124:  | '{' bfd_iface_opts '}'
        !           125:  ;
        !           126: 
        !           127: bfd_iface:
        !           128:   bfd_iface_start iface_patt_list_nopx bfd_iface_opt_list bfd_iface_finish;
        !           129: 
        !           130: bfd_multihop:
        !           131:   bfd_iface_start bfd_iface_opt_list bfd_iface_finish
        !           132: { BFD_CFG->multihop = BFD_IFACE; };
        !           133: 
        !           134: 
        !           135: bfd_neigh_iface:
        !           136:    /* empty */ { $$ = NULL; }
        !           137:  | '%' SYM { $$ = if_get_by_name($2->name); }
        !           138:  | DEV text { $$ = if_get_by_name($2); }
        !           139:  ;
        !           140: 
        !           141: bfd_neigh_local:
        !           142:    /* empty */ { $$ = IPA_NONE; }
        !           143:  | LOCAL ipa { $$ = $2; }
        !           144:  ;
        !           145: 
        !           146: bfd_neigh_multihop:
        !           147:    /* empty */ { $$ = 0; }
        !           148:  | MULTIHOP bool { $$ = $2; }
        !           149:  ;
        !           150: 
        !           151: bfd_neighbor: ipa bfd_neigh_iface bfd_neigh_local bfd_neigh_multihop
        !           152: {
        !           153:   this_bfd_neighbor = cfg_allocz(sizeof(struct bfd_neighbor));
        !           154:   add_tail(&BFD_CFG->neigh_list, NODE this_bfd_neighbor);
        !           155: 
        !           156:   BFD_NEIGHBOR->addr = $1;
        !           157:   BFD_NEIGHBOR->local = $3;
        !           158:   BFD_NEIGHBOR->iface = $2;
        !           159:   BFD_NEIGHBOR->multihop = $4;
        !           160: 
        !           161:   if ($4 && $2)
        !           162:     cf_error("Neighbor cannot set both interface and multihop");
        !           163: 
        !           164:   if ($4 && ipa_zero($3))
        !           165:     cf_error("Multihop neighbor requires specified local address");
        !           166: };
        !           167: 
        !           168: 
        !           169: CF_CLI_HELP(SHOW BFD, ..., [[Show information about BFD protocol]]);
        !           170: CF_CLI(SHOW BFD SESSIONS, optsym, [<name>], [[Show information about BFD sessions]])
        !           171: { bfd_show_sessions(proto_get_named($4, &proto_bfd)); };
        !           172: 
        !           173: CF_CODE
        !           174: 
        !           175: CF_END

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>