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