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

📄 bgp_vty.c

📁 大名鼎鼎的路由器源码。程序分ZEBRA、OSPFRIP等3个包。程序框架采用一个路由协议一个进程的方式
💻 C
📖 第 1 页 / 共 5 页
字号:
       NEIGHBOR_CMD2 "passive",       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Don't send open messages to this neighbor\n"){  return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);}DEFUN (no_neighbor_passive,       no_neighbor_passive_cmd,       NO_NEIGHBOR_CMD2 "passive",       NO_STR       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Don't send open messages to this neighbor\n"){  return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);}/* neighbor shutdown. */DEFUN (neighbor_shutdown,       neighbor_shutdown_cmd,       NEIGHBOR_CMD2 "shutdown",       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Administratively shut down this neighbor\n"){  return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);}DEFUN (no_neighbor_shutdown,       no_neighbor_shutdown_cmd,       NO_NEIGHBOR_CMD2 "shutdown",       NO_STR       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Administratively shut down this neighbor\n"){  return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);}/* neighbor capability route-refresh. */DEFUN (neighbor_capability_route_refresh,       neighbor_capability_route_refresh_cmd,       NEIGHBOR_CMD2 "capability route-refresh",       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Advertise capability to the peer\n"       "Advertise route-refresh capability to this neighbor\n"){  return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_NO_ROUTE_REFRESH_CAP);}DEFUN (no_neighbor_capability_route_refresh,       no_neighbor_capability_route_refresh_cmd,       NO_NEIGHBOR_CMD2 "capability route-refresh",       NO_STR       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Advertise capability to the peer\n"       "Advertise route-refresh capability to this neighbor\n"){  return peer_flag_set_vty (vty, argv[0], PEER_FLAG_NO_ROUTE_REFRESH_CAP);}/* neighbor capability dynamic. */DEFUN (neighbor_capability_dynamic,       neighbor_capability_dynamic_cmd,       NEIGHBOR_CMD2 "capability dynamic",       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Advertise capability to the peer\n"       "Advertise dynamic capability to this neighbor\n"){  return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);}DEFUN (no_neighbor_capability_dynamic,       no_neighbor_capability_dynamic_cmd,       NO_NEIGHBOR_CMD2 "capability dynamic",       NO_STR       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Advertise capability to the peer\n"       "Advertise dynamic capability to this neighbor\n"){  return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);}/* neighbor dont-capability-negotiate */DEFUN (neighbor_dont_capability_negotiate,       neighbor_dont_capability_negotiate_cmd,       NEIGHBOR_CMD2 "dont-capability-negotiate",       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Do not perform capability negotiation\n"){  return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);}DEFUN (no_neighbor_dont_capability_negotiate,       no_neighbor_dont_capability_negotiate_cmd,       NO_NEIGHBOR_CMD2 "dont-capability-negotiate",       NO_STR       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Do not perform capability negotiation\n"){  return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);}intpeer_af_flag_modify_vty (struct vty *vty, char *peer_str, afi_t afi,			 safi_t safi, u_int16_t flag, int set){  int ret;  struct peer *peer;  peer = peer_and_group_lookup_vty (vty, peer_str);  if (! peer)    return CMD_WARNING;  if (set)    ret = peer_af_flag_set (peer, afi, safi, flag);  else    ret = peer_af_flag_unset (peer, afi, safi, flag);  return bgp_vty_return (vty, ret);}intpeer_af_flag_set_vty (struct vty *vty, char *peer_str, afi_t afi,		      safi_t safi, u_int16_t flag){  return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);}intpeer_af_flag_unset_vty (struct vty *vty, char *peer_str, afi_t afi,			safi_t safi, u_int16_t flag){  return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);}/* neighbor capability orf prefix-list. */DEFUN (neighbor_capability_orf_prefix,       neighbor_capability_orf_prefix_cmd,       NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Advertise capability to the peer\n"       "Advertise ORF capability to the peer\n"       "Advertise prefixlist ORF capability to this neighbor\n"       "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"       "Capability to RECEIVE the ORF from this neighbor\n"       "Capability to SEND the ORF to this neighbor\n"){  u_int16_t flag = 0;  if (strncmp (argv[1], "s", 1) == 0)    flag = PEER_FLAG_ORF_PREFIX_SM;  else if (strncmp (argv[1], "r", 1) == 0)    flag = PEER_FLAG_ORF_PREFIX_RM;  else if (strncmp (argv[1], "b", 1) == 0)    flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;  else    return CMD_WARNING;  return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),			       bgp_node_safi (vty), flag);}DEFUN (no_neighbor_capability_orf_prefix,       no_neighbor_capability_orf_prefix_cmd,       NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",       NO_STR       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Advertise capability to the peer\n"       "Advertise ORF capability to the peer\n"       "Advertise prefixlist ORF capability to this neighbor\n"       "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"       "Capability to RECEIVE the ORF from this neighbor\n"       "Capability to SEND the ORF to this neighbor\n"){  u_int16_t flag = 0;  if (strncmp (argv[1], "s", 1) == 0)    flag = PEER_FLAG_ORF_PREFIX_SM;  else if (strncmp (argv[1], "r", 1) == 0)    flag = PEER_FLAG_ORF_PREFIX_RM;  else if (strncmp (argv[1], "b", 1) == 0)    flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;  else    return CMD_WARNING;  return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),				 bgp_node_safi (vty), flag);}/* neighbor next-hop-self. */DEFUN (neighbor_nexthop_self,       neighbor_nexthop_self_cmd,       NEIGHBOR_CMD2 "next-hop-self",       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Disable the next hop calculation for this neighbor\n"){  return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),			       bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF);}DEFUN (no_neighbor_nexthop_self,       no_neighbor_nexthop_self_cmd,       NO_NEIGHBOR_CMD2 "next-hop-self",       NO_STR       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Disable the next hop calculation for this neighbor\n"){  return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),				 bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF);}/* neighbor remove-private-AS. */DEFUN (neighbor_remove_private_as,       neighbor_remove_private_as_cmd,       NEIGHBOR_CMD2 "remove-private-AS",       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Remove private AS number from outbound updates\n"){  return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),			       bgp_node_safi (vty),			       PEER_FLAG_REMOVE_PRIVATE_AS);}DEFUN (no_neighbor_remove_private_as,       no_neighbor_remove_private_as_cmd,       NO_NEIGHBOR_CMD2 "remove-private-AS",       NO_STR       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Remove private AS number from outbound updates\n"){  return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),				 bgp_node_safi (vty),				 PEER_FLAG_REMOVE_PRIVATE_AS);}/* neighbor send-community. */DEFUN (neighbor_send_community,       neighbor_send_community_cmd,       NEIGHBOR_CMD2 "send-community",       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Send Community attribute to this neighbor\n"){  return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),			       bgp_node_safi (vty),			       PEER_FLAG_SEND_COMMUNITY);}DEFUN (no_neighbor_send_community,       no_neighbor_send_community_cmd,       NO_NEIGHBOR_CMD2 "send-community",       NO_STR       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Send Community attribute to this neighbor\n"){  return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),				 bgp_node_safi (vty),				 PEER_FLAG_SEND_COMMUNITY);}/* neighbor send-community extended. */DEFUN (neighbor_send_community_type,       neighbor_send_community_type_cmd,       NEIGHBOR_CMD2 "send-community (both|extended|standard)",       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Send Community attribute to this neighbor\n"       "Send Standard and Extended Community attributes\n"       "Send Extended Community attributes\n"       "Send Standard Community attributes\n"){  if (strncmp (argv[1], "s", 1) == 0)    return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),				 bgp_node_safi (vty),				 PEER_FLAG_SEND_COMMUNITY);  if (strncmp (argv[1], "e", 1) == 0)    return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),				 bgp_node_safi (vty),				 PEER_FLAG_SEND_EXT_COMMUNITY);  return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),			       bgp_node_safi (vty),			       (PEER_FLAG_SEND_COMMUNITY|				PEER_FLAG_SEND_EXT_COMMUNITY));}DEFUN (no_neighbor_send_community_type,       no_neighbor_send_community_type_cmd,       NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",       NO_STR       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Send Community attribute to this neighbor\n"       "Send Standard and Extended Community attributes\n"       "Send Extended Community attributes\n"       "Send Standard Community attributes\n"){  if (strncmp (argv[1], "s", 1) == 0)    return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),				   bgp_node_safi (vty),				   PEER_FLAG_SEND_COMMUNITY);  if (strncmp (argv[1], "e", 1) == 0)    return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),				   bgp_node_safi (vty),				   PEER_FLAG_SEND_EXT_COMMUNITY);  return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),				 bgp_node_safi (vty),				 (PEER_FLAG_SEND_COMMUNITY |				  PEER_FLAG_SEND_EXT_COMMUNITY));}/* neighbor soft-reconfig. */DEFUN (neighbor_soft_reconfiguration,       neighbor_soft_reconfiguration_cmd,       NEIGHBOR_CMD2 "soft-reconfiguration inbound",       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Per neighbor soft reconfiguration\n"       "Allow inbound soft reconfiguration for this neighbor\n"){  return peer_af_flag_set_vty (vty, argv[0],			       bgp_node_afi (vty), bgp_node_safi (vty),			       PEER_FLAG_SOFT_RECONFIG);}DEFUN (no_neighbor_soft_reconfiguration,       no_neighbor_soft_reconfiguration_cmd,       NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",       NO_STR       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Per neighbor soft reconfiguration\n"       "Allow inbound soft reconfiguration for this neighbor\n"){  return peer_af_flag_unset_vty (vty, argv[0],				 bgp_node_afi (vty), bgp_node_safi (vty),				 PEER_FLAG_SOFT_RECONFIG);}DEFUN (neighbor_route_reflector_client,       neighbor_route_reflector_client_cmd,       NEIGHBOR_CMD2 "route-reflector-client",       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Configure a neighbor as Route Reflector client\n"){  struct peer *peer;  peer = peer_and_group_lookup_vty (vty, argv[0]);  if (! peer)    return CMD_WARNING;  return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),			       bgp_node_safi (vty),			       PEER_FLAG_REFLECTOR_CLIENT);}DEFUN (no_neighbor_route_reflector_client,       no_neighbor_route_reflector_client_cmd,       NO_NEIGHBOR_CMD2 "route-reflector-client",       NO_STR       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Configure a neighbor as Route Reflector client\n"){  return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),				 bgp_node_safi (vty),				 PEER_FLAG_REFLECTOR_CLIENT);}/* neighbor route-server-client. */DEFUN (neighbor_route_server_client,       neighbor_route_server_client_cmd,       NEIGHBOR_CMD2 "route-server-client",       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Configure a neighbor as Route Server client\n"){  return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),			       bgp_node_safi (vty),			       PEER_FLAG_RSERVER_CLIENT);}DEFUN (no_neighbor_route_server_client,       no_neighbor_route_server_client_cmd,       NO_NEIGHBOR_CMD2 "route-server-client",       NO_STR       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "Configure a neighbor as Route Server client\n"){  return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),				 bgp_node_safi (vty),				 PEER_FLAG_RSERVER_CLIENT);}DEFUN (neighbor_attr_unchanged,       neighbor_attr_unchanged_cmd,       NEIGHBOR_CMD2 "attribute-unchanged",       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "BGP attribute is propagated unchanged to this neighbor\n"){  return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),			       bgp_node_safi (vty),			       (PEER_FLAG_AS_PATH_UNCHANGED |				PEER_FLAG_NEXTHOP_UNCHANGED |				PEER_FLAG_MED_UNCHANGED));}DEFUN (neighbor_attr_unchanged1,       neighbor_attr_unchanged1_cmd,       NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "BGP attribute is propagated unchanged to this neighbor\n"       "As-path attribute\n"       "Nexthop attribute\n"       "Med attribute\n"){  u_int16_t flags = 0;  if (strncmp (argv[1], "as-path", 1) == 0)    SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);  else if (strncmp (argv[1], "next-hop", 1) == 0)    SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);  else if (strncmp (argv[1], "med", 1) == 0)    SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);  return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),			       bgp_node_safi (vty), flags);}DEFUN (neighbor_attr_unchanged2,       neighbor_attr_unchanged2_cmd,       NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "BGP attribute is propagated unchanged to this neighbor\n"       "As-path attribute\n"       "Nexthop attribute\n"       "Med attribute\n"){  u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;  if (strncmp (argv[1], "next-hop", 1) == 0)    SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);  else if (strncmp (argv[1], "med", 1) == 0)    SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);  return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),			       bgp_node_safi (vty), flags);}DEFUN (neighbor_attr_unchanged3,       neighbor_attr_unchanged3_cmd,       NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "BGP attribute is propagated unchanged to this neighbor\n"       "Nexthop attribute\n"       "As-path attribute\n"       "Med attribute\n"){  u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;  if (strncmp (argv[1], "as-path", 1) == 0)    SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);  else if (strncmp (argv[1], "med", 1) == 0)    SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);  return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),			       bgp_node_safi (vty), flags);}DEFUN (neighbor_attr_unchanged4,       neighbor_attr_unchanged4_cmd,       NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",       NEIGHBOR_STR       NEIGHBOR_ADDR_STR2       "BGP attribute is propagated unchanged to this neighbor\n"       "Med attribute\n"       "As-path attribute\n"       "Nexthop attribute\n")

⌨️ 快捷键说明

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