ospf_vty.c
上传用户:xiaozhuqw
上传日期:2009-11-15
资源大小:1338k
文件大小:217k
- SHOW_STR
- IP_STR
- "OSPF informationn"
- "Database summaryn"
- OSPF_LSA_TYPES_DESC
- "Link State ID (as an IP address)n"
- "Advertising Router link statesn"
- "Advertising Router (as an IP address)n");
- ALIAS (show_ip_ospf_database,
- show_ip_ospf_database_type_id_self_cmd,
- "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D (self-originate|)",
- SHOW_STR
- IP_STR
- "OSPF informationn"
- "Database summaryn"
- OSPF_LSA_TYPES_DESC
- "Link State ID (as an IP address)n"
- "Self-originated link statesn"
- "n");
- DEFUN (show_ip_ospf_database_type_adv_router,
- show_ip_ospf_database_type_adv_router_cmd,
- "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") adv-router A.B.C.D",
- SHOW_STR
- IP_STR
- "OSPF informationn"
- "Database summaryn"
- OSPF_LSA_TYPES_DESC
- "Advertising Router link statesn"
- "Advertising Router (as an IP address)n")
- {
- struct ospf *ospf;
- int type, ret;
- struct in_addr adv_router;
- ospf = ospf_lookup ();
- if (ospf == NULL)
- return CMD_SUCCESS;
- vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE,
- inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE);
- if (argc != 2)
- return CMD_WARNING;
- /* Set database type to show. */
- if (strncmp (argv[0], "r", 1) == 0)
- type = OSPF_ROUTER_LSA;
- else if (strncmp (argv[0], "ne", 2) == 0)
- type = OSPF_NETWORK_LSA;
- #ifdef HAVE_NSSA
- else if (strncmp (argv[0], "ns", 2) == 0)
- type = OSPF_AS_NSSA_LSA;
- #endif /* HAVE_NSSA */
- else if (strncmp (argv[0], "s", 1) == 0)
- type = OSPF_SUMMARY_LSA;
- else if (strncmp (argv[0], "a", 1) == 0)
- type = OSPF_ASBR_SUMMARY_LSA;
- else if (strncmp (argv[0], "e", 1) == 0)
- type = OSPF_AS_EXTERNAL_LSA;
- #ifdef HAVE_OPAQUE_LSA
- else if (strncmp (argv[0], "opaque-l", 8) == 0)
- type = OSPF_OPAQUE_LINK_LSA;
- else if (strncmp (argv[0], "opaque-ar", 9) == 0)
- type = OSPF_OPAQUE_AREA_LSA;
- else if (strncmp (argv[0], "opaque-as", 9) == 0)
- type = OSPF_OPAQUE_AS_LSA;
- #endif /* HAVE_OPAQUE_LSA */
- else
- return CMD_WARNING;
- /* `show ip ospf database LSA adv-router ADV_ROUTER'. */
- if (strncmp (argv[1], "s", 1) == 0)
- adv_router = ospf->router_id;
- else
- {
- ret = inet_aton (argv[1], &adv_router);
- if (!ret)
- return CMD_WARNING;
- }
- show_lsa_detail_adv_router (vty, ospf, type, &adv_router);
- return CMD_SUCCESS;
- }
- ALIAS (show_ip_ospf_database_type_adv_router,
- show_ip_ospf_database_type_self_cmd,
- "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") (self-originate|)",
- SHOW_STR
- IP_STR
- "OSPF informationn"
- "Database summaryn"
- OSPF_LSA_TYPES_DESC
- "Self-originated link statesn");
- DEFUN (ip_ospf_authentication_args,
- ip_ospf_authentication_args_addr_cmd,
- "ip ospf authentication (null|message-digest) A.B.C.D",
- "IP Informationn"
- "OSPF interface commandsn"
- "Enable authentication on this interfacen"
- "Use null authenticationn"
- "Use message-digest authenticationn"
- "Address of interface")
- {
- struct interface *ifp;
- struct in_addr addr;
- int ret;
- struct ospf_if_params *params;
-
- ifp = vty->index;
- params = IF_DEF_PARAMS (ifp);
- if (argc == 2)
- {
- ret = inet_aton(argv[1], &addr);
- if (!ret)
- {
- vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- params = ospf_get_if_params (ifp, addr);
- ospf_if_update_params (ifp, addr);
- }
- /* Handle null authentication */
- if ( argv[0][0] == 'n' )
- {
- SET_IF_PARAM (params, auth_type);
- params->auth_type = OSPF_AUTH_NULL;
- return CMD_SUCCESS;
- }
- /* Handle message-digest authentication */
- if ( argv[0][0] == 'm' )
- {
- SET_IF_PARAM (params, auth_type);
- params->auth_type = OSPF_AUTH_CRYPTOGRAPHIC;
- return CMD_SUCCESS;
- }
- vty_out (vty, "You shouldn't get here!%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- ALIAS (ip_ospf_authentication_args,
- ip_ospf_authentication_args_cmd,
- "ip ospf authentication (null|message-digest)",
- "IP Informationn"
- "OSPF interface commandsn"
- "Enable authentication on this interfacen"
- "Use null authenticationn"
- "Use message-digest authenticationn");
- DEFUN (ip_ospf_authentication,
- ip_ospf_authentication_addr_cmd,
- "ip ospf authentication A.B.C.D",
- "IP Informationn"
- "OSPF interface commandsn"
- "Enable authentication on this interfacen"
- "Address of interface")
- {
- struct interface *ifp;
- struct in_addr addr;
- int ret;
- struct ospf_if_params *params;
-
- ifp = vty->index;
- params = IF_DEF_PARAMS (ifp);
- if (argc == 1)
- {
- ret = inet_aton(argv[1], &addr);
- if (!ret)
- {
- vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- params = ospf_get_if_params (ifp, addr);
- ospf_if_update_params (ifp, addr);
- }
-
- SET_IF_PARAM (params, auth_type);
- params->auth_type = OSPF_AUTH_SIMPLE;
- return CMD_SUCCESS;
- }
- ALIAS (ip_ospf_authentication,
- ip_ospf_authentication_cmd,
- "ip ospf authentication",
- "IP Informationn"
- "OSPF interface commandsn"
- "Enable authentication on this interfacen");
- DEFUN (no_ip_ospf_authentication,
- no_ip_ospf_authentication_addr_cmd,
- "no ip ospf authentication A.B.C.D",
- NO_STR
- "IP Informationn"
- "OSPF interface commandsn"
- "Enable authentication on this interfacen"
- "Address of interface")
- {
- struct interface *ifp;
- struct in_addr addr;
- int ret;
- struct ospf_if_params *params;
-
- ifp = vty->index;
- params = IF_DEF_PARAMS (ifp);
- if (argc == 1)
- {
- ret = inet_aton(argv[1], &addr);
- if (!ret)
- {
- vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- params = ospf_lookup_if_params (ifp, addr);
- if (params == NULL)
- return CMD_SUCCESS;
- }
- params->auth_type = OSPF_AUTH_NOTSET;
- UNSET_IF_PARAM (params, auth_type);
-
- if (params != IF_DEF_PARAMS (ifp))
- {
- ospf_free_if_params (ifp, addr);
- ospf_if_update_params (ifp, addr);
- }
-
- return CMD_SUCCESS;
- }
- ALIAS (no_ip_ospf_authentication,
- no_ip_ospf_authentication_cmd,
- "no ip ospf authentication",
- NO_STR
- "IP Informationn"
- "OSPF interface commandsn"
- "Enable authentication on this interfacen");
- DEFUN (ip_ospf_authentication_key,
- ip_ospf_authentication_key_addr_cmd,
- "ip ospf authentication-key AUTH_KEY A.B.C.D",
- "IP Informationn"
- "OSPF interface commandsn"
- "Authentication password (key)n"
- "The OSPF password (key)n"
- "Address of interface")
- {
- struct interface *ifp;
- struct in_addr addr;
- int ret;
- struct ospf_if_params *params;
-
- ifp = vty->index;
- params = IF_DEF_PARAMS (ifp);
- if (argc == 2)
- {
- ret = inet_aton(argv[1], &addr);
- if (!ret)
- {
- vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- params = ospf_get_if_params (ifp, addr);
- ospf_if_update_params (ifp, addr);
- }
- memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
- strncpy (params->auth_simple, argv[0], OSPF_AUTH_SIMPLE_SIZE);
- SET_IF_PARAM (params, auth_simple);
- return CMD_SUCCESS;
- }
- ALIAS (ip_ospf_authentication_key,
- ip_ospf_authentication_key_cmd,
- "ip ospf authentication-key AUTH_KEY",
- "IP Informationn"
- "OSPF interface commandsn"
- "Authentication password (key)n"
- "The OSPF password (key)");
- ALIAS (ip_ospf_authentication_key,
- ospf_authentication_key_cmd,
- "ospf authentication-key AUTH_KEY",
- "OSPF interface commandsn"
- "Authentication password (key)n"
- "The OSPF password (key)");
- DEFUN (no_ip_ospf_authentication_key,
- no_ip_ospf_authentication_key_addr_cmd,
- "no ip ospf authentication-key A.B.C.D",
- NO_STR
- "IP Informationn"
- "OSPF interface commandsn"
- "Authentication password (key)n"
- "Address of interface")
- {
- struct interface *ifp;
- struct in_addr addr;
- int ret;
- struct ospf_if_params *params;
-
- ifp = vty->index;
- params = IF_DEF_PARAMS (ifp);
- if (argc == 2)
- {
- ret = inet_aton(argv[1], &addr);
- if (!ret)
- {
- vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- params = ospf_lookup_if_params (ifp, addr);
- if (params == NULL)
- return CMD_SUCCESS;
- }
- memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE);
- UNSET_IF_PARAM (params, auth_simple);
-
- if (params != IF_DEF_PARAMS (ifp))
- {
- ospf_free_if_params (ifp, addr);
- ospf_if_update_params (ifp, addr);
- }
-
- return CMD_SUCCESS;
- }
- ALIAS (no_ip_ospf_authentication_key,
- no_ip_ospf_authentication_key_cmd,
- "no ip ospf authentication-key",
- NO_STR
- "IP Informationn"
- "OSPF interface commandsn"
- "Authentication password (key)n");
- ALIAS (no_ip_ospf_authentication_key,
- no_ospf_authentication_key_cmd,
- "no ospf authentication-key",
- NO_STR
- "OSPF interface commandsn"
- "Authentication password (key)n");
- DEFUN (ip_ospf_message_digest_key,
- ip_ospf_message_digest_key_addr_cmd,
- "ip ospf message-digest-key <1-255> md5 KEY A.B.C.D",
- "IP Informationn"
- "OSPF interface commandsn"
- "Message digest authentication password (key)n"
- "Key IDn"
- "Use MD5 algorithmn"
- "The OSPF password (key)"
- "Address of interface")
- {
- struct interface *ifp;
- struct crypt_key *ck;
- u_char key_id;
- struct in_addr addr;
- int ret;
- struct ospf_if_params *params;
-
- ifp = vty->index;
- params = IF_DEF_PARAMS (ifp);
- if (argc == 3)
- {
- ret = inet_aton(argv[2], &addr);
- if (!ret)
- {
- vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- params = ospf_get_if_params (ifp, addr);
- ospf_if_update_params (ifp, addr);
- }
- key_id = strtol (argv[0], NULL, 10);
- if (ospf_crypt_key_lookup (params->auth_crypt, key_id) != NULL)
- {
- vty_out (vty, "OSPF: Key %d already exists%s", key_id, VTY_NEWLINE);
- return CMD_WARNING;
- }
- ck = ospf_crypt_key_new ();
- ck->key_id = (u_char) key_id;
- memset (ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1);
- strncpy (ck->auth_key, argv[1], OSPF_AUTH_MD5_SIZE);
- ospf_crypt_key_add (params->auth_crypt, ck);
- SET_IF_PARAM (params, auth_crypt);
-
- return CMD_SUCCESS;
- }
- ALIAS (ip_ospf_message_digest_key,
- ip_ospf_message_digest_key_cmd,
- "ip ospf message-digest-key <1-255> md5 KEY",
- "IP Informationn"
- "OSPF interface commandsn"
- "Message digest authentication password (key)n"
- "Key IDn"
- "Use MD5 algorithmn"
- "The OSPF password (key)");
- ALIAS (ip_ospf_message_digest_key,
- ospf_message_digest_key_cmd,
- "ospf message-digest-key <1-255> md5 KEY",
- "OSPF interface commandsn"
- "Message digest authentication password (key)n"
- "Key IDn"
- "Use MD5 algorithmn"
- "The OSPF password (key)");
- DEFUN (no_ip_ospf_message_digest_key,
- no_ip_ospf_message_digest_key_addr_cmd,
- "no ip ospf message-digest-key <1-255> A.B.C.D",
- NO_STR
- "IP Informationn"
- "OSPF interface commandsn"
- "Message digest authentication password (key)n"
- "Key IDn"
- "Address of interface")
- {
- struct interface *ifp;
- struct crypt_key *ck;
- int key_id;
- struct in_addr addr;
- int ret;
- struct ospf_if_params *params;
-
- ifp = vty->index;
- params = IF_DEF_PARAMS (ifp);
- if (argc == 2)
- {
- ret = inet_aton(argv[1], &addr);
- if (!ret)
- {
- vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- params = ospf_lookup_if_params (ifp, addr);
- if (params == NULL)
- return CMD_SUCCESS;
- }
- key_id = strtol (argv[0], NULL, 10);
- ck = ospf_crypt_key_lookup (params->auth_crypt, key_id);
- if (ck == NULL)
- {
- vty_out (vty, "OSPF: Key %d does not exist%s", key_id, VTY_NEWLINE);
- return CMD_WARNING;
- }
- ospf_crypt_key_delete (params->auth_crypt, key_id);
- if (params != IF_DEF_PARAMS (ifp))
- {
- ospf_free_if_params (ifp, addr);
- ospf_if_update_params (ifp, addr);
- }
-
- return CMD_SUCCESS;
- }
- ALIAS (no_ip_ospf_message_digest_key,
- no_ip_ospf_message_digest_key_cmd,
- "no ip ospf message-digest-key <1-255>",
- NO_STR
- "IP Informationn"
- "OSPF interface commandsn"
- "Message digest authentication password (key)n"
- "Key IDn");
-
- ALIAS (no_ip_ospf_message_digest_key,
- no_ospf_message_digest_key_cmd,
- "no ospf message-digest-key <1-255>",
- NO_STR
- "OSPF interface commandsn"
- "Message digest authentication password (key)n"
- "Key IDn");
- DEFUN (ip_ospf_cost,
- ip_ospf_cost_addr_cmd,
- "ip ospf cost <1-65535> A.B.C.D",
- "IP Informationn"
- "OSPF interface commandsn"
- "Interface costn"
- "Costn"
- "Address of interface")
- {
- struct interface *ifp = vty->index;
- u_int32_t cost;
- struct in_addr addr;
- int ret;
- struct ospf_if_params *params;
-
- params = IF_DEF_PARAMS (ifp);
- cost = strtol (argv[0], NULL, 10);
- /* cost range is <1-65535>. */
- if (cost < 1 || cost > 65535)
- {
- vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- if (argc == 2)
- {
- ret = inet_aton(argv[1], &addr);
- if (!ret)
- {
- vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- params = ospf_get_if_params (ifp, addr);
- ospf_if_update_params (ifp, addr);
- }
- SET_IF_PARAM (params, output_cost_cmd);
- params->output_cost_cmd = cost;
- ospf_if_recalculate_output_cost (ifp);
-
- return CMD_SUCCESS;
- }
- ALIAS (ip_ospf_cost,
- ip_ospf_cost_cmd,
- "ip ospf cost <1-65535>",
- "IP Informationn"
- "OSPF interface commandsn"
- "Interface costn"
- "Cost");
- ALIAS (ip_ospf_cost,
- ospf_cost_cmd,
- "ospf cost <1-65535>",
- "OSPF interface commandsn"
- "Interface costn"
- "Cost");
- DEFUN (no_ip_ospf_cost,
- no_ip_ospf_cost_addr_cmd,
- "no ip ospf cost A.B.C.D",
- NO_STR
- "IP Informationn"
- "OSPF interface commandsn"
- "Interface costn"
- "Address of interface")
- {
- struct interface *ifp = vty->index;
- struct in_addr addr;
- int ret;
- struct ospf_if_params *params;
-
- ifp = vty->index;
- params = IF_DEF_PARAMS (ifp);
- if (argc == 1)
- {
- ret = inet_aton(argv[0], &addr);
- if (!ret)
- {
- vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- params = ospf_lookup_if_params (ifp, addr);
- if (params == NULL)
- return CMD_SUCCESS;
- }
- UNSET_IF_PARAM (params, output_cost_cmd);
- if (params != IF_DEF_PARAMS (ifp))
- {
- ospf_free_if_params (ifp, addr);
- ospf_if_update_params (ifp, addr);
- }
- ospf_if_recalculate_output_cost (ifp);
-
- return CMD_SUCCESS;
- }
- ALIAS (no_ip_ospf_cost,
- no_ip_ospf_cost_cmd,
- "no ip ospf cost",
- NO_STR
- "IP Informationn"
- "OSPF interface commandsn"
- "Interface costn");
- ALIAS (no_ip_ospf_cost,
- no_ospf_cost_cmd,
- "no ospf cost",
- NO_STR
- "OSPF interface commandsn"
- "Interface costn");
- void
- ospf_nbr_timer_update (struct ospf_interface *oi)
- {
- struct route_node *rn;
- struct ospf_neighbor *nbr;
- for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
- if ((nbr = rn->info))
- {
- nbr->v_inactivity = OSPF_IF_PARAM (oi, v_wait);
- nbr->v_db_desc = OSPF_IF_PARAM (oi, retransmit_interval);
- nbr->v_ls_req = OSPF_IF_PARAM (oi, retransmit_interval);
- nbr->v_ls_upd = OSPF_IF_PARAM (oi, retransmit_interval);
- }
- }
- DEFUN (ip_ospf_dead_interval,
- ip_ospf_dead_interval_addr_cmd,
- "ip ospf dead-interval <1-65535> A.B.C.D",
- "IP Informationn"
- "OSPF interface commandsn"
- "Interval after which a neighbor is declared deadn"
- "Secondsn"
- "Address of interface")
- {
- struct interface *ifp = vty->index;
- u_int32_t seconds;
- struct in_addr addr;
- int ret;
- struct ospf_if_params *params;
- struct ospf_interface *oi;
- struct route_node *rn;
- struct ospf *ospf;
-
- ospf = ospf_lookup ();
- params = IF_DEF_PARAMS (ifp);
- seconds = strtol (argv[0], NULL, 10);
- /* dead_interval range is <1-65535>. */
- if (seconds < 1 || seconds > 65535)
- {
- vty_out (vty, "Router Dead Interval is invalid%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- if (argc == 2)
- {
- ret = inet_aton(argv[1], &addr);
- if (!ret)
- {
- vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- params = ospf_get_if_params (ifp, addr);
- ospf_if_update_params (ifp, addr);
- }
- SET_IF_PARAM (params, v_wait);
- params->v_wait = seconds;
-
- /* Update timer values in neighbor structure. */
- if (argc == 2)
- {
- if (ospf)
- {
- oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr);
- if (oi)
- ospf_nbr_timer_update (oi);
- }
- }
- else
- {
- for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
- if ((oi = rn->info))
- ospf_nbr_timer_update (oi);
- }
- return CMD_SUCCESS;
- }
- ALIAS (ip_ospf_dead_interval,
- ip_ospf_dead_interval_cmd,
- "ip ospf dead-interval <1-65535>",
- "IP Informationn"
- "OSPF interface commandsn"
- "Interval after which a neighbor is declared deadn"
- "Secondsn");
- ALIAS (ip_ospf_dead_interval,
- ospf_dead_interval_cmd,
- "ospf dead-interval <1-65535>",
- "OSPF interface commandsn"
- "Interval after which a neighbor is declared deadn"
- "Secondsn");
- DEFUN (no_ip_ospf_dead_interval,
- no_ip_ospf_dead_interval_addr_cmd,
- "no ip ospf dead-interval A.B.C.D",
- NO_STR
- "IP Informationn"
- "OSPF interface commandsn"
- "Interval after which a neighbor is declared deadn"
- "Address of interface")
- {
- struct interface *ifp = vty->index;
- struct in_addr addr;
- int ret;
- struct ospf_if_params *params;
- struct ospf_interface *oi;
- struct route_node *rn;
- struct ospf *ospf;
-
- ospf = ospf_lookup ();
- ifp = vty->index;
- params = IF_DEF_PARAMS (ifp);
- if (argc == 1)
- {
- ret = inet_aton(argv[0], &addr);
- if (!ret)
- {
- vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- params = ospf_lookup_if_params (ifp, addr);
- if (params == NULL)
- return CMD_SUCCESS;
- }
- UNSET_IF_PARAM (params, v_wait);
- params->v_wait = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
- if (params != IF_DEF_PARAMS (ifp))
- {
- ospf_free_if_params (ifp, addr);
- ospf_if_update_params (ifp, addr);
- }
- /* Update timer values in neighbor structure. */
- if (argc == 1)
- {
- if (ospf)
- {
- oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr);
- if (oi)
- ospf_nbr_timer_update (oi);
- }
- }
- else
- {
- for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
- if ((oi = rn->info))
- ospf_nbr_timer_update (oi);
- }
- return CMD_SUCCESS;
- }
- ALIAS (no_ip_ospf_dead_interval,
- no_ip_ospf_dead_interval_cmd,
- "no ip ospf dead-interval",
- NO_STR
- "IP Informationn"
- "OSPF interface commandsn"
- "Interval after which a neighbor is declared deadn");
- ALIAS (no_ip_ospf_dead_interval,
- no_ospf_dead_interval_cmd,
- "no ospf dead-interval",
- NO_STR
- "OSPF interface commandsn"
- "Interval after which a neighbor is declared deadn");
- DEFUN (ip_ospf_hello_interval,
- ip_ospf_hello_interval_addr_cmd,
- "ip ospf hello-interval <1-65535> A.B.C.D",
- "IP Informationn"
- "OSPF interface commandsn"
- "Time between HELLO packetsn"
- "Secondsn"
- "Address of interface")
- {
- struct interface *ifp = vty->index;
- u_int32_t seconds;
- struct in_addr addr;
- int ret;
- struct ospf_if_params *params;
-
- params = IF_DEF_PARAMS (ifp);
- seconds = strtol (argv[0], NULL, 10);
-
- /* HelloInterval range is <1-65535>. */
- if (seconds < 1 || seconds > 65535)
- {
- vty_out (vty, "Hello Interval is invalid%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- if (argc == 2)
- {
- ret = inet_aton(argv[1], &addr);
- if (!ret)
- {
- vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- params = ospf_get_if_params (ifp, addr);
- ospf_if_update_params (ifp, addr);
- }
- SET_IF_PARAM (params, v_hello);
- params->v_hello = seconds;
- return CMD_SUCCESS;
- }
- ALIAS (ip_ospf_hello_interval,
- ip_ospf_hello_interval_cmd,
- "ip ospf hello-interval <1-65535>",
- "IP Informationn"
- "OSPF interface commandsn"
- "Time between HELLO packetsn"
- "Secondsn");
- ALIAS (ip_ospf_hello_interval,
- ospf_hello_interval_cmd,
- "ospf hello-interval <1-65535>",
- "OSPF interface commandsn"
- "Time between HELLO packetsn"
- "Secondsn");
- DEFUN (no_ip_ospf_hello_interval,
- no_ip_ospf_hello_interval_addr_cmd,
- "no ip ospf hello-interval A.B.C.D",
- NO_STR
- "IP Informationn"
- "OSPF interface commandsn"
- "Time between HELLO packetsn"
- "Address of interface")
- {
- struct interface *ifp = vty->index;
- struct in_addr addr;
- int ret;
- struct ospf_if_params *params;
-
- ifp = vty->index;
- params = IF_DEF_PARAMS (ifp);
- if (argc == 1)
- {
- ret = inet_aton(argv[0], &addr);
- if (!ret)
- {
- vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- params = ospf_lookup_if_params (ifp, addr);
- if (params == NULL)
- return CMD_SUCCESS;
- }
- UNSET_IF_PARAM (params, v_hello);
- params->v_hello = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
- if (params != IF_DEF_PARAMS (ifp))
- {
- ospf_free_if_params (ifp, addr);
- ospf_if_update_params (ifp, addr);
- }
- return CMD_SUCCESS;
- }
- ALIAS (no_ip_ospf_hello_interval,
- no_ip_ospf_hello_interval_cmd,
- "no ip ospf hello-interval",
- NO_STR
- "IP Informationn"
- "OSPF interface commandsn"
- "Time between HELLO packetsn");
- ALIAS (no_ip_ospf_hello_interval,
- no_ospf_hello_interval_cmd,
- "no ospf hello-interval",
- NO_STR
- "OSPF interface commandsn"
- "Time between HELLO packetsn");
- DEFUN (ip_ospf_network,
- ip_ospf_network_cmd,
- "ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
- "IP Informationn"
- "OSPF interface commandsn"
- "Network typen"
- "Specify OSPF broadcast multi-access networkn"
- "Specify OSPF NBMA networkn"
- "Specify OSPF point-to-multipoint networkn"
- "Specify OSPF point-to-point networkn")
- {
- struct interface *ifp = vty->index;
- int old_type = IF_DEF_PARAMS (ifp)->type;
- struct route_node *rn;
-
- if (strncmp (argv[0], "b", 1) == 0)
- IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST;
- else if (strncmp (argv[0], "n", 1) == 0)
- IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_NBMA;
- else if (strncmp (argv[0], "point-to-m", 10) == 0)
- IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOMULTIPOINT;
- else if (strncmp (argv[0], "point-to-p", 10) == 0)
- IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOPOINT;
- if (IF_DEF_PARAMS (ifp)->type == old_type)
- return CMD_SUCCESS;
- SET_IF_PARAM (IF_DEF_PARAMS (ifp), type);
- for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
- {
- struct ospf_interface *oi = rn->info;
- if (!oi)
- continue;
-
- oi->type = IF_DEF_PARAMS (ifp)->type;
-
- if (oi->state > ISM_Down)
- {
- OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown);
- OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp);
- }
- }
- return CMD_SUCCESS;
- }
- ALIAS (ip_ospf_network,
- ospf_network_cmd,
- "ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
- "OSPF interface commandsn"
- "Network typen"
- "Specify OSPF broadcast multi-access networkn"
- "Specify OSPF NBMA networkn"
- "Specify OSPF point-to-multipoint networkn"
- "Specify OSPF point-to-point networkn");
- DEFUN (no_ip_ospf_network,
- no_ip_ospf_network_cmd,
- "no ip ospf network",
- NO_STR
- "IP Informationn"
- "OSPF interface commandsn"
- "Network typen")
- {
- struct interface *ifp = vty->index;
- int old_type = IF_DEF_PARAMS (ifp)->type;
- struct route_node *rn;
- IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST;
- if (IF_DEF_PARAMS (ifp)->type == old_type)
- return CMD_SUCCESS;
- for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
- {
- struct ospf_interface *oi = rn->info;
- if (!oi)
- continue;
-
- oi->type = IF_DEF_PARAMS (ifp)->type;
-
- if (oi->state > ISM_Down)
- {
- OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown);
- OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp);
- }
- }
- return CMD_SUCCESS;
- }
- ALIAS (no_ip_ospf_network,
- no_ospf_network_cmd,
- "no ospf network",
- NO_STR
- "OSPF interface commandsn"
- "Network typen");
- DEFUN (ip_ospf_priority,
- ip_ospf_priority_addr_cmd,
- "ip ospf priority <0-255> A.B.C.D",
- "IP Informationn"
- "OSPF interface commandsn"
- "Router priorityn"
- "Priorityn"
- "Address of interface")
- {
- struct interface *ifp = vty->index;
- u_int32_t priority;
- struct route_node *rn;
- struct in_addr addr;
- int ret;
- struct ospf_if_params *params;
-
- params = IF_DEF_PARAMS (ifp);
- priority = strtol (argv[0], NULL, 10);
-
- /* Router Priority range is <0-255>. */
- if (priority < 0 || priority > 255)
- {
- vty_out (vty, "Router Priority is invalid%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- if (argc == 2)
- {
- ret = inet_aton(argv[1], &addr);
- if (!ret)
- {
- vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- params = ospf_get_if_params (ifp, addr);
- ospf_if_update_params (ifp, addr);
- }
-
- SET_IF_PARAM (params, priority);
- params->priority = priority;
- for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
- {
- struct ospf_interface *oi = rn->info;
-
- if (!oi)
- continue;
-
- if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority))
- {
- PRIORITY (oi) = OSPF_IF_PARAM (oi, priority);
- OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange);
- }
- }
-
- return CMD_SUCCESS;
- }
- ALIAS (ip_ospf_priority,
- ip_ospf_priority_cmd,
- "ip ospf priority <0-255>",
- "IP Informationn"
- "OSPF interface commandsn"
- "Router priorityn"
- "Priorityn");
- ALIAS (ip_ospf_priority,
- ospf_priority_cmd,
- "ospf priority <0-255>",
- "OSPF interface commandsn"
- "Router priorityn"
- "Priorityn");
- DEFUN (no_ip_ospf_priority,
- no_ip_ospf_priority_addr_cmd,
- "no ip ospf priority A.B.C.D",
- NO_STR
- "IP Informationn"
- "OSPF interface commandsn"
- "Router priorityn"
- "Address of interface")
- {
- struct interface *ifp = vty->index;
- struct route_node *rn;
- struct in_addr addr;
- int ret;
- struct ospf_if_params *params;
-
- ifp = vty->index;
- params = IF_DEF_PARAMS (ifp);
- if (argc == 1)
- {
- ret = inet_aton(argv[0], &addr);
- if (!ret)
- {
- vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- params = ospf_lookup_if_params (ifp, addr);
- if (params == NULL)
- return CMD_SUCCESS;
- }
- UNSET_IF_PARAM (params, priority);
- params->priority = OSPF_ROUTER_PRIORITY_DEFAULT;
- if (params != IF_DEF_PARAMS (ifp))
- {
- ospf_free_if_params (ifp, addr);
- ospf_if_update_params (ifp, addr);
- }
-
- for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
- {
- struct ospf_interface *oi = rn->info;
-
- if (!oi)
- continue;
-
-
- if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority))
- {
- PRIORITY (oi) = OSPF_IF_PARAM (oi, priority);
- OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange);
- }
- }
-
- return CMD_SUCCESS;
- }
- ALIAS (no_ip_ospf_priority,
- no_ip_ospf_priority_cmd,
- "no ip ospf priority",
- NO_STR
- "IP Informationn"
- "OSPF interface commandsn"
- "Router priorityn");
- ALIAS (no_ip_ospf_priority,
- no_ospf_priority_cmd,
- "no ospf priority",
- NO_STR
- "OSPF interface commandsn"
- "Router priorityn");
- DEFUN (ip_ospf_retransmit_interval,
- ip_ospf_retransmit_interval_addr_cmd,
- "ip ospf retransmit-interval <3-65535> A.B.C.D",
- "IP Informationn"
- "OSPF interface commandsn"
- "Time between retransmitting lost link state advertisementsn"
- "Secondsn"
- "Address of interface")
- {
- struct interface *ifp = vty->index;
- u_int32_t seconds;
- struct in_addr addr;
- int ret;
- struct ospf_if_params *params;
-
- params = IF_DEF_PARAMS (ifp);
- seconds = strtol (argv[0], NULL, 10);
- /* Retransmit Interval range is <3-65535>. */
- if (seconds < 3 || seconds > 65535)
- {
- vty_out (vty, "Retransmit Interval is invalid%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- if (argc == 2)
- {
- ret = inet_aton(argv[1], &addr);
- if (!ret)
- {
- vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- params = ospf_get_if_params (ifp, addr);
- ospf_if_update_params (ifp, addr);
- }
- SET_IF_PARAM (params, retransmit_interval);
- params->retransmit_interval = seconds;
- return CMD_SUCCESS;
- }
- ALIAS (ip_ospf_retransmit_interval,
- ip_ospf_retransmit_interval_cmd,
- "ip ospf retransmit-interval <3-65535>",
- "IP Informationn"
- "OSPF interface commandsn"
- "Time between retransmitting lost link state advertisementsn"
- "Secondsn");
- ALIAS (ip_ospf_retransmit_interval,
- ospf_retransmit_interval_cmd,
- "ospf retransmit-interval <3-65535>",
- "OSPF interface commandsn"
- "Time between retransmitting lost link state advertisementsn"
- "Secondsn");
- DEFUN (no_ip_ospf_retransmit_interval,
- no_ip_ospf_retransmit_interval_addr_cmd,
- "no ip ospf retransmit-interval A.B.C.D",
- NO_STR
- "IP Informationn"
- "OSPF interface commandsn"
- "Time between retransmitting lost link state advertisementsn"
- "Address of interface")
- {
- struct interface *ifp = vty->index;
- struct in_addr addr;
- int ret;
- struct ospf_if_params *params;
-
- ifp = vty->index;
- params = IF_DEF_PARAMS (ifp);
- if (argc == 1)
- {
- ret = inet_aton(argv[0], &addr);
- if (!ret)
- {
- vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- params = ospf_lookup_if_params (ifp, addr);
- if (params == NULL)
- return CMD_SUCCESS;
- }
- UNSET_IF_PARAM (params, retransmit_interval);
- params->retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT;
- if (params != IF_DEF_PARAMS (ifp))
- {
- ospf_free_if_params (ifp, addr);
- ospf_if_update_params (ifp, addr);
- }
- return CMD_SUCCESS;
- }
- ALIAS (no_ip_ospf_retransmit_interval,
- no_ip_ospf_retransmit_interval_cmd,
- "no ip ospf retransmit-interval",
- NO_STR
- "IP Informationn"
- "OSPF interface commandsn"
- "Time between retransmitting lost link state advertisementsn");
- ALIAS (no_ip_ospf_retransmit_interval,
- no_ospf_retransmit_interval_cmd,
- "no ospf retransmit-interval",
- NO_STR
- "OSPF interface commandsn"
- "Time between retransmitting lost link state advertisementsn");
- DEFUN (ip_ospf_transmit_delay,
- ip_ospf_transmit_delay_addr_cmd,
- "ip ospf transmit-delay <1-65535> A.B.C.D",
- "IP Informationn"
- "OSPF interface commandsn"
- "Link state transmit delayn"
- "Secondsn"
- "Address of interface")
- {
- struct interface *ifp = vty->index;
- u_int32_t seconds;
- struct in_addr addr;
- int ret;
- struct ospf_if_params *params;
-
- params = IF_DEF_PARAMS (ifp);
- seconds = strtol (argv[0], NULL, 10);
- /* Transmit Delay range is <1-65535>. */
- if (seconds < 1 || seconds > 65535)
- {
- vty_out (vty, "Transmit Delay is invalid%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- if (argc == 2)
- {
- ret = inet_aton(argv[1], &addr);
- if (!ret)
- {
- vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- params = ospf_get_if_params (ifp, addr);
- ospf_if_update_params (ifp, addr);
- }
- SET_IF_PARAM (params, transmit_delay);
- params->transmit_delay = seconds;
- return CMD_SUCCESS;
- }
- ALIAS (ip_ospf_transmit_delay,
- ip_ospf_transmit_delay_cmd,
- "ip ospf transmit-delay <1-65535>",
- "IP Informationn"
- "OSPF interface commandsn"
- "Link state transmit delayn"
- "Secondsn");
- ALIAS (ip_ospf_transmit_delay,
- ospf_transmit_delay_cmd,
- "ospf transmit-delay <1-65535>",
- "OSPF interface commandsn"
- "Link state transmit delayn"
- "Secondsn");
- DEFUN (no_ip_ospf_transmit_delay,
- no_ip_ospf_transmit_delay_addr_cmd,
- "no ip ospf transmit-delay A.B.C.D",
- NO_STR
- "IP Informationn"
- "OSPF interface commandsn"
- "Link state transmit delayn"
- "Address of interface")
- {
- struct interface *ifp = vty->index;
- struct in_addr addr;
- int ret;
- struct ospf_if_params *params;
-
- ifp = vty->index;
- params = IF_DEF_PARAMS (ifp);
- if (argc == 1)
- {
- ret = inet_aton(argv[0], &addr);
- if (!ret)
- {
- vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- params = ospf_lookup_if_params (ifp, addr);
- if (params == NULL)
- return CMD_SUCCESS;
- }
- UNSET_IF_PARAM (params, transmit_delay);
- params->transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT;
- if (params != IF_DEF_PARAMS (ifp))
- {
- ospf_free_if_params (ifp, addr);
- ospf_if_update_params (ifp, addr);
- }
- return CMD_SUCCESS;
- }
- ALIAS (no_ip_ospf_transmit_delay,
- no_ip_ospf_transmit_delay_cmd,
- "no ip ospf transmit-delay",
- NO_STR
- "IP Informationn"
- "OSPF interface commandsn"
- "Link state transmit delayn");
- ALIAS (no_ip_ospf_transmit_delay,
- no_ospf_transmit_delay_cmd,
- "no ospf transmit-delay",
- NO_STR
- "OSPF interface commandsn"
- "Link state transmit delayn");
- DEFUN (ospf_redistribute_source_metric_type,
- ospf_redistribute_source_metric_type_routemap_cmd,
- "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2) route-map WORD",
- "Redistribute information from another routing protocoln"
- "Kernel routesn"
- "Connectedn"
- "Static routesn"
- "Routing Information Protocol (RIP)n"
- "Border Gateway Protocol (BGP)n"
- "Metric for redistributed routesn"
- "OSPF default metricn"
- "OSPF exterior metric type for redistributed routesn"
- "Set OSPF External Type 1 metricsn"
- "Set OSPF External Type 2 metricsn"
- "Route map referencen"
- "Pointer to route-map entriesn")
- {
- struct ospf *ospf = vty->index;
- int source;
- int type = -1;
- int metric = -1;
- /* Get distribute source. */
- if (!str2distribute_source (argv[0], &source))
- return CMD_WARNING;
- /* Get metric value. */
- if (argc >= 2)
- if (!str2metric (argv[1], &metric))
- return CMD_WARNING;
- /* Get metric type. */
- if (argc >= 3)
- if (!str2metric_type (argv[2], &type))
- return CMD_WARNING;
- if (argc == 4)
- ospf_routemap_set (ospf, source, argv[3]);
- else
- ospf_routemap_unset (ospf, source);
-
- return ospf_redistribute_set (ospf, source, type, metric);
- }
- ALIAS (ospf_redistribute_source_metric_type,
- ospf_redistribute_source_metric_type_cmd,
- "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2)",
- "Redistribute information from another routing protocoln"
- "Kernel routesn"
- "Connectedn"
- "Static routesn"
- "Routing Information Protocol (RIP)n"
- "Border Gateway Protocol (BGP)n"
- "Metric for redistributed routesn"
- "OSPF default metricn"
- "OSPF exterior metric type for redistributed routesn"
- "Set OSPF External Type 1 metricsn"
- "Set OSPF External Type 2 metricsn");
- ALIAS (ospf_redistribute_source_metric_type,
- ospf_redistribute_source_metric_cmd,
- "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214>",
- "Redistribute information from another routing protocoln"
- "Kernel routesn"
- "Connectedn"
- "Static routesn"
- "Routing Information Protocol (RIP)n"
- "Border Gateway Protocol (BGP)n"
- "Metric for redistributed routesn"
- "OSPF default metricn");
- DEFUN (ospf_redistribute_source_type_metric,
- ospf_redistribute_source_type_metric_routemap_cmd,
- "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214> route-map WORD",
- "Redistribute information from another routing protocoln"
- "Kernel routesn"
- "Connectedn"
- "Static routesn"
- "Routing Information Protocol (RIP)n"
- "Border Gateway Protocol (BGP)n"
- "OSPF exterior metric type for redistributed routesn"
- "Set OSPF External Type 1 metricsn"
- "Set OSPF External Type 2 metricsn"
- "Metric for redistributed routesn"
- "OSPF default metricn"
- "Route map referencen"
- "Pointer to route-map entriesn")
- {
- struct ospf *ospf = vty->index;
- int source;
- int type = -1;
- int metric = -1;
- /* Get distribute source. */
- if (!str2distribute_source (argv[0], &source))
- return CMD_WARNING;
- /* Get metric value. */
- if (argc >= 2)
- if (!str2metric_type (argv[1], &type))
- return CMD_WARNING;
- /* Get metric type. */
- if (argc >= 3)
- if (!str2metric (argv[2], &metric))
- return CMD_WARNING;
- if (argc == 4)
- ospf_routemap_set (ospf, source, argv[3]);
- else
- ospf_routemap_unset (ospf, source);
- return ospf_redistribute_set (ospf, source, type, metric);
- }
- ALIAS (ospf_redistribute_source_type_metric,
- ospf_redistribute_source_type_metric_cmd,
- "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214>",
- "Redistribute information from another routing protocoln"
- "Kernel routesn"
- "Connectedn"
- "Static routesn"
- "Routing Information Protocol (RIP)n"
- "Border Gateway Protocol (BGP)n"
- "OSPF exterior metric type for redistributed routesn"
- "Set OSPF External Type 1 metricsn"
- "Set OSPF External Type 2 metricsn"
- "Metric for redistributed routesn"
- "OSPF default metricn");
- ALIAS (ospf_redistribute_source_type_metric,
- ospf_redistribute_source_type_cmd,
- "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2)",
- "Redistribute information from another routing protocoln"
- "Kernel routesn"
- "Connectedn"
- "Static routesn"
- "Routing Information Protocol (RIP)n"
- "Border Gateway Protocol (BGP)n"
- "OSPF exterior metric type for redistributed routesn"
- "Set OSPF External Type 1 metricsn"
- "Set OSPF External Type 2 metricsn");
- ALIAS (ospf_redistribute_source_type_metric,
- ospf_redistribute_source_cmd,
- "redistribute (kernel|connected|static|rip|bgp)",
- "Redistribute information from another routing protocoln"
- "Kernel routesn"
- "Connectedn"
- "Static routesn"
- "Routing Information Protocol (RIP)n"
- "Border Gateway Protocol (BGP)n");
- DEFUN (ospf_redistribute_source_metric_routemap,
- ospf_redistribute_source_metric_routemap_cmd,
- "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> route-map WORD",
- "Redistribute information from another routing protocoln"
- "Kernel routesn"
- "Connectedn"
- "Static routesn"
- "Routing Information Protocol (RIP)n"
- "Border Gateway Protocol (BGP)n"
- "Metric for redistributed routesn"
- "OSPF default metricn"
- "Route map referencen"
- "Pointer to route-map entriesn")
- {
- struct ospf *ospf = vty->index;
- int source;
- int metric = -1;
- /* Get distribute source. */
- if (!str2distribute_source (argv[0], &source))
- return CMD_WARNING;
- /* Get metric value. */
- if (argc >= 2)
- if (!str2metric (argv[1], &metric))
- return CMD_WARNING;
- if (argc == 3)
- ospf_routemap_set (ospf, source, argv[2]);
- else
- ospf_routemap_unset (ospf, source);
-
- return ospf_redistribute_set (ospf, source, -1, metric);
- }
- DEFUN (ospf_redistribute_source_type_routemap,
- ospf_redistribute_source_type_routemap_cmd,
- "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) route-map WORD",
- "Redistribute information from another routing protocoln"
- "Kernel routesn"
- "Connectedn"
- "Static routesn"
- "Routing Information Protocol (RIP)n"
- "Border Gateway Protocol (BGP)n"
- "OSPF exterior metric type for redistributed routesn"
- "Set OSPF External Type 1 metricsn"
- "Set OSPF External Type 2 metricsn"
- "Route map referencen"
- "Pointer to route-map entriesn")
- {
- struct ospf *ospf = vty->index;
- int source;
- int type = -1;
- /* Get distribute source. */
- if (!str2distribute_source (argv[0], &source))
- return CMD_WARNING;
- /* Get metric value. */
- if (argc >= 2)
- if (!str2metric_type (argv[1], &type))
- return CMD_WARNING;
- if (argc == 3)
- ospf_routemap_set (ospf, source, argv[2]);
- else
- ospf_routemap_unset (ospf, source);
- return ospf_redistribute_set (ospf, source, type, -1);
- }
- DEFUN (ospf_redistribute_source_routemap,
- ospf_redistribute_source_routemap_cmd,
- "redistribute (kernel|connected|static|rip|bgp) route-map WORD",
- "Redistribute information from another routing protocoln"
- "Kernel routesn"
- "Connectedn"
- "Static routesn"
- "Routing Information Protocol (RIP)n"
- "Border Gateway Protocol (BGP)n"
- "Route map referencen"
- "Pointer to route-map entriesn")
- {
- struct ospf *ospf = vty->index;
- int source;
- /* Get distribute source. */
- if (!str2distribute_source (argv[0], &source))
- return CMD_WARNING;
- if (argc == 2)
- ospf_routemap_set (ospf, source, argv[1]);
- else
- ospf_routemap_unset (ospf, source);
- return ospf_redistribute_set (ospf, source, -1, -1);
- }
- DEFUN (no_ospf_redistribute_source,
- no_ospf_redistribute_source_cmd,
- "no redistribute (kernel|connected|static|rip|bgp)",
- NO_STR
- "Redistribute information from another routing protocoln"
- "Kernel routesn"
- "Connectedn"
- "Static routesn"
- "Routing Information Protocol (RIP)n"
- "Border Gateway Protocol (BGP)n")
- {
- struct ospf *ospf = vty->index;
- int source;
- if (!str2distribute_source (argv[0], &source))
- return CMD_WARNING;
- ospf_routemap_unset (ospf, source);
- return ospf_redistribute_unset (ospf, source);
- }
- DEFUN (ospf_distribute_list_out,
- ospf_distribute_list_out_cmd,
- "distribute-list WORD out (kernel|connected|static|rip|bgp)",
- "Filter networks in routing updatesn"
- "Access-list namen"
- OUT_STR
- "Kernel routesn"
- "Connectedn"
- "Static routesn"
- "Routing Information Protocol (RIP)n"
- "Border Gateway Protocol (BGP)n")
- {
- struct ospf *ospf = vty->index;
- int source;
- /* Get distribute source. */
- if (!str2distribute_source (argv[1], &source))
- return CMD_WARNING;
- return ospf_distribute_list_out_set (ospf, source, argv[0]);
- }
- DEFUN (no_ospf_distribute_list_out,
- no_ospf_distribute_list_out_cmd,
- "no distribute-list WORD out (kernel|connected|static|rip|bgp)",
- NO_STR
- "Filter networks in routing updatesn"
- "Access-list namen"
- OUT_STR
- "Kernel routesn"
- "Connectedn"
- "Static routesn"
- "Routing Information Protocol (RIP)n"
- "Border Gateway Protocol (BGP)n")
- {
- struct ospf *ospf = vty->index;
- int source;
- if (!str2distribute_source (argv[1], &source))
- return CMD_WARNING;
- return ospf_distribute_list_out_unset (ospf, source, argv[0]);
- }
- /* Default information originate. */
- DEFUN (ospf_default_information_originate_metric_type_routemap,
- ospf_default_information_originate_metric_type_routemap_cmd,
- "default-information originate metric <0-16777214> metric-type (1|2) route-map WORD",
- "Control distribution of default informationn"
- "Distribute a default routen"
- "OSPF default metricn"
- "OSPF metricn"
- "OSPF metric type for default routesn"
- "Set OSPF External Type 1 metricsn"
- "Set OSPF External Type 2 metricsn"
- "Route map referencen"
- "Pointer to route-map entriesn")
- {
- struct ospf *ospf = vty->index;
- int type = -1;
- int metric = -1;
- /* Get metric value. */
- if (argc >= 1)
- if (!str2metric (argv[0], &metric))
- return CMD_WARNING;
- /* Get metric type. */
- if (argc >= 2)
- if (!str2metric_type (argv[1], &type))
- return CMD_WARNING;
- if (argc == 3)
- ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]);
- else
- ospf_routemap_unset (ospf, DEFAULT_ROUTE);
- return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA,
- type, metric);
- }
- ALIAS (ospf_default_information_originate_metric_type_routemap,
- ospf_default_information_originate_metric_type_cmd,
- "default-information originate metric <0-16777214> metric-type (1|2)",
- "Control distribution of default informationn"
- "Distribute a default routen"
- "OSPF default metricn"
- "OSPF metricn"
- "OSPF metric type for default routesn"
- "Set OSPF External Type 1 metricsn"
- "Set OSPF External Type 2 metricsn");
- ALIAS (ospf_default_information_originate_metric_type_routemap,
- ospf_default_information_originate_metric_cmd,
- "default-information originate metric <0-16777214>",
- "Control distribution of default informationn"
- "Distribute a default routen"
- "OSPF default metricn"
- "OSPF metricn");
- ALIAS (ospf_default_information_originate_metric_type_routemap,
- ospf_default_information_originate_cmd,
- "default-information originate",
- "Control distribution of default informationn"
- "Distribute a default routen");
- /* Default information originate. */
- DEFUN (ospf_default_information_originate_metric_routemap,
- ospf_default_information_originate_metric_routemap_cmd,
- "default-information originate metric <0-16777214> route-map WORD",
- "Control distribution of default informationn"
- "Distribute a default routen"
- "OSPF default metricn"
- "OSPF metricn"
- "Route map referencen"
- "Pointer to route-map entriesn")
- {
- struct ospf *ospf = vty->index;
- int metric = -1;
- /* Get metric value. */
- if (argc >= 1)
- if (!str2metric (argv[0], &metric))
- return CMD_WARNING;
- if (argc == 2)
- ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]);
- else
- ospf_routemap_unset (ospf, DEFAULT_ROUTE);
- return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA,
- -1, metric);
- }
- /* Default information originate. */
- DEFUN (ospf_default_information_originate_routemap,
- ospf_default_information_originate_routemap_cmd,
- "default-information originate route-map WORD",
- "Control distribution of default informationn"
- "Distribute a default routen"
- "Route map referencen"
- "Pointer to route-map entriesn")
- {
- struct ospf *ospf = vty->index;
- if (argc == 1)
- ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]);
- else
- ospf_routemap_unset (ospf, DEFAULT_ROUTE);
- return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, -1, -1);
- }
- DEFUN (ospf_default_information_originate_type_metric_routemap,
- ospf_default_information_originate_type_metric_routemap_cmd,
- "default-information originate metric-type (1|2) metric <0-16777214> route-map WORD",
- "Control distribution of default informationn"
- "Distribute a default routen"
- "OSPF metric type for default routesn"
- "Set OSPF External Type 1 metricsn"
- "Set OSPF External Type 2 metricsn"
- "OSPF default metricn"
- "OSPF metricn"
- "Route map referencen"
- "Pointer to route-map entriesn")
- {
- struct ospf *ospf = vty->index;
- int type = -1;
- int metric = -1;
- /* Get metric type. */
- if (argc >= 1)
- if (!str2metric_type (argv[0], &type))
- return CMD_WARNING;
- /* Get metric value. */
- if (argc >= 2)
- if (!str2metric (argv[1], &metric))
- return CMD_WARNING;
- if (argc == 3)
- ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]);
- else
- ospf_routemap_unset (ospf, DEFAULT_ROUTE);
- return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA,
- type, metric);
- }
- ALIAS (ospf_default_information_originate_type_metric_routemap,
- ospf_default_information_originate_type_metric_cmd,
- "default-information originate metric-type (1|2) metric <0-16777214>",
- "Control distribution of default informationn"
- "Distribute a default routen"
- "OSPF metric type for default routesn"
- "Set OSPF External Type 1 metricsn"
- "Set OSPF External Type 2 metricsn"
- "OSPF default metricn"
- "OSPF metricn");
- ALIAS (ospf_default_information_originate_type_metric_routemap,
- ospf_default_information_originate_type_cmd,
- "default-information originate metric-type (1|2)",
- "Control distribution of default informationn"
- "Distribute a default routen"
- "OSPF metric type for default routesn"
- "Set OSPF External Type 1 metricsn"
- "Set OSPF External Type 2 metricsn");
- DEFUN (ospf_default_information_originate_type_routemap,
- ospf_default_information_originate_type_routemap_cmd,
- "default-information originate metric-type (1|2) route-map WORD",
- "Control distribution of default informationn"
- "Distribute a default routen"
- "OSPF metric type for default routesn"
- "Set OSPF External Type 1 metricsn"
- "Set OSPF External Type 2 metricsn"
- "Route map referencen"
- "Pointer to route-map entriesn")
- {
- struct ospf *ospf = vty->index;
- int type = -1;
- /* Get metric type. */
- if (argc >= 1)
- if (!str2metric_type (argv[0], &type))
- return CMD_WARNING;
- if (argc == 2)
- ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]);
- else
- ospf_routemap_unset (ospf, DEFAULT_ROUTE);
- return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA,
- type, -1);
- }
- DEFUN (ospf_default_information_originate_always_metric_type_routemap,
- ospf_default_information_originate_always_metric_type_routemap_cmd,
- "default-information originate always metric <0-16777214> metric-type (1|2) route-map WORD",
- "Control distribution of default informationn"
- "Distribute a default routen"
- "Always advertise default routen"
- "OSPF default metricn"
- "OSPF metricn"
- "OSPF metric type for default routesn"
- "Set OSPF External Type 1 metricsn"
- "Set OSPF External Type 2 metricsn"
- "Route map referencen"
- "Pointer to route-map entriesn")
- {
- struct ospf *ospf = vty->index;
- int type = -1;
- int metric = -1;
- /* Get metric value. */
- if (argc >= 1)
- if (!str2metric (argv[0], &metric))
- return CMD_WARNING;
- /* Get metric type. */
- if (argc >= 2)
- if (!str2metric_type (argv[1], &type))
- return CMD_WARNING;
- if (argc == 3)
- ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]);
- else
- ospf_routemap_unset (ospf, DEFAULT_ROUTE);
- return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS,
- type, metric);
- }
- ALIAS (ospf_default_information_originate_always_metric_type_routemap,
- ospf_default_information_originate_always_metric_type_cmd,
- "default-information originate always metric <0-16777214> metric-type (1|2)",
- "Control distribution of default informationn"
- "Distribute a default routen"
- "Always advertise default routen"
- "OSPF default metricn"
- "OSPF metricn"
- "OSPF metric type for default routesn"
- "Set OSPF External Type 1 metricsn"
- "Set OSPF External Type 2 metricsn");
- ALIAS (ospf_default_information_originate_always_metric_type_routemap,
- ospf_default_information_originate_always_metric_cmd,
- "default-information originate always metric <0-16777214>",
- "Control distribution of default informationn"
- "Distribute a default routen"
- "Always advertise default routen"
- "OSPF default metricn"
- "OSPF metricn"
- "OSPF metric type for default routesn");
- ALIAS (ospf_default_information_originate_always_metric_type_routemap,
- ospf_default_information_originate_always_cmd,
- "default-information originate always",
- "Control distribution of default informationn"
- "Distribute a default routen"
- "Always advertise default routen");
- DEFUN (ospf_default_information_originate_always_metric_routemap,
- ospf_default_information_originate_always_metric_routemap_cmd,
- "default-information originate always metric <0-16777214> route-map WORD",
- "Control distribution of default informationn"
- "Distribute a default routen"
- "Always advertise default routen"
- "OSPF default metricn"
- "OSPF metricn"
- "Route map referencen"
- "Pointer to route-map entriesn")
- {
- struct ospf *ospf = vty->index;
- int metric = -1;
- /* Get metric value. */
- if (argc >= 1)
- if (!str2metric (argv[0], &metric))
- return CMD_WARNING;
- if (argc == 2)
- ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]);
- else
- ospf_routemap_unset (ospf, DEFAULT_ROUTE);
- return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS,
- -1, metric);
- }
- DEFUN (ospf_default_information_originate_always_routemap,
- ospf_default_information_originate_always_routemap_cmd,
- "default-information originate always route-map WORD",
- "Control distribution of default informationn"
- "Distribute a default routen"
- "Always advertise default routen"
- "Route map referencen"
- "Pointer to route-map entriesn")
- {
- struct ospf *ospf = vty->index;
- if (argc == 1)
- ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]);
- else
- ospf_routemap_unset (ospf, DEFAULT_ROUTE);
- return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, -1, -1);
- }
- DEFUN (ospf_default_information_originate_always_type_metric_routemap,
- ospf_default_information_originate_always_type_metric_routemap_cmd,
- "default-information originate always metric-type (1|2) metric <0-16777214> route-map WORD",
- "Control distribution of default informationn"
- "Distribute a default routen"
- "Always advertise default routen"
- "OSPF metric type for default routesn"
- "Set OSPF External Type 1 metricsn"
- "Set OSPF External Type 2 metricsn"
- "OSPF default metricn"
- "OSPF metricn"
- "Route map referencen"
- "Pointer to route-map entriesn")
- {
- struct ospf *ospf = vty->index;
- int type = -1;
- int metric = -1;
- /* Get metric type. */
- if (argc >= 1)
- if (!str2metric_type (argv[0], &type))
- return CMD_WARNING;
- /* Get metric value. */
- if (argc >= 2)
- if (!str2metric (argv[1], &metric))
- return CMD_WARNING;
- if (argc == 3)
- ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]);
- else
- ospf_routemap_unset (ospf, DEFAULT_ROUTE);
- return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS,
- type, metric);
- }
- ALIAS (ospf_default_information_originate_always_type_metric_routemap,
- ospf_default_information_originate_always_type_metric_cmd,
- "default-information originate always metric-type (1|2) metric <0-16777214>",
- "Control distribution of default informationn"
- "Distribute a default routen"
- "Always advertise default routen"
- "OSPF metric type for default routesn"
- "Set OSPF External Type 1 metricsn"
- "Set OSPF External Type 2 metricsn"
- "OSPF default metricn"
- "OSPF metricn");
- ALIAS (ospf_default_information_originate_always_type_metric_routemap,
- ospf_default_information_originate_always_type_cmd,
- "default-information originate always metric-type (1|2)",
- "Control distribution of default informationn"
- "Distribute a default routen"
- "Always advertise default routen"
- "OSPF metric type for default routesn"
- "Set OSPF External Type 1 metricsn"
- "Set OSPF External Type 2 metricsn");
- DEFUN (ospf_default_information_originate_always_type_routemap,
- ospf_default_information_originate_always_type_routemap_cmd,
- "default-information originate always metric-type (1|2) route-map WORD",
- "Control distribution of default informationn"
- "Distribute a default routen"
- "Always advertise default routen"
- "OSPF metric type for default routesn"
- "Set OSPF External Type 1 metricsn"
- "Set OSPF External Type 2 metricsn"
- "Route map referencen"
- "Pointer to route-map entriesn")
- {
- struct ospf *ospf = vty->index;
- int type = -1;
- /* Get metric type. */
- if (argc >= 1)
- if (!str2metric_type (argv[0], &type))
- return CMD_WARNING;
- if (argc == 2)
- ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]);
- else
- ospf_routemap_unset (ospf, DEFAULT_ROUTE);
- return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS,
- type, -1);
- }
- DEFUN (no_ospf_default_information_originate,
- no_ospf_default_information_originate_cmd,
- "no default-information originate",
- NO_STR
- "Control distribution of default informationn"
- "Distribute a default routen")
- {
- struct ospf *ospf = vty->index;
- struct prefix_ipv4 p;
- struct in_addr nexthop;
-
- p.family = AF_INET;
- p.prefix.s_addr = 0;
- p.prefixlen = 0;
- ospf_external_lsa_flush (ospf, DEFAULT_ROUTE, &p, 0, nexthop);
- if (EXTERNAL_INFO (DEFAULT_ROUTE)) {
- ospf_external_info_delete (DEFAULT_ROUTE, p);
- route_table_finish (EXTERNAL_INFO (DEFAULT_ROUTE));
- EXTERNAL_INFO (DEFAULT_ROUTE) = NULL;
- }
- ospf_routemap_unset (ospf, DEFAULT_ROUTE);
- return ospf_redistribute_default_unset (ospf);
- }
- DEFUN (ospf_default_metric,
- ospf_default_metric_cmd,
- "default-metric <0-16777214>",
- "Set metric of redistributed routesn"
- "Default metricn")
- {
- struct ospf *ospf = vty->index;
- int metric = -1;
- if (!str2metric (argv[0], &metric))
- return CMD_WARNING;
- ospf->default_metric = metric;
- return CMD_SUCCESS;
- }
- DEFUN (no_ospf_default_metric,
- no_ospf_default_metric_cmd,
- "no default-metric",
- NO_STR
- "Set metric of redistributed routesn")
- {
- struct ospf *ospf = vty->index;
- ospf->default_metric = -1;
- return CMD_SUCCESS;
- }
- ALIAS (no_ospf_default_metric,
- no_ospf_default_metric_val_cmd,
- "no default-metric <0-16777214>",
- NO_STR
- "Set metric of redistributed routesn"
- "Default metricn");
- DEFUN (ospf_distance,
- ospf_distance_cmd,
- "distance <1-255>",
- "Define an administrative distancen"
- "OSPF Administrative distancen")
- {
- struct ospf *ospf = vty->index;
- ospf->distance_all = atoi (argv[0]);
- return CMD_SUCCESS;
- }
- DEFUN (no_ospf_distance,
- no_ospf_distance_cmd,
- "no distance <1-255>",
- NO_STR
- "Define an administrative distancen"
- "OSPF Administrative distancen")
- {
- struct ospf *ospf = vty->index;
- ospf->distance_all = 0;
- return CMD_SUCCESS;
- }
- DEFUN (no_ospf_distance_ospf,
- no_ospf_distance_ospf_cmd,
- "no distance ospf",
- NO_STR
- "Define an administrative distancen"
- "OSPF Administrative distancen"
- "OSPF Distancen")
- {
- struct ospf *ospf = vty->index;
- ospf->distance_intra = 0;
- ospf->distance_inter = 0;
- ospf->distance_external = 0;
- return CMD_SUCCESS;
- }
- DEFUN (ospf_distance_ospf_intra,
- ospf_distance_ospf_intra_cmd,
- "distance ospf intra-area <1-255>",
- "Define an administrative distancen"
- "OSPF Administrative distancen"
- "Intra-area routesn"
- "Distance for intra-area routesn")
- {
- struct ospf *ospf = vty->index;
- ospf->distance_intra = atoi (argv[0]);
- return CMD_SUCCESS;
- }
- DEFUN (ospf_distance_ospf_intra_inter,
- ospf_distance_ospf_intra_inter_cmd,
- "distance ospf intra-area <1-255> inter-area <1-255>",
- "Define an administrative distancen"
- "OSPF Administrative distancen"
- "Intra-area routesn"
- "Distance for intra-area routesn"
- "Inter-area routesn"
- "Distance for inter-area routesn")
- {
- struct ospf *ospf = vty->index;
- ospf->distance_intra = atoi (argv[0]);
- ospf->distance_inter = atoi (argv[1]);
- return CMD_SUCCESS;
- }
- DEFUN (ospf_distance_ospf_intra_external,
- ospf_distance_ospf_intra_external_cmd,
- "distance ospf intra-area <1-255> external <1-255>",
- "Define an administrative distancen"
- "OSPF Administrative distancen"
- "Intra-area routesn"
- "Distance for intra-area routesn"
- "External routesn"
- "Distance for external routesn")
- {
- struct ospf *ospf = vty->index;
- ospf->distance_intra = atoi (argv[0]);
- ospf->distance_external = atoi (argv[1]);
- return CMD_SUCCESS;
- }
- DEFUN (ospf_distance_ospf_intra_inter_external,
- ospf_distance_ospf_intra_inter_external_cmd,
- "distance ospf intra-area <1-255> inter-area <1-255> external <1-255>",
- "Define an administrative distancen"
- "OSPF Administrative distancen"
- "Intra-area routesn"
- "Distance for intra-area routesn"
- "Inter-area routesn"
- "Distance for inter-area routesn"
- "External routesn"
- "Distance for external routesn")
- {
- struct ospf *ospf = vty->index;
- ospf->distance_intra = atoi (argv[0]);
- ospf->distance_inter = atoi (argv[1]);
- ospf->distance_external = atoi (argv[2]);
- return CMD_SUCCESS;
- }
- DEFUN (ospf_distance_ospf_intra_external_inter,
- ospf_distance_ospf_intra_external_inter_cmd,
- "distance ospf intra-area <1-255> external <1-255> inter-area <1-255>",
- "Define an administrative distancen"
- "OSPF Administrative distancen"
- "Intra-area routesn"
- "Distance for intra-area routesn"
- "External routesn"
- "Distance for external routesn"
- "Inter-area routesn"
- "Distance for inter-area routesn")
- {
- struct ospf *ospf = vty->index;
- ospf->distance_intra = atoi (argv[0]);
- ospf->distance_external = atoi (argv[1]);
- ospf->distance_inter = atoi (argv[2]);
- return CMD_SUCCESS;
- }
- DEFUN (ospf_distance_ospf_inter,
- ospf_distance_ospf_inter_cmd,
- "distance ospf inter-area <1-255>",
- "Define an administrative distancen"
- "OSPF Administrative distancen"
- "Inter-area routesn"
- "Distance for inter-area routesn")
- {
- struct ospf *ospf = vty->index;
- ospf->distance_inter = atoi (argv[0]);
- return CMD_SUCCESS;
- }
- DEFUN (ospf_distance_ospf_inter_intra,
- ospf_distance_ospf_inter_intra_cmd,
- "distance ospf inter-area <1-255> intra-area <1-255>",
- "Define an administrative distancen"
- "OSPF Administrative distancen"
- "Inter-area routesn"
- "Distance for inter-area routesn"
- "Intra-area routesn"
- "Distance for intra-area routesn")
- {
- struct ospf *ospf = vty->index;
- ospf->distance_inter = atoi (argv[0]);
- ospf->distance_intra = atoi (argv[1]);
- return CMD_SUCCESS;
- }
- DEFUN (ospf_distance_ospf_inter_external,
- ospf_distance_ospf_inter_external_cmd,
- "distance ospf inter-area <1-255> external <1-255>",
- "Define an administrative distancen"
- "OSPF Administrative distancen"
- "Inter-area routesn"
- "Distance for inter-area routesn"
- "External routesn"
- "Distance for external routesn")
- {
- struct ospf *ospf = vty->index;
- ospf->distance_inter = atoi (argv[0]);
- ospf->distance_external = atoi (argv[1]);
- return CMD_SUCCESS;
- }
- DEFUN (ospf_distance_ospf_inter_intra_external,
- ospf_distance_ospf_inter_intra_external_cmd,
- "distance ospf inter-area <1-255> intra-area <1-255> external <1-255>",
- "Define an administrative distancen"
- "OSPF Administrative distancen"
- "Inter-area routesn"
- "Distance for inter-area routesn"
- "Intra-area routesn"
- "Distance for intra-area routesn"
- "External routesn"
- "Distance for external routesn")
- {
- struct ospf *ospf = vty->index;
- ospf->distance_inter = atoi (argv[0]);
- ospf->distance_intra = atoi (argv[1]);
- ospf->distance_external = atoi (argv[2]);
- return CMD_SUCCESS;
- }
- DEFUN (ospf_distance_ospf_inter_external_intra,
- ospf_distance_ospf_inter_external_intra_cmd,
- "distance ospf inter-area <1-255> external <1-255> intra-area <1-255>",
- "Define an administrative distancen"
- "OSPF Administrative distancen"
- "Inter-area routesn"
- "Distance for inter-area routesn"
- "External routesn"
- "Distance for external routesn"
- "Intra-area routesn"
- "Distance for intra-area routesn")
- {
- struct ospf *ospf = vty->index;
- ospf->distance_inter = atoi (argv[0]);
- ospf->distance_external = atoi (argv[1]);
- ospf->distance_intra = atoi (argv[2]);
- return CMD_SUCCESS;
- }
- DEFUN (ospf_distance_ospf_external,
- ospf_distance_ospf_external_cmd,
- "distance ospf external <1-255>",
- "Define an administrative distancen"
- "OSPF Administrative distancen"
- "External routesn"
- "Distance for external routesn")
- {
- struct ospf *ospf = vty->index;
- ospf->distance_external = atoi (argv[0]);
- return CMD_SUCCESS;
- }
- DEFUN (ospf_distance_ospf_external_intra,
- ospf_distance_ospf_external_intra_cmd,
- "distance ospf external <1-255> intra-area <1-255>",
- "Define an administrative distancen"
- "OSPF Administrative distancen"
- "External routesn"
- "Distance for external routesn"
- "Intra-area routesn"
- "Distance for intra-area routesn")
- {
- struct ospf *ospf = vty->index;
- ospf->distance_external = atoi (argv[0]);
- ospf->distance_intra = atoi (argv[1]);
- return CMD_SUCCESS;
- }
- DEFUN (ospf_distance_ospf_external_inter,
- ospf_distance_ospf_external_inter_cmd,
- "distance ospf external <1-255> inter-area <1-255>",
- "Define an administrative distancen"
- "OSPF Administrative distancen"
- "External routesn"
- "Distance for external routesn"
- "Inter-area routesn"
- "Distance for inter-area routesn")
- {
- struct ospf *ospf = vty->index;
- ospf->distance_external = atoi (argv[0]);
- ospf->distance_inter = atoi (argv[1]);
- return CMD_SUCCESS;
- }
- DEFUN (ospf_distance_ospf_external_intra_inter,
- ospf_distance_ospf_external_intra_inter_cmd,
- "distance ospf external <1-255> intra-area <1-255> inter-area <1-255>",
- "Define an administrative distancen"
- "OSPF Administrative distancen"
- "External routesn"
- "Distance for external routesn"
- "Intra-area routesn"
- "Distance for intra-area routesn"
- "Inter-area routesn"
- "Distance for inter-area routesn")
- {
- struct ospf *ospf = vty->index;
- ospf->distance_external = atoi (argv[0]);
- ospf->distance_intra = atoi (argv[1]);
- ospf->distance_inter = atoi (argv[2]);
- return CMD_SUCCESS;
- }
- DEFUN (ospf_distance_ospf_external_inter_intra,
- ospf_distance_ospf_external_inter_intra_cmd,
- "distance ospf external <1-255> inter-area <1-255> intra-area <1-255>",
- "Define an administrative distancen"
- "OSPF Administrative distancen"
- "External routesn"
- "Distance for external routesn"
- "Inter-area routesn"
- "Distance for inter-area routesn"
- "Intra-area routesn"
- "Distance for intra-area routesn")
- {
- struct ospf *ospf = vty->index;
- ospf->distance_external = atoi (argv[0]);
- ospf->distance_inter = atoi (argv[1]);
- ospf->distance_intra = atoi (argv[2]);
- return CMD_SUCCESS;
- }
- DEFUN (ospf_distance_source,
- ospf_distance_source_cmd,
- "distance <1-255> A.B.C.D/M",
- "Administrative distancen"
- "Distance valuen"
- "IP source prefixn")
- {
- struct ospf *ospf = vty->index;
- ospf_distance_set (vty, ospf, argv[0], argv[1], NULL);
- return CMD_SUCCESS;
- }
- DEFUN (no_ospf_distance_source,
- no_ospf_distance_source_cmd,
- "no distance <1-255> A.B.C.D/M",
- NO_STR
- "Administrative distancen"
- "Distance valuen"
- "IP source prefixn")
- {
- struct ospf *ospf = vty->index;
- ospf_distance_unset (vty, ospf, argv[0], argv[1], NULL);
- return CMD_SUCCESS;
- }
- DEFUN (ospf_distance_source_access_list,
- ospf_distance_source_access_list_cmd,
- "distance <1-255> A.B.C.D/M WORD",
- "Administrative distancen"
- "Distance valuen"
- "IP source prefixn"
- "Access list namen")
- {
- struct ospf *ospf = vty->index;
- ospf_distance_set (vty, ospf, argv[0], argv[1], argv[2]);
- return CMD_SUCCESS;
- }
- DEFUN (no_ospf_distance_source_access_list,
- no_ospf_distance_source_access_list_cmd,
- "no distance <1-255> A.B.C.D/M WORD",
- NO_STR
- "Administrative distancen"
- "Distance valuen"
- "IP source prefixn"
- "Access list namen")
- {
- struct ospf *ospf = vty->index;
- ospf_distance_unset (vty, ospf, argv[0], argv[1], argv[2]);
- return CMD_SUCCESS;
- }
- void
- show_ip_ospf_route_network (struct vty *vty, struct route_table *rt)
- {
- struct route_node *rn;
- struct ospf_route *or;
- listnode pnode;
- struct ospf_path *path;
- vty_out (vty, "============ OSPF network routing table ============%s",
- VTY_NEWLINE);
- for (rn = route_top (rt); rn; rn = route_next (rn))
- if ((or = rn->info) != NULL)
- {
- char buf1[19];
- snprintf (buf1, 19, "%s/%d",
- inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen);
- switch (or->path_type)
- {
- case OSPF_PATH_INTER_AREA:
- if (or->type == OSPF_DESTINATION_NETWORK)
- vty_out (vty, "N IA %-18s [%d] area: %s%s", buf1, or->cost,
- inet_ntoa (or->u.std.area_id), VTY_NEWLINE);
- else if (or->type == OSPF_DESTINATION_DISCARD)
- vty_out (vty, "D IA %-18s Discard entry%s", buf1, VTY_NEWLINE);
- break;
- case OSPF_PATH_INTRA_AREA:
- vty_out (vty, "N %-18s [%d] area: %s%s", buf1, or->cost,
- inet_ntoa (or->u.std.area_id), VTY_NEWLINE);
- break;
- default:
- break;
- }
- if (or->type == OSPF_DESTINATION_NETWORK)
- for (pnode = listhead (or->path); pnode; nextnode (pnode))
- {
- path = getdata (pnode);
- if (path->oi != NULL)
- {
- if (path->nexthop.s_addr == 0)
- vty_out (vty, "%24s directly attached to %s%s",
- "", path->oi->ifp->name, VTY_NEWLINE);
- else
- vty_out (vty, "%24s via %s, %s%s", "",
- inet_ntoa (path->nexthop), path->oi->ifp->name,
- VTY_NEWLINE);
- }
- }
- }
- vty_out (vty, "%s", VTY_NEWLINE);
- }
- void
- show_ip_ospf_route_router (struct vty *vty, struct route_table *rtrs)
- {
- struct route_node *rn;
- struct ospf_route *or;
- listnode pn, nn;
- struct ospf_path *path;
- vty_out (vty, "============ OSPF router routing table =============%s",
- VTY_NEWLINE);
- for (rn = route_top (rtrs); rn; rn = route_next (rn))
- if (rn->info)
- {
- int flag = 0;
- vty_out (vty, "R %-15s ", inet_ntoa (rn->p.u.prefix4));
- for (nn = listhead ((list) rn->info); nn; nextnode (nn))
- if ((or = getdata (nn)) != NULL)
- {
- if (flag++)
- vty_out(vty," " );
- /* Show path. */
- vty_out (vty, "%s [%d] area: %s",
- (or->path_type == OSPF_PATH_INTER_AREA ? "IA" : " "),
- or->cost, inet_ntoa (or->u.std.area_id));
- /* Show flags. */
- vty_out (vty, "%s%s%s",
- (or->u.std.flags & ROUTER_LSA_BORDER ? ", ABR" : ""),
- (or->u.std.flags & ROUTER_LSA_EXTERNAL ? ", ASBR" : ""),
- VTY_NEWLINE);
- for (pn = listhead (or->path); pn; nextnode (pn))
- {
- path = getdata (pn);
- if (path->nexthop.s_addr == 0)
- vty_out (vty, "%24s directly attached to %s%s",
- "", path->oi->ifp->name, VTY_NEWLINE);
- else
- vty_out (vty, "%24s via %s, %s%s", "",
- inet_ntoa (path->nexthop), path->oi->ifp->name,
- VTY_NEWLINE);
- }
- }
- }
- vty_out (vty, "%s", VTY_NEWLINE);
- }
- void
- show_ip_ospf_route_external (struct vty *vty, struct route_table *rt)
- {
- struct route_node *rn;
- struct ospf_route *er;
- listnode pnode;
- struct ospf_path *path;
- vty_out (vty, "============ OSPF external routing table ===========%s",
- VTY_NEWLINE);
- for (rn = route_top (rt); rn; rn = route_next (rn))
- if ((er = rn->info) != NULL)
- {
- char buf1[19];
- snprintf (buf1, 19, "%s/%d",
- inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen);
- switch (er->path_type)
- {
- case OSPF_PATH_TYPE1_EXTERNAL:
- vty_out (vty, "N E1 %-18s [%d] tag: %u%s", buf1,
- er->cost, er->u.ext.tag, VTY_NEWLINE);
- break;
- case OSPF_PATH_TYPE2_EXTERNAL:
- vty_out (vty, "N E2 %-18s [%d/%d] tag: %u%s", buf1, er->cost,
- er->u.ext.type2_cost, er->u.ext.tag, VTY_NEWLINE);
- break;
- }
- for (pnode = listhead (er->path); pnode; nextnode (pnode))
- {
- path = getdata (pnode);
- if (path->oi != NULL)
- {
- if (path->nexthop.s_addr == 0)
- vty_out (vty, "%24s directly attached to %s%s",
- "", path->oi->ifp->name, VTY_NEWLINE);
- else
- vty_out (vty, "%24s via %s, %s%s", "",
- inet_ntoa (path->nexthop), path->oi->ifp->name,
- VTY_NEWLINE);
- }
- }
- }
- vty_out (vty, "%s", VTY_NEWLINE);
- }
- #ifdef HAVE_NSSA
- DEFUN (show_ip_ospf_border_routers,
- show_ip_ospf_border_routers_cmd,
- "show ip ospf border-routers",
- SHOW_STR
- IP_STR
- "show all the ABR's and ASBR'sn"
- "for this arean")
- {
- struct ospf *ospf;
- ospf = ospf_lookup ();
- if (ospf == NULL)
- {
- vty_out (vty, "OSPF is not enabled%s", VTY_NEWLINE);
- return CMD_SUCCESS;
- }
- if (ospf->new_table == NULL)
- {
- vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE);
- return CMD_SUCCESS;
- }
- /* Show Network routes.
- show_ip_ospf_route_network (vty, ospf->new_table); */
- /* Show Router routes. */
- show_ip_ospf_route_router (vty, ospf->new_rtrs);
- return CMD_SUCCESS;
- }
- #endif /* HAVE_NSSA */
- DEFUN (show_ip_ospf_route,
- show_ip_ospf_route_cmd,
- "show ip ospf route",
- SHOW_STR
- IP_STR
- "OSPF informationn"
- "OSPF routing tablen")
- {
- struct ospf *ospf;
- ospf = ospf_lookup ();
- if (ospf == NULL)
- {
- vty_out (vty, "OSPF is not enabled%s", VTY_NEWLINE);
- return CMD_SUCCESS;
- }
- if (ospf->new_table == NULL)
- {
- vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE);
- return CMD_SUCCESS;
- }
- /* Show Network routes. */
- show_ip_ospf_route_network (vty, ospf->new_table);
- /* Show Router routes. */
- show_ip_ospf_route_router (vty, ospf->new_rtrs);
- /* Show AS External routes. */
- show_ip_ospf_route_external (vty, ospf->old_external_route);
- return CMD_SUCCESS;
- }
- char *ospf_abr_type_str[] =
- {
- "unknown",
- "standard",
- "ibm",
- "cisco",
- "shortcut"
- };
- char *ospf_shortcut_mode_str[] =
- {
- "default",
- "enable",
- "disable"
- };
- void
- area_id2str (char *buf, int length, struct ospf_area *area)
- {
- memset (buf, 0, length);
- if (area->format == OSPF_AREA_ID_FORMAT_ADDRESS)
- strncpy (buf, inet_ntoa (area->area_id), length);
- else
- sprintf (buf, "%lu", (unsigned long) ntohl (area->area_id.s_addr));
- }
- char *ospf_int_type_str[] =
- {
- "unknown", /* should never be used. */
- "point-to-point",
- "broadcast",
- "non-broadcast",
- "point-to-multipoint",
- "virtual-link", /* should never be used. */
- "loopback"
- };
- /* Configuration write function for ospfd. */
- int
- config_write_interface (struct vty *vty)
- {
- listnode n1, n2;
- struct interface *ifp;
- struct crypt_key *ck;
- int write = 0;
- struct route_node *rn = NULL;
- struct ospf_if_params *params;
- for (n1 = listhead (iflist); n1; nextnode (n1))
- {
- ifp = getdata (n1);
- if (memcmp (ifp->name, "VLINK", 5) == 0)
- continue;
- vty_out (vty, "!%s", VTY_NEWLINE);
- vty_out (vty, "interface %s%s", ifp->name,
- VTY_NEWLINE);
- if (ifp->desc)
- vty_out (vty, " description %s%s", ifp->desc,
- VTY_NEWLINE);
- write++;
- params = IF_DEF_PARAMS (ifp);
-
- do {
- /* Interface Network print. */
- if (OSPF_IF_PARAM_CONFIGURED (params, type) &&
- params->type != OSPF_IFTYPE_BROADCAST &&
- params->type != OSPF_IFTYPE_LOOPBACK)
- {
- vty_out (vty, " ip ospf network %s",
- ospf_int_type_str[params->type]);
- if (params != IF_DEF_PARAMS (ifp))
- vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
- vty_out (vty, "%s", VTY_NEWLINE);
- }
-
- /* OSPF interface authentication print */
- if (OSPF_IF_PARAM_CONFIGURED (params, auth_type) &&
- params->auth_type != OSPF_AUTH_NOTSET)
- {
- char *auth_str;
-
- /* Translation tables are not that much help here due to syntax
- of the simple option */
- switch (params->auth_type)
- {
-
- case OSPF_AUTH_NULL:
- auth_str = " null";
- break;
-
- case OSPF_AUTH_SIMPLE:
- auth_str = "";
- break;
-
- case OSPF_AUTH_CRYPTOGRAPHIC:
- auth_str = " message-digest";
- break;
-
- default:
- auth_str = "";
- break;
- }
-
- vty_out (vty, " ip ospf authentication%s", auth_str);
- if (params != IF_DEF_PARAMS (ifp))
- vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
- vty_out (vty, "%s", VTY_NEWLINE);
- }
- /* Simple Authentication Password print. */
- if (OSPF_IF_PARAM_CONFIGURED (params, auth_simple) &&
- params->auth_simple[0] != ' ')
- {
- vty_out (vty, " ip ospf authentication-key %s",
- params->auth_simple);
- if (params != IF_DEF_PARAMS (ifp))
- vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
- vty_out (vty, "%s", VTY_NEWLINE);
- }
-
- /* Cryptographic Authentication Key print. */
- for (n2 = listhead (params->auth_crypt); n2; nextnode (n2))
- {
- ck = getdata (n2);
- vty_out (vty, " ip ospf message-digest-key %d md5 %s",
- ck->key_id, ck->auth_key);
- if (params != IF_DEF_PARAMS (ifp))
- vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
- vty_out (vty, "%s", VTY_NEWLINE);
- }
-
- /* Interface Output Cost print. */
- if (OSPF_IF_PARAM_CONFIGURED (params, output_cost_cmd))
- {
- vty_out (vty, " ip ospf cost %u", params->output_cost_cmd);
- if (params != IF_DEF_PARAMS (ifp))
- vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
- vty_out (vty, "%s", VTY_NEWLINE);
- }
-
- /* Hello Interval print. */
- if (OSPF_IF_PARAM_CONFIGURED (params, v_hello) &&
- params->v_hello != OSPF_HELLO_INTERVAL_DEFAULT)
- {
- vty_out (vty, " ip ospf hello-interval %u", params->v_hello);
- if (params != IF_DEF_PARAMS (ifp))
- vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
- vty_out (vty, "%s", VTY_NEWLINE);
- }
-
-
- /* Router Dead Interval print. */
- if (OSPF_IF_PARAM_CONFIGURED (params, v_wait) &&
- params->v_wait != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT)
- {
- vty_out (vty, " ip ospf dead-interval %u", params->v_wait);
- if (params != IF_DEF_PARAMS (ifp))
- vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
- vty_out (vty, "%s", VTY_NEWLINE);
- }
-
- /* Router Priority print. */
- if (OSPF_IF_PARAM_CONFIGURED (params, priority) &&
- params->priority != OSPF_ROUTER_PRIORITY_DEFAULT)
- {
- vty_out (vty, " ip ospf priority %u", params->priority);
- if (params != IF_DEF_PARAMS (ifp))
- vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
- vty_out (vty, "%s", VTY_NEWLINE);
- }
-
- /* Retransmit Interval print. */
- if (OSPF_IF_PARAM_CONFIGURED (params, retransmit_interval) &&
- params->retransmit_interval != OSPF_RETRANSMIT_INTERVAL_DEFAULT)
- {
- vty_out (vty, " ip ospf retransmit-interval %u",
- params->retransmit_interval);
- if (params != IF_DEF_PARAMS (ifp))
- vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
- vty_out (vty, "%s", VTY_NEWLINE);
- }
-
- /* Transmit Delay print. */
- if (OSPF_IF_PARAM_CONFIGURED (params, transmit_delay) &&
- params->transmit_delay != OSPF_TRANSMIT_DELAY_DEFAULT)
- {
- vty_out (vty, " ip ospf transmit-delay %u", params->transmit_delay);
- if (params != IF_DEF_PARAMS (ifp))
- vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
- vty_out (vty, "%s", VTY_NEWLINE);
- }
- while (1)
- {
- if (rn == NULL)
- rn = route_top (IF_OIFS_PARAMS (ifp));
- else
- rn = route_next (rn);
- if (rn == NULL)
- break;
- params = rn->info;
- if (params != NULL)
- break;
- }
- } while (rn);
-
- #ifdef HAVE_OPAQUE_LSA
- ospf_opaque_config_write_if (vty, ifp);
- #endif /* HAVE_OPAQUE_LSA */
- }
- return write;
- }
- int
- config_write_network_area (struct vty *vty, struct ospf *ospf)
- {
- struct route_node *rn;
- u_char buf[INET_ADDRSTRLEN];
- /* `network area' print. */
- for (rn = route_top (ospf->networks); rn; rn = route_next (rn))
- if (rn->info)
- {
- struct ospf_network *n = rn->info;
- memset (buf, 0, INET_ADDRSTRLEN);
- /* Create Area ID string by specified Area ID format. */
- if (n->format == OSPF_AREA_ID_FORMAT_ADDRESS)
- strncpy (buf, inet_ntoa (n->area_id), INET_ADDRSTRLEN);
- else
- sprintf (buf, "%lu",
- (unsigned long int) ntohl (n->area_id.s_addr));
- /* Network print. */
- vty_out (vty, " network %s/%d area %s%s",
- inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen,
- buf, VTY_NEWLINE);
- }
- return 0;
- }
- int
- config_write_ospf_area (struct vty *vty, struct ospf *ospf)
- {
- listnode node;
- u_char buf[INET_ADDRSTRLEN];
- /* Area configuration print. */
- for (node = listhead (ospf->areas); node; nextnode (node))
- {
- struct ospf_area *area = getdata (node);
- struct route_node *rn1;
- area_id2str (buf, INET_ADDRSTRLEN, area);
- if (area->auth_type != OSPF_AUTH_NULL)
- {
- if (area->auth_type == OSPF_AUTH_SIMPLE)
- vty_out (vty, " area %s authentication%s", buf, VTY_NEWLINE);
- else
- vty_out (vty, " area %s authentication message-digest%s",
- buf, VTY_NEWLINE);
- }
- if (area->shortcut_configured != OSPF_SHORTCUT_DEFAULT)
- vty_out (vty, " area %s shortcut %s%s", buf,
- ospf_shortcut_mode_str[area->shortcut_configured],
- VTY_NEWLINE);
- if ((area->external_routing == OSPF_AREA_STUB)
- #ifdef HAVE_NSSA
- || (area->external_routing == OSPF_AREA_NSSA)
- #endif /* HAVE_NSSA */
- )
- {
- #ifdef HAVE_NSSA
- if (area->external_routing == OSPF_AREA_NSSA)
- vty_out (vty, " area %s nssa", buf);
- else
- #endif /* HAVE_NSSA */
- vty_out (vty, " area %s stub", buf);
- if (area->no_summary)
- vty_out (vty, " no-summary");
- vty_out (vty, "%s", VTY_NEWLINE);
- if (area->default_cost != 1)
- vty_out (vty, " area %s default-cost %d%s", buf,
- area->default_cost, VTY_NEWLINE);
- }
- for (rn1 = route_top (area->ranges); rn1; rn1 = route_next (rn1))
- if (rn1->info)
- {
- struct ospf_area_range *range = rn1->info;
- vty_out (vty, " area %s range %s/%d", buf,
- inet_ntoa (rn1->p.u.prefix4), rn1->p.prefixlen);
- if (range->cost_config != -1)
- vty_out (vty, " cost %d", range->cost_config);
- if (!CHECK_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE))
- vty_out (vty, " not-advertise");
- if (CHECK_FLAG (range->flags, OSPF_AREA_RANGE_SUBSTITUTE))
- vty_out (vty, " substitute %s/%d",
- inet_ntoa (range->subst_addr), range->subst_masklen);
- vty_out (vty, "%s", VTY_NEWLINE);
- }
- if (EXPORT_NAME (area))
- vty_out (vty, " area %s export-list %s%s", buf,
- EXPORT_NAME (area), VTY_NEWLINE);
- if (IMPORT_NAME (area))
- vty_out (vty, " area %s import-list %s%s", buf,
- IMPORT_NAME (area), VTY_NEWLINE);
- if (PREFIX_NAME_IN (area))
- vty_out (vty, " area %s filter-list prefix %s in%s", buf,
- PREFIX_NAME_IN (area), VTY_NEWLINE);
- if (PREFIX_NAME_OUT (area))
- vty_out (vty, " area %s filter-list prefix %s out%s", buf,
- PREFIX_NAME_OUT (area), VTY_NEWLINE);
- }
- return 0;
- }
- int
- config_write_ospf_nbr_nbma (struct vty *vty, struct ospf *ospf)
- {
- struct ospf_nbr_nbma *nbr_nbma;
- struct route_node *rn;
- /* Static Neighbor configuration print. */
- for (rn = route_top (ospf->nbr_nbma); rn; rn = route_next (rn))
- if ((nbr_nbma = rn->info))
- {
- vty_out (vty, " neighbor %s", inet_ntoa (nbr_nbma->addr));
- if (nbr_nbma->priority != OSPF_NEIGHBOR_PRIORITY_DEFAULT)
- vty_out (vty, " priority %d", nbr_nbma->priority);
- if (nbr_nbma->v_poll != OSPF_POLL_INTERVAL_DEFAULT)
- vty_out (vty, " poll-interval %d", nbr_nbma->v_poll);
- vty_out (vty, "%s", VTY_NEWLINE);
- }
- return 0;
- }
- int
- config_write_virtual_link (struct vty *vty, struct ospf *ospf)
- {
- listnode node;
- u_char buf[INET_ADDRSTRLEN];
- /* Virtual-Link print */
- for (node = listhead (ospf->vlinks); node; nextnode (node))
- {
- listnode n2;
- struct crypt_key *ck;
- struct ospf_vl_data *vl_data = getdata (node);
- struct ospf_interface *oi;
- if (vl_data != NULL)
- {
- memset (buf, 0, INET_ADDRSTRLEN);
-
- if (vl_data->format == OSPF_AREA_ID_FORMAT_ADDRESS)
- strncpy (buf, inet_ntoa (vl_data->vl_area_id), INET_ADDRSTRLEN);
- else
- sprintf (buf, "%lu",
- (unsigned long int) ntohl (vl_data->vl_area_id.s_addr));
- oi = vl_data->vl_oi;
- /* timers */
- if (OSPF_IF_PARAM (oi, v_hello) != OSPF_HELLO_INTERVAL_DEFAULT ||
- OSPF_IF_PARAM (oi, v_wait) != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT ||
- OSPF_IF_PARAM (oi, retransmit_interval) != OSPF_RETRANSMIT_INTERVAL_DEFAULT ||
- OSPF_IF_PARAM (oi, transmit_delay) != OSPF_TRANSMIT_DELAY_DEFAULT)
- vty_out (vty, " area %s virtual-link %s hello-interval %d retransmit-interval %d transmit-delay %d dead-interval %d%s",
- buf,
- inet_ntoa (vl_data->vl_peer),
- OSPF_IF_PARAM (oi, v_hello),
- OSPF_IF_PARAM (oi, retransmit_interval),
- OSPF_IF_PARAM (oi, transmit_delay),
- OSPF_IF_PARAM (oi, v_wait),
- VTY_NEWLINE);
- else
- vty_out (vty, " area %s virtual-link %s%s", buf,
- inet_ntoa (vl_data->vl_peer), VTY_NEWLINE);
- /* Auth key */
- if (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple[0] != ' ')
- vty_out (vty, " area %s virtual-link %s authentication-key %s%s",
- buf,
- inet_ntoa (vl_data->vl_peer),
- IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple,
- VTY_NEWLINE);
- /* md5 keys */
- for (n2 = listhead (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_crypt); n2; nextnode (n2))
- {
- ck = getdata (n2);
- vty_out (vty, " area %s virtual-link %s message-digest-key %d md5 %s%s",
- buf,
- inet_ntoa (vl_data->vl_peer),
- ck->key_id, ck->auth_key, VTY_NEWLINE);
- }
-
- }
- }
- return 0;
- }
- char *distribute_str[] = { "system", "kernel", "connected", "static", "rip",
- "ripng", "ospf", "ospf6", "bgp"};
- int
- config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf)
- {
- int type;
- /* redistribute print. */
- for (type = 0; type < ZEBRA_ROUTE_MAX; type++)
- if (type != zclient->redist_default && zclient->redist[type])
- {
- vty_out (vty, " redistribute %s", distribute_str[type]);
- if (ospf->dmetric[type].value >= 0)
- vty_out (vty, " metric %d", ospf->dmetric[type].value);
-
- if (ospf->dmetric[type].type == EXTERNAL_METRIC_TYPE_1)
- vty_out (vty, " metric-type 1");
- if (ROUTEMAP_NAME (ospf, type))
- vty_out (vty, " route-map %s", ROUTEMAP_NAME (ospf, type));
-
- vty_out (vty, "%s", VTY_NEWLINE);
- }
- return 0;
- }
- int
- config_write_ospf_default_metric (struct vty *vty, struct ospf *ospf)
- {
- if (ospf->default_metric != -1)
- vty_out (vty, " default-metric %d%s", ospf->default_metric,
- VTY_NEWLINE);
- return 0;
- }
- int
- config_write_ospf_distribute (struct vty *vty, struct ospf *ospf)
- {
- int type;
- if (ospf)
- {
- /* distribute-list print. */
- for (type = 0; type < ZEBRA_ROUTE_MAX; type++)
- if (ospf->dlist[type].name)
- vty_out (vty, " distribute-list %s out %s%s",
- ospf->dlist[type].name,
- distribute_str[type], VTY_NEWLINE);
- /* default-information print. */
- if (ospf->default_originate != DEFAULT_ORIGINATE_NONE)
- {
- if (ospf->default_originate == DEFAULT_ORIGINATE_ZEBRA)
- vty_out (vty, " default-information originate");
- else
- vty_out (vty, " default-information originate always");
- if (ospf->dmetric[DEFAULT_ROUTE].value >= 0)
- vty_out (vty, " metric %d",
- ospf->dmetric[DEFAULT_ROUTE].value);
- if (ospf->dmetric[DEFAULT_ROUTE].type == EXTERNAL_METRIC_TYPE_1)
- vty_out (vty, " metric-type 1");
- if (ROUTEMAP_NAME (ospf, DEFAULT_ROUTE))
- vty_out (vty, " route-map %s",
- ROUTEMAP_NAME (ospf, DEFAULT_ROUTE));
-
- vty_out (vty, "%s", VTY_NEWLINE);
- }
- }
- return 0;
- }
- int
- config_write_ospf_distance (struct vty *vty, struct ospf *ospf)
- {
- struct route_node *rn;
- struct ospf_distance *odistance;
- if (ospf->distance_all)
- vty_out (vty, " distance %d%s", ospf->distance_all, VTY_NEWLINE);
- if (ospf->distance_intra
- || ospf->distance_inter
- || ospf->distance_external)
- {
- vty_out (vty, " distance ospf");
- if (ospf->distance_intra)
- vty_out (vty, " intra-area %d", ospf->distance_intra);
- if (ospf->distance_inter)
- vty_out (vty, " inter-area %d", ospf->distance_inter);
- if (ospf->distance_external)
- vty_out (vty, " external %d", ospf->distance_external);
- vty_out (vty, "%s", VTY_NEWLINE);
- }
-
- for (rn = route_top (ospf->distance_table); rn; rn = route_next (rn))
- if ((odistance = rn->info) != NULL)
- {
- vty_out (vty, " distance %d %s/%d %s%s", odistance->distance,
- inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen,
- odistance->access_list ? odistance->access_list : "",
- VTY_NEWLINE);
- }
- return 0;
- }
- /* OSPF configuration write function. */
- int
- ospf_config_write (struct vty *vty)
- {
- struct ospf *ospf;
- listnode node;
- int write = 0;
- ospf = ospf_lookup ();
- if (ospf != NULL)
- {
- /* `router ospf' print. */
- vty_out (vty, "router ospf%s", VTY_NEWLINE);
- write++;
- if (!ospf->networks)
- return write;
- /* Router ID print. */
- if (ospf->router_id_static.s_addr != 0)
- vty_out (vty, " ospf router-id %s%s",
- inet_ntoa (ospf->router_id_static), VTY_NEWLINE);
- /* ABR type print. */
- if (ospf->abr_type != OSPF_ABR_STAND)
- vty_out (vty, " ospf abr-type %s%s",
- ospf_abr_type_str[ospf->abr_type], VTY_NEWLINE);
- /* RFC1583 compatibility flag print -- Compatible with CISCO 12.1. */
- if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE))
- vty_out (vty, " compatible rfc1583%s", VTY_NEWLINE);
- /* auto-cost reference-bandwidth configuration. */
- if (ospf->ref_bandwidth != OSPF_DEFAULT_REF_BANDWIDTH)
- vty_out (vty, " auto-cost reference-bandwidth %d%s",
- ospf->ref_bandwidth / 1000, VTY_NEWLINE);
- /* SPF timers print. */
- if (ospf->spf_delay != OSPF_SPF_DELAY_DEFAULT ||
- ospf->spf_holdtime != OSPF_SPF_HOLDTIME_DEFAULT)
- vty_out (vty, " timers spf %d %d%s",
- ospf->spf_delay, ospf->spf_holdtime, VTY_NEWLINE);
- /* SPF refresh parameters print. */
- if (ospf->lsa_refresh_interval != OSPF_LSA_REFRESH_INTERVAL_DEFAULT)
- vty_out (vty, " refresh timer %d%s",
- ospf->lsa_refresh_interval, VTY_NEWLINE);
- /* Redistribute information print. */
- config_write_ospf_redistribute (vty, ospf);
- /* passive-interface print. */
- for (node = listhead (om->iflist); node; nextnode (node))
- {
- struct interface *ifp = getdata (node);
- if (!ifp)
- continue;
- if (IF_DEF_PARAMS (ifp)->passive_interface == OSPF_IF_PASSIVE)
- vty_out (vty, " passive-interface %s%s",
- ifp->name, VTY_NEWLINE);
- }
- for (node = listhead (ospf->oiflist); node; nextnode (node))
- {
- struct ospf_interface *oi = getdata (node);
- if (OSPF_IF_PARAM_CONFIGURED (oi->params, passive_interface) &&
- oi->params->passive_interface == OSPF_IF_PASSIVE)
- vty_out (vty, " passive-interface %s%s",
- inet_ntoa (oi->address->u.prefix4), VTY_NEWLINE);
- }
-
- /* Network area print. */
- config_write_network_area (vty, ospf);
- /* Area config print. */
- config_write_ospf_area (vty, ospf);
- /* static neighbor print. */
- config_write_ospf_nbr_nbma (vty, ospf);
- /* Virtual-Link print. */
- config_write_virtual_link (vty, ospf);
- /* Default metric configuration. */
- config_write_ospf_default_metric (vty, ospf);
- /* Distribute-list and default-information print. */
- config_write_ospf_distribute (vty, ospf);
- /* Distance configuration. */
- config_write_ospf_distance (vty, ospf);
- #ifdef HAVE_OPAQUE_LSA
- ospf_opaque_config_write_router (vty, ospf);
- #endif /* HAVE_OPAQUE_LSA */
- }
- return write;
- }
- void
- ospf_vty_show_init ()
- {
- /* "show ip ospf" commands. */
- install_element (VIEW_NODE, &show_ip_ospf_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_cmd);
- /* "show ip ospf database" commands. */
- install_element (VIEW_NODE, &show_ip_ospf_database_type_cmd);
- install_element (VIEW_NODE, &show_ip_ospf_database_type_id_cmd);
- install_element (VIEW_NODE, &show_ip_ospf_database_type_id_adv_router_cmd);
- install_element (VIEW_NODE, &show_ip_ospf_database_type_adv_router_cmd);
- install_element (VIEW_NODE, &show_ip_ospf_database_type_id_self_cmd);
- install_element (VIEW_NODE, &show_ip_ospf_database_type_self_cmd);
- install_element (VIEW_NODE, &show_ip_ospf_database_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_database_type_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_adv_router_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_database_type_adv_router_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_self_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_database_type_self_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_database_cmd);
- /* "show ip ospf interface" commands. */
- install_element (VIEW_NODE, &show_ip_ospf_interface_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_interface_cmd);
- /* "show ip ospf neighbor" commands. */
- install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_detail_cmd);
- install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_cmd);
- install_element (VIEW_NODE, &show_ip_ospf_neighbor_id_cmd);
- install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_all_cmd);
- install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_cmd);
- install_element (VIEW_NODE, &show_ip_ospf_neighbor_cmd);
- install_element (VIEW_NODE, &show_ip_ospf_neighbor_all_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_detail_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_neighbor_id_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_all_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_neighbor_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_neighbor_all_cmd);
- /* "show ip ospf route" commands. */
- install_element (VIEW_NODE, &show_ip_ospf_route_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_route_cmd);
- #ifdef HAVE_NSSA
- install_element (VIEW_NODE, &show_ip_ospf_border_routers_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_border_routers_cmd);
- #endif /* HAVE_NSSA */
- }
- /* ospfd's interface node. */
- struct cmd_node interface_node =
- {
- INTERFACE_NODE,
- "%s(config-if)# ",
- 1
- };
- /* Initialization of OSPF interface. */
- void
- ospf_vty_if_init ()
- {
- /* Install interface node. */
- install_node (&interface_node, config_write_interface);
- install_element (CONFIG_NODE, &interface_cmd);
- install_default (INTERFACE_NODE);
- /* "description" commands. */
- install_element (INTERFACE_NODE, &interface_desc_cmd);
- install_element (INTERFACE_NODE, &no_interface_desc_cmd);
- /* "ip ospf authentication" commands. */
- install_element (INTERFACE_NODE, &ip_ospf_authentication_args_addr_cmd);
- install_element (INTERFACE_NODE, &ip_ospf_authentication_args_cmd);
- install_element (INTERFACE_NODE, &ip_ospf_authentication_addr_cmd);
- install_element (INTERFACE_NODE, &ip_ospf_authentication_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_authentication_addr_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_authentication_cmd);
- install_element (INTERFACE_NODE, &ip_ospf_authentication_key_addr_cmd);
- install_element (INTERFACE_NODE, &ip_ospf_authentication_key_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_addr_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_cmd);
- /* "ip ospf message-digest-key" commands. */
- install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_addr_cmd);
- install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_addr_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_cmd);
- /* "ip ospf cost" commands. */
- install_element (INTERFACE_NODE, &ip_ospf_cost_addr_cmd);
- install_element (INTERFACE_NODE, &ip_ospf_cost_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_cost_addr_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_cost_cmd);
- /* "ip ospf dead-interval" commands. */
- install_element (INTERFACE_NODE, &ip_ospf_dead_interval_addr_cmd);
- install_element (INTERFACE_NODE, &ip_ospf_dead_interval_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_addr_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_cmd);
- /* "ip ospf hello-interval" commands. */
- install_element (INTERFACE_NODE, &ip_ospf_hello_interval_addr_cmd);
- install_element (INTERFACE_NODE, &ip_ospf_hello_interval_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_addr_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_cmd);
- /* "ip ospf network" commands. */
- install_element (INTERFACE_NODE, &ip_ospf_network_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_network_cmd);
- /* "ip ospf priority" commands. */
- install_element (INTERFACE_NODE, &ip_ospf_priority_addr_cmd);
- install_element (INTERFACE_NODE, &ip_ospf_priority_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_priority_addr_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_priority_cmd);
- /* "ip ospf retransmit-interval" commands. */
- install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_addr_cmd);
- install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_addr_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_cmd);
- /* "ip ospf transmit-delay" commands. */
- install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_addr_cmd);
- install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_addr_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_cmd);
- /* These commands are compatibitliy for previous version. */
- install_element (INTERFACE_NODE, &ospf_authentication_key_cmd);
- install_element (INTERFACE_NODE, &no_ospf_authentication_key_cmd);
- install_element (INTERFACE_NODE, &ospf_message_digest_key_cmd);
- install_element (INTERFACE_NODE, &no_ospf_message_digest_key_cmd);
- install_element (INTERFACE_NODE, &ospf_cost_cmd);
- install_element (INTERFACE_NODE, &no_ospf_cost_cmd);
- install_element (INTERFACE_NODE, &ospf_dead_interval_cmd);
- install_element (INTERFACE_NODE, &no_ospf_dead_interval_cmd);
- install_element (INTERFACE_NODE, &ospf_hello_interval_cmd);
- install_element (INTERFACE_NODE, &no_ospf_hello_interval_cmd);
- install_element (INTERFACE_NODE, &ospf_network_cmd);
- install_element (INTERFACE_NODE, &no_ospf_network_cmd);
- install_element (INTERFACE_NODE, &ospf_priority_cmd);
- install_element (INTERFACE_NODE, &no_ospf_priority_cmd);
- install_element (INTERFACE_NODE, &ospf_retransmit_interval_cmd);
- install_element (INTERFACE_NODE, &no_ospf_retransmit_interval_cmd);
- install_element (INTERFACE_NODE, &ospf_transmit_delay_cmd);
- install_element (INTERFACE_NODE, &no_ospf_transmit_delay_cmd);
- }
- /* Zebra node structure. */
- struct cmd_node zebra_node =
- {
- ZEBRA_NODE,
- "%s(config-router)#",
- };
- void
- ospf_vty_zebra_init ()
- {
- install_element (OSPF_NODE, &ospf_redistribute_source_type_metric_cmd);
- install_element (OSPF_NODE, &ospf_redistribute_source_metric_type_cmd);
- install_element (OSPF_NODE, &ospf_redistribute_source_type_cmd);
- install_element (OSPF_NODE, &ospf_redistribute_source_metric_cmd);
- install_element (OSPF_NODE, &ospf_redistribute_source_cmd);
- install_element (OSPF_NODE,
- &ospf_redistribute_source_metric_type_routemap_cmd);
- install_element (OSPF_NODE,
- &ospf_redistribute_source_type_metric_routemap_cmd);
- install_element (OSPF_NODE, &ospf_redistribute_source_metric_routemap_cmd);
- install_element (OSPF_NODE, &ospf_redistribute_source_type_routemap_cmd);
- install_element (OSPF_NODE, &ospf_redistribute_source_routemap_cmd);
-
- install_element (OSPF_NODE, &no_ospf_redistribute_source_cmd);
- install_element (OSPF_NODE, &ospf_distribute_list_out_cmd);
- install_element (OSPF_NODE, &no_ospf_distribute_list_out_cmd);
- install_element (OSPF_NODE,
- &ospf_default_information_originate_metric_type_cmd);
- install_element (OSPF_NODE, &ospf_default_information_originate_metric_cmd);
- install_element (OSPF_NODE,
- &ospf_default_information_originate_type_metric_cmd);
- install_element (OSPF_NODE, &ospf_default_information_originate_type_cmd);
- install_element (OSPF_NODE, &ospf_default_information_originate_cmd);
- install_element (OSPF_NODE,
- &ospf_default_information_originate_always_metric_type_cmd);
- install_element (OSPF_NODE,
- &ospf_default_information_originate_always_metric_cmd);
- install_element (OSPF_NODE,
- &ospf_default_information_originate_always_cmd);
- install_element (OSPF_NODE,
- &ospf_default_information_originate_always_type_metric_cmd);
- install_element (OSPF_NODE,
- &ospf_default_information_originate_always_type_cmd);
- install_element (OSPF_NODE,
- &ospf_default_information_originate_metric_type_routemap_cmd);
- install_element (OSPF_NODE,
- &ospf_default_information_originate_metric_routemap_cmd);
- install_element (OSPF_NODE,
- &ospf_default_information_originate_routemap_cmd);
- install_element (OSPF_NODE,
- &ospf_default_information_originate_type_metric_routemap_cmd);
- install_element (OSPF_NODE,
- &ospf_default_information_originate_type_routemap_cmd);
- install_element (OSPF_NODE,
- &ospf_default_information_originate_always_metric_type_routemap_cmd);
- install_element (OSPF_NODE,
- &ospf_default_information_originate_always_metric_routemap_cmd);
- install_element (OSPF_NODE,
- &ospf_default_information_originate_always_routemap_cmd);
- install_element (OSPF_NODE,
- &ospf_default_information_originate_always_type_metric_routemap_cmd);
- install_element (OSPF_NODE,
- &ospf_default_information_originate_always_type_routemap_cmd);
- install_element (OSPF_NODE, &no_ospf_default_information_originate_cmd);
- install_element (OSPF_NODE, &ospf_default_metric_cmd);
- install_element (OSPF_NODE, &no_ospf_default_metric_cmd);
- install_element (OSPF_NODE, &no_ospf_default_metric_val_cmd);
- install_element (OSPF_NODE, &ospf_distance_cmd);
- install_element (OSPF_NODE, &no_ospf_distance_cmd);
- install_element (OSPF_NODE, &no_ospf_distance_ospf_cmd);
- install_element (OSPF_NODE, &ospf_distance_ospf_intra_cmd);
- install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_cmd);
- install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_cmd);
- install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_external_cmd);
- install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_inter_cmd);
- install_element (OSPF_NODE, &ospf_distance_ospf_inter_cmd);
- install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_cmd);
- install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_cmd);
- install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_external_cmd);
- install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_intra_cmd);
- install_element (OSPF_NODE, &ospf_distance_ospf_external_cmd);
- install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_cmd);
- install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_cmd);
- install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_inter_cmd);
- install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_intra_cmd);
- install_element (OSPF_NODE, &ospf_distance_source_cmd);
- install_element (OSPF_NODE, &no_ospf_distance_source_cmd);
- install_element (OSPF_NODE, &ospf_distance_source_access_list_cmd);
- install_element (OSPF_NODE, &no_ospf_distance_source_access_list_cmd);
- }
- struct cmd_node ospf_node =
- {
- OSPF_NODE,
- "%s(config-router)# ",
- 1
- };
- /* Install OSPF related vty commands. */
- void
- ospf_vty_init ()
- {
- /* Install ospf top node. */
- install_node (&ospf_node, ospf_config_write);
- /* "router ospf" commands. */
- install_element (CONFIG_NODE, &router_ospf_cmd);
- install_element (CONFIG_NODE, &no_router_ospf_cmd);
- install_default (OSPF_NODE);
- /* "ospf router-id" commands. */
- install_element (OSPF_NODE, &ospf_router_id_cmd);
- install_element (OSPF_NODE, &no_ospf_router_id_cmd);
- install_element (OSPF_NODE, &router_ospf_id_cmd);
- install_element (OSPF_NODE, &no_router_ospf_id_cmd);
- /* "passive-interface" commands. */
- install_element (OSPF_NODE, &ospf_passive_interface_addr_cmd);
- install_element (OSPF_NODE, &ospf_passive_interface_cmd);
- install_element (OSPF_NODE, &no_ospf_passive_interface_addr_cmd);
- install_element (OSPF_NODE, &no_ospf_passive_interface_cmd);
- /* "ospf abr-type" commands. */
- install_element (OSPF_NODE, &ospf_abr_type_cmd);
- install_element (OSPF_NODE, &no_ospf_abr_type_cmd);
- /* "ospf rfc1583-compatible" commands. */
- install_element (OSPF_NODE, &ospf_rfc1583_flag_cmd);
- install_element (OSPF_NODE, &no_ospf_rfc1583_flag_cmd);
- install_element (OSPF_NODE, &ospf_compatible_rfc1583_cmd);
- install_element (OSPF_NODE, &no_ospf_compatible_rfc1583_cmd);
- /* "network area" commands. */
- install_element (OSPF_NODE, &ospf_network_area_cmd);
- install_element (OSPF_NODE, &no_ospf_network_area_cmd);
- /* "area authentication" commands. */
- install_element (OSPF_NODE, &ospf_area_authentication_message_digest_cmd);
- install_element (OSPF_NODE, &ospf_area_authentication_cmd);
- install_element (OSPF_NODE, &no_ospf_area_authentication_cmd);
- /* "area range" commands. */
- install_element (OSPF_NODE, &ospf_area_range_cmd);
- install_element (OSPF_NODE, &ospf_area_range_advertise_cmd);
- install_element (OSPF_NODE, &ospf_area_range_cost_cmd);
- install_element (OSPF_NODE, &ospf_area_range_advertise_cost_cmd);
- install_element (OSPF_NODE, &ospf_area_range_not_advertise_cmd);
- install_element (OSPF_NODE, &no_ospf_area_range_cmd);
- install_element (OSPF_NODE, &no_ospf_area_range_advertise_cmd);
- install_element (OSPF_NODE, &no_ospf_area_range_cost_cmd);
- install_element (OSPF_NODE, &no_ospf_area_range_advertise_cost_cmd);
- install_element (OSPF_NODE, &ospf_area_range_substitute_cmd);
- install_element (OSPF_NODE, &no_ospf_area_range_substitute_cmd);
- /* "area virtual-link" commands. */
- install_element (OSPF_NODE, &ospf_area_vlink_cmd);
- install_element (OSPF_NODE, &no_ospf_area_vlink_cmd);
- install_element (OSPF_NODE, &ospf_area_vlink_param1_cmd);
- install_element (OSPF_NODE, &no_ospf_area_vlink_param1_cmd);
- install_element (OSPF_NODE, &ospf_area_vlink_param2_cmd);
- install_element (OSPF_NODE, &no_ospf_area_vlink_param2_cmd);
- install_element (OSPF_NODE, &ospf_area_vlink_param3_cmd);
- install_element (OSPF_NODE, &no_ospf_area_vlink_param3_cmd);
- install_element (OSPF_NODE, &ospf_area_vlink_param4_cmd);
- install_element (OSPF_NODE, &no_ospf_area_vlink_param4_cmd);
- install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_cmd);
- install_element (OSPF_NODE, &ospf_area_vlink_authtype_cmd);
- install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_cmd);
- install_element (OSPF_NODE, &ospf_area_vlink_md5_cmd);
- install_element (OSPF_NODE, &no_ospf_area_vlink_md5_cmd);
- install_element (OSPF_NODE, &ospf_area_vlink_authkey_cmd);
- install_element (OSPF_NODE, &no_ospf_area_vlink_authkey_cmd);
- install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_authkey_cmd);
- install_element (OSPF_NODE, &ospf_area_vlink_authtype_authkey_cmd);
- install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_authkey_cmd);
- install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_md5_cmd);
- install_element (OSPF_NODE, &ospf_area_vlink_authtype_md5_cmd);
- install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_md5_cmd);
- /* "area stub" commands. */
- install_element (OSPF_NODE, &ospf_area_stub_no_summary_cmd);
- install_element (OSPF_NODE, &ospf_area_stub_cmd);
- install_element (OSPF_NODE, &no_ospf_area_stub_no_summary_cmd);
- install_element (OSPF_NODE, &no_ospf_area_stub_cmd);
- #ifdef HAVE_NSSA
- /* "area nssa" commands. */
- install_element (OSPF_NODE, &ospf_area_nssa_cmd);
- install_element (OSPF_NODE, &ospf_area_nssa_translate_no_summary_cmd);
- install_element (OSPF_NODE, &ospf_area_nssa_translate_cmd);
- install_element (OSPF_NODE, &ospf_area_nssa_no_summary_cmd);
- install_element (OSPF_NODE, &no_ospf_area_nssa_cmd);
- install_element (OSPF_NODE, &no_ospf_area_nssa_no_summary_cmd);
- #endif /* HAVE_NSSA */
- install_element (OSPF_NODE, &ospf_area_default_cost_cmd);
- install_element (OSPF_NODE, &no_ospf_area_default_cost_cmd);
- install_element (OSPF_NODE, &ospf_area_shortcut_cmd);
- install_element (OSPF_NODE, &no_ospf_area_shortcut_cmd);
- install_element (OSPF_NODE, &ospf_area_export_list_cmd);
- install_element (OSPF_NODE, &no_ospf_area_export_list_cmd);
- install_element (OSPF_NODE, &ospf_area_filter_list_cmd);
- install_element (OSPF_NODE, &no_ospf_area_filter_list_cmd);
- install_element (OSPF_NODE, &ospf_area_import_list_cmd);
- install_element (OSPF_NODE, &no_ospf_area_import_list_cmd);
- install_element (OSPF_NODE, &ospf_timers_spf_cmd);
- install_element (OSPF_NODE, &no_ospf_timers_spf_cmd);
- install_element (OSPF_NODE, &ospf_refresh_timer_cmd);
- install_element (OSPF_NODE, &no_ospf_refresh_timer_val_cmd);
- install_element (OSPF_NODE, &no_ospf_refresh_timer_cmd);
-
- install_element (OSPF_NODE, &ospf_auto_cost_reference_bandwidth_cmd);
- install_element (OSPF_NODE, &no_ospf_auto_cost_reference_bandwidth_cmd);
- /* "neighbor" commands. */
- install_element (OSPF_NODE, &ospf_neighbor_cmd);
- install_element (OSPF_NODE, &ospf_neighbor_priority_poll_interval_cmd);
- install_element (OSPF_NODE, &ospf_neighbor_priority_cmd);
- install_element (OSPF_NODE, &ospf_neighbor_poll_interval_cmd);
- install_element (OSPF_NODE, &ospf_neighbor_poll_interval_priority_cmd);
- install_element (OSPF_NODE, &no_ospf_neighbor_cmd);
- install_element (OSPF_NODE, &no_ospf_neighbor_priority_cmd);
- install_element (OSPF_NODE, &no_ospf_neighbor_poll_interval_cmd);
- /* Init interface related vty commands. */
- ospf_vty_if_init ();
- /* Init zebra related vty commands. */
- ospf_vty_zebra_init ();
- }