paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | /* |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 2 | * Copyright (C) 2003 Yasuhiro Ohara |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3 | * |
| 4 | * This file is part of GNU Zebra. |
| 5 | * |
| 6 | * GNU Zebra is free software; you can redistribute it and/or modify it |
| 7 | * under the terms of the GNU General Public License as published by the |
| 8 | * Free Software Foundation; either version 2, or (at your option) any |
| 9 | * later version. |
| 10 | * |
| 11 | * GNU Zebra is distributed in the hope that it will be useful, but |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with GNU Zebra; see the file COPYING. If not, write to the |
| 18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 19 | * Boston, MA 02111-1307, USA. |
| 20 | */ |
| 21 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 22 | #include <zebra.h> |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 23 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 24 | #include "memory.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 25 | #include "if.h" |
| 26 | #include "log.h" |
| 27 | #include "command.h" |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 28 | #include "thread.h" |
| 29 | #include "prefix.h" |
| 30 | #include "plist.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 31 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 32 | #include "ospf6_lsa.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 33 | #include "ospf6_lsdb.h" |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 34 | #include "ospf6_network.h" |
| 35 | #include "ospf6_message.h" |
| 36 | #include "ospf6_route.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 37 | #include "ospf6_top.h" |
| 38 | #include "ospf6_area.h" |
| 39 | #include "ospf6_interface.h" |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 40 | #include "ospf6_neighbor.h" |
| 41 | #include "ospf6_intra.h" |
| 42 | #include "ospf6_spf.h" |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 43 | #include "ospf6d.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 44 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 45 | unsigned char conf_debug_ospf6_interface = 0; |
| 46 | |
paul | 0c083ee | 2004-10-10 12:54:58 +0000 | [diff] [blame] | 47 | const char *ospf6_interface_state_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 48 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 49 | "None", |
| 50 | "Down", |
| 51 | "Loopback", |
| 52 | "Waiting", |
| 53 | "PointToPoint", |
| 54 | "DROther", |
| 55 | "BDR", |
| 56 | "DR", |
| 57 | NULL |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 58 | }; |
| 59 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 60 | struct ospf6_interface * |
| 61 | ospf6_interface_lookup_by_ifindex (int ifindex) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 62 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 63 | struct ospf6_interface *oi; |
| 64 | struct interface *ifp; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 65 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 66 | ifp = if_lookup_by_index (ifindex); |
| 67 | if (ifp == NULL) |
| 68 | return (struct ospf6_interface *) NULL; |
| 69 | |
| 70 | oi = (struct ospf6_interface *) ifp->info; |
| 71 | return oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 72 | } |
| 73 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 74 | /* schedule routing table recalculation */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 75 | static void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 76 | ospf6_interface_lsdb_hook (struct ospf6_lsa *lsa) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 77 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 78 | switch (ntohs (lsa->header->type)) |
| 79 | { |
| 80 | case OSPF6_LSTYPE_LINK: |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 81 | if (OSPF6_INTERFACE (lsa->lsdb->data)->state == OSPF6_INTERFACE_DR) |
| 82 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (OSPF6_INTERFACE (lsa->lsdb->data)); |
| 83 | ospf6_spf_schedule (OSPF6_INTERFACE (lsa->lsdb->data)->area); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 84 | break; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 85 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 86 | default: |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 87 | break; |
| 88 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | /* Create new ospf6 interface structure */ |
| 92 | struct ospf6_interface * |
| 93 | ospf6_interface_create (struct interface *ifp) |
| 94 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 95 | struct ospf6_interface *oi; |
paul | 0c083ee | 2004-10-10 12:54:58 +0000 | [diff] [blame] | 96 | unsigned int iobuflen; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 97 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 98 | oi = (struct ospf6_interface *) |
Stephen Hemminger | 393deb9 | 2008-08-18 14:13:29 -0700 | [diff] [blame] | 99 | XCALLOC (MTYPE_OSPF6_IF, sizeof (struct ospf6_interface)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 100 | |
Stephen Hemminger | 393deb9 | 2008-08-18 14:13:29 -0700 | [diff] [blame] | 101 | if (!oi) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 102 | { |
| 103 | zlog_err ("Can't malloc ospf6_interface for ifindex %d", ifp->ifindex); |
| 104 | return (struct ospf6_interface *) NULL; |
| 105 | } |
| 106 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 107 | oi->area = (struct ospf6_area *) NULL; |
| 108 | oi->neighbor_list = list_new (); |
| 109 | oi->neighbor_list->cmp = ospf6_neighbor_cmp; |
| 110 | oi->linklocal_addr = (struct in6_addr *) NULL; |
| 111 | oi->instance_id = 0; |
| 112 | oi->transdelay = 1; |
| 113 | oi->priority = 1; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 114 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 115 | oi->hello_interval = 10; |
| 116 | oi->dead_interval = 40; |
| 117 | oi->rxmt_interval = 5; |
| 118 | oi->cost = 1; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 119 | oi->state = OSPF6_INTERFACE_DOWN; |
| 120 | oi->flag = 0; |
Dmitrij Tejblum | d42306d | 2011-04-22 19:27:54 +0400 | [diff] [blame] | 121 | oi->mtu_ignore = 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 122 | |
hasso | b596c71 | 2004-07-09 18:33:43 +0000 | [diff] [blame] | 123 | /* Try to adjust I/O buffer size with IfMtu */ |
hasso | 1203e1c | 2004-07-23 21:34:27 +0000 | [diff] [blame] | 124 | oi->ifmtu = ifp->mtu6; |
| 125 | iobuflen = ospf6_iobuf_size (ifp->mtu6); |
hasso | b596c71 | 2004-07-09 18:33:43 +0000 | [diff] [blame] | 126 | if (oi->ifmtu > iobuflen) |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 127 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 128 | if (IS_OSPF6_DEBUG_INTERFACE) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 129 | zlog_debug ("Interface %s: IfMtu is adjusted to I/O buffer size: %d.", |
| 130 | ifp->name, iobuflen); |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 131 | oi->ifmtu = iobuflen; |
| 132 | } |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 133 | |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 134 | oi->lsupdate_list = ospf6_lsdb_create (oi); |
| 135 | oi->lsack_list = ospf6_lsdb_create (oi); |
| 136 | oi->lsdb = ospf6_lsdb_create (oi); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 137 | oi->lsdb->hook_add = ospf6_interface_lsdb_hook; |
| 138 | oi->lsdb->hook_remove = ospf6_interface_lsdb_hook; |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 139 | oi->lsdb_self = ospf6_lsdb_create (oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 140 | |
Paul Jakma | cf1ce25 | 2006-05-15 10:46:07 +0000 | [diff] [blame] | 141 | oi->route_connected = OSPF6_ROUTE_TABLE_CREATE (INTERFACE, CONNECTED_ROUTES); |
| 142 | oi->route_connected->scope = oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 143 | |
| 144 | /* link both */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 145 | oi->interface = ifp; |
| 146 | ifp->info = oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 147 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 148 | return oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 149 | } |
| 150 | |
| 151 | void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 152 | ospf6_interface_delete (struct ospf6_interface *oi) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 153 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 154 | struct listnode *node, *nnode; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 155 | struct ospf6_neighbor *on; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 156 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 157 | for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on)) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 158 | ospf6_neighbor_delete (on); |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 159 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 160 | list_delete (oi->neighbor_list); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 161 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 162 | THREAD_OFF (oi->thread_send_hello); |
| 163 | THREAD_OFF (oi->thread_send_lsupdate); |
| 164 | THREAD_OFF (oi->thread_send_lsack); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 165 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 166 | ospf6_lsdb_remove_all (oi->lsdb); |
| 167 | ospf6_lsdb_remove_all (oi->lsupdate_list); |
| 168 | ospf6_lsdb_remove_all (oi->lsack_list); |
| 169 | |
| 170 | ospf6_lsdb_delete (oi->lsdb); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 171 | ospf6_lsdb_delete (oi->lsdb_self); |
| 172 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 173 | ospf6_lsdb_delete (oi->lsupdate_list); |
| 174 | ospf6_lsdb_delete (oi->lsack_list); |
| 175 | |
| 176 | ospf6_route_table_delete (oi->route_connected); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 177 | |
| 178 | /* cut link */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 179 | oi->interface->info = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 180 | |
| 181 | /* plist_name */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 182 | if (oi->plist_name) |
| 183 | XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 184 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 185 | XFREE (MTYPE_OSPF6_IF, oi); |
| 186 | } |
| 187 | |
| 188 | void |
| 189 | ospf6_interface_enable (struct ospf6_interface *oi) |
| 190 | { |
| 191 | UNSET_FLAG (oi->flag, OSPF6_INTERFACE_DISABLE); |
| 192 | |
| 193 | oi->thread_send_hello = |
| 194 | thread_add_event (master, ospf6_hello_send, oi, 0); |
| 195 | } |
| 196 | |
| 197 | void |
| 198 | ospf6_interface_disable (struct ospf6_interface *oi) |
| 199 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 200 | struct listnode *node, *nnode; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 201 | struct ospf6_neighbor *on; |
| 202 | |
| 203 | SET_FLAG (oi->flag, OSPF6_INTERFACE_DISABLE); |
| 204 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 205 | for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on)) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 206 | ospf6_neighbor_delete (on); |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 207 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 208 | list_delete_all_node (oi->neighbor_list); |
| 209 | |
| 210 | ospf6_lsdb_remove_all (oi->lsdb); |
| 211 | ospf6_lsdb_remove_all (oi->lsupdate_list); |
| 212 | ospf6_lsdb_remove_all (oi->lsack_list); |
| 213 | |
| 214 | THREAD_OFF (oi->thread_send_hello); |
| 215 | THREAD_OFF (oi->thread_send_lsupdate); |
| 216 | THREAD_OFF (oi->thread_send_lsack); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 217 | } |
| 218 | |
| 219 | static struct in6_addr * |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 220 | ospf6_interface_get_linklocal_address (struct interface *ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 221 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 222 | struct listnode *n; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 223 | struct connected *c; |
| 224 | struct in6_addr *l = (struct in6_addr *) NULL; |
| 225 | |
| 226 | /* for each connected address */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 227 | for (ALL_LIST_ELEMENTS_RO (ifp->connected, n, c)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 228 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 229 | /* if family not AF_INET6, ignore */ |
| 230 | if (c->address->family != AF_INET6) |
| 231 | continue; |
| 232 | |
| 233 | /* linklocal scope check */ |
| 234 | if (IN6_IS_ADDR_LINKLOCAL (&c->address->u.prefix6)) |
| 235 | l = &c->address->u.prefix6; |
| 236 | } |
| 237 | return l; |
| 238 | } |
| 239 | |
| 240 | void |
| 241 | ospf6_interface_if_add (struct interface *ifp) |
| 242 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 243 | struct ospf6_interface *oi; |
paul | 0c083ee | 2004-10-10 12:54:58 +0000 | [diff] [blame] | 244 | unsigned int iobuflen; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 245 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 246 | oi = (struct ospf6_interface *) ifp->info; |
| 247 | if (oi == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 248 | return; |
| 249 | |
hasso | b596c71 | 2004-07-09 18:33:43 +0000 | [diff] [blame] | 250 | /* Try to adjust I/O buffer size with IfMtu */ |
| 251 | if (oi->ifmtu == 0) |
hasso | 1203e1c | 2004-07-23 21:34:27 +0000 | [diff] [blame] | 252 | oi->ifmtu = ifp->mtu6; |
| 253 | iobuflen = ospf6_iobuf_size (ifp->mtu6); |
hasso | b596c71 | 2004-07-09 18:33:43 +0000 | [diff] [blame] | 254 | if (oi->ifmtu > iobuflen) |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 255 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 256 | if (IS_OSPF6_DEBUG_INTERFACE) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 257 | zlog_debug ("Interface %s: IfMtu is adjusted to I/O buffer size: %d.", |
| 258 | ifp->name, iobuflen); |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 259 | oi->ifmtu = iobuflen; |
| 260 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 261 | |
| 262 | /* interface start */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 263 | if (oi->area) |
| 264 | thread_add_event (master, interface_up, oi, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 265 | } |
| 266 | |
| 267 | void |
| 268 | ospf6_interface_if_del (struct interface *ifp) |
| 269 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 270 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 271 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 272 | oi = (struct ospf6_interface *) ifp->info; |
| 273 | if (oi == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 274 | return; |
| 275 | |
| 276 | /* interface stop */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 277 | if (oi->area) |
| 278 | thread_execute (master, interface_down, oi, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 279 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 280 | listnode_delete (oi->area->if_list, oi); |
| 281 | oi->area = (struct ospf6_area *) NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 282 | |
| 283 | /* cut link */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 284 | oi->interface = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 285 | ifp->info = NULL; |
| 286 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 287 | ospf6_interface_delete (oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 288 | } |
| 289 | |
| 290 | void |
| 291 | ospf6_interface_state_update (struct interface *ifp) |
| 292 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 293 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 294 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 295 | oi = (struct ospf6_interface *) ifp->info; |
| 296 | if (oi == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 297 | return; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 298 | if (oi->area == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 299 | return; |
| 300 | |
| 301 | if (if_is_up (ifp)) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 302 | thread_add_event (master, interface_up, oi, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 303 | else |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 304 | thread_add_event (master, interface_down, oi, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 305 | |
| 306 | return; |
| 307 | } |
| 308 | |
| 309 | void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 310 | ospf6_interface_connected_route_update (struct interface *ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 311 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 312 | struct ospf6_interface *oi; |
| 313 | struct ospf6_route *route; |
| 314 | struct connected *c; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 315 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 316 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 317 | oi = (struct ospf6_interface *) ifp->info; |
| 318 | if (oi == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 319 | return; |
| 320 | |
| 321 | /* reset linklocal pointer */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 322 | oi->linklocal_addr = ospf6_interface_get_linklocal_address (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 323 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 324 | /* if area is null, do not make connected-route list */ |
| 325 | if (oi->area == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 326 | return; |
| 327 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 328 | /* update "route to advertise" interface route table */ |
| 329 | ospf6_route_remove_all (oi->route_connected); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 330 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 331 | for (ALL_LIST_ELEMENTS (oi->interface->connected, node, nnode, c)) |
| 332 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 333 | if (c->address->family != AF_INET6) |
| 334 | continue; |
| 335 | |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 336 | CONTINUE_IF_ADDRESS_LINKLOCAL (IS_OSPF6_DEBUG_INTERFACE, c->address); |
| 337 | CONTINUE_IF_ADDRESS_UNSPECIFIED (IS_OSPF6_DEBUG_INTERFACE, c->address); |
| 338 | CONTINUE_IF_ADDRESS_LOOPBACK (IS_OSPF6_DEBUG_INTERFACE, c->address); |
| 339 | CONTINUE_IF_ADDRESS_V4COMPAT (IS_OSPF6_DEBUG_INTERFACE, c->address); |
| 340 | CONTINUE_IF_ADDRESS_V4MAPPED (IS_OSPF6_DEBUG_INTERFACE, c->address); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 341 | |
| 342 | /* apply filter */ |
| 343 | if (oi->plist_name) |
| 344 | { |
| 345 | struct prefix_list *plist; |
| 346 | enum prefix_list_type ret; |
| 347 | char buf[128]; |
| 348 | |
| 349 | prefix2str (c->address, buf, sizeof (buf)); |
| 350 | plist = prefix_list_lookup (AFI_IP6, oi->plist_name); |
| 351 | ret = prefix_list_apply (plist, (void *) c->address); |
| 352 | if (ret == PREFIX_DENY) |
| 353 | { |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 354 | if (IS_OSPF6_DEBUG_INTERFACE) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 355 | zlog_debug ("%s on %s filtered by prefix-list %s ", |
| 356 | buf, oi->interface->name, oi->plist_name); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 357 | continue; |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | route = ospf6_route_create (); |
| 362 | memcpy (&route->prefix, c->address, sizeof (struct prefix)); |
| 363 | apply_mask (&route->prefix); |
| 364 | route->type = OSPF6_DEST_TYPE_NETWORK; |
| 365 | route->path.area_id = oi->area->area_id; |
| 366 | route->path.type = OSPF6_PATH_TYPE_INTRA; |
| 367 | route->path.cost = oi->cost; |
| 368 | route->nexthop[0].ifindex = oi->interface->ifindex; |
| 369 | inet_pton (AF_INET6, "::1", &route->nexthop[0].address); |
| 370 | ospf6_route_add (route, oi->route_connected); |
| 371 | } |
| 372 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 373 | /* create new Link-LSA */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 374 | OSPF6_LINK_LSA_SCHEDULE (oi); |
| 375 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi); |
| 376 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 377 | } |
| 378 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 379 | static void |
| 380 | ospf6_interface_state_change (u_char next_state, struct ospf6_interface *oi) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 381 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 382 | u_char prev_state; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 383 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 384 | prev_state = oi->state; |
| 385 | oi->state = next_state; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 386 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 387 | if (prev_state == next_state) |
| 388 | return; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 389 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 390 | /* log */ |
| 391 | if (IS_OSPF6_DEBUG_INTERFACE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 392 | { |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 393 | zlog_debug ("Interface state change %s: %s -> %s", oi->interface->name, |
| 394 | ospf6_interface_state_str[prev_state], |
| 395 | ospf6_interface_state_str[next_state]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 396 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 397 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 398 | if ((prev_state == OSPF6_INTERFACE_DR || |
| 399 | prev_state == OSPF6_INTERFACE_BDR) && |
| 400 | (next_state != OSPF6_INTERFACE_DR && |
| 401 | next_state != OSPF6_INTERFACE_BDR)) |
| 402 | ospf6_leave_alldrouters (oi->interface->ifindex); |
| 403 | if ((prev_state != OSPF6_INTERFACE_DR && |
| 404 | prev_state != OSPF6_INTERFACE_BDR) && |
| 405 | (next_state == OSPF6_INTERFACE_DR || |
| 406 | next_state == OSPF6_INTERFACE_BDR)) |
| 407 | ospf6_join_alldrouters (oi->interface->ifindex); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 408 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 409 | OSPF6_ROUTER_LSA_SCHEDULE (oi->area); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 410 | if (next_state == OSPF6_INTERFACE_DOWN) |
| 411 | { |
| 412 | OSPF6_NETWORK_LSA_EXECUTE (oi); |
| 413 | OSPF6_INTRA_PREFIX_LSA_EXECUTE_TRANSIT (oi); |
| 414 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area); |
| 415 | } |
| 416 | else if (prev_state == OSPF6_INTERFACE_DR || |
| 417 | next_state == OSPF6_INTERFACE_DR) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 418 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 419 | OSPF6_NETWORK_LSA_SCHEDULE (oi); |
| 420 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi); |
| 421 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 422 | } |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 423 | } |
| 424 | |
| 425 | |
| 426 | /* DR Election, RFC2328 section 9.4 */ |
| 427 | |
| 428 | #define IS_ELIGIBLE(n) \ |
| 429 | ((n)->state >= OSPF6_NEIGHBOR_TWOWAY && (n)->priority != 0) |
| 430 | |
| 431 | static struct ospf6_neighbor * |
| 432 | better_bdrouter (struct ospf6_neighbor *a, struct ospf6_neighbor *b) |
| 433 | { |
| 434 | if ((a == NULL || ! IS_ELIGIBLE (a) || a->drouter == a->router_id) && |
| 435 | (b == NULL || ! IS_ELIGIBLE (b) || b->drouter == b->router_id)) |
| 436 | return NULL; |
| 437 | else if (a == NULL || ! IS_ELIGIBLE (a) || a->drouter == a->router_id) |
| 438 | return b; |
| 439 | else if (b == NULL || ! IS_ELIGIBLE (b) || b->drouter == b->router_id) |
| 440 | return a; |
| 441 | |
| 442 | if (a->bdrouter == a->router_id && b->bdrouter != b->router_id) |
| 443 | return a; |
| 444 | if (a->bdrouter != a->router_id && b->bdrouter == b->router_id) |
| 445 | return b; |
| 446 | |
| 447 | if (a->priority > b->priority) |
| 448 | return a; |
| 449 | if (a->priority < b->priority) |
| 450 | return b; |
| 451 | |
| 452 | if (ntohl (a->router_id) > ntohl (b->router_id)) |
| 453 | return a; |
| 454 | if (ntohl (a->router_id) < ntohl (b->router_id)) |
| 455 | return b; |
| 456 | |
| 457 | zlog_warn ("Router-ID duplicate ?"); |
| 458 | return a; |
| 459 | } |
| 460 | |
| 461 | static struct ospf6_neighbor * |
| 462 | better_drouter (struct ospf6_neighbor *a, struct ospf6_neighbor *b) |
| 463 | { |
| 464 | if ((a == NULL || ! IS_ELIGIBLE (a) || a->drouter != a->router_id) && |
| 465 | (b == NULL || ! IS_ELIGIBLE (b) || b->drouter != b->router_id)) |
| 466 | return NULL; |
| 467 | else if (a == NULL || ! IS_ELIGIBLE (a) || a->drouter != a->router_id) |
| 468 | return b; |
| 469 | else if (b == NULL || ! IS_ELIGIBLE (b) || b->drouter != b->router_id) |
| 470 | return a; |
| 471 | |
| 472 | if (a->drouter == a->router_id && b->drouter != b->router_id) |
| 473 | return a; |
| 474 | if (a->drouter != a->router_id && b->drouter == b->router_id) |
| 475 | return b; |
| 476 | |
| 477 | if (a->priority > b->priority) |
| 478 | return a; |
| 479 | if (a->priority < b->priority) |
| 480 | return b; |
| 481 | |
| 482 | if (ntohl (a->router_id) > ntohl (b->router_id)) |
| 483 | return a; |
| 484 | if (ntohl (a->router_id) < ntohl (b->router_id)) |
| 485 | return b; |
| 486 | |
| 487 | zlog_warn ("Router-ID duplicate ?"); |
| 488 | return a; |
| 489 | } |
| 490 | |
| 491 | static u_char |
| 492 | dr_election (struct ospf6_interface *oi) |
| 493 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 494 | struct listnode *node, *nnode; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 495 | struct ospf6_neighbor *on, *drouter, *bdrouter, myself; |
| 496 | struct ospf6_neighbor *best_drouter, *best_bdrouter; |
| 497 | u_char next_state = 0; |
| 498 | |
| 499 | drouter = bdrouter = NULL; |
| 500 | best_drouter = best_bdrouter = NULL; |
| 501 | |
| 502 | /* pseudo neighbor myself, including noting current DR/BDR (1) */ |
| 503 | memset (&myself, 0, sizeof (myself)); |
| 504 | inet_ntop (AF_INET, &oi->area->ospf6->router_id, myself.name, |
| 505 | sizeof (myself.name)); |
| 506 | myself.state = OSPF6_NEIGHBOR_TWOWAY; |
| 507 | myself.drouter = oi->drouter; |
| 508 | myself.bdrouter = oi->bdrouter; |
| 509 | myself.priority = oi->priority; |
| 510 | myself.router_id = oi->area->ospf6->router_id; |
| 511 | |
| 512 | /* Electing BDR (2) */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 513 | for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on)) |
| 514 | bdrouter = better_bdrouter (bdrouter, on); |
| 515 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 516 | best_bdrouter = bdrouter; |
| 517 | bdrouter = better_bdrouter (best_bdrouter, &myself); |
| 518 | |
| 519 | /* Electing DR (3) */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 520 | for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on)) |
| 521 | drouter = better_drouter (drouter, on); |
| 522 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 523 | best_drouter = drouter; |
| 524 | drouter = better_drouter (best_drouter, &myself); |
| 525 | if (drouter == NULL) |
| 526 | drouter = bdrouter; |
| 527 | |
| 528 | /* the router itself is newly/no longer DR/BDR (4) */ |
| 529 | if ((drouter == &myself && myself.drouter != myself.router_id) || |
| 530 | (drouter != &myself && myself.drouter == myself.router_id) || |
| 531 | (bdrouter == &myself && myself.bdrouter != myself.router_id) || |
| 532 | (bdrouter != &myself && myself.bdrouter == myself.router_id)) |
| 533 | { |
| 534 | myself.drouter = (drouter ? drouter->router_id : htonl (0)); |
| 535 | myself.bdrouter = (bdrouter ? bdrouter->router_id : htonl (0)); |
| 536 | |
| 537 | /* compatible to Electing BDR (2) */ |
| 538 | bdrouter = better_bdrouter (best_bdrouter, &myself); |
| 539 | |
| 540 | /* compatible to Electing DR (3) */ |
| 541 | drouter = better_drouter (best_drouter, &myself); |
| 542 | if (drouter == NULL) |
| 543 | drouter = bdrouter; |
| 544 | } |
| 545 | |
| 546 | /* Set interface state accordingly (5) */ |
| 547 | if (drouter && drouter == &myself) |
| 548 | next_state = OSPF6_INTERFACE_DR; |
| 549 | else if (bdrouter && bdrouter == &myself) |
| 550 | next_state = OSPF6_INTERFACE_BDR; |
| 551 | else |
| 552 | next_state = OSPF6_INTERFACE_DROTHER; |
| 553 | |
| 554 | /* If NBMA, schedule Start for each neighbor having priority of 0 (6) */ |
| 555 | /* XXX */ |
| 556 | |
| 557 | /* If DR or BDR change, invoke AdjOK? for each neighbor (7) */ |
| 558 | /* RFC 2328 section 12.4. Originating LSAs (3) will be handled |
| 559 | accordingly after AdjOK */ |
| 560 | if (oi->drouter != (drouter ? drouter->router_id : htonl (0)) || |
| 561 | oi->bdrouter != (bdrouter ? bdrouter->router_id : htonl (0))) |
| 562 | { |
| 563 | if (IS_OSPF6_DEBUG_INTERFACE) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 564 | zlog_debug ("DR Election on %s: DR: %s BDR: %s", oi->interface->name, |
| 565 | (drouter ? drouter->name : "0.0.0.0"), |
| 566 | (bdrouter ? bdrouter->name : "0.0.0.0")); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 567 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 568 | for (ALL_LIST_ELEMENTS_RO (oi->neighbor_list, node, on)) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 569 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 570 | if (on->state < OSPF6_NEIGHBOR_TWOWAY) |
| 571 | continue; |
| 572 | /* Schedule AdjOK. */ |
| 573 | thread_add_event (master, adj_ok, on, 0); |
| 574 | } |
| 575 | } |
| 576 | |
| 577 | oi->drouter = (drouter ? drouter->router_id : htonl (0)); |
| 578 | oi->bdrouter = (bdrouter ? bdrouter->router_id : htonl (0)); |
| 579 | return next_state; |
| 580 | } |
| 581 | |
| 582 | |
| 583 | /* Interface State Machine */ |
| 584 | int |
| 585 | interface_up (struct thread *thread) |
| 586 | { |
| 587 | struct ospf6_interface *oi; |
| 588 | |
| 589 | oi = (struct ospf6_interface *) THREAD_ARG (thread); |
| 590 | assert (oi && oi->interface); |
| 591 | |
| 592 | if (IS_OSPF6_DEBUG_INTERFACE) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 593 | zlog_debug ("Interface Event %s: [InterfaceUp]", |
| 594 | oi->interface->name); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 595 | |
| 596 | /* check physical interface is up */ |
| 597 | if (! if_is_up (oi->interface)) |
| 598 | { |
| 599 | if (IS_OSPF6_DEBUG_INTERFACE) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 600 | zlog_debug ("Interface %s is down, can't execute [InterfaceUp]", |
| 601 | oi->interface->name); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 602 | return 0; |
| 603 | } |
| 604 | |
| 605 | /* if already enabled, do nothing */ |
| 606 | if (oi->state > OSPF6_INTERFACE_DOWN) |
| 607 | { |
| 608 | if (IS_OSPF6_DEBUG_INTERFACE) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 609 | zlog_debug ("Interface %s already enabled", |
| 610 | oi->interface->name); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 611 | return 0; |
| 612 | } |
| 613 | |
| 614 | /* Join AllSPFRouters */ |
| 615 | ospf6_join_allspfrouters (oi->interface->ifindex); |
| 616 | |
| 617 | /* Update interface route */ |
| 618 | ospf6_interface_connected_route_update (oi->interface); |
| 619 | |
| 620 | /* Schedule Hello */ |
| 621 | if (! CHECK_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE)) |
| 622 | thread_add_event (master, ospf6_hello_send, oi, 0); |
| 623 | |
| 624 | /* decide next interface state */ |
| 625 | if (if_is_pointopoint (oi->interface)) |
| 626 | ospf6_interface_state_change (OSPF6_INTERFACE_POINTTOPOINT, oi); |
| 627 | else if (oi->priority == 0) |
| 628 | ospf6_interface_state_change (OSPF6_INTERFACE_DROTHER, oi); |
| 629 | else |
| 630 | { |
| 631 | ospf6_interface_state_change (OSPF6_INTERFACE_WAITING, oi); |
| 632 | thread_add_timer (master, wait_timer, oi, oi->dead_interval); |
| 633 | } |
| 634 | |
| 635 | return 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 636 | } |
| 637 | |
| 638 | int |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 639 | wait_timer (struct thread *thread) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 640 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 641 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 642 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 643 | oi = (struct ospf6_interface *) THREAD_ARG (thread); |
| 644 | assert (oi && oi->interface); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 645 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 646 | if (IS_OSPF6_DEBUG_INTERFACE) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 647 | zlog_debug ("Interface Event %s: [WaitTimer]", |
| 648 | oi->interface->name); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 649 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 650 | if (oi->state == OSPF6_INTERFACE_WAITING) |
| 651 | ospf6_interface_state_change (dr_election (oi), oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 652 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 653 | return 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 654 | } |
| 655 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 656 | int |
| 657 | backup_seen (struct thread *thread) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 658 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 659 | struct ospf6_interface *oi; |
| 660 | |
| 661 | oi = (struct ospf6_interface *) THREAD_ARG (thread); |
| 662 | assert (oi && oi->interface); |
| 663 | |
| 664 | if (IS_OSPF6_DEBUG_INTERFACE) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 665 | zlog_debug ("Interface Event %s: [BackupSeen]", |
| 666 | oi->interface->name); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 667 | |
| 668 | if (oi->state == OSPF6_INTERFACE_WAITING) |
| 669 | ospf6_interface_state_change (dr_election (oi), oi); |
| 670 | |
| 671 | return 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 672 | } |
| 673 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 674 | int |
| 675 | neighbor_change (struct thread *thread) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 676 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 677 | struct ospf6_interface *oi; |
| 678 | |
| 679 | oi = (struct ospf6_interface *) THREAD_ARG (thread); |
| 680 | assert (oi && oi->interface); |
| 681 | |
| 682 | if (IS_OSPF6_DEBUG_INTERFACE) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 683 | zlog_debug ("Interface Event %s: [NeighborChange]", |
| 684 | oi->interface->name); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 685 | |
| 686 | if (oi->state == OSPF6_INTERFACE_DROTHER || |
| 687 | oi->state == OSPF6_INTERFACE_BDR || |
| 688 | oi->state == OSPF6_INTERFACE_DR) |
| 689 | ospf6_interface_state_change (dr_election (oi), oi); |
| 690 | |
| 691 | return 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 692 | } |
| 693 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 694 | int |
| 695 | interface_down (struct thread *thread) |
| 696 | { |
| 697 | struct ospf6_interface *oi; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 698 | struct listnode *node, *nnode; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 699 | struct ospf6_neighbor *on; |
| 700 | |
| 701 | oi = (struct ospf6_interface *) THREAD_ARG (thread); |
| 702 | assert (oi && oi->interface); |
| 703 | |
| 704 | if (IS_OSPF6_DEBUG_INTERFACE) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 705 | zlog_debug ("Interface Event %s: [InterfaceDown]", |
| 706 | oi->interface->name); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 707 | |
| 708 | /* Leave AllSPFRouters */ |
| 709 | if (oi->state > OSPF6_INTERFACE_DOWN) |
| 710 | ospf6_leave_allspfrouters (oi->interface->ifindex); |
| 711 | |
| 712 | ospf6_interface_state_change (OSPF6_INTERFACE_DOWN, oi); |
| 713 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 714 | for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on)) |
| 715 | ospf6_neighbor_delete (on); |
| 716 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 717 | list_delete_all_node (oi->neighbor_list); |
| 718 | |
| 719 | return 0; |
| 720 | } |
| 721 | |
| 722 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 723 | /* show specified interface structure */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 724 | static int |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 725 | ospf6_interface_show (struct vty *vty, struct interface *ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 726 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 727 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 728 | struct connected *c; |
| 729 | struct prefix *p; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 730 | struct listnode *i; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 731 | char strbuf[64], drouter[32], bdrouter[32]; |
paul | 0c083ee | 2004-10-10 12:54:58 +0000 | [diff] [blame] | 732 | const char *updown[3] = {"down", "up", NULL}; |
| 733 | const char *type; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 734 | struct timeval res, now; |
| 735 | char duration[32]; |
| 736 | struct ospf6_lsa *lsa; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 737 | |
| 738 | /* check physical interface type */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 739 | if (if_is_loopback (ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 740 | type = "LOOPBACK"; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 741 | else if (if_is_broadcast (ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 742 | type = "BROADCAST"; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 743 | else if (if_is_pointopoint (ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 744 | type = "POINTOPOINT"; |
| 745 | else |
| 746 | type = "UNKNOWN"; |
| 747 | |
| 748 | vty_out (vty, "%s is %s, type %s%s", |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 749 | ifp->name, updown[if_is_up (ifp)], type, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 750 | VNL); |
| 751 | vty_out (vty, " Interface ID: %d%s", ifp->ifindex, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 752 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 753 | if (ifp->info == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 754 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 755 | vty_out (vty, " OSPF not enabled on this interface%s", VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 756 | return 0; |
| 757 | } |
| 758 | else |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 759 | oi = (struct ospf6_interface *) ifp->info; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 760 | |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 761 | vty_out (vty, " Internet Address:%s", VNL); |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 762 | |
| 763 | for (ALL_LIST_ELEMENTS_RO (ifp->connected, i, c)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 764 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 765 | p = c->address; |
| 766 | prefix2str (p, strbuf, sizeof (strbuf)); |
| 767 | switch (p->family) |
| 768 | { |
| 769 | case AF_INET: |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 770 | vty_out (vty, " inet : %s%s", strbuf, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 771 | VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 772 | break; |
| 773 | case AF_INET6: |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 774 | vty_out (vty, " inet6: %s%s", strbuf, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 775 | VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 776 | break; |
| 777 | default: |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 778 | vty_out (vty, " ??? : %s%s", strbuf, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 779 | VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 780 | break; |
| 781 | } |
| 782 | } |
| 783 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 784 | if (oi->area) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 785 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 786 | vty_out (vty, " Instance ID %d, Interface MTU %d (autodetect: %d)%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 787 | oi->instance_id, oi->ifmtu, ifp->mtu6, VNL); |
Dmitrij Tejblum | d42306d | 2011-04-22 19:27:54 +0400 | [diff] [blame] | 788 | vty_out (vty, " MTU mismatch detection: %s%s", oi->mtu_ignore ? |
| 789 | "disabled" : "enabled", VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 790 | inet_ntop (AF_INET, &oi->area->area_id, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 791 | strbuf, sizeof (strbuf)); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 792 | vty_out (vty, " Area ID %s, Cost %hu%s", strbuf, oi->cost, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 793 | VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 794 | } |
| 795 | else |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 796 | vty_out (vty, " Not Attached to Area%s", VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 797 | |
| 798 | vty_out (vty, " State %s, Transmit Delay %d sec, Priority %d%s", |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 799 | ospf6_interface_state_str[oi->state], |
| 800 | oi->transdelay, oi->priority, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 801 | VNL); |
| 802 | vty_out (vty, " Timer intervals configured:%s", VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 803 | vty_out (vty, " Hello %d, Dead %d, Retransmit %d%s", |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 804 | oi->hello_interval, oi->dead_interval, oi->rxmt_interval, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 805 | VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 806 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 807 | inet_ntop (AF_INET, &oi->drouter, drouter, sizeof (drouter)); |
| 808 | inet_ntop (AF_INET, &oi->bdrouter, bdrouter, sizeof (bdrouter)); |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 809 | vty_out (vty, " DR: %s BDR: %s%s", drouter, bdrouter, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 810 | |
| 811 | vty_out (vty, " Number of I/F scoped LSAs is %u%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 812 | oi->lsdb->count, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 813 | |
Takashi Sogabe | 86f72dc | 2009-06-22 13:07:02 +0900 | [diff] [blame] | 814 | quagga_gettime (QUAGGA_CLK_MONOTONIC, &now); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 815 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 816 | timerclear (&res); |
| 817 | if (oi->thread_send_lsupdate) |
| 818 | timersub (&oi->thread_send_lsupdate->u.sands, &now, &res); |
| 819 | timerstring (&res, duration, sizeof (duration)); |
| 820 | vty_out (vty, " %d Pending LSAs for LSUpdate in Time %s [thread %s]%s", |
| 821 | oi->lsupdate_list->count, duration, |
| 822 | (oi->thread_send_lsupdate ? "on" : "off"), |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 823 | VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 824 | for (lsa = ospf6_lsdb_head (oi->lsupdate_list); lsa; |
| 825 | lsa = ospf6_lsdb_next (lsa)) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 826 | vty_out (vty, " %s%s", lsa->name, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 827 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 828 | timerclear (&res); |
| 829 | if (oi->thread_send_lsack) |
| 830 | timersub (&oi->thread_send_lsack->u.sands, &now, &res); |
| 831 | timerstring (&res, duration, sizeof (duration)); |
| 832 | vty_out (vty, " %d Pending LSAs for LSAck in Time %s [thread %s]%s", |
| 833 | oi->lsack_list->count, duration, |
| 834 | (oi->thread_send_lsack ? "on" : "off"), |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 835 | VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 836 | for (lsa = ospf6_lsdb_head (oi->lsack_list); lsa; |
| 837 | lsa = ospf6_lsdb_next (lsa)) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 838 | vty_out (vty, " %s%s", lsa->name, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 839 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 840 | return 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 841 | } |
| 842 | |
| 843 | /* show interface */ |
| 844 | DEFUN (show_ipv6_ospf6_interface, |
| 845 | show_ipv6_ospf6_interface_ifname_cmd, |
| 846 | "show ipv6 ospf6 interface IFNAME", |
| 847 | SHOW_STR |
| 848 | IP6_STR |
| 849 | OSPF6_STR |
| 850 | INTERFACE_STR |
| 851 | IFNAME_STR |
| 852 | ) |
| 853 | { |
| 854 | struct interface *ifp; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 855 | struct listnode *i; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 856 | |
| 857 | if (argc) |
| 858 | { |
| 859 | ifp = if_lookup_by_name (argv[0]); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 860 | if (ifp == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 861 | { |
| 862 | vty_out (vty, "No such Interface: %s%s", argv[0], |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 863 | VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 864 | return CMD_WARNING; |
| 865 | } |
| 866 | ospf6_interface_show (vty, ifp); |
| 867 | } |
| 868 | else |
| 869 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 870 | for (ALL_LIST_ELEMENTS_RO (iflist, i, ifp)) |
| 871 | ospf6_interface_show (vty, ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 872 | } |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 873 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 874 | return CMD_SUCCESS; |
| 875 | } |
| 876 | |
| 877 | ALIAS (show_ipv6_ospf6_interface, |
| 878 | show_ipv6_ospf6_interface_cmd, |
| 879 | "show ipv6 ospf6 interface", |
| 880 | SHOW_STR |
| 881 | IP6_STR |
| 882 | OSPF6_STR |
| 883 | INTERFACE_STR |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 884 | ) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 885 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 886 | DEFUN (show_ipv6_ospf6_interface_ifname_prefix, |
| 887 | show_ipv6_ospf6_interface_ifname_prefix_cmd, |
| 888 | "show ipv6 ospf6 interface IFNAME prefix", |
| 889 | SHOW_STR |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 890 | IP6_STR |
| 891 | OSPF6_STR |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 892 | INTERFACE_STR |
| 893 | IFNAME_STR |
| 894 | "Display connected prefixes to advertise\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 895 | ) |
| 896 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 897 | struct interface *ifp; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 898 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 899 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 900 | ifp = if_lookup_by_name (argv[0]); |
| 901 | if (ifp == NULL) |
| 902 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 903 | vty_out (vty, "No such Interface: %s%s", argv[0], VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 904 | return CMD_WARNING; |
| 905 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 906 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 907 | oi = ifp->info; |
| 908 | if (oi == NULL) |
| 909 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 910 | vty_out (vty, "OSPFv3 is not enabled on %s%s", argv[0], VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 911 | return CMD_WARNING; |
| 912 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 913 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 914 | argc--; |
| 915 | argv++; |
| 916 | ospf6_route_table_show (vty, argc, argv, oi->route_connected); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 917 | |
| 918 | return CMD_SUCCESS; |
| 919 | } |
| 920 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 921 | ALIAS (show_ipv6_ospf6_interface_ifname_prefix, |
| 922 | show_ipv6_ospf6_interface_ifname_prefix_detail_cmd, |
| 923 | "show ipv6 ospf6 interface IFNAME prefix (X:X::X:X|X:X::X:X/M|detail)", |
| 924 | SHOW_STR |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 925 | IP6_STR |
| 926 | OSPF6_STR |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 927 | INTERFACE_STR |
| 928 | IFNAME_STR |
| 929 | "Display connected prefixes to advertise\n" |
| 930 | OSPF6_ROUTE_ADDRESS_STR |
| 931 | OSPF6_ROUTE_PREFIX_STR |
Denis Ovsienko | ea40219 | 2011-08-19 16:27:16 +0400 | [diff] [blame] | 932 | "Display details of the prefixes\n" |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 933 | ) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 934 | |
| 935 | ALIAS (show_ipv6_ospf6_interface_ifname_prefix, |
| 936 | show_ipv6_ospf6_interface_ifname_prefix_match_cmd, |
| 937 | "show ipv6 ospf6 interface IFNAME prefix X:X::X:X/M (match|detail)", |
| 938 | SHOW_STR |
| 939 | IP6_STR |
| 940 | OSPF6_STR |
| 941 | INTERFACE_STR |
| 942 | IFNAME_STR |
| 943 | "Display connected prefixes to advertise\n" |
| 944 | OSPF6_ROUTE_PREFIX_STR |
| 945 | OSPF6_ROUTE_MATCH_STR |
Denis Ovsienko | ea40219 | 2011-08-19 16:27:16 +0400 | [diff] [blame] | 946 | "Display details of the prefixes\n" |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 947 | ) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 948 | |
| 949 | DEFUN (show_ipv6_ospf6_interface_prefix, |
| 950 | show_ipv6_ospf6_interface_prefix_cmd, |
| 951 | "show ipv6 ospf6 interface prefix", |
| 952 | SHOW_STR |
| 953 | IP6_STR |
| 954 | OSPF6_STR |
| 955 | INTERFACE_STR |
| 956 | "Display connected prefixes to advertise\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 957 | ) |
| 958 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 959 | struct listnode *i; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 960 | struct ospf6_interface *oi; |
| 961 | struct interface *ifp; |
| 962 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 963 | for (ALL_LIST_ELEMENTS_RO (iflist, i, ifp)) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 964 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 965 | oi = (struct ospf6_interface *) ifp->info; |
| 966 | if (oi == NULL) |
| 967 | continue; |
| 968 | |
| 969 | ospf6_route_table_show (vty, argc, argv, oi->route_connected); |
| 970 | } |
| 971 | |
| 972 | return CMD_SUCCESS; |
| 973 | } |
| 974 | |
| 975 | ALIAS (show_ipv6_ospf6_interface_prefix, |
| 976 | show_ipv6_ospf6_interface_prefix_detail_cmd, |
| 977 | "show ipv6 ospf6 interface prefix (X:X::X:X|X:X::X:X/M|detail)", |
| 978 | SHOW_STR |
| 979 | IP6_STR |
| 980 | OSPF6_STR |
| 981 | INTERFACE_STR |
| 982 | "Display connected prefixes to advertise\n" |
| 983 | OSPF6_ROUTE_ADDRESS_STR |
| 984 | OSPF6_ROUTE_PREFIX_STR |
Denis Ovsienko | ea40219 | 2011-08-19 16:27:16 +0400 | [diff] [blame] | 985 | "Display details of the prefixes\n" |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 986 | ) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 987 | |
| 988 | ALIAS (show_ipv6_ospf6_interface_prefix, |
| 989 | show_ipv6_ospf6_interface_prefix_match_cmd, |
| 990 | "show ipv6 ospf6 interface prefix X:X::X:X/M (match|detail)", |
| 991 | SHOW_STR |
| 992 | IP6_STR |
| 993 | OSPF6_STR |
| 994 | INTERFACE_STR |
| 995 | "Display connected prefixes to advertise\n" |
| 996 | OSPF6_ROUTE_PREFIX_STR |
| 997 | OSPF6_ROUTE_MATCH_STR |
Denis Ovsienko | ea40219 | 2011-08-19 16:27:16 +0400 | [diff] [blame] | 998 | "Display details of the prefixes\n" |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 999 | ) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1000 | |
| 1001 | |
| 1002 | /* interface variable set command */ |
hasso | b596c71 | 2004-07-09 18:33:43 +0000 | [diff] [blame] | 1003 | DEFUN (ipv6_ospf6_ifmtu, |
| 1004 | ipv6_ospf6_ifmtu_cmd, |
| 1005 | "ipv6 ospf6 ifmtu <1-65535>", |
| 1006 | IP6_STR |
| 1007 | OSPF6_STR |
| 1008 | "Interface MTU\n" |
| 1009 | "OSPFv3 Interface MTU\n" |
| 1010 | ) |
| 1011 | { |
| 1012 | struct ospf6_interface *oi; |
| 1013 | struct interface *ifp; |
paul | 0c083ee | 2004-10-10 12:54:58 +0000 | [diff] [blame] | 1014 | unsigned int ifmtu, iobuflen; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1015 | struct listnode *node, *nnode; |
hasso | b596c71 | 2004-07-09 18:33:43 +0000 | [diff] [blame] | 1016 | struct ospf6_neighbor *on; |
| 1017 | |
| 1018 | ifp = (struct interface *) vty->index; |
| 1019 | assert (ifp); |
| 1020 | |
| 1021 | oi = (struct ospf6_interface *) ifp->info; |
| 1022 | if (oi == NULL) |
| 1023 | oi = ospf6_interface_create (ifp); |
| 1024 | assert (oi); |
| 1025 | |
| 1026 | ifmtu = strtol (argv[0], NULL, 10); |
| 1027 | |
| 1028 | if (oi->ifmtu == ifmtu) |
| 1029 | return CMD_SUCCESS; |
| 1030 | |
hasso | 1203e1c | 2004-07-23 21:34:27 +0000 | [diff] [blame] | 1031 | if (ifp->mtu6 != 0 && ifp->mtu6 < ifmtu) |
hasso | b596c71 | 2004-07-09 18:33:43 +0000 | [diff] [blame] | 1032 | { |
| 1033 | vty_out (vty, "%s's ospf6 ifmtu cannot go beyond physical mtu (%d)%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1034 | ifp->name, ifp->mtu6, VNL); |
hasso | b596c71 | 2004-07-09 18:33:43 +0000 | [diff] [blame] | 1035 | return CMD_WARNING; |
| 1036 | } |
| 1037 | |
| 1038 | if (oi->ifmtu < ifmtu) |
| 1039 | { |
| 1040 | iobuflen = ospf6_iobuf_size (ifmtu); |
| 1041 | if (iobuflen < ifmtu) |
| 1042 | { |
| 1043 | vty_out (vty, "%s's ifmtu is adjusted to I/O buffer size (%d).%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1044 | ifp->name, iobuflen, VNL); |
hasso | b596c71 | 2004-07-09 18:33:43 +0000 | [diff] [blame] | 1045 | oi->ifmtu = iobuflen; |
| 1046 | } |
| 1047 | else |
| 1048 | oi->ifmtu = ifmtu; |
| 1049 | } |
| 1050 | else |
| 1051 | oi->ifmtu = ifmtu; |
| 1052 | |
| 1053 | /* re-establish adjacencies */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1054 | for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on)) |
hasso | b596c71 | 2004-07-09 18:33:43 +0000 | [diff] [blame] | 1055 | { |
hasso | b596c71 | 2004-07-09 18:33:43 +0000 | [diff] [blame] | 1056 | THREAD_OFF (on->inactivity_timer); |
hasso | 3e834b1 | 2005-06-24 07:50:12 +0000 | [diff] [blame] | 1057 | thread_add_event (master, inactivity_timer, on, 0); |
hasso | b596c71 | 2004-07-09 18:33:43 +0000 | [diff] [blame] | 1058 | } |
| 1059 | |
| 1060 | return CMD_SUCCESS; |
| 1061 | } |
| 1062 | |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1063 | DEFUN (no_ipv6_ospf6_ifmtu, |
| 1064 | no_ipv6_ospf6_ifmtu_cmd, |
| 1065 | "no ipv6 ospf6 ifmtu", |
| 1066 | NO_STR |
| 1067 | IP6_STR |
| 1068 | OSPF6_STR |
| 1069 | "Interface MTU\n" |
| 1070 | ) |
| 1071 | { |
| 1072 | struct ospf6_interface *oi; |
| 1073 | struct interface *ifp; |
paul | 0c083ee | 2004-10-10 12:54:58 +0000 | [diff] [blame] | 1074 | unsigned int iobuflen; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1075 | struct listnode *node, *nnode; |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1076 | struct ospf6_neighbor *on; |
| 1077 | |
| 1078 | ifp = (struct interface *) vty->index; |
| 1079 | assert (ifp); |
| 1080 | |
| 1081 | oi = (struct ospf6_interface *) ifp->info; |
| 1082 | if (oi == NULL) |
| 1083 | oi = ospf6_interface_create (ifp); |
| 1084 | assert (oi); |
| 1085 | |
| 1086 | if (oi->ifmtu < ifp->mtu) |
| 1087 | { |
| 1088 | iobuflen = ospf6_iobuf_size (ifp->mtu); |
| 1089 | if (iobuflen < ifp->mtu) |
| 1090 | { |
| 1091 | vty_out (vty, "%s's ifmtu is adjusted to I/O buffer size (%d).%s", |
| 1092 | ifp->name, iobuflen, VNL); |
| 1093 | oi->ifmtu = iobuflen; |
| 1094 | } |
| 1095 | else |
| 1096 | oi->ifmtu = ifp->mtu; |
| 1097 | } |
| 1098 | else |
| 1099 | oi->ifmtu = ifp->mtu; |
| 1100 | |
| 1101 | /* re-establish adjacencies */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1102 | for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on)) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1103 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1104 | THREAD_OFF (on->inactivity_timer); |
hasso | 3e834b1 | 2005-06-24 07:50:12 +0000 | [diff] [blame] | 1105 | thread_add_event (master, inactivity_timer, on, 0); |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1106 | } |
| 1107 | |
| 1108 | return CMD_SUCCESS; |
| 1109 | } |
| 1110 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1111 | DEFUN (ipv6_ospf6_cost, |
| 1112 | ipv6_ospf6_cost_cmd, |
| 1113 | "ipv6 ospf6 cost <1-65535>", |
| 1114 | IP6_STR |
| 1115 | OSPF6_STR |
| 1116 | "Interface cost\n" |
| 1117 | "Outgoing metric of this interface\n" |
| 1118 | ) |
| 1119 | { |
| 1120 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1121 | struct interface *ifp; |
paul | 0c083ee | 2004-10-10 12:54:58 +0000 | [diff] [blame] | 1122 | unsigned long int lcost; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1123 | |
| 1124 | ifp = (struct interface *) vty->index; |
| 1125 | assert (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1126 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1127 | oi = (struct ospf6_interface *) ifp->info; |
| 1128 | if (oi == NULL) |
| 1129 | oi = ospf6_interface_create (ifp); |
| 1130 | assert (oi); |
| 1131 | |
paul | 0c083ee | 2004-10-10 12:54:58 +0000 | [diff] [blame] | 1132 | lcost = strtol (argv[0], NULL, 10); |
| 1133 | |
| 1134 | if (lcost > UINT32_MAX) |
| 1135 | { |
| 1136 | vty_out (vty, "Cost %ld is out of range%s", lcost, VNL); |
| 1137 | return CMD_WARNING; |
| 1138 | } |
| 1139 | |
| 1140 | if (oi->cost == lcost) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1141 | return CMD_SUCCESS; |
paul | 0c083ee | 2004-10-10 12:54:58 +0000 | [diff] [blame] | 1142 | |
| 1143 | oi->cost = lcost; |
| 1144 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1145 | /* update cost held in route_connected list in ospf6_interface */ |
| 1146 | ospf6_interface_connected_route_update (oi->interface); |
| 1147 | |
| 1148 | /* execute LSA hooks */ |
| 1149 | if (oi->area) |
| 1150 | { |
| 1151 | OSPF6_LINK_LSA_SCHEDULE (oi); |
| 1152 | OSPF6_ROUTER_LSA_SCHEDULE (oi->area); |
| 1153 | OSPF6_NETWORK_LSA_SCHEDULE (oi); |
| 1154 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi); |
| 1155 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area); |
| 1156 | } |
| 1157 | |
| 1158 | return CMD_SUCCESS; |
| 1159 | } |
| 1160 | |
| 1161 | DEFUN (ipv6_ospf6_hellointerval, |
| 1162 | ipv6_ospf6_hellointerval_cmd, |
| 1163 | "ipv6 ospf6 hello-interval <1-65535>", |
| 1164 | IP6_STR |
| 1165 | OSPF6_STR |
| 1166 | "Interval time of Hello packets\n" |
| 1167 | SECONDS_STR |
| 1168 | ) |
| 1169 | { |
| 1170 | struct ospf6_interface *oi; |
| 1171 | struct interface *ifp; |
| 1172 | |
| 1173 | ifp = (struct interface *) vty->index; |
| 1174 | assert (ifp); |
| 1175 | |
| 1176 | oi = (struct ospf6_interface *) ifp->info; |
| 1177 | if (oi == NULL) |
| 1178 | oi = ospf6_interface_create (ifp); |
| 1179 | assert (oi); |
| 1180 | |
| 1181 | oi->hello_interval = strtol (argv[0], NULL, 10); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1182 | return CMD_SUCCESS; |
| 1183 | } |
| 1184 | |
| 1185 | /* interface variable set command */ |
| 1186 | DEFUN (ipv6_ospf6_deadinterval, |
| 1187 | ipv6_ospf6_deadinterval_cmd, |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1188 | "ipv6 ospf6 dead-interval <1-65535>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1189 | IP6_STR |
| 1190 | OSPF6_STR |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1191 | "Interval time after which a neighbor is declared down\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1192 | SECONDS_STR |
| 1193 | ) |
| 1194 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1195 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1196 | struct interface *ifp; |
| 1197 | |
| 1198 | ifp = (struct interface *) vty->index; |
| 1199 | assert (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1200 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1201 | oi = (struct ospf6_interface *) ifp->info; |
| 1202 | if (oi == NULL) |
| 1203 | oi = ospf6_interface_create (ifp); |
| 1204 | assert (oi); |
| 1205 | |
| 1206 | oi->dead_interval = strtol (argv[0], NULL, 10); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1207 | return CMD_SUCCESS; |
| 1208 | } |
| 1209 | |
| 1210 | /* interface variable set command */ |
| 1211 | DEFUN (ipv6_ospf6_transmitdelay, |
| 1212 | ipv6_ospf6_transmitdelay_cmd, |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1213 | "ipv6 ospf6 transmit-delay <1-3600>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1214 | IP6_STR |
| 1215 | OSPF6_STR |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1216 | "Transmit delay of this interface\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1217 | SECONDS_STR |
| 1218 | ) |
| 1219 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1220 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1221 | struct interface *ifp; |
| 1222 | |
| 1223 | ifp = (struct interface *) vty->index; |
| 1224 | assert (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1225 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1226 | oi = (struct ospf6_interface *) ifp->info; |
| 1227 | if (oi == NULL) |
| 1228 | oi = ospf6_interface_create (ifp); |
| 1229 | assert (oi); |
| 1230 | |
| 1231 | oi->transdelay = strtol (argv[0], NULL, 10); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1232 | return CMD_SUCCESS; |
| 1233 | } |
| 1234 | |
| 1235 | /* interface variable set command */ |
| 1236 | DEFUN (ipv6_ospf6_retransmitinterval, |
| 1237 | ipv6_ospf6_retransmitinterval_cmd, |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1238 | "ipv6 ospf6 retransmit-interval <1-65535>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1239 | IP6_STR |
| 1240 | OSPF6_STR |
| 1241 | "Time between retransmitting lost link state advertisements\n" |
| 1242 | SECONDS_STR |
| 1243 | ) |
| 1244 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1245 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1246 | struct interface *ifp; |
| 1247 | |
| 1248 | ifp = (struct interface *) vty->index; |
| 1249 | assert (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1250 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1251 | oi = (struct ospf6_interface *) ifp->info; |
| 1252 | if (oi == NULL) |
| 1253 | oi = ospf6_interface_create (ifp); |
| 1254 | assert (oi); |
| 1255 | |
| 1256 | oi->rxmt_interval = strtol (argv[0], NULL, 10); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1257 | return CMD_SUCCESS; |
| 1258 | } |
| 1259 | |
| 1260 | /* interface variable set command */ |
| 1261 | DEFUN (ipv6_ospf6_priority, |
| 1262 | ipv6_ospf6_priority_cmd, |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1263 | "ipv6 ospf6 priority <0-255>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1264 | IP6_STR |
| 1265 | OSPF6_STR |
| 1266 | "Router priority\n" |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1267 | "Priority value\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1268 | ) |
| 1269 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1270 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1271 | struct interface *ifp; |
| 1272 | |
| 1273 | ifp = (struct interface *) vty->index; |
| 1274 | assert (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1275 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1276 | oi = (struct ospf6_interface *) ifp->info; |
| 1277 | if (oi == NULL) |
| 1278 | oi = ospf6_interface_create (ifp); |
| 1279 | assert (oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1280 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1281 | oi->priority = strtol (argv[0], NULL, 10); |
| 1282 | |
| 1283 | if (oi->area) |
| 1284 | ospf6_interface_state_change (dr_election (oi), oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1285 | |
| 1286 | return CMD_SUCCESS; |
| 1287 | } |
| 1288 | |
| 1289 | DEFUN (ipv6_ospf6_instance, |
| 1290 | ipv6_ospf6_instance_cmd, |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1291 | "ipv6 ospf6 instance-id <0-255>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1292 | IP6_STR |
| 1293 | OSPF6_STR |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1294 | "Instance ID for this interface\n" |
| 1295 | "Instance ID value\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1296 | ) |
| 1297 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1298 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1299 | struct interface *ifp; |
| 1300 | |
| 1301 | ifp = (struct interface *)vty->index; |
| 1302 | assert (ifp); |
| 1303 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1304 | oi = (struct ospf6_interface *)ifp->info; |
| 1305 | if (oi == NULL) |
| 1306 | oi = ospf6_interface_create (ifp); |
| 1307 | assert (oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1308 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1309 | oi->instance_id = strtol (argv[0], NULL, 10); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1310 | return CMD_SUCCESS; |
| 1311 | } |
| 1312 | |
| 1313 | DEFUN (ipv6_ospf6_passive, |
| 1314 | ipv6_ospf6_passive_cmd, |
| 1315 | "ipv6 ospf6 passive", |
| 1316 | IP6_STR |
| 1317 | OSPF6_STR |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1318 | "passive interface, No adjacency will be formed on this interface\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1319 | ) |
| 1320 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1321 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1322 | struct interface *ifp; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1323 | struct listnode *node, *nnode; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1324 | struct ospf6_neighbor *on; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1325 | |
| 1326 | ifp = (struct interface *) vty->index; |
| 1327 | assert (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1328 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1329 | oi = (struct ospf6_interface *) ifp->info; |
| 1330 | if (oi == NULL) |
| 1331 | oi = ospf6_interface_create (ifp); |
| 1332 | assert (oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1333 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1334 | SET_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE); |
| 1335 | THREAD_OFF (oi->thread_send_hello); |
| 1336 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1337 | for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1338 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1339 | THREAD_OFF (on->inactivity_timer); |
hasso | 3e834b1 | 2005-06-24 07:50:12 +0000 | [diff] [blame] | 1340 | thread_add_event (master, inactivity_timer, on, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1341 | } |
| 1342 | |
| 1343 | return CMD_SUCCESS; |
| 1344 | } |
| 1345 | |
| 1346 | DEFUN (no_ipv6_ospf6_passive, |
| 1347 | no_ipv6_ospf6_passive_cmd, |
| 1348 | "no ipv6 ospf6 passive", |
| 1349 | NO_STR |
| 1350 | IP6_STR |
| 1351 | OSPF6_STR |
| 1352 | "passive interface: No Adjacency will be formed on this I/F\n" |
| 1353 | ) |
| 1354 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1355 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1356 | struct interface *ifp; |
| 1357 | |
| 1358 | ifp = (struct interface *) vty->index; |
| 1359 | assert (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1360 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1361 | oi = (struct ospf6_interface *) ifp->info; |
| 1362 | if (oi == NULL) |
| 1363 | oi = ospf6_interface_create (ifp); |
| 1364 | assert (oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1365 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1366 | UNSET_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE); |
| 1367 | THREAD_OFF (oi->thread_send_hello); |
| 1368 | oi->thread_send_hello = |
| 1369 | thread_add_event (master, ospf6_hello_send, oi, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1370 | |
| 1371 | return CMD_SUCCESS; |
| 1372 | } |
| 1373 | |
Dmitrij Tejblum | d42306d | 2011-04-22 19:27:54 +0400 | [diff] [blame] | 1374 | DEFUN (ipv6_ospf6_mtu_ignore, |
| 1375 | ipv6_ospf6_mtu_ignore_cmd, |
| 1376 | "ipv6 ospf6 mtu-ignore", |
| 1377 | IP6_STR |
| 1378 | OSPF6_STR |
| 1379 | "Ignore MTU mismatch on this interface\n" |
| 1380 | ) |
| 1381 | { |
| 1382 | struct ospf6_interface *oi; |
| 1383 | struct interface *ifp; |
| 1384 | |
| 1385 | ifp = (struct interface *) vty->index; |
| 1386 | assert (ifp); |
| 1387 | |
| 1388 | oi = (struct ospf6_interface *) ifp->info; |
| 1389 | if (oi == NULL) |
| 1390 | oi = ospf6_interface_create (ifp); |
| 1391 | assert (oi); |
| 1392 | |
| 1393 | oi->mtu_ignore = 1; |
| 1394 | |
| 1395 | return CMD_SUCCESS; |
| 1396 | } |
| 1397 | |
| 1398 | DEFUN (no_ipv6_ospf6_mtu_ignore, |
| 1399 | no_ipv6_ospf6_mtu_ignore_cmd, |
| 1400 | "no ipv6 ospf6 mtu-ignore", |
| 1401 | NO_STR |
| 1402 | IP6_STR |
| 1403 | OSPF6_STR |
| 1404 | "Ignore MTU mismatch on this interface\n" |
| 1405 | ) |
| 1406 | { |
| 1407 | struct ospf6_interface *oi; |
| 1408 | struct interface *ifp; |
| 1409 | |
| 1410 | ifp = (struct interface *) vty->index; |
| 1411 | assert (ifp); |
| 1412 | |
| 1413 | oi = (struct ospf6_interface *) ifp->info; |
| 1414 | if (oi == NULL) |
| 1415 | oi = ospf6_interface_create (ifp); |
| 1416 | assert (oi); |
| 1417 | |
| 1418 | oi->mtu_ignore = 0; |
| 1419 | |
| 1420 | return CMD_SUCCESS; |
| 1421 | } |
| 1422 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1423 | DEFUN (ipv6_ospf6_advertise_prefix_list, |
| 1424 | ipv6_ospf6_advertise_prefix_list_cmd, |
| 1425 | "ipv6 ospf6 advertise prefix-list WORD", |
| 1426 | IP6_STR |
| 1427 | OSPF6_STR |
| 1428 | "Advertising options\n" |
| 1429 | "Filter prefix using prefix-list\n" |
| 1430 | "Prefix list name\n" |
| 1431 | ) |
| 1432 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1433 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1434 | struct interface *ifp; |
| 1435 | |
| 1436 | ifp = (struct interface *) vty->index; |
| 1437 | assert (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1438 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1439 | oi = (struct ospf6_interface *) ifp->info; |
| 1440 | if (oi == NULL) |
| 1441 | oi = ospf6_interface_create (ifp); |
| 1442 | assert (oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1443 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1444 | if (oi->plist_name) |
| 1445 | XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name); |
| 1446 | oi->plist_name = XSTRDUP (MTYPE_PREFIX_LIST_STR, argv[0]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1447 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1448 | ospf6_interface_connected_route_update (oi->interface); |
David Ward | 2470e99 | 2010-01-05 02:45:39 +0000 | [diff] [blame] | 1449 | |
| 1450 | if (oi->area) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1451 | { |
David Ward | 2470e99 | 2010-01-05 02:45:39 +0000 | [diff] [blame] | 1452 | OSPF6_LINK_LSA_SCHEDULE (oi); |
| 1453 | if (oi->state == OSPF6_INTERFACE_DR) |
| 1454 | { |
| 1455 | OSPF6_NETWORK_LSA_SCHEDULE (oi); |
| 1456 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi); |
| 1457 | } |
| 1458 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1459 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1460 | |
| 1461 | return CMD_SUCCESS; |
| 1462 | } |
| 1463 | |
| 1464 | DEFUN (no_ipv6_ospf6_advertise_prefix_list, |
| 1465 | no_ipv6_ospf6_advertise_prefix_list_cmd, |
| 1466 | "no ipv6 ospf6 advertise prefix-list", |
| 1467 | NO_STR |
| 1468 | IP6_STR |
| 1469 | OSPF6_STR |
| 1470 | "Advertising options\n" |
| 1471 | "Filter prefix using prefix-list\n" |
| 1472 | ) |
| 1473 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1474 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1475 | struct interface *ifp; |
| 1476 | |
| 1477 | ifp = (struct interface *) vty->index; |
| 1478 | assert (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1479 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1480 | oi = (struct ospf6_interface *) ifp->info; |
| 1481 | if (oi == NULL) |
| 1482 | oi = ospf6_interface_create (ifp); |
| 1483 | assert (oi); |
| 1484 | |
| 1485 | if (oi->plist_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1486 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1487 | XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name); |
| 1488 | oi->plist_name = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1489 | } |
| 1490 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1491 | ospf6_interface_connected_route_update (oi->interface); |
David Ward | 2470e99 | 2010-01-05 02:45:39 +0000 | [diff] [blame] | 1492 | |
| 1493 | if (oi->area) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1494 | { |
David Ward | 2470e99 | 2010-01-05 02:45:39 +0000 | [diff] [blame] | 1495 | OSPF6_LINK_LSA_SCHEDULE (oi); |
| 1496 | if (oi->state == OSPF6_INTERFACE_DR) |
| 1497 | { |
| 1498 | OSPF6_NETWORK_LSA_SCHEDULE (oi); |
| 1499 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi); |
| 1500 | } |
| 1501 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1502 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1503 | |
| 1504 | return CMD_SUCCESS; |
| 1505 | } |
| 1506 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 1507 | static int |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1508 | config_write_ospf6_interface (struct vty *vty) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1509 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 1510 | struct listnode *i; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1511 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1512 | struct interface *ifp; |
| 1513 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1514 | for (ALL_LIST_ELEMENTS_RO (iflist, i, ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1515 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1516 | oi = (struct ospf6_interface *) ifp->info; |
| 1517 | if (oi == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1518 | continue; |
| 1519 | |
| 1520 | vty_out (vty, "interface %s%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1521 | oi->interface->name, VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1522 | |
| 1523 | if (ifp->desc) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1524 | vty_out (vty, " description %s%s", ifp->desc, VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1525 | |
hasso | 1203e1c | 2004-07-23 21:34:27 +0000 | [diff] [blame] | 1526 | if (ifp->mtu6 != oi->ifmtu) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1527 | vty_out (vty, " ipv6 ospf6 ifmtu %d%s", oi->ifmtu, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1528 | vty_out (vty, " ipv6 ospf6 cost %d%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1529 | oi->cost, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1530 | vty_out (vty, " ipv6 ospf6 hello-interval %d%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1531 | oi->hello_interval, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1532 | vty_out (vty, " ipv6 ospf6 dead-interval %d%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1533 | oi->dead_interval, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1534 | vty_out (vty, " ipv6 ospf6 retransmit-interval %d%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1535 | oi->rxmt_interval, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1536 | vty_out (vty, " ipv6 ospf6 priority %d%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1537 | oi->priority, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1538 | vty_out (vty, " ipv6 ospf6 transmit-delay %d%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1539 | oi->transdelay, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1540 | vty_out (vty, " ipv6 ospf6 instance-id %d%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1541 | oi->instance_id, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1542 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1543 | if (oi->plist_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1544 | vty_out (vty, " ipv6 ospf6 advertise prefix-list %s%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1545 | oi->plist_name, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1546 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1547 | if (CHECK_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE)) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1548 | vty_out (vty, " ipv6 ospf6 passive%s", VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1549 | |
Dmitrij Tejblum | d42306d | 2011-04-22 19:27:54 +0400 | [diff] [blame] | 1550 | if (oi->mtu_ignore) |
| 1551 | vty_out (vty, " ipv6 ospf6 mtu-ignore%s", VNL); |
| 1552 | |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1553 | vty_out (vty, "!%s", VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1554 | } |
| 1555 | return 0; |
| 1556 | } |
| 1557 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 1558 | static struct cmd_node interface_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1559 | { |
| 1560 | INTERFACE_NODE, |
| 1561 | "%s(config-if)# ", |
hasso | 69b4a81 | 2004-08-26 18:10:36 +0000 | [diff] [blame] | 1562 | 1 /* VTYSH */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1563 | }; |
| 1564 | |
| 1565 | void |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 1566 | ospf6_interface_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1567 | { |
| 1568 | /* Install interface node. */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1569 | install_node (&interface_node, config_write_ospf6_interface); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1570 | |
| 1571 | install_element (VIEW_NODE, &show_ipv6_ospf6_interface_cmd); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1572 | install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_cmd); |
| 1573 | install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_detail_cmd); |
| 1574 | install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_match_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1575 | install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_cmd); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1576 | install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_cmd); |
| 1577 | install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd); |
| 1578 | install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1579 | install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_cmd); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1580 | install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_cmd); |
| 1581 | install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_detail_cmd); |
| 1582 | install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_match_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1583 | install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_cmd); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1584 | install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_cmd); |
| 1585 | install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd); |
| 1586 | install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1587 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1588 | install_element (CONFIG_NODE, &interface_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1589 | install_default (INTERFACE_NODE); |
| 1590 | install_element (INTERFACE_NODE, &interface_desc_cmd); |
| 1591 | install_element (INTERFACE_NODE, &no_interface_desc_cmd); |
| 1592 | install_element (INTERFACE_NODE, &ipv6_ospf6_cost_cmd); |
hasso | b596c71 | 2004-07-09 18:33:43 +0000 | [diff] [blame] | 1593 | install_element (INTERFACE_NODE, &ipv6_ospf6_ifmtu_cmd); |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1594 | install_element (INTERFACE_NODE, &no_ipv6_ospf6_ifmtu_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1595 | install_element (INTERFACE_NODE, &ipv6_ospf6_deadinterval_cmd); |
| 1596 | install_element (INTERFACE_NODE, &ipv6_ospf6_hellointerval_cmd); |
| 1597 | install_element (INTERFACE_NODE, &ipv6_ospf6_priority_cmd); |
| 1598 | install_element (INTERFACE_NODE, &ipv6_ospf6_retransmitinterval_cmd); |
| 1599 | install_element (INTERFACE_NODE, &ipv6_ospf6_transmitdelay_cmd); |
| 1600 | install_element (INTERFACE_NODE, &ipv6_ospf6_instance_cmd); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1601 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1602 | install_element (INTERFACE_NODE, &ipv6_ospf6_passive_cmd); |
| 1603 | install_element (INTERFACE_NODE, &no_ipv6_ospf6_passive_cmd); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1604 | |
Dmitrij Tejblum | d42306d | 2011-04-22 19:27:54 +0400 | [diff] [blame] | 1605 | install_element (INTERFACE_NODE, &ipv6_ospf6_mtu_ignore_cmd); |
| 1606 | install_element (INTERFACE_NODE, &no_ipv6_ospf6_mtu_ignore_cmd); |
| 1607 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1608 | install_element (INTERFACE_NODE, &ipv6_ospf6_advertise_prefix_list_cmd); |
| 1609 | install_element (INTERFACE_NODE, &no_ipv6_ospf6_advertise_prefix_list_cmd); |
| 1610 | } |
| 1611 | |
| 1612 | DEFUN (debug_ospf6_interface, |
| 1613 | debug_ospf6_interface_cmd, |
| 1614 | "debug ospf6 interface", |
| 1615 | DEBUG_STR |
| 1616 | OSPF6_STR |
| 1617 | "Debug OSPFv3 Interface\n" |
| 1618 | ) |
| 1619 | { |
| 1620 | OSPF6_DEBUG_INTERFACE_ON (); |
| 1621 | return CMD_SUCCESS; |
| 1622 | } |
| 1623 | |
| 1624 | DEFUN (no_debug_ospf6_interface, |
| 1625 | no_debug_ospf6_interface_cmd, |
| 1626 | "no debug ospf6 interface", |
| 1627 | NO_STR |
| 1628 | DEBUG_STR |
| 1629 | OSPF6_STR |
| 1630 | "Debug OSPFv3 Interface\n" |
| 1631 | ) |
| 1632 | { |
hasso | 3b68735 | 2004-08-19 06:56:53 +0000 | [diff] [blame] | 1633 | OSPF6_DEBUG_INTERFACE_OFF (); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1634 | return CMD_SUCCESS; |
| 1635 | } |
| 1636 | |
| 1637 | int |
| 1638 | config_write_ospf6_debug_interface (struct vty *vty) |
| 1639 | { |
| 1640 | if (IS_OSPF6_DEBUG_INTERFACE) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1641 | vty_out (vty, "debug ospf6 interface%s", VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1642 | return 0; |
| 1643 | } |
| 1644 | |
| 1645 | void |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 1646 | install_element_ospf6_debug_interface (void) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1647 | { |
| 1648 | install_element (ENABLE_NODE, &debug_ospf6_interface_cmd); |
| 1649 | install_element (ENABLE_NODE, &no_debug_ospf6_interface_cmd); |
| 1650 | install_element (CONFIG_NODE, &debug_ospf6_interface_cmd); |
| 1651 | install_element (CONFIG_NODE, &no_debug_ospf6_interface_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1652 | } |
| 1653 | |
| 1654 | |