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

📄 ospf6_interface.c

📁 大名鼎鼎的路由器源码。程序分ZEBRA、OSPFRIP等3个包。程序框架采用一个路由协议一个进程的方式
💻 C
📖 第 1 页 / 共 2 页
字号:
	   " (Tx: %ldbps Rx: %ldbps)%s",           bps_total_avg, bps_tx_avg, bps_rx_avg, VTY_NEWLINE);}/* show interface */DEFUN (show_ipv6_ospf6_interface,       show_ipv6_ospf6_interface_ifname_cmd,       "show ipv6 ospf6 interface IFNAME",       SHOW_STR       IP6_STR       OSPF6_STR       INTERFACE_STR       IFNAME_STR       ){  struct interface *ifp;  listnode i;  if (argc)    {      ifp = if_lookup_by_name (argv[0]);      if (!ifp)        {          vty_out (vty, "No such Interface: %s%s", argv[0],		   VTY_NEWLINE);          return CMD_WARNING;        }      ospf6_interface_show (vty, ifp);    }  else    {      for (i = listhead (iflist); i; nextnode (i))        {          ifp = (struct interface *)getdata (i);          ospf6_interface_show (vty, ifp);        }    }  return CMD_SUCCESS;}ALIAS (show_ipv6_ospf6_interface,       show_ipv6_ospf6_interface_cmd,       "show ipv6 ospf6 interface",       SHOW_STR       IP6_STR       OSPF6_STR       INTERFACE_STR       );/* interface variable set command */DEFUN (ipv6_ospf6_cost,       ipv6_ospf6_cost_cmd,       "ipv6 ospf6 cost COST",       IP6_STR       OSPF6_STR       "Interface cost\n"       "<1-65535> Cost\n"       ){  struct ospf6_interface *o6i;  struct interface *ifp;  ifp = (struct interface *)vty->index;  assert (ifp);  o6i = (struct ospf6_interface *)ifp->info;  if (!o6i)    o6i = ospf6_interface_create (ifp);  assert (o6i);  if (o6i->cost == strtol (argv[0], NULL, 10))    return CMD_SUCCESS;  o6i->cost = strtol (argv[0], NULL, 10);  /* execute LSA hooks */  CALL_FOREACH_LSA_HOOK (hook_interface, hook_change, o6i);  CALL_CHANGE_HOOK (&interface_hook, o6i);  return CMD_SUCCESS;}/* interface variable set command */DEFUN (ipv6_ospf6_hellointerval,       ipv6_ospf6_hellointerval_cmd,       "ipv6 ospf6 hello-interval HELLO_INTERVAL",       IP6_STR       OSPF6_STR       "Time between HELLO packets\n"       SECONDS_STR       ){  struct ospf6_interface *ospf6_interface;  struct interface *ifp;  ifp = (struct interface *) vty->index;  assert (ifp);  ospf6_interface = (struct ospf6_interface *) ifp->info;  if (!ospf6_interface)    ospf6_interface = ospf6_interface_create (ifp);  assert (ospf6_interface);  ospf6_interface->hello_interval = strtol (argv[0], NULL, 10);  return CMD_SUCCESS;}/* interface variable set command */DEFUN (ipv6_ospf6_deadinterval,       ipv6_ospf6_deadinterval_cmd,       "ipv6 ospf6 dead-interval ROUTER_DEAD_INTERVAL",       IP6_STR       OSPF6_STR       "Interval after which a neighbor is declared dead\n"       SECONDS_STR       ){  struct ospf6_interface *ospf6_interface;  struct interface *ifp;  ifp = (struct interface *) vty->index;  assert (ifp);  ospf6_interface = (struct ospf6_interface *) ifp->info;  if (!ospf6_interface)    ospf6_interface = ospf6_interface_create (ifp);  assert (ospf6_interface);  ospf6_interface->dead_interval = strtol (argv[0], NULL, 10);  return CMD_SUCCESS;}/* interface variable set command */DEFUN (ipv6_ospf6_transmitdelay,       ipv6_ospf6_transmitdelay_cmd,       "ipv6 ospf6 transmit-delay TRANSMITDELAY",       IP6_STR       OSPF6_STR       "Link state transmit delay\n"       SECONDS_STR       ){  struct ospf6_interface *ospf6_interface;  struct interface *ifp;  ifp = (struct interface *) vty->index;  assert (ifp);  ospf6_interface = (struct ospf6_interface *) ifp->info;  if (!ospf6_interface)    ospf6_interface = ospf6_interface_create (ifp);  assert (ospf6_interface);  ospf6_interface->transdelay = strtol (argv[0], NULL, 10);  return CMD_SUCCESS;}/* interface variable set command */DEFUN (ipv6_ospf6_retransmitinterval,       ipv6_ospf6_retransmitinterval_cmd,       "ipv6 ospf6 retransmit-interval RXMTINTERVAL",       IP6_STR       OSPF6_STR       "Time between retransmitting lost link state advertisements\n"       SECONDS_STR       ){  struct ospf6_interface *ospf6_interface;  struct interface *ifp;  ifp = (struct interface *) vty->index;  assert (ifp);  ospf6_interface = (struct ospf6_interface *) ifp->info;  if (!ospf6_interface)    ospf6_interface = ospf6_interface_create (ifp);  assert (ospf6_interface);  ospf6_interface->rxmt_interval = strtol (argv[0], NULL, 10);  return CMD_SUCCESS;}/* interface variable set command */DEFUN (ipv6_ospf6_priority,       ipv6_ospf6_priority_cmd,       "ipv6 ospf6 priority PRIORITY",       IP6_STR       OSPF6_STR       "Router priority\n"       "<0-255> Priority\n"       ){  struct ospf6_interface *ospf6_interface;  struct interface *ifp;  ifp = (struct interface *) vty->index;  assert (ifp);  ospf6_interface = (struct ospf6_interface *) ifp->info;  if (!ospf6_interface)    ospf6_interface = ospf6_interface_create (ifp);  assert (ospf6_interface);  ospf6_interface->priority = strtol (argv[0], NULL, 10);  if (ospf6_interface->area)    ifs_change (dr_election (ospf6_interface), "Priority reconfigured",                ospf6_interface);  return CMD_SUCCESS;}DEFUN (ipv6_ospf6_instance,       ipv6_ospf6_instance_cmd,       "ipv6 ospf6 instance-id INSTANCE",       IP6_STR       OSPF6_STR       "Instance ID\n"       "<0-255> Instance ID\n"       ){  struct ospf6_interface *ospf6_interface;  struct interface *ifp;  ifp = (struct interface *)vty->index;  assert (ifp);  ospf6_interface = (struct ospf6_interface *)ifp->info;  if (!ospf6_interface)    ospf6_interface = ospf6_interface_create (ifp);  assert (ospf6_interface);  ospf6_interface->instance_id = strtol (argv[0], NULL, 10);  return CMD_SUCCESS;}DEFUN (ipv6_ospf6_passive,       ipv6_ospf6_passive_cmd,       "ipv6 ospf6 passive",       IP6_STR       OSPF6_STR       "passive interface: No Adjacency will be formed on this I/F\n"       ){  struct ospf6_interface *o6i;  struct interface *ifp;  listnode node;  struct ospf6_neighbor *o6n;  ifp = (struct interface *) vty->index;  assert (ifp);  o6i = (struct ospf6_interface *) ifp->info;  if (! o6i)    o6i = ospf6_interface_create (ifp);  assert (o6i);  SET_FLAG (o6i->flag, OSPF6_INTERFACE_FLAG_PASSIVE);  if (o6i->thread_send_hello)    {      thread_cancel (o6i->thread_send_hello);      o6i->thread_send_hello = (struct thread *) NULL;    }  for (node = listhead (o6i->neighbor_list); node; nextnode (node))    {      o6n = getdata (node);      if (o6n->inactivity_timer)        thread_cancel (o6n->inactivity_timer);      thread_execute (master, inactivity_timer, o6n, 0);    }  return CMD_SUCCESS;}DEFUN (no_ipv6_ospf6_passive,       no_ipv6_ospf6_passive_cmd,       "no ipv6 ospf6 passive",       NO_STR       IP6_STR       OSPF6_STR       "passive interface: No Adjacency will be formed on this I/F\n"       ){  struct ospf6_interface *o6i;  struct interface *ifp;  ifp = (struct interface *) vty->index;  assert (ifp);  o6i = (struct ospf6_interface *) ifp->info;  if (! o6i)    o6i = ospf6_interface_create (ifp);  assert (o6i);  UNSET_FLAG (o6i->flag, OSPF6_INTERFACE_FLAG_PASSIVE);  if (o6i->thread_send_hello == NULL)    thread_add_event (master, ospf6_send_hello, o6i, 0);  return CMD_SUCCESS;}DEFUN (ipv6_ospf6_advertise_force_prefix,       ipv6_ospf6_advertise_force_prefix_cmd,       "ipv6 ospf6 advertise force-prefix",       IP6_STR       OSPF6_STR       "Advertising options\n"       "Force advertising prefix, applicable if Loopback or P-to-P\n"       ){  struct ospf6_interface *o6i;  struct interface *ifp;  ifp = (struct interface *) vty->index;  assert (ifp);  o6i = (struct ospf6_interface *) ifp->info;  if (! o6i)    o6i = ospf6_interface_create (ifp);  assert (o6i);  if (! if_is_loopback (ifp) && ! if_is_pointopoint (ifp))    {      vty_out (vty, "Interface not Loopback nor PointToPoint%s",               VTY_NEWLINE);      return CMD_ERR_NOTHING_TODO;    }  SET_FLAG (o6i->flag, OSPF6_INTERFACE_FLAG_FORCE_PREFIX);  /* execute LSA hooks */  CALL_FOREACH_LSA_HOOK (hook_interface, hook_change, o6i);  CALL_CHANGE_HOOK (&interface_hook, o6i);  return CMD_SUCCESS;}DEFUN (no_ipv6_ospf6_advertise_force_prefix,       no_ipv6_ospf6_advertise_force_prefix_cmd,       "no ipv6 ospf6 advertise force-prefix",       NO_STR       IP6_STR       OSPF6_STR       "Advertising options\n"       "Force to advertise prefix, applicable if Loopback or P-to-P\n"       ){  struct ospf6_interface *o6i;  struct interface *ifp;  ifp = (struct interface *) vty->index;  assert (ifp);  o6i = (struct ospf6_interface *) ifp->info;  if (! o6i)    o6i = ospf6_interface_create (ifp);  assert (o6i);  UNSET_FLAG (o6i->flag, OSPF6_INTERFACE_FLAG_FORCE_PREFIX);  /* execute LSA hooks */  CALL_FOREACH_LSA_HOOK (hook_interface, hook_change, o6i);  CALL_CHANGE_HOOK (&interface_hook, o6i);  return CMD_SUCCESS;}DEFUN (ipv6_ospf6_advertise_prefix_list,       ipv6_ospf6_advertise_prefix_list_cmd,       "ipv6 ospf6 advertise prefix-list WORD",       IP6_STR       OSPF6_STR       "Advertising options\n"       "Filter prefix using prefix-list\n"       "Prefix list name\n"       ){  struct ospf6_interface *o6i;  struct interface *ifp;  ifp = (struct interface *) vty->index;  assert (ifp);  o6i = (struct ospf6_interface *) ifp->info;  if (! o6i)    o6i = ospf6_interface_create (ifp);  assert (o6i);  if (o6i->plist_name)    XFREE (MTYPE_PREFIX_LIST_STR, o6i->plist_name);  o6i->plist_name = XSTRDUP (MTYPE_PREFIX_LIST_STR, argv[0]);  /* execute LSA hooks */  CALL_FOREACH_LSA_HOOK (hook_interface, hook_change, o6i);  CALL_CHANGE_HOOK (&interface_hook, o6i);  return CMD_SUCCESS;}DEFUN (no_ipv6_ospf6_advertise_prefix_list,       no_ipv6_ospf6_advertise_prefix_list_cmd,       "no ipv6 ospf6 advertise prefix-list",       NO_STR       IP6_STR       OSPF6_STR       "Advertising options\n"       "Filter prefix using prefix-list\n"       ){  struct ospf6_interface *o6i;  struct interface *ifp;  ifp = (struct interface *) vty->index;  assert (ifp);  o6i = (struct ospf6_interface *) ifp->info;  if (! o6i)    o6i = ospf6_interface_create (ifp);  assert (o6i);  if (o6i->plist_name)    {      XFREE (MTYPE_PREFIX_LIST_STR, o6i->plist_name);      o6i->plist_name = NULL;    }  /* execute LSA hooks */  CALL_FOREACH_LSA_HOOK (hook_interface, hook_change, o6i);  CALL_CHANGE_HOOK (&interface_hook, o6i);  return CMD_SUCCESS;}intospf6_interface_config_write (struct vty *vty){  listnode i;  struct ospf6_interface *o6i;  struct interface *ifp;  for (i = listhead (iflist); i; nextnode (i))    {      ifp = (struct interface *) getdata (i);      o6i = (struct ospf6_interface *) ifp->info;      if (! o6i)        continue;      vty_out (vty, "interface %s%s",               o6i->interface->name, VTY_NEWLINE);      if (o6i->cost != 1)	vty_out (vty, " ipv6 ospf6 cost %d%s",		 o6i->cost, VTY_NEWLINE);      if (o6i->hello_interval != 10)	vty_out (vty, " ipv6 ospf6 hello-interval %d%s",		 o6i->hello_interval, VTY_NEWLINE);      if (o6i->dead_interval != 40)	vty_out (vty, " ipv6 ospf6 dead-interval %d%s",		 o6i->dead_interval, VTY_NEWLINE);      if (o6i->rxmt_interval != 5)	vty_out (vty, " ipv6 ospf6 retransmit-interval %d%s",		 o6i->rxmt_interval, VTY_NEWLINE);      if (o6i->priority != 1)	vty_out (vty, " ipv6 ospf6 priority %d%s",		 o6i->priority, VTY_NEWLINE);      if (o6i->transdelay != 1)	vty_out (vty, " ipv6 ospf6 transmit-delay %d%s",		 o6i->transdelay, VTY_NEWLINE);      if (o6i->instance_id != 0)	vty_out (vty, " ipv6 ospf6 instance-id %d%s",		 o6i->instance_id, VTY_NEWLINE);      if (CHECK_FLAG (o6i->flag, OSPF6_INTERFACE_FLAG_FORCE_PREFIX))        vty_out (vty, " ipv6 ospf6 advertise force-prefix%s", VTY_NEWLINE);      if (o6i->plist_name)        vty_out (vty, " ipv6 ospf6 advertise prefix-list %s%s",                 o6i->plist_name, VTY_NEWLINE);      if (CHECK_FLAG (o6i->flag, OSPF6_INTERFACE_FLAG_PASSIVE))        vty_out (vty, " ipv6 ospf6 passive%s", VTY_NEWLINE);      vty_out (vty, "!%s", VTY_NEWLINE);    }  return 0;}struct cmd_node interface_node =  {    INTERFACE_NODE,    "%s(config-if)# ",    1  };voidospf6_interface_init (){  /* Install interface node. */  install_node (&interface_node, ospf6_interface_config_write);  install_element (VIEW_NODE, &show_ipv6_ospf6_interface_cmd);  install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_cmd);  install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_cmd);  install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_cmd);  install_default (INTERFACE_NODE);  install_element (INTERFACE_NODE, &interface_desc_cmd);  install_element (INTERFACE_NODE, &no_interface_desc_cmd);  install_element (INTERFACE_NODE, &ipv6_ospf6_cost_cmd);  install_element (INTERFACE_NODE, &ipv6_ospf6_deadinterval_cmd);  install_element (INTERFACE_NODE, &ipv6_ospf6_hellointerval_cmd);  install_element (INTERFACE_NODE, &ipv6_ospf6_priority_cmd);  install_element (INTERFACE_NODE, &ipv6_ospf6_retransmitinterval_cmd);  install_element (INTERFACE_NODE, &ipv6_ospf6_transmitdelay_cmd);  install_element (INTERFACE_NODE, &ipv6_ospf6_instance_cmd);  install_element (INTERFACE_NODE, &ipv6_ospf6_advertise_force_prefix_cmd);  install_element (INTERFACE_NODE, &no_ipv6_ospf6_advertise_force_prefix_cmd);  install_element (INTERFACE_NODE, &ipv6_ospf6_advertise_prefix_list_cmd);  install_element (INTERFACE_NODE, &no_ipv6_ospf6_advertise_prefix_list_cmd);  install_element (INTERFACE_NODE, &ipv6_ospf6_passive_cmd);  install_element (INTERFACE_NODE, &no_ipv6_ospf6_passive_cmd);}

⌨️ 快捷键说明

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