⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bgp_vty.c

📁 linux 路由软件 可支持RIP OSPF BGP等
💻 C
📖 第 1 页 / 共 5 页
字号:
  int ret;  struct bgp *bgp;  struct in_addr cluster;  bgp = vty->index;  if (argc == 1)    {      ret = inet_aton (argv[0], &cluster);      if (! ret)	{	  vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);	  return CMD_WARNING;	}    }  bgp_cluster_id_unset (bgp);  return CMD_SUCCESS;}ALIAS (no_bgp_cluster_id,       no_bgp_cluster_id_arg_cmd,       "no bgp cluster-id A.B.C.D",       NO_STR       BGP_STR       "Configure Route-Reflector Cluster-id\n"       "Route-Reflector Cluster-id in IP address format\n");DEFUN (bgp_confederation_identifier,       bgp_confederation_identifier_cmd,       "bgp confederation identifier <1-65535>",       "BGP specific commands\n"       "AS confederation parameters\n"       "AS number\n"       "Set routing domain confederation AS\n"){  struct bgp *bgp;  as_t as;  bgp = vty->index;  VTY_GET_INTEGER ("AS", as, argv[0]);  bgp_confederation_id_set (bgp, as);  return CMD_SUCCESS;}DEFUN (no_bgp_confederation_identifier,       no_bgp_confederation_identifier_cmd,       "no bgp confederation identifier",       NO_STR       "BGP specific commands\n"       "AS confederation parameters\n"       "AS number\n"){  struct bgp *bgp;  as_t as;  bgp = vty->index;  if (argc == 1)    VTY_GET_INTEGER ("AS", as, argv[0]);  bgp_confederation_id_unset (bgp);  return CMD_SUCCESS;}ALIAS (no_bgp_confederation_identifier,       no_bgp_confederation_identifier_arg_cmd,       "no bgp confederation identifier <1-65535>",       NO_STR       "BGP specific commands\n"       "AS confederation parameters\n"       "AS number\n"       "Set routing domain confederation AS\n");DEFUN (bgp_confederation_peers,       bgp_confederation_peers_cmd,       "bgp confederation peers .<1-65535>",       "BGP specific commands\n"       "AS confederation parameters\n"       "Peer ASs in BGP confederation\n"       AS_STR){  struct bgp *bgp;  as_t as;  int i;  bgp = vty->index;  for (i = 0; i < argc; i++)    {      VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, 65535);      if (bgp->as == as)	{	  vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",		   VTY_NEWLINE);	  continue;	}      bgp_confederation_peers_add (bgp, as);    }  return CMD_SUCCESS;}DEFUN (no_bgp_confederation_peers,       no_bgp_confederation_peers_cmd,       "no bgp confederation peers .<1-65535>",       NO_STR       "BGP specific commands\n"       "AS confederation parameters\n"       "Peer ASs in BGP confederation\n"       AS_STR){  struct bgp *bgp;  as_t as;  int i;  bgp = vty->index;  for (i = 0; i < argc; i++)    {      VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, 65535);            bgp_confederation_peers_remove (bgp, as);    }  return CMD_SUCCESS;}/* BGP timers.  */DEFUN (bgp_timers,       bgp_timers_cmd,       "timers bgp <0-65535> <0-65535>",       "Adjust routing timers\n"       "BGP timers\n"       "Keepalive interval\n"       "Holdtime\n"){  struct bgp *bgp;  unsigned long keepalive = 0;  unsigned long holdtime = 0;  bgp = vty->index;  VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);  VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);  /* Holdtime value check. */  if (holdtime < 3 && holdtime != 0)    {      vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",	       VTY_NEWLINE);      return CMD_WARNING;    }  bgp_timers_set (bgp, keepalive, holdtime);  return CMD_SUCCESS;}DEFUN (no_bgp_timers,       no_bgp_timers_cmd,       "no timers bgp",       NO_STR       "Adjust routing timers\n"       "BGP timers\n"){  struct bgp *bgp;  bgp = vty->index;  bgp_timers_unset (bgp);  return CMD_SUCCESS;}ALIAS (no_bgp_timers,       no_bgp_timers_arg_cmd,       "no timers bgp <0-65535> <0-65535>",       NO_STR       "Adjust routing timers\n"       "BGP timers\n"       "Keepalive interval\n"       "Holdtime\n");DEFUN (bgp_client_to_client_reflection,       bgp_client_to_client_reflection_cmd,       "bgp client-to-client reflection",       "BGP specific commands\n"       "Configure client to client route reflection\n"       "reflection of routes allowed\n"){  struct bgp *bgp;  bgp = vty->index;  bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);  return CMD_SUCCESS;}DEFUN (no_bgp_client_to_client_reflection,       no_bgp_client_to_client_reflection_cmd,       "no bgp client-to-client reflection",       NO_STR       "BGP specific commands\n"       "Configure client to client route reflection\n"       "reflection of routes allowed\n"){  struct bgp *bgp;  bgp = vty->index;  bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);  return CMD_SUCCESS;}/* "bgp always-compare-med" configuration. */DEFUN (bgp_always_compare_med,       bgp_always_compare_med_cmd,       "bgp always-compare-med",       "BGP specific commands\n"       "Allow comparing MED from different neighbors\n"){  struct bgp *bgp;  bgp = vty->index;  bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);  return CMD_SUCCESS;}DEFUN (no_bgp_always_compare_med,       no_bgp_always_compare_med_cmd,       "no bgp always-compare-med",       NO_STR       "BGP specific commands\n"       "Allow comparing MED from different neighbors\n"){  struct bgp *bgp;  bgp = vty->index;  bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);  return CMD_SUCCESS;}/* "bgp deterministic-med" configuration. */DEFUN (bgp_deterministic_med,       bgp_deterministic_med_cmd,       "bgp deterministic-med",       "BGP specific commands\n"       "Pick the best-MED path among paths advertised from the neighboring AS\n"){  struct bgp *bgp;  bgp = vty->index;  bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);  return CMD_SUCCESS;}DEFUN (no_bgp_deterministic_med,       no_bgp_deterministic_med_cmd,       "no bgp deterministic-med",       NO_STR       "BGP specific commands\n"       "Pick the best-MED path among paths advertised from the neighboring AS\n"){  struct bgp *bgp;  bgp = vty->index;  bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);  return CMD_SUCCESS;}/* "bgp graceful-restart" configuration. */DEFUN (bgp_graceful_restart,       bgp_graceful_restart_cmd,       "bgp graceful-restart",       "BGP specific commands\n"       "Graceful restart capability parameters\n"){  struct bgp *bgp;  bgp = vty->index;  bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);  return CMD_SUCCESS;}DEFUN (no_bgp_graceful_restart,       no_bgp_graceful_restart_cmd,       "no bgp graceful-restart",       NO_STR       "BGP specific commands\n"       "Graceful restart capability parameters\n"){  struct bgp *bgp;  bgp = vty->index;  bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);  return CMD_SUCCESS;}DEFUN (bgp_graceful_restart_stalepath_time,       bgp_graceful_restart_stalepath_time_cmd,       "bgp graceful-restart stalepath-time <1-3600>",       "BGP specific commands\n"       "Graceful restart capability parameters\n"       "Set the max time to hold onto restarting peer's stale paths\n"       "Delay value (seconds)\n"){  struct bgp *bgp;  u_int32_t stalepath;  bgp = vty->index;  if (! bgp)    return CMD_WARNING;  VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);  bgp->stalepath_time = stalepath;   return CMD_SUCCESS;}DEFUN (no_bgp_graceful_restart_stalepath_time,       no_bgp_graceful_restart_stalepath_time_cmd,       "no bgp graceful-restart stalepath-time",       NO_STR       "BGP specific commands\n"       "Graceful restart capability parameters\n"       "Set the max time to hold onto restarting peer's stale paths\n"){  struct bgp *bgp;  bgp = vty->index;  if (! bgp)    return CMD_WARNING;  bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;   return CMD_SUCCESS;}ALIAS (no_bgp_graceful_restart_stalepath_time,       no_bgp_graceful_restart_stalepath_time_val_cmd,       "no bgp graceful-restart stalepath-time <1-3600>",       NO_STR       "BGP specific commands\n"       "Graceful restart capability parameters\n"       "Set the max time to hold onto restarting peer's stale paths\n"       "Delay value (seconds)\n")/* "bgp fast-external-failover" configuration. */DEFUN (bgp_fast_external_failover,       bgp_fast_external_failover_cmd,       "bgp fast-external-failover",       BGP_STR       "Immediately reset session if a link to a directly connected external peer goes down\n"){  struct bgp *bgp;  bgp = vty->index;  bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);  return CMD_SUCCESS;}DEFUN (no_bgp_fast_external_failover,       no_bgp_fast_external_failover_cmd,       "no bgp fast-external-failover",       NO_STR       BGP_STR       "Immediately reset session if a link to a directly connected external peer goes down\n"){  struct bgp *bgp;  bgp = vty->index;  bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);  return CMD_SUCCESS;}/* "bgp enforce-first-as" configuration. */DEFUN (bgp_enforce_first_as,       bgp_enforce_first_as_cmd,       "bgp enforce-first-as",       BGP_STR       "Enforce the first AS for EBGP routes(default)\n"){  struct bgp *bgp;  bgp = vty->index;  bgp_flag_unset (bgp, BGP_FLAG_NO_ENFORCE_FIRST_AS);  return CMD_SUCCESS;}DEFUN (no_bgp_enforce_first_as,       no_bgp_enforce_first_as_cmd,       "no bgp enforce-first-as",       NO_STR       BGP_STR       "Enforce the first AS for EBGP routes(default)\n"){  struct bgp *bgp;  bgp = vty->index;  bgp_flag_set (bgp, BGP_FLAG_NO_ENFORCE_FIRST_AS);  return CMD_SUCCESS;}/* "bgp bestpath compare-routerid" configuration.  */DEFUN (bgp_bestpath_compare_router_id,       bgp_bestpath_compare_router_id_cmd,       "bgp bestpath compare-routerid",       "BGP specific commands\n"       "Change the default bestpath selection\n"       "Compare router-id for identical EBGP paths\n"){  struct bgp *bgp;  bgp = vty->index;  bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);  return CMD_SUCCESS;}DEFUN (no_bgp_bestpath_compare_router_id,       no_bgp_bestpath_compare_router_id_cmd,       "no bgp bestpath compare-routerid",       NO_STR       "BGP specific commands\n"       "Change the default bestpath selection\n"       "Compare router-id for identical EBGP paths\n"){  struct bgp *bgp;  bgp = vty->index;  bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);  return CMD_SUCCESS;}/* "bgp bestpath cost-community ignore" configuration.  */DEFUN (bgp_bestpath_cost_community_ignore,       bgp_bestpath_cost_community_ignore_cmd,       "bgp bestpath cost-community ignore",       "BGP specific commands\n"       "Change the default bestpath selection\n"       "cost community\n"       "Ignore cost communities in bestpath selection\n"){  struct bgp *bgp;  bgp = vty->index;  bgp_flag_set (bgp, BGP_FLAG_COST_COMMUNITY_IGNORE);  return CMD_SUCCESS;}DEFUN (no_bgp_bestpath_cost_community_ignore,       no_bgp_bestpath_cost_community_ignore_cmd,       "no bgp bestpath cost-community ignore",       NO_STR       "BGP specific commands\n"       "Change the default bestpath selection\n"       "cost community\n"       "Ignore cost communities in bestpath selection\n"){  struct bgp *bgp;  bgp = vty->index;  bgp_flag_unset (bgp, BGP_FLAG_COST_COMMUNITY_IGNORE);  return CMD_SUCCESS;}/* "bgp bestpath as-path ignore" configuration.  */DEFUN (bgp_bestpath_aspath_ignore,       bgp_bestpath_aspath_ignore_cmd,       "bgp bestpath as-path ignore",       "BGP specific commands\n"       "Change the default bestpath selection\n"       "AS-path attribute\n"       "Ignore as-path length in selecting a route\n"){  struct bgp *bgp;  bgp = vty->index;  bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);  return CMD_SUCCESS;}DEFUN (no_bgp_bestpath_aspath_ignore,       no_bgp_bestpath_aspath_ignore_cmd,       "no bgp bestpath as-path ignore",       NO_STR       "BGP specific commands\n"       "Change the default bestpath selection\n"       "AS-path attribute\n"       "Ignore as-path length in selecting a route\n"){  struct bgp *bgp;  bgp = vty->index;  bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);  return CMD_SUCCESS;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -