📄 ospf_vty.c
字号:
area->auth_type = OSPF_AUTH_CRYPTOGRAPHIC; return CMD_SUCCESS;}DEFUN (ospf_area_authentication, ospf_area_authentication_cmd, "area (A.B.C.D|<0-4294967295>) authentication", "OSPF area parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" "Enable authentication\n"){ struct ospf *ospf = vty->index; struct ospf_area *area; struct in_addr area_id; int format; VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); area = ospf_area_get (ospf, area_id, format); area->auth_type = OSPF_AUTH_SIMPLE; return CMD_SUCCESS;}DEFUN (no_ospf_area_authentication, no_ospf_area_authentication_cmd, "no area (A.B.C.D|<0-4294967295>) authentication", NO_STR "OSPF area parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" "Enable authentication\n"){ struct ospf *ospf = vty->index; struct ospf_area *area; struct in_addr area_id; int format; VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); area = ospf_area_lookup_by_area_id (ospf, area_id); if (area == NULL) return CMD_SUCCESS; area->auth_type = OSPF_AUTH_NULL; ospf_area_check_free (ospf, area_id); return CMD_SUCCESS;}DEFUN (ospf_abr_type, ospf_abr_type_cmd, "ospf abr-type (cisco|ibm|shortcut|standard)", "OSPF specific commands\n" "Set OSPF ABR type\n" "Alternative ABR, cisco implementation\n" "Alternative ABR, IBM implementation\n" "Shortcut ABR\n" "Standard behavior (RFC2328)\n"){ struct ospf *ospf = vty->index; u_char abr_type = OSPF_ABR_UNKNOWN; if (strncmp (argv[0], "c", 1) == 0) abr_type = OSPF_ABR_CISCO; else if (strncmp (argv[0], "i", 1) == 0) abr_type = OSPF_ABR_IBM; else if (strncmp (argv[0], "sh", 2) == 0) abr_type = OSPF_ABR_SHORTCUT; else if (strncmp (argv[0], "st", 2) == 0) abr_type = OSPF_ABR_STAND; else return CMD_WARNING; /* If ABR type value is changed, schedule ABR task. */ if (ospf->abr_type != abr_type) { ospf->abr_type = abr_type; ospf_schedule_abr_task (ospf); } return CMD_SUCCESS;}DEFUN (no_ospf_abr_type, no_ospf_abr_type_cmd, "no ospf abr-type (cisco|ibm|shortcut)", NO_STR "OSPF specific commands\n" "Set OSPF ABR type\n" "Alternative ABR, cisco implementation\n" "Alternative ABR, IBM implementation\n" "Shortcut ABR\n"){ struct ospf *ospf = vty->index; u_char abr_type = OSPF_ABR_UNKNOWN; if (strncmp (argv[0], "c", 1) == 0) abr_type = OSPF_ABR_CISCO; else if (strncmp (argv[0], "i", 1) == 0) abr_type = OSPF_ABR_IBM; else if (strncmp (argv[0], "s", 1) == 0) abr_type = OSPF_ABR_SHORTCUT; else return CMD_WARNING; /* If ABR type value is changed, schedule ABR task. */ if (ospf->abr_type == abr_type) { ospf->abr_type = OSPF_ABR_STAND; ospf_schedule_abr_task (ospf); } return CMD_SUCCESS;}DEFUN (ospf_compatible_rfc1583, ospf_compatible_rfc1583_cmd, "compatible rfc1583", "OSPF compatibility list\n" "compatible with RFC 1583\n"){ struct ospf *ospf = vty->index; if (!CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE)) { SET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE); ospf_spf_calculate_schedule (ospf); } return CMD_SUCCESS;}DEFUN (no_ospf_compatible_rfc1583, no_ospf_compatible_rfc1583_cmd, "no compatible rfc1583", NO_STR "OSPF compatibility list\n" "compatible with RFC 1583\n"){ struct ospf *ospf = vty->index; if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE)) { UNSET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE); ospf_spf_calculate_schedule (ospf); } return CMD_SUCCESS;}ALIAS (ospf_compatible_rfc1583, ospf_rfc1583_flag_cmd, "ospf rfc1583compatibility", "OSPF specific commands\n" "Enable the RFC1583Compatibility flag\n");ALIAS (no_ospf_compatible_rfc1583, no_ospf_rfc1583_flag_cmd, "no ospf rfc1583compatibility", NO_STR "OSPF specific commands\n" "Disable the RFC1583Compatibility flag\n");DEFUN (ospf_timers_spf, ospf_timers_spf_cmd, "timers spf <0-4294967295> <0-4294967295>", "Adjust routing timers\n" "OSPF SPF timers\n" "Delay between receiving a change to SPF calculation\n" "Hold time between consecutive SPF calculations\n"){ struct ospf *ospf = vty->index; u_int32_t delay, hold; VTY_GET_UINT32 ("SPF delay timer", delay, argv[0]); VTY_GET_UINT32 ("SPF hold timer", hold, argv[1]); ospf_timers_spf_set (ospf, delay, hold); return CMD_SUCCESS;}DEFUN (no_ospf_timers_spf, no_ospf_timers_spf_cmd, "no timers spf", NO_STR "Adjust routing timers\n" "OSPF SPF timers\n"){ struct ospf *ospf = vty->index; ospf->spf_delay = OSPF_SPF_DELAY_DEFAULT; ospf->spf_holdtime = OSPF_SPF_HOLDTIME_DEFAULT; return CMD_SUCCESS;}DEFUN (ospf_neighbor, ospf_neighbor_cmd, "neighbor A.B.C.D", NEIGHBOR_STR "Neighbor IP address\n"){ struct ospf *ospf = vty->index; struct in_addr nbr_addr; int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT; int interval = OSPF_POLL_INTERVAL_DEFAULT; VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); if (argc > 1) VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[1], 0, 255); if (argc > 2) VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[2], 1, 65535); ospf_nbr_nbma_set (ospf, nbr_addr); if (argc > 1) ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority); if (argc > 2) ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, priority); return CMD_SUCCESS;}ALIAS (ospf_neighbor, ospf_neighbor_priority_poll_interval_cmd, "neighbor A.B.C.D priority <0-255> poll-interval <1-65535>", NEIGHBOR_STR "Neighbor IP address\n" "Neighbor Priority\n" "Priority\n" "Dead Neighbor Polling interval\n" "Seconds\n");ALIAS (ospf_neighbor, ospf_neighbor_priority_cmd, "neighbor A.B.C.D priority <0-255>", NEIGHBOR_STR "Neighbor IP address\n" "Neighbor Priority\n" "Seconds\n");DEFUN (ospf_neighbor_poll_interval, ospf_neighbor_poll_interval_cmd, "neighbor A.B.C.D poll-interval <1-65535>", NEIGHBOR_STR "Neighbor IP address\n" "Dead Neighbor Polling interval\n" "Seconds\n"){ struct ospf *ospf = vty->index; struct in_addr nbr_addr; int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT; int interval = OSPF_POLL_INTERVAL_DEFAULT; VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); if (argc > 1) VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[1], 1, 65535); if (argc > 2) VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[2], 0, 255); ospf_nbr_nbma_set (ospf, nbr_addr); if (argc > 1) ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, interval); if (argc > 2) ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority); return CMD_SUCCESS;}ALIAS (ospf_neighbor_poll_interval, ospf_neighbor_poll_interval_priority_cmd, "neighbor A.B.C.D poll-interval <1-65535> priority <0-255>", NEIGHBOR_STR "Neighbor address\n" "OSPF dead-router polling interval\n" "Seconds\n" "OSPF priority of non-broadcast neighbor\n" "Priority\n");DEFUN (no_ospf_neighbor, no_ospf_neighbor_cmd, "no neighbor A.B.C.D", NO_STR NEIGHBOR_STR "Neighbor IP address\n"){ struct ospf *ospf = vty->index; struct in_addr nbr_addr; int ret; VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); ret = ospf_nbr_nbma_unset (ospf, nbr_addr); return CMD_SUCCESS;}ALIAS (no_ospf_neighbor, no_ospf_neighbor_priority_cmd, "no neighbor A.B.C.D priority <0-255>", NO_STR NEIGHBOR_STR "Neighbor IP address\n" "Neighbor Priority\n" "Priority\n");ALIAS (no_ospf_neighbor, no_ospf_neighbor_poll_interval_cmd, "no neighbor A.B.C.D poll-interval <1-65535>", NO_STR NEIGHBOR_STR "Neighbor IP address\n" "Dead Neighbor Polling interval\n" "Seconds\n");ALIAS (no_ospf_neighbor, no_ospf_neighbor_priority_pollinterval_cmd, "no neighbor A.B.C.D priority <0-255> poll-interval <1-65535>", NO_STR NEIGHBOR_STR "Neighbor IP address\n" "Neighbor Priority\n" "Priority\n" "Dead Neighbor Polling interval\n" "Seconds\n");DEFUN (ospf_refresh_timer, ospf_refresh_timer_cmd, "refresh timer <10-1800>", "Adjust refresh parameters\n" "Set refresh timer\n" "Timer value in seconds\n"){ struct ospf *ospf = vty->index; int interval; VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800); interval = (interval / 10) * 10; ospf_timers_refresh_set (ospf, interval); return CMD_SUCCESS;}DEFUN (no_ospf_refresh_timer, no_ospf_refresh_timer_val_cmd, "no refresh timer <10-1800>", "Adjust refresh parameters\n" "Unset refresh timer\n" "Timer value in seconds\n"){ struct ospf *ospf = vty->index; int interval; if (argc == 1) { VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800); if (ospf->lsa_refresh_interval != interval || interval == OSPF_LSA_REFRESH_INTERVAL_DEFAULT) return CMD_SUCCESS; } ospf_timers_refresh_unset (ospf); return CMD_SUCCESS;}ALIAS (no_ospf_refresh_timer, no_ospf_refresh_timer_cmd, "no refresh timer", "Adjust refresh parameters\n" "Unset refresh timer\n");DEFUN (ospf_auto_cost_reference_bandwidth, ospf_auto_cost_reference_bandwidth_cmd, "auto-cost reference-bandwidth <1-4294967>", "Calculate OSPF interface cost according to bandwidth\n" "Use reference bandwidth method to assign OSPF cost\n" "The reference bandwidth in terms of Mbits per second\n"){ struct ospf *ospf = vty->index; u_int32_t refbw; listnode node; refbw = strtol (argv[0], NULL, 10); if (refbw < 1 || refbw > 4294967) { vty_out (vty, "reference-bandwidth value is invalid%s", VTY_NEWLINE); return CMD_WARNING; } /* If reference bandwidth is changed. */ if ((refbw * 1000) == ospf->ref_bandwidth) return CMD_SUCCESS; ospf->ref_bandwidth = refbw * 1000; vty_out (vty, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE); vty_out (vty, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE); for (node = listhead (om->iflist); node; nextnode (node)) ospf_if_recalculate_output_cost (getdata (node)); return CMD_SUCCESS;}DEFUN (no_ospf_auto_cost_reference_bandwidth, no_ospf_auto_cost_reference_bandwidth_cmd, "no auto-cost reference-bandwidth", NO_STR "Calculate OSPF interface cost according to bandwidth\n" "Use reference bandwidth method to assign OSPF cost\n"){ struct ospf *ospf = vty->index; listnode node; if (ospf->ref_bandwidth == OSPF_DEFAULT_REF_BANDWIDTH) return CMD_SUCCESS; ospf->ref_bandwidth = OSPF_DEFAULT_REF_BANDWIDTH; vty_out (vty, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE); vty_out (vty, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE); for (node = listhead (om->iflist); node; nextnode (node)) ospf_if_recalculate_output_cost (getdata (node)); return CMD_SUCCESS;}char *ospf_abr_type_descr_str[] = { "Unknown", "Standard (RFC2328)", "Alternative IBM", "Alternative Cisco", "Alternative Shortcut" };char *ospf_shortcut_mode_descr_str[] = { "Default", "Enabled", "Disabled" };voidshow_ip_ospf_area (struct vty *vty, struct ospf_area *area){ /* Show Area ID. */ vty_out (vty, " Area ID: %s", inet_ntoa (area->area_id)); /* Show Area type/mode. */ if (OSPF_IS_AREA_BACKBONE (area)) vty_out (vty, " (Backbone)%s", VTY_NEWLINE); else { if (area->external_routing == OSPF_AREA_STUB) vty_out (vty, " (Stub%s%s)", area->no_summary ? ", no summary" : "", area->shortcut_configured ? "; " : "");#ifdef HAVE_NSSA else if (area->external_routing == OSPF
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -