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

📄 ospf6_top.c

📁 linux 路由软件 可支持RIP OSPF BGP等
💻 C
📖 第 1 页 / 共 2 页
字号:
      vty_out (vty, "%s already attached to Area %s%s",               oi->interface->name, oi->area->name, VNL);      return CMD_SUCCESS;    }  /* parse Area-ID */  if (inet_pton (AF_INET, argv[1], &area_id) != 1)    {      vty_out (vty, "Invalid Area-ID: %s%s", argv[1], VNL);      return CMD_SUCCESS;    }  /* find/create ospf6 area */  oa = ospf6_area_lookup (area_id, o);  if (oa == NULL)    oa = ospf6_area_create (area_id, o);  /* attach interface to area */  listnode_add (oa->if_list, oi); /* sort ?? */  oi->area = oa;  SET_FLAG (oa->flag, OSPF6_AREA_ENABLE);  /* start up */  thread_add_event (master, interface_up, oi, 0);  /* If the router is ABR, originate summary routes */  if (ospf6_is_router_abr (o))    ospf6_abr_enable_area (oa);  return CMD_SUCCESS;}DEFUN (no_ospf6_interface_area,       no_ospf6_interface_area_cmd,       "no interface IFNAME area A.B.C.D",       NO_STR       "Disable routing on an IPv6 interface\n"       IFNAME_STR       "Specify the OSPF6 area ID\n"       "OSPF6 area ID in IPv4 address notation\n"       ){  struct ospf6 *o;  struct ospf6_interface *oi;  struct ospf6_area *oa;  struct interface *ifp;  u_int32_t area_id;  o = (struct ospf6 *) vty->index;  ifp = if_lookup_by_name (argv[0]);  if (ifp == NULL)    {      vty_out (vty, "No such interface %s%s", argv[0], VNL);      return CMD_SUCCESS;    }  oi = (struct ospf6_interface *) ifp->info;  if (oi == NULL)    {      vty_out (vty, "Interface %s not enabled%s", ifp->name, VNL);      return CMD_SUCCESS;    }  /* parse Area-ID */  if (inet_pton (AF_INET, argv[1], &area_id) != 1)    {      vty_out (vty, "Invalid Area-ID: %s%s", argv[1], VNL);      return CMD_SUCCESS;    }  if (oi->area->area_id != area_id)    {      vty_out (vty, "Wrong Area-ID: %s is attached to area %s%s",               oi->interface->name, oi->area->name, VNL);      return CMD_SUCCESS;    }  thread_execute (master, interface_down, oi, 0);  oa = oi->area;  listnode_delete (oi->area->if_list, oi);  oi->area = (struct ospf6_area *) NULL;  /* Withdraw inter-area routes from this area, if necessary */  if (oa->if_list->count == 0)    {      UNSET_FLAG (oa->flag, OSPF6_AREA_ENABLE);      ospf6_abr_disable_area (oa);    }  return CMD_SUCCESS;}voidospf6_show (struct vty *vty, struct ospf6 *o){  listnode n;  struct ospf6_area *oa;  char router_id[16], duration[32];  struct timeval now, running;  /* process id, router id */  inet_ntop (AF_INET, &o->router_id, router_id, sizeof (router_id));  vty_out (vty, " OSPFv3 Routing Process (0) with Router-ID %s%s",           router_id, VNL);  /* running time */  gettimeofday (&now, (struct timezone *)NULL);  timersub (&now, &o->starttime, &running);  timerstring (&running, duration, sizeof (duration));  vty_out (vty, " Running %s%s", duration, VNL);  /* Redistribute configuration */  /* XXX */  /* LSAs */  vty_out (vty, " Number of AS scoped LSAs is %u%s",           o->lsdb->count, VNL);  /* Areas */  vty_out (vty, " Number of areas in this router is %u%s",           listcount (o->area_list), VNL);  for (n = listhead (o->area_list); n; nextnode (n))    {      oa = (struct ospf6_area *) getdata (n);      ospf6_area_show (vty, oa);    }}/* show top level structures */DEFUN (show_ipv6_ospf6,       show_ipv6_ospf6_cmd,       "show ipv6 ospf6",       SHOW_STR       IP6_STR       OSPF6_STR){  OSPF6_CMD_CHECK_RUNNING ();  ospf6_show (vty, ospf6);  return CMD_SUCCESS;}DEFUN (show_ipv6_ospf6_route,       show_ipv6_ospf6_route_cmd,       "show ipv6 ospf6 route",       SHOW_STR       IP6_STR       OSPF6_STR       ROUTE_STR       ){  ospf6_route_table_show (vty, argc, argv, ospf6->route_table);  return CMD_SUCCESS;}ALIAS (show_ipv6_ospf6_route,       show_ipv6_ospf6_route_detail_cmd,       "show ipv6 ospf6 route (X:X::X:X|X:X::X:X/M|detail|summary)",       SHOW_STR       IP6_STR       OSPF6_STR       ROUTE_STR       "Specify IPv6 address\n"       "Specify IPv6 prefix\n"       "Detailed information\n"       "Summary of route table\n"       );DEFUN (show_ipv6_ospf6_route_match,       show_ipv6_ospf6_route_match_cmd,       "show ipv6 ospf6 route X:X::X:X/M match",       SHOW_STR       IP6_STR       OSPF6_STR       ROUTE_STR       "Specify IPv6 prefix\n"       "Display routes which match the specified route\n"       ){  char *sargv[CMD_ARGC_MAX];  int i, sargc;  /* copy argv to sargv and then append "match" */  for (i = 0; i < argc; i++)    sargv[i] = argv[i];  sargc = argc;  sargv[sargc++] = "match";  sargv[sargc] = NULL;  ospf6_route_table_show (vty, sargc, sargv, ospf6->route_table);  return CMD_SUCCESS;}DEFUN (show_ipv6_ospf6_route_match_detail,       show_ipv6_ospf6_route_match_detail_cmd,       "show ipv6 ospf6 route X:X::X:X/M match detail",       SHOW_STR       IP6_STR       OSPF6_STR       ROUTE_STR       "Specify IPv6 prefix\n"       "Display routes which match the specified route\n"       "Detailed information\n"       ){  char *sargv[CMD_ARGC_MAX];  int i, sargc;  /* copy argv to sargv and then append "match" and "detail" */  for (i = 0; i < argc; i++)    sargv[i] = argv[i];  sargc = argc;  sargv[sargc++] = "match";  sargv[sargc++] = "detail";  sargv[sargc] = NULL;  ospf6_route_table_show (vty, sargc, sargv, ospf6->route_table);  return CMD_SUCCESS;}ALIAS (show_ipv6_ospf6_route,       show_ipv6_ospf6_route_type_cmd,       "show ipv6 ospf6 route (intra-area|inter-area|external-1|external-2)",       SHOW_STR       IP6_STR       OSPF6_STR       ROUTE_STR       "Dispaly Intra-Area routes\n"       "Dispaly Inter-Area routes\n"       "Dispaly Type-1 External routes\n"       "Dispaly Type-2 External routes\n"       );DEFUN (show_ipv6_ospf6_route_type_detail,       show_ipv6_ospf6_route_type_detail_cmd,       "show ipv6 ospf6 route (intra-area|inter-area|external-1|external-2) detail",       SHOW_STR       IP6_STR       OSPF6_STR       ROUTE_STR       "Dispaly Intra-Area routes\n"       "Dispaly Inter-Area routes\n"       "Dispaly Type-1 External routes\n"       "Dispaly Type-2 External routes\n"       "Detailed information\n"       ){  char *sargv[CMD_ARGC_MAX];  int i, sargc;  /* copy argv to sargv and then append "detail" */  for (i = 0; i < argc; i++)    sargv[i] = argv[i];  sargc = argc;  sargv[sargc++] = "detail";  sargv[sargc] = NULL;  ospf6_route_table_show (vty, sargc, sargv, ospf6->route_table);  return CMD_SUCCESS;}/* OSPF configuration write function. */intconfig_write_ospf6 (struct vty *vty){  char router_id[16];  listnode j, k;  struct ospf6_area *oa;  struct ospf6_interface *oi;  /* OSPFv6 configuration. */  if (ospf6 == NULL)    return CMD_SUCCESS;  if (CHECK_FLAG (ospf6->flag, OSPF6_DISABLED))    return CMD_SUCCESS;  inet_ntop (AF_INET, &ospf6->router_id, router_id, sizeof (router_id));  vty_out (vty, "router ospf6%s", VNL);  vty_out (vty, " router-id %s%s", router_id, VNL);  ospf6_redistribute_config_write (vty);  ospf6_area_config_write (vty);  for (j = listhead (ospf6->area_list); j; nextnode (j))    {      oa = (struct ospf6_area *) getdata (j);      for (k = listhead (oa->if_list); k; nextnode (k))        {          oi = (struct ospf6_interface *) getdata (k);          vty_out (vty, " interface %s area %s%s",                   oi->interface->name, oa->name, VNL);        }    }  vty_out (vty, "!%s", VNL);  return 0;}/* OSPF6 node structure. */struct cmd_node ospf6_node ={  OSPF6_NODE,  "%s(config-ospf6)# ",  1 /* VTYSH */};/* Install ospf related commands. */voidospf6_top_init (){  /* Install ospf6 top node. */  install_node (&ospf6_node, config_write_ospf6);  install_element (VIEW_NODE, &show_ipv6_ospf6_cmd);  install_element (ENABLE_NODE, &show_ipv6_ospf6_cmd);  install_element (CONFIG_NODE, &router_ospf6_cmd);  install_element (VIEW_NODE, &show_ipv6_ospf6_route_cmd);  install_element (VIEW_NODE, &show_ipv6_ospf6_route_detail_cmd);  install_element (VIEW_NODE, &show_ipv6_ospf6_route_match_cmd);  install_element (VIEW_NODE, &show_ipv6_ospf6_route_match_detail_cmd);  install_element (VIEW_NODE, &show_ipv6_ospf6_route_type_cmd);  install_element (VIEW_NODE, &show_ipv6_ospf6_route_type_detail_cmd);  install_element (ENABLE_NODE, &show_ipv6_ospf6_route_cmd);  install_element (ENABLE_NODE, &show_ipv6_ospf6_route_detail_cmd);  install_element (ENABLE_NODE, &show_ipv6_ospf6_route_match_cmd);  install_element (ENABLE_NODE, &show_ipv6_ospf6_route_match_detail_cmd);  install_element (ENABLE_NODE, &show_ipv6_ospf6_route_type_cmd);  install_element (ENABLE_NODE, &show_ipv6_ospf6_route_type_detail_cmd);  install_default (OSPF6_NODE);  install_element (OSPF6_NODE, &ospf6_router_id_cmd);  install_element (OSPF6_NODE, &ospf6_interface_area_cmd);  install_element (OSPF6_NODE, &no_ospf6_interface_area_cmd);  install_element (OSPF6_NODE, &no_router_ospf6_cmd);}

⌨️ 快捷键说明

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