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

📄 ospf6_interface.c

📁 linux 路由软件 可支持RIP OSPF BGP等
💻 C
📖 第 1 页 / 共 3 页
字号:
                   ifp->name, iobuflen, VNL);          oi->ifmtu = iobuflen;        }      else        oi->ifmtu = ifmtu;    }  else    oi->ifmtu = ifmtu;  /* re-establish adjacencies */  for (node = listhead (oi->neighbor_list); node; nextnode (node))    {      on = (struct ospf6_neighbor *) getdata (node);      THREAD_OFF (on->inactivity_timer);      thread_execute (master, inactivity_timer, on, 0);    }  return CMD_SUCCESS;}DEFUN (no_ipv6_ospf6_ifmtu,       no_ipv6_ospf6_ifmtu_cmd,       "no ipv6 ospf6 ifmtu",       NO_STR       IP6_STR       OSPF6_STR       "Interface MTU\n"       ){  struct ospf6_interface *oi;  struct interface *ifp;  int iobuflen;  listnode node;  struct ospf6_neighbor *on;  ifp = (struct interface *) vty->index;  assert (ifp);  oi = (struct ospf6_interface *) ifp->info;  if (oi == NULL)    oi = ospf6_interface_create (ifp);  assert (oi);  if (oi->ifmtu < ifp->mtu)    {      iobuflen = ospf6_iobuf_size (ifp->mtu);      if (iobuflen < ifp->mtu)        {          vty_out (vty, "%s's ifmtu is adjusted to I/O buffer size (%d).%s",                   ifp->name, iobuflen, VNL);          oi->ifmtu = iobuflen;        }      else        oi->ifmtu = ifp->mtu;    }  else    oi->ifmtu = ifp->mtu;  /* re-establish adjacencies */  for (node = listhead (oi->neighbor_list); node; nextnode (node))    {      on = (struct ospf6_neighbor *) getdata (node);      THREAD_OFF (on->inactivity_timer);      thread_execute (master, inactivity_timer, on, 0);    }  return CMD_SUCCESS;}DEFUN (ipv6_ospf6_cost,       ipv6_ospf6_cost_cmd,       "ipv6 ospf6 cost <1-65535>",       IP6_STR       OSPF6_STR       "Interface cost\n"       "Outgoing metric of this interface\n"       ){  struct ospf6_interface *oi;  struct interface *ifp;  ifp = (struct interface *) vty->index;  assert (ifp);  oi = (struct ospf6_interface *) ifp->info;  if (oi == NULL)    oi = ospf6_interface_create (ifp);  assert (oi);  if (oi->cost == strtol (argv[0], NULL, 10))    return CMD_SUCCESS;  oi->cost = strtol (argv[0], NULL, 10);  /* update cost held in route_connected list in ospf6_interface */  ospf6_interface_connected_route_update (oi->interface);  /* execute LSA hooks */  if (oi->area)    {      OSPF6_LINK_LSA_SCHEDULE (oi);      OSPF6_ROUTER_LSA_SCHEDULE (oi->area);      OSPF6_NETWORK_LSA_SCHEDULE (oi);      OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);      OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);    }  return CMD_SUCCESS;}DEFUN (ipv6_ospf6_hellointerval,       ipv6_ospf6_hellointerval_cmd,       "ipv6 ospf6 hello-interval <1-65535>",       IP6_STR       OSPF6_STR       "Interval time of Hello packets\n"       SECONDS_STR       ){  struct ospf6_interface *oi;  struct interface *ifp;  ifp = (struct interface *) vty->index;  assert (ifp);  oi = (struct ospf6_interface *) ifp->info;  if (oi == NULL)    oi = ospf6_interface_create (ifp);  assert (oi);  oi->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 <1-65535>",       IP6_STR       OSPF6_STR       "Interval time after which a neighbor is declared down\n"       SECONDS_STR       ){  struct ospf6_interface *oi;  struct interface *ifp;  ifp = (struct interface *) vty->index;  assert (ifp);  oi = (struct ospf6_interface *) ifp->info;  if (oi == NULL)    oi = ospf6_interface_create (ifp);  assert (oi);  oi->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 <1-3600>",       IP6_STR       OSPF6_STR       "Transmit delay of this interface\n"       SECONDS_STR       ){  struct ospf6_interface *oi;  struct interface *ifp;  ifp = (struct interface *) vty->index;  assert (ifp);  oi = (struct ospf6_interface *) ifp->info;  if (oi == NULL)    oi = ospf6_interface_create (ifp);  assert (oi);  oi->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 <1-65535>",       IP6_STR       OSPF6_STR       "Time between retransmitting lost link state advertisements\n"       SECONDS_STR       ){  struct ospf6_interface *oi;  struct interface *ifp;  ifp = (struct interface *) vty->index;  assert (ifp);  oi = (struct ospf6_interface *) ifp->info;  if (oi == NULL)    oi = ospf6_interface_create (ifp);  assert (oi);  oi->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 <0-255>",       IP6_STR       OSPF6_STR       "Router priority\n"       "Priority value\n"       ){  struct ospf6_interface *oi;  struct interface *ifp;  ifp = (struct interface *) vty->index;  assert (ifp);  oi = (struct ospf6_interface *) ifp->info;  if (oi == NULL)    oi = ospf6_interface_create (ifp);  assert (oi);  oi->priority = strtol (argv[0], NULL, 10);  if (oi->area)    ospf6_interface_state_change (dr_election (oi), oi);  return CMD_SUCCESS;}DEFUN (ipv6_ospf6_instance,       ipv6_ospf6_instance_cmd,       "ipv6 ospf6 instance-id <0-255>",       IP6_STR       OSPF6_STR       "Instance ID for this interface\n"       "Instance ID value\n"       ){  struct ospf6_interface *oi;  struct interface *ifp;  ifp = (struct interface *)vty->index;  assert (ifp);  oi = (struct ospf6_interface *)ifp->info;  if (oi == NULL)    oi = ospf6_interface_create (ifp);  assert (oi);  oi->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 interface\n"       ){  struct ospf6_interface *oi;  struct interface *ifp;  listnode node;  struct ospf6_neighbor *on;  ifp = (struct interface *) vty->index;  assert (ifp);  oi = (struct ospf6_interface *) ifp->info;  if (oi == NULL)    oi = ospf6_interface_create (ifp);  assert (oi);  SET_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE);  THREAD_OFF (oi->thread_send_hello);  for (node = listhead (oi->neighbor_list); node; nextnode (node))    {      on = (struct ospf6_neighbor *) getdata (node);      THREAD_OFF (on->inactivity_timer);      thread_execute (master, inactivity_timer, on, 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 *oi;  struct interface *ifp;  ifp = (struct interface *) vty->index;  assert (ifp);  oi = (struct ospf6_interface *) ifp->info;  if (oi == NULL)    oi = ospf6_interface_create (ifp);  assert (oi);  UNSET_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE);  THREAD_OFF (oi->thread_send_hello);  oi->thread_send_hello =    thread_add_event (master, ospf6_hello_send, oi, 0);  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 *oi;  struct interface *ifp;  ifp = (struct interface *) vty->index;  assert (ifp);  oi = (struct ospf6_interface *) ifp->info;  if (oi == NULL)    oi = ospf6_interface_create (ifp);  assert (oi);  if (oi->plist_name)    XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name);  oi->plist_name = XSTRDUP (MTYPE_PREFIX_LIST_STR, argv[0]);  ospf6_interface_connected_route_update (oi->interface);  OSPF6_LINK_LSA_SCHEDULE (oi);  if (oi->state == OSPF6_INTERFACE_DR)    {      OSPF6_NETWORK_LSA_SCHEDULE (oi);      OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);    }  OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);  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 *oi;  struct interface *ifp;  ifp = (struct interface *) vty->index;  assert (ifp);  oi = (struct ospf6_interface *) ifp->info;  if (oi == NULL)    oi = ospf6_interface_create (ifp);  assert (oi);  if (oi->plist_name)    {      XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name);      oi->plist_name = NULL;    }  ospf6_interface_connected_route_update (oi->interface);  OSPF6_LINK_LSA_SCHEDULE (oi);  if (oi->state == OSPF6_INTERFACE_DR)    {      OSPF6_NETWORK_LSA_SCHEDULE (oi);      OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);    }  OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);  return CMD_SUCCESS;}intconfig_write_ospf6_interface (struct vty *vty){  listnode i;  struct ospf6_interface *oi;  struct interface *ifp;  for (i = listhead (iflist); i; nextnode (i))    {      ifp = (struct interface *) getdata (i);      oi = (struct ospf6_interface *) ifp->info;      if (oi == NULL)        continue;      vty_out (vty, "interface %s%s",               oi->interface->name, VNL);      if (ifp->desc)        vty_out (vty, " description %s%s", ifp->desc, VNL);      if (ifp->mtu != oi->ifmtu)        vty_out (vty, " ipv6 ospf6 ifmtu %d%s", oi->ifmtu, VNL);      vty_out (vty, " ipv6 ospf6 cost %d%s",               oi->cost, VNL);      vty_out (vty, " ipv6 ospf6 hello-interval %d%s",               oi->hello_interval, VNL);      vty_out (vty, " ipv6 ospf6 dead-interval %d%s",               oi->dead_interval, VNL);      vty_out (vty, " ipv6 ospf6 retransmit-interval %d%s",               oi->rxmt_interval, VNL);      vty_out (vty, " ipv6 ospf6 priority %d%s",               oi->priority, VNL);      vty_out (vty, " ipv6 ospf6 transmit-delay %d%s",               oi->transdelay, VNL);      vty_out (vty, " ipv6 ospf6 instance-id %d%s",               oi->instance_id, VNL);      if (oi->plist_name)        vty_out (vty, " ipv6 ospf6 advertise prefix-list %s%s",                 oi->plist_name, VNL);      if (CHECK_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE))        vty_out (vty, " ipv6 ospf6 passive%s", VNL);      vty_out (vty, "!%s", VNL);    }  return 0;}struct cmd_node interface_node ={  INTERFACE_NODE,  "%s(config-if)# ",  1 /* VTYSH */};voidospf6_interface_init (){  /* Install interface node. */  install_node (&interface_node, config_write_ospf6_interface);  install_element (VIEW_NODE, &show_ipv6_ospf6_interface_cmd);  install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_cmd);  install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_detail_cmd);  install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_match_cmd);  install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_cmd);  install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_cmd);  install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd);  install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd);  install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_cmd);  install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_cmd);  install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_detail_cmd);  install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_match_cmd);  install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_cmd);  install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_cmd);  install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd);  install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd);  install_element (CONFIG_NODE, &interface_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_ifmtu_cmd);  install_element (INTERFACE_NODE, &no_ipv6_ospf6_ifmtu_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_passive_cmd);  install_element (INTERFACE_NODE, &no_ipv6_ospf6_passive_cmd);  install_element (INTERFACE_NODE, &ipv6_ospf6_advertise_prefix_list_cmd);  install_element (INTERFACE_NODE, &no_ipv6_ospf6_advertise_prefix_list_cmd);}DEFUN (debug_ospf6_interface,       debug_ospf6_interface_cmd,       "debug ospf6 interface",       DEBUG_STR       OSPF6_STR       "Debug OSPFv3 Interface\n"      ){  OSPF6_DEBUG_INTERFACE_ON ();  return CMD_SUCCESS;}DEFUN (no_debug_ospf6_interface,       no_debug_ospf6_interface_cmd,       "no debug ospf6 interface",       NO_STR       DEBUG_STR       OSPF6_STR       "Debug OSPFv3 Interface\n"      ){  OSPF6_DEBUG_INTERFACE_OFF ();  return CMD_SUCCESS;}intconfig_write_ospf6_debug_interface (struct vty *vty){  if (IS_OSPF6_DEBUG_INTERFACE)    vty_out (vty, "debug ospf6 interface%s", VNL);  return 0;}voidinstall_element_ospf6_debug_interface (){  install_element (ENABLE_NODE, &debug_ospf6_interface_cmd);  install_element (ENABLE_NODE, &no_debug_ospf6_interface_cmd);  install_element (CONFIG_NODE, &debug_ospf6_interface_cmd);  install_element (CONFIG_NODE, &no_debug_ospf6_interface_cmd);}

⌨️ 快捷键说明

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