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; |
Vyacheslav Trushkin | b51a3a3 | 2012-02-10 10:42:45 +0400 | [diff] [blame] | 111 | oi->instance_id = OSPF6_INTERFACE_INSTANCE_ID; |
| 112 | oi->transdelay = OSPF6_INTERFACE_TRANSDELAY; |
| 113 | oi->priority = OSPF6_INTERFACE_PRIORITY; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 114 | |
Vyacheslav Trushkin | b51a3a3 | 2012-02-10 10:42:45 +0400 | [diff] [blame] | 115 | oi->hello_interval = OSPF6_INTERFACE_HELLO_INTERVAL; |
| 116 | oi->dead_interval = OSPF6_INTERFACE_DEAD_INTERVAL; |
| 117 | oi->rxmt_interval = OSPF6_INTERFACE_RXMT_INTERVAL; |
| 118 | oi->cost = OSPF6_INTERFACE_COST; |
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 | } |
Vincent Bernat | 3bc4f84 | 2012-06-04 11:40:04 +0200 | [diff] [blame^] | 397 | oi->state_change++; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 398 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 399 | if ((prev_state == OSPF6_INTERFACE_DR || |
| 400 | prev_state == OSPF6_INTERFACE_BDR) && |
| 401 | (next_state != OSPF6_INTERFACE_DR && |
| 402 | next_state != OSPF6_INTERFACE_BDR)) |
Vyacheslav Trushkin | 9a9446e | 2011-11-21 20:26:39 +0400 | [diff] [blame] | 403 | ospf6_sso (oi->interface->ifindex, &alldrouters6, IPV6_LEAVE_GROUP); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 404 | if ((prev_state != OSPF6_INTERFACE_DR && |
| 405 | prev_state != OSPF6_INTERFACE_BDR) && |
| 406 | (next_state == OSPF6_INTERFACE_DR || |
| 407 | next_state == OSPF6_INTERFACE_BDR)) |
Vyacheslav Trushkin | 9a9446e | 2011-11-21 20:26:39 +0400 | [diff] [blame] | 408 | ospf6_sso (oi->interface->ifindex, &alldrouters6, IPV6_JOIN_GROUP); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 409 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 410 | OSPF6_ROUTER_LSA_SCHEDULE (oi->area); |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 411 | if (next_state == OSPF6_INTERFACE_DOWN) |
| 412 | { |
| 413 | OSPF6_NETWORK_LSA_EXECUTE (oi); |
| 414 | OSPF6_INTRA_PREFIX_LSA_EXECUTE_TRANSIT (oi); |
| 415 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area); |
| 416 | } |
| 417 | else if (prev_state == OSPF6_INTERFACE_DR || |
| 418 | next_state == OSPF6_INTERFACE_DR) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 419 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 420 | OSPF6_NETWORK_LSA_SCHEDULE (oi); |
| 421 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi); |
| 422 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 423 | } |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 424 | } |
| 425 | |
| 426 | |
| 427 | /* DR Election, RFC2328 section 9.4 */ |
| 428 | |
| 429 | #define IS_ELIGIBLE(n) \ |
| 430 | ((n)->state >= OSPF6_NEIGHBOR_TWOWAY && (n)->priority != 0) |
| 431 | |
| 432 | static struct ospf6_neighbor * |
| 433 | better_bdrouter (struct ospf6_neighbor *a, struct ospf6_neighbor *b) |
| 434 | { |
| 435 | if ((a == NULL || ! IS_ELIGIBLE (a) || a->drouter == a->router_id) && |
| 436 | (b == NULL || ! IS_ELIGIBLE (b) || b->drouter == b->router_id)) |
| 437 | return NULL; |
| 438 | else if (a == NULL || ! IS_ELIGIBLE (a) || a->drouter == a->router_id) |
| 439 | return b; |
| 440 | else if (b == NULL || ! IS_ELIGIBLE (b) || b->drouter == b->router_id) |
| 441 | return a; |
| 442 | |
| 443 | if (a->bdrouter == a->router_id && b->bdrouter != b->router_id) |
| 444 | return a; |
| 445 | if (a->bdrouter != a->router_id && b->bdrouter == b->router_id) |
| 446 | return b; |
| 447 | |
| 448 | if (a->priority > b->priority) |
| 449 | return a; |
| 450 | if (a->priority < b->priority) |
| 451 | return b; |
| 452 | |
| 453 | if (ntohl (a->router_id) > ntohl (b->router_id)) |
| 454 | return a; |
| 455 | if (ntohl (a->router_id) < ntohl (b->router_id)) |
| 456 | return b; |
| 457 | |
| 458 | zlog_warn ("Router-ID duplicate ?"); |
| 459 | return a; |
| 460 | } |
| 461 | |
| 462 | static struct ospf6_neighbor * |
| 463 | better_drouter (struct ospf6_neighbor *a, struct ospf6_neighbor *b) |
| 464 | { |
| 465 | if ((a == NULL || ! IS_ELIGIBLE (a) || a->drouter != a->router_id) && |
| 466 | (b == NULL || ! IS_ELIGIBLE (b) || b->drouter != b->router_id)) |
| 467 | return NULL; |
| 468 | else if (a == NULL || ! IS_ELIGIBLE (a) || a->drouter != a->router_id) |
| 469 | return b; |
| 470 | else if (b == NULL || ! IS_ELIGIBLE (b) || b->drouter != b->router_id) |
| 471 | return a; |
| 472 | |
| 473 | if (a->drouter == a->router_id && b->drouter != b->router_id) |
| 474 | return a; |
| 475 | if (a->drouter != a->router_id && b->drouter == b->router_id) |
| 476 | return b; |
| 477 | |
| 478 | if (a->priority > b->priority) |
| 479 | return a; |
| 480 | if (a->priority < b->priority) |
| 481 | return b; |
| 482 | |
| 483 | if (ntohl (a->router_id) > ntohl (b->router_id)) |
| 484 | return a; |
| 485 | if (ntohl (a->router_id) < ntohl (b->router_id)) |
| 486 | return b; |
| 487 | |
| 488 | zlog_warn ("Router-ID duplicate ?"); |
| 489 | return a; |
| 490 | } |
| 491 | |
| 492 | static u_char |
| 493 | dr_election (struct ospf6_interface *oi) |
| 494 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 495 | struct listnode *node, *nnode; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 496 | struct ospf6_neighbor *on, *drouter, *bdrouter, myself; |
| 497 | struct ospf6_neighbor *best_drouter, *best_bdrouter; |
| 498 | u_char next_state = 0; |
| 499 | |
| 500 | drouter = bdrouter = NULL; |
| 501 | best_drouter = best_bdrouter = NULL; |
| 502 | |
| 503 | /* pseudo neighbor myself, including noting current DR/BDR (1) */ |
| 504 | memset (&myself, 0, sizeof (myself)); |
| 505 | inet_ntop (AF_INET, &oi->area->ospf6->router_id, myself.name, |
| 506 | sizeof (myself.name)); |
| 507 | myself.state = OSPF6_NEIGHBOR_TWOWAY; |
| 508 | myself.drouter = oi->drouter; |
| 509 | myself.bdrouter = oi->bdrouter; |
| 510 | myself.priority = oi->priority; |
| 511 | myself.router_id = oi->area->ospf6->router_id; |
| 512 | |
| 513 | /* Electing BDR (2) */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 514 | for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on)) |
| 515 | bdrouter = better_bdrouter (bdrouter, on); |
| 516 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 517 | best_bdrouter = bdrouter; |
| 518 | bdrouter = better_bdrouter (best_bdrouter, &myself); |
| 519 | |
| 520 | /* Electing DR (3) */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 521 | for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on)) |
| 522 | drouter = better_drouter (drouter, on); |
| 523 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 524 | best_drouter = drouter; |
| 525 | drouter = better_drouter (best_drouter, &myself); |
| 526 | if (drouter == NULL) |
| 527 | drouter = bdrouter; |
| 528 | |
| 529 | /* the router itself is newly/no longer DR/BDR (4) */ |
| 530 | if ((drouter == &myself && myself.drouter != myself.router_id) || |
| 531 | (drouter != &myself && myself.drouter == myself.router_id) || |
| 532 | (bdrouter == &myself && myself.bdrouter != myself.router_id) || |
| 533 | (bdrouter != &myself && myself.bdrouter == myself.router_id)) |
| 534 | { |
| 535 | myself.drouter = (drouter ? drouter->router_id : htonl (0)); |
| 536 | myself.bdrouter = (bdrouter ? bdrouter->router_id : htonl (0)); |
| 537 | |
| 538 | /* compatible to Electing BDR (2) */ |
| 539 | bdrouter = better_bdrouter (best_bdrouter, &myself); |
| 540 | |
| 541 | /* compatible to Electing DR (3) */ |
| 542 | drouter = better_drouter (best_drouter, &myself); |
| 543 | if (drouter == NULL) |
| 544 | drouter = bdrouter; |
| 545 | } |
| 546 | |
| 547 | /* Set interface state accordingly (5) */ |
| 548 | if (drouter && drouter == &myself) |
| 549 | next_state = OSPF6_INTERFACE_DR; |
| 550 | else if (bdrouter && bdrouter == &myself) |
| 551 | next_state = OSPF6_INTERFACE_BDR; |
| 552 | else |
| 553 | next_state = OSPF6_INTERFACE_DROTHER; |
| 554 | |
| 555 | /* If NBMA, schedule Start for each neighbor having priority of 0 (6) */ |
| 556 | /* XXX */ |
| 557 | |
| 558 | /* If DR or BDR change, invoke AdjOK? for each neighbor (7) */ |
| 559 | /* RFC 2328 section 12.4. Originating LSAs (3) will be handled |
| 560 | accordingly after AdjOK */ |
| 561 | if (oi->drouter != (drouter ? drouter->router_id : htonl (0)) || |
| 562 | oi->bdrouter != (bdrouter ? bdrouter->router_id : htonl (0))) |
| 563 | { |
| 564 | if (IS_OSPF6_DEBUG_INTERFACE) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 565 | zlog_debug ("DR Election on %s: DR: %s BDR: %s", oi->interface->name, |
| 566 | (drouter ? drouter->name : "0.0.0.0"), |
| 567 | (bdrouter ? bdrouter->name : "0.0.0.0")); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 568 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 569 | for (ALL_LIST_ELEMENTS_RO (oi->neighbor_list, node, on)) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 570 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 571 | if (on->state < OSPF6_NEIGHBOR_TWOWAY) |
| 572 | continue; |
| 573 | /* Schedule AdjOK. */ |
| 574 | thread_add_event (master, adj_ok, on, 0); |
| 575 | } |
| 576 | } |
| 577 | |
| 578 | oi->drouter = (drouter ? drouter->router_id : htonl (0)); |
| 579 | oi->bdrouter = (bdrouter ? bdrouter->router_id : htonl (0)); |
| 580 | return next_state; |
| 581 | } |
| 582 | |
| 583 | |
| 584 | /* Interface State Machine */ |
| 585 | int |
| 586 | interface_up (struct thread *thread) |
| 587 | { |
| 588 | struct ospf6_interface *oi; |
| 589 | |
| 590 | oi = (struct ospf6_interface *) THREAD_ARG (thread); |
| 591 | assert (oi && oi->interface); |
| 592 | |
| 593 | if (IS_OSPF6_DEBUG_INTERFACE) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 594 | zlog_debug ("Interface Event %s: [InterfaceUp]", |
| 595 | oi->interface->name); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 596 | |
| 597 | /* check physical interface is up */ |
| 598 | if (! if_is_up (oi->interface)) |
| 599 | { |
| 600 | if (IS_OSPF6_DEBUG_INTERFACE) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 601 | zlog_debug ("Interface %s is down, can't execute [InterfaceUp]", |
| 602 | oi->interface->name); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 603 | return 0; |
| 604 | } |
| 605 | |
| 606 | /* if already enabled, do nothing */ |
| 607 | if (oi->state > OSPF6_INTERFACE_DOWN) |
| 608 | { |
| 609 | if (IS_OSPF6_DEBUG_INTERFACE) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 610 | zlog_debug ("Interface %s already enabled", |
| 611 | oi->interface->name); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 612 | return 0; |
| 613 | } |
| 614 | |
| 615 | /* Join AllSPFRouters */ |
Vyacheslav Trushkin | 9a9446e | 2011-11-21 20:26:39 +0400 | [diff] [blame] | 616 | ospf6_sso (oi->interface->ifindex, &allspfrouters6, IPV6_JOIN_GROUP); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 617 | |
| 618 | /* Update interface route */ |
| 619 | ospf6_interface_connected_route_update (oi->interface); |
| 620 | |
| 621 | /* Schedule Hello */ |
| 622 | if (! CHECK_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE)) |
| 623 | thread_add_event (master, ospf6_hello_send, oi, 0); |
| 624 | |
| 625 | /* decide next interface state */ |
| 626 | if (if_is_pointopoint (oi->interface)) |
| 627 | ospf6_interface_state_change (OSPF6_INTERFACE_POINTTOPOINT, oi); |
| 628 | else if (oi->priority == 0) |
| 629 | ospf6_interface_state_change (OSPF6_INTERFACE_DROTHER, oi); |
| 630 | else |
| 631 | { |
| 632 | ospf6_interface_state_change (OSPF6_INTERFACE_WAITING, oi); |
| 633 | thread_add_timer (master, wait_timer, oi, oi->dead_interval); |
| 634 | } |
| 635 | |
| 636 | return 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 637 | } |
| 638 | |
| 639 | int |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 640 | wait_timer (struct thread *thread) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 641 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 642 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 643 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 644 | oi = (struct ospf6_interface *) THREAD_ARG (thread); |
| 645 | assert (oi && oi->interface); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 646 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 647 | if (IS_OSPF6_DEBUG_INTERFACE) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 648 | zlog_debug ("Interface Event %s: [WaitTimer]", |
| 649 | oi->interface->name); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 650 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 651 | if (oi->state == OSPF6_INTERFACE_WAITING) |
| 652 | ospf6_interface_state_change (dr_election (oi), oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 653 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 654 | return 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 655 | } |
| 656 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 657 | int |
| 658 | backup_seen (struct thread *thread) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 659 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 660 | struct ospf6_interface *oi; |
| 661 | |
| 662 | oi = (struct ospf6_interface *) THREAD_ARG (thread); |
| 663 | assert (oi && oi->interface); |
| 664 | |
| 665 | if (IS_OSPF6_DEBUG_INTERFACE) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 666 | zlog_debug ("Interface Event %s: [BackupSeen]", |
| 667 | oi->interface->name); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 668 | |
| 669 | if (oi->state == OSPF6_INTERFACE_WAITING) |
| 670 | ospf6_interface_state_change (dr_election (oi), oi); |
| 671 | |
| 672 | return 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 673 | } |
| 674 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 675 | int |
| 676 | neighbor_change (struct thread *thread) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 677 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 678 | struct ospf6_interface *oi; |
| 679 | |
| 680 | oi = (struct ospf6_interface *) THREAD_ARG (thread); |
| 681 | assert (oi && oi->interface); |
| 682 | |
| 683 | if (IS_OSPF6_DEBUG_INTERFACE) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 684 | zlog_debug ("Interface Event %s: [NeighborChange]", |
| 685 | oi->interface->name); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 686 | |
| 687 | if (oi->state == OSPF6_INTERFACE_DROTHER || |
| 688 | oi->state == OSPF6_INTERFACE_BDR || |
| 689 | oi->state == OSPF6_INTERFACE_DR) |
| 690 | ospf6_interface_state_change (dr_election (oi), oi); |
| 691 | |
| 692 | return 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 693 | } |
| 694 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 695 | int |
| 696 | interface_down (struct thread *thread) |
| 697 | { |
| 698 | struct ospf6_interface *oi; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 699 | struct listnode *node, *nnode; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 700 | struct ospf6_neighbor *on; |
| 701 | |
| 702 | oi = (struct ospf6_interface *) THREAD_ARG (thread); |
| 703 | assert (oi && oi->interface); |
| 704 | |
| 705 | if (IS_OSPF6_DEBUG_INTERFACE) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 706 | zlog_debug ("Interface Event %s: [InterfaceDown]", |
| 707 | oi->interface->name); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 708 | |
| 709 | /* Leave AllSPFRouters */ |
| 710 | if (oi->state > OSPF6_INTERFACE_DOWN) |
Vyacheslav Trushkin | 9a9446e | 2011-11-21 20:26:39 +0400 | [diff] [blame] | 711 | ospf6_sso (oi->interface->ifindex, &allspfrouters6, IPV6_LEAVE_GROUP); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 712 | |
| 713 | ospf6_interface_state_change (OSPF6_INTERFACE_DOWN, oi); |
| 714 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 715 | for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on)) |
| 716 | ospf6_neighbor_delete (on); |
| 717 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 718 | list_delete_all_node (oi->neighbor_list); |
| 719 | |
| 720 | return 0; |
| 721 | } |
| 722 | |
| 723 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 724 | /* show specified interface structure */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 725 | static int |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 726 | ospf6_interface_show (struct vty *vty, struct interface *ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 727 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 728 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 729 | struct connected *c; |
| 730 | struct prefix *p; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 731 | struct listnode *i; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 732 | char strbuf[64], drouter[32], bdrouter[32]; |
paul | 0c083ee | 2004-10-10 12:54:58 +0000 | [diff] [blame] | 733 | const char *updown[3] = {"down", "up", NULL}; |
| 734 | const char *type; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 735 | struct timeval res, now; |
| 736 | char duration[32]; |
| 737 | struct ospf6_lsa *lsa; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 738 | |
| 739 | /* check physical interface type */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 740 | if (if_is_loopback (ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 741 | type = "LOOPBACK"; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 742 | else if (if_is_broadcast (ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 743 | type = "BROADCAST"; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 744 | else if (if_is_pointopoint (ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 745 | type = "POINTOPOINT"; |
| 746 | else |
| 747 | type = "UNKNOWN"; |
| 748 | |
| 749 | vty_out (vty, "%s is %s, type %s%s", |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 750 | ifp->name, updown[if_is_up (ifp)], type, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 751 | VNL); |
| 752 | vty_out (vty, " Interface ID: %d%s", ifp->ifindex, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 753 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 754 | if (ifp->info == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 755 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 756 | vty_out (vty, " OSPF not enabled on this interface%s", VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 757 | return 0; |
| 758 | } |
| 759 | else |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 760 | oi = (struct ospf6_interface *) ifp->info; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 761 | |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 762 | vty_out (vty, " Internet Address:%s", VNL); |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 763 | |
| 764 | for (ALL_LIST_ELEMENTS_RO (ifp->connected, i, c)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 765 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 766 | p = c->address; |
| 767 | prefix2str (p, strbuf, sizeof (strbuf)); |
| 768 | switch (p->family) |
| 769 | { |
| 770 | case AF_INET: |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 771 | vty_out (vty, " inet : %s%s", strbuf, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 772 | VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 773 | break; |
| 774 | case AF_INET6: |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 775 | vty_out (vty, " inet6: %s%s", strbuf, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 776 | VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 777 | break; |
| 778 | default: |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 779 | vty_out (vty, " ??? : %s%s", strbuf, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 780 | VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 781 | break; |
| 782 | } |
| 783 | } |
| 784 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 785 | if (oi->area) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 786 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 787 | vty_out (vty, " Instance ID %d, Interface MTU %d (autodetect: %d)%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 788 | oi->instance_id, oi->ifmtu, ifp->mtu6, VNL); |
Dmitrij Tejblum | d42306d | 2011-04-22 19:27:54 +0400 | [diff] [blame] | 789 | vty_out (vty, " MTU mismatch detection: %s%s", oi->mtu_ignore ? |
| 790 | "disabled" : "enabled", VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 791 | inet_ntop (AF_INET, &oi->area->area_id, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 792 | strbuf, sizeof (strbuf)); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 793 | vty_out (vty, " Area ID %s, Cost %hu%s", strbuf, oi->cost, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 794 | VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 795 | } |
| 796 | else |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 797 | vty_out (vty, " Not Attached to Area%s", VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 798 | |
| 799 | vty_out (vty, " State %s, Transmit Delay %d sec, Priority %d%s", |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 800 | ospf6_interface_state_str[oi->state], |
| 801 | oi->transdelay, oi->priority, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 802 | VNL); |
| 803 | vty_out (vty, " Timer intervals configured:%s", VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 804 | vty_out (vty, " Hello %d, Dead %d, Retransmit %d%s", |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 805 | oi->hello_interval, oi->dead_interval, oi->rxmt_interval, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 806 | VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 807 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 808 | inet_ntop (AF_INET, &oi->drouter, drouter, sizeof (drouter)); |
| 809 | inet_ntop (AF_INET, &oi->bdrouter, bdrouter, sizeof (bdrouter)); |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 810 | vty_out (vty, " DR: %s BDR: %s%s", drouter, bdrouter, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 811 | |
| 812 | vty_out (vty, " Number of I/F scoped LSAs is %u%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 813 | oi->lsdb->count, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 814 | |
Takashi Sogabe | 86f72dc | 2009-06-22 13:07:02 +0900 | [diff] [blame] | 815 | quagga_gettime (QUAGGA_CLK_MONOTONIC, &now); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 816 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 817 | timerclear (&res); |
| 818 | if (oi->thread_send_lsupdate) |
| 819 | timersub (&oi->thread_send_lsupdate->u.sands, &now, &res); |
| 820 | timerstring (&res, duration, sizeof (duration)); |
| 821 | vty_out (vty, " %d Pending LSAs for LSUpdate in Time %s [thread %s]%s", |
| 822 | oi->lsupdate_list->count, duration, |
| 823 | (oi->thread_send_lsupdate ? "on" : "off"), |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 824 | VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 825 | for (lsa = ospf6_lsdb_head (oi->lsupdate_list); lsa; |
| 826 | lsa = ospf6_lsdb_next (lsa)) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 827 | vty_out (vty, " %s%s", lsa->name, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 828 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 829 | timerclear (&res); |
| 830 | if (oi->thread_send_lsack) |
| 831 | timersub (&oi->thread_send_lsack->u.sands, &now, &res); |
| 832 | timerstring (&res, duration, sizeof (duration)); |
| 833 | vty_out (vty, " %d Pending LSAs for LSAck in Time %s [thread %s]%s", |
| 834 | oi->lsack_list->count, duration, |
| 835 | (oi->thread_send_lsack ? "on" : "off"), |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 836 | VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 837 | for (lsa = ospf6_lsdb_head (oi->lsack_list); lsa; |
| 838 | lsa = ospf6_lsdb_next (lsa)) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 839 | vty_out (vty, " %s%s", lsa->name, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 840 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 841 | return 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 842 | } |
| 843 | |
| 844 | /* show interface */ |
| 845 | DEFUN (show_ipv6_ospf6_interface, |
| 846 | show_ipv6_ospf6_interface_ifname_cmd, |
| 847 | "show ipv6 ospf6 interface IFNAME", |
| 848 | SHOW_STR |
| 849 | IP6_STR |
| 850 | OSPF6_STR |
| 851 | INTERFACE_STR |
| 852 | IFNAME_STR |
| 853 | ) |
| 854 | { |
| 855 | struct interface *ifp; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 856 | struct listnode *i; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 857 | |
| 858 | if (argc) |
| 859 | { |
| 860 | ifp = if_lookup_by_name (argv[0]); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 861 | if (ifp == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 862 | { |
| 863 | vty_out (vty, "No such Interface: %s%s", argv[0], |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 864 | VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 865 | return CMD_WARNING; |
| 866 | } |
| 867 | ospf6_interface_show (vty, ifp); |
| 868 | } |
| 869 | else |
| 870 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 871 | for (ALL_LIST_ELEMENTS_RO (iflist, i, ifp)) |
| 872 | ospf6_interface_show (vty, ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 873 | } |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 874 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 875 | return CMD_SUCCESS; |
| 876 | } |
| 877 | |
| 878 | ALIAS (show_ipv6_ospf6_interface, |
| 879 | show_ipv6_ospf6_interface_cmd, |
| 880 | "show ipv6 ospf6 interface", |
| 881 | SHOW_STR |
| 882 | IP6_STR |
| 883 | OSPF6_STR |
| 884 | INTERFACE_STR |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 885 | ) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 886 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 887 | DEFUN (show_ipv6_ospf6_interface_ifname_prefix, |
| 888 | show_ipv6_ospf6_interface_ifname_prefix_cmd, |
| 889 | "show ipv6 ospf6 interface IFNAME prefix", |
| 890 | SHOW_STR |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 891 | IP6_STR |
| 892 | OSPF6_STR |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 893 | INTERFACE_STR |
| 894 | IFNAME_STR |
| 895 | "Display connected prefixes to advertise\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 896 | ) |
| 897 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 898 | struct interface *ifp; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 899 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 900 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 901 | ifp = if_lookup_by_name (argv[0]); |
| 902 | if (ifp == NULL) |
| 903 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 904 | vty_out (vty, "No such Interface: %s%s", argv[0], VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 905 | return CMD_WARNING; |
| 906 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 907 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 908 | oi = ifp->info; |
| 909 | if (oi == NULL) |
| 910 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 911 | vty_out (vty, "OSPFv3 is not enabled on %s%s", argv[0], VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 912 | return CMD_WARNING; |
| 913 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 914 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 915 | argc--; |
| 916 | argv++; |
| 917 | ospf6_route_table_show (vty, argc, argv, oi->route_connected); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 918 | |
| 919 | return CMD_SUCCESS; |
| 920 | } |
| 921 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 922 | ALIAS (show_ipv6_ospf6_interface_ifname_prefix, |
| 923 | show_ipv6_ospf6_interface_ifname_prefix_detail_cmd, |
| 924 | "show ipv6 ospf6 interface IFNAME prefix (X:X::X:X|X:X::X:X/M|detail)", |
| 925 | SHOW_STR |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 926 | IP6_STR |
| 927 | OSPF6_STR |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 928 | INTERFACE_STR |
| 929 | IFNAME_STR |
| 930 | "Display connected prefixes to advertise\n" |
| 931 | OSPF6_ROUTE_ADDRESS_STR |
| 932 | OSPF6_ROUTE_PREFIX_STR |
Denis Ovsienko | ea40219 | 2011-08-19 16:27:16 +0400 | [diff] [blame] | 933 | "Display details of the prefixes\n" |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 934 | ) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 935 | |
| 936 | ALIAS (show_ipv6_ospf6_interface_ifname_prefix, |
| 937 | show_ipv6_ospf6_interface_ifname_prefix_match_cmd, |
| 938 | "show ipv6 ospf6 interface IFNAME prefix X:X::X:X/M (match|detail)", |
| 939 | SHOW_STR |
| 940 | IP6_STR |
| 941 | OSPF6_STR |
| 942 | INTERFACE_STR |
| 943 | IFNAME_STR |
| 944 | "Display connected prefixes to advertise\n" |
| 945 | OSPF6_ROUTE_PREFIX_STR |
| 946 | OSPF6_ROUTE_MATCH_STR |
Denis Ovsienko | ea40219 | 2011-08-19 16:27:16 +0400 | [diff] [blame] | 947 | "Display details of the prefixes\n" |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 948 | ) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 949 | |
| 950 | DEFUN (show_ipv6_ospf6_interface_prefix, |
| 951 | show_ipv6_ospf6_interface_prefix_cmd, |
| 952 | "show ipv6 ospf6 interface prefix", |
| 953 | SHOW_STR |
| 954 | IP6_STR |
| 955 | OSPF6_STR |
| 956 | INTERFACE_STR |
| 957 | "Display connected prefixes to advertise\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 958 | ) |
| 959 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 960 | struct listnode *i; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 961 | struct ospf6_interface *oi; |
| 962 | struct interface *ifp; |
| 963 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 964 | for (ALL_LIST_ELEMENTS_RO (iflist, i, ifp)) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 965 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 966 | oi = (struct ospf6_interface *) ifp->info; |
| 967 | if (oi == NULL) |
| 968 | continue; |
| 969 | |
| 970 | ospf6_route_table_show (vty, argc, argv, oi->route_connected); |
| 971 | } |
| 972 | |
| 973 | return CMD_SUCCESS; |
| 974 | } |
| 975 | |
| 976 | ALIAS (show_ipv6_ospf6_interface_prefix, |
| 977 | show_ipv6_ospf6_interface_prefix_detail_cmd, |
| 978 | "show ipv6 ospf6 interface prefix (X:X::X:X|X:X::X:X/M|detail)", |
| 979 | SHOW_STR |
| 980 | IP6_STR |
| 981 | OSPF6_STR |
| 982 | INTERFACE_STR |
| 983 | "Display connected prefixes to advertise\n" |
| 984 | OSPF6_ROUTE_ADDRESS_STR |
| 985 | OSPF6_ROUTE_PREFIX_STR |
Denis Ovsienko | ea40219 | 2011-08-19 16:27:16 +0400 | [diff] [blame] | 986 | "Display details of the prefixes\n" |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 987 | ) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 988 | |
| 989 | ALIAS (show_ipv6_ospf6_interface_prefix, |
| 990 | show_ipv6_ospf6_interface_prefix_match_cmd, |
| 991 | "show ipv6 ospf6 interface prefix X:X::X:X/M (match|detail)", |
| 992 | SHOW_STR |
| 993 | IP6_STR |
| 994 | OSPF6_STR |
| 995 | INTERFACE_STR |
| 996 | "Display connected prefixes to advertise\n" |
| 997 | OSPF6_ROUTE_PREFIX_STR |
| 998 | OSPF6_ROUTE_MATCH_STR |
Denis Ovsienko | ea40219 | 2011-08-19 16:27:16 +0400 | [diff] [blame] | 999 | "Display details of the prefixes\n" |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 1000 | ) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1001 | |
| 1002 | |
| 1003 | /* interface variable set command */ |
hasso | b596c71 | 2004-07-09 18:33:43 +0000 | [diff] [blame] | 1004 | DEFUN (ipv6_ospf6_ifmtu, |
| 1005 | ipv6_ospf6_ifmtu_cmd, |
| 1006 | "ipv6 ospf6 ifmtu <1-65535>", |
| 1007 | IP6_STR |
| 1008 | OSPF6_STR |
| 1009 | "Interface MTU\n" |
| 1010 | "OSPFv3 Interface MTU\n" |
| 1011 | ) |
| 1012 | { |
| 1013 | struct ospf6_interface *oi; |
| 1014 | struct interface *ifp; |
paul | 0c083ee | 2004-10-10 12:54:58 +0000 | [diff] [blame] | 1015 | unsigned int ifmtu, iobuflen; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1016 | struct listnode *node, *nnode; |
hasso | b596c71 | 2004-07-09 18:33:43 +0000 | [diff] [blame] | 1017 | struct ospf6_neighbor *on; |
| 1018 | |
| 1019 | ifp = (struct interface *) vty->index; |
| 1020 | assert (ifp); |
| 1021 | |
| 1022 | oi = (struct ospf6_interface *) ifp->info; |
| 1023 | if (oi == NULL) |
| 1024 | oi = ospf6_interface_create (ifp); |
| 1025 | assert (oi); |
| 1026 | |
| 1027 | ifmtu = strtol (argv[0], NULL, 10); |
| 1028 | |
| 1029 | if (oi->ifmtu == ifmtu) |
| 1030 | return CMD_SUCCESS; |
| 1031 | |
hasso | 1203e1c | 2004-07-23 21:34:27 +0000 | [diff] [blame] | 1032 | if (ifp->mtu6 != 0 && ifp->mtu6 < ifmtu) |
hasso | b596c71 | 2004-07-09 18:33:43 +0000 | [diff] [blame] | 1033 | { |
| 1034 | 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] | 1035 | ifp->name, ifp->mtu6, VNL); |
hasso | b596c71 | 2004-07-09 18:33:43 +0000 | [diff] [blame] | 1036 | return CMD_WARNING; |
| 1037 | } |
| 1038 | |
| 1039 | if (oi->ifmtu < ifmtu) |
| 1040 | { |
| 1041 | iobuflen = ospf6_iobuf_size (ifmtu); |
| 1042 | if (iobuflen < ifmtu) |
| 1043 | { |
| 1044 | 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] | 1045 | ifp->name, iobuflen, VNL); |
hasso | b596c71 | 2004-07-09 18:33:43 +0000 | [diff] [blame] | 1046 | oi->ifmtu = iobuflen; |
| 1047 | } |
| 1048 | else |
| 1049 | oi->ifmtu = ifmtu; |
| 1050 | } |
| 1051 | else |
| 1052 | oi->ifmtu = ifmtu; |
| 1053 | |
| 1054 | /* re-establish adjacencies */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1055 | for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on)) |
hasso | b596c71 | 2004-07-09 18:33:43 +0000 | [diff] [blame] | 1056 | { |
hasso | b596c71 | 2004-07-09 18:33:43 +0000 | [diff] [blame] | 1057 | THREAD_OFF (on->inactivity_timer); |
hasso | 3e834b1 | 2005-06-24 07:50:12 +0000 | [diff] [blame] | 1058 | thread_add_event (master, inactivity_timer, on, 0); |
hasso | b596c71 | 2004-07-09 18:33:43 +0000 | [diff] [blame] | 1059 | } |
| 1060 | |
| 1061 | return CMD_SUCCESS; |
| 1062 | } |
| 1063 | |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1064 | DEFUN (no_ipv6_ospf6_ifmtu, |
| 1065 | no_ipv6_ospf6_ifmtu_cmd, |
| 1066 | "no ipv6 ospf6 ifmtu", |
| 1067 | NO_STR |
| 1068 | IP6_STR |
| 1069 | OSPF6_STR |
| 1070 | "Interface MTU\n" |
| 1071 | ) |
| 1072 | { |
| 1073 | struct ospf6_interface *oi; |
| 1074 | struct interface *ifp; |
paul | 0c083ee | 2004-10-10 12:54:58 +0000 | [diff] [blame] | 1075 | unsigned int iobuflen; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1076 | struct listnode *node, *nnode; |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1077 | struct ospf6_neighbor *on; |
| 1078 | |
| 1079 | ifp = (struct interface *) vty->index; |
| 1080 | assert (ifp); |
| 1081 | |
| 1082 | oi = (struct ospf6_interface *) ifp->info; |
| 1083 | if (oi == NULL) |
| 1084 | oi = ospf6_interface_create (ifp); |
| 1085 | assert (oi); |
| 1086 | |
| 1087 | if (oi->ifmtu < ifp->mtu) |
| 1088 | { |
| 1089 | iobuflen = ospf6_iobuf_size (ifp->mtu); |
| 1090 | if (iobuflen < ifp->mtu) |
| 1091 | { |
| 1092 | vty_out (vty, "%s's ifmtu is adjusted to I/O buffer size (%d).%s", |
| 1093 | ifp->name, iobuflen, VNL); |
| 1094 | oi->ifmtu = iobuflen; |
| 1095 | } |
| 1096 | else |
| 1097 | oi->ifmtu = ifp->mtu; |
| 1098 | } |
| 1099 | else |
| 1100 | oi->ifmtu = ifp->mtu; |
| 1101 | |
| 1102 | /* re-establish adjacencies */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1103 | for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on)) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1104 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1105 | THREAD_OFF (on->inactivity_timer); |
hasso | 3e834b1 | 2005-06-24 07:50:12 +0000 | [diff] [blame] | 1106 | thread_add_event (master, inactivity_timer, on, 0); |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1107 | } |
| 1108 | |
| 1109 | return CMD_SUCCESS; |
| 1110 | } |
| 1111 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1112 | DEFUN (ipv6_ospf6_cost, |
| 1113 | ipv6_ospf6_cost_cmd, |
| 1114 | "ipv6 ospf6 cost <1-65535>", |
| 1115 | IP6_STR |
| 1116 | OSPF6_STR |
| 1117 | "Interface cost\n" |
| 1118 | "Outgoing metric of this interface\n" |
| 1119 | ) |
| 1120 | { |
| 1121 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1122 | struct interface *ifp; |
paul | 0c083ee | 2004-10-10 12:54:58 +0000 | [diff] [blame] | 1123 | unsigned long int lcost; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1124 | |
| 1125 | ifp = (struct interface *) vty->index; |
| 1126 | assert (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1127 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1128 | oi = (struct ospf6_interface *) ifp->info; |
| 1129 | if (oi == NULL) |
| 1130 | oi = ospf6_interface_create (ifp); |
| 1131 | assert (oi); |
| 1132 | |
paul | 0c083ee | 2004-10-10 12:54:58 +0000 | [diff] [blame] | 1133 | lcost = strtol (argv[0], NULL, 10); |
| 1134 | |
| 1135 | if (lcost > UINT32_MAX) |
| 1136 | { |
| 1137 | vty_out (vty, "Cost %ld is out of range%s", lcost, VNL); |
| 1138 | return CMD_WARNING; |
| 1139 | } |
| 1140 | |
| 1141 | if (oi->cost == lcost) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1142 | return CMD_SUCCESS; |
paul | 0c083ee | 2004-10-10 12:54:58 +0000 | [diff] [blame] | 1143 | |
| 1144 | oi->cost = lcost; |
| 1145 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1146 | /* update cost held in route_connected list in ospf6_interface */ |
| 1147 | ospf6_interface_connected_route_update (oi->interface); |
| 1148 | |
| 1149 | /* execute LSA hooks */ |
| 1150 | if (oi->area) |
| 1151 | { |
| 1152 | OSPF6_LINK_LSA_SCHEDULE (oi); |
| 1153 | OSPF6_ROUTER_LSA_SCHEDULE (oi->area); |
| 1154 | OSPF6_NETWORK_LSA_SCHEDULE (oi); |
| 1155 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi); |
| 1156 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area); |
| 1157 | } |
| 1158 | |
| 1159 | return CMD_SUCCESS; |
| 1160 | } |
| 1161 | |
| 1162 | DEFUN (ipv6_ospf6_hellointerval, |
| 1163 | ipv6_ospf6_hellointerval_cmd, |
| 1164 | "ipv6 ospf6 hello-interval <1-65535>", |
| 1165 | IP6_STR |
| 1166 | OSPF6_STR |
| 1167 | "Interval time of Hello packets\n" |
| 1168 | SECONDS_STR |
| 1169 | ) |
| 1170 | { |
| 1171 | struct ospf6_interface *oi; |
| 1172 | struct interface *ifp; |
| 1173 | |
| 1174 | ifp = (struct interface *) vty->index; |
| 1175 | assert (ifp); |
| 1176 | |
| 1177 | oi = (struct ospf6_interface *) ifp->info; |
| 1178 | if (oi == NULL) |
| 1179 | oi = ospf6_interface_create (ifp); |
| 1180 | assert (oi); |
| 1181 | |
| 1182 | oi->hello_interval = strtol (argv[0], NULL, 10); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1183 | return CMD_SUCCESS; |
| 1184 | } |
| 1185 | |
| 1186 | /* interface variable set command */ |
| 1187 | DEFUN (ipv6_ospf6_deadinterval, |
| 1188 | ipv6_ospf6_deadinterval_cmd, |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1189 | "ipv6 ospf6 dead-interval <1-65535>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1190 | IP6_STR |
| 1191 | OSPF6_STR |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1192 | "Interval time after which a neighbor is declared down\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1193 | SECONDS_STR |
| 1194 | ) |
| 1195 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1196 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1197 | struct interface *ifp; |
| 1198 | |
| 1199 | ifp = (struct interface *) vty->index; |
| 1200 | assert (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1201 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1202 | oi = (struct ospf6_interface *) ifp->info; |
| 1203 | if (oi == NULL) |
| 1204 | oi = ospf6_interface_create (ifp); |
| 1205 | assert (oi); |
| 1206 | |
| 1207 | oi->dead_interval = strtol (argv[0], NULL, 10); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1208 | return CMD_SUCCESS; |
| 1209 | } |
| 1210 | |
| 1211 | /* interface variable set command */ |
| 1212 | DEFUN (ipv6_ospf6_transmitdelay, |
| 1213 | ipv6_ospf6_transmitdelay_cmd, |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1214 | "ipv6 ospf6 transmit-delay <1-3600>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1215 | IP6_STR |
| 1216 | OSPF6_STR |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1217 | "Transmit delay of this interface\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1218 | SECONDS_STR |
| 1219 | ) |
| 1220 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1221 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1222 | struct interface *ifp; |
| 1223 | |
| 1224 | ifp = (struct interface *) vty->index; |
| 1225 | assert (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1226 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1227 | oi = (struct ospf6_interface *) ifp->info; |
| 1228 | if (oi == NULL) |
| 1229 | oi = ospf6_interface_create (ifp); |
| 1230 | assert (oi); |
| 1231 | |
| 1232 | oi->transdelay = strtol (argv[0], NULL, 10); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1233 | return CMD_SUCCESS; |
| 1234 | } |
| 1235 | |
| 1236 | /* interface variable set command */ |
| 1237 | DEFUN (ipv6_ospf6_retransmitinterval, |
| 1238 | ipv6_ospf6_retransmitinterval_cmd, |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1239 | "ipv6 ospf6 retransmit-interval <1-65535>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1240 | IP6_STR |
| 1241 | OSPF6_STR |
| 1242 | "Time between retransmitting lost link state advertisements\n" |
| 1243 | SECONDS_STR |
| 1244 | ) |
| 1245 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1246 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1247 | struct interface *ifp; |
| 1248 | |
| 1249 | ifp = (struct interface *) vty->index; |
| 1250 | assert (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1251 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1252 | oi = (struct ospf6_interface *) ifp->info; |
| 1253 | if (oi == NULL) |
| 1254 | oi = ospf6_interface_create (ifp); |
| 1255 | assert (oi); |
| 1256 | |
| 1257 | oi->rxmt_interval = strtol (argv[0], NULL, 10); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1258 | return CMD_SUCCESS; |
| 1259 | } |
| 1260 | |
| 1261 | /* interface variable set command */ |
| 1262 | DEFUN (ipv6_ospf6_priority, |
| 1263 | ipv6_ospf6_priority_cmd, |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1264 | "ipv6 ospf6 priority <0-255>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1265 | IP6_STR |
| 1266 | OSPF6_STR |
| 1267 | "Router priority\n" |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1268 | "Priority value\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1269 | ) |
| 1270 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1271 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1272 | struct interface *ifp; |
| 1273 | |
| 1274 | ifp = (struct interface *) vty->index; |
| 1275 | assert (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1276 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1277 | oi = (struct ospf6_interface *) ifp->info; |
| 1278 | if (oi == NULL) |
| 1279 | oi = ospf6_interface_create (ifp); |
| 1280 | assert (oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1281 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1282 | oi->priority = strtol (argv[0], NULL, 10); |
| 1283 | |
| 1284 | if (oi->area) |
| 1285 | ospf6_interface_state_change (dr_election (oi), oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1286 | |
| 1287 | return CMD_SUCCESS; |
| 1288 | } |
| 1289 | |
| 1290 | DEFUN (ipv6_ospf6_instance, |
| 1291 | ipv6_ospf6_instance_cmd, |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1292 | "ipv6 ospf6 instance-id <0-255>", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1293 | IP6_STR |
| 1294 | OSPF6_STR |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1295 | "Instance ID for this interface\n" |
| 1296 | "Instance ID value\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1297 | ) |
| 1298 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1299 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1300 | struct interface *ifp; |
| 1301 | |
| 1302 | ifp = (struct interface *)vty->index; |
| 1303 | assert (ifp); |
| 1304 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1305 | oi = (struct ospf6_interface *)ifp->info; |
| 1306 | if (oi == NULL) |
| 1307 | oi = ospf6_interface_create (ifp); |
| 1308 | assert (oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1309 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1310 | oi->instance_id = strtol (argv[0], NULL, 10); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1311 | return CMD_SUCCESS; |
| 1312 | } |
| 1313 | |
| 1314 | DEFUN (ipv6_ospf6_passive, |
| 1315 | ipv6_ospf6_passive_cmd, |
| 1316 | "ipv6 ospf6 passive", |
| 1317 | IP6_STR |
| 1318 | OSPF6_STR |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1319 | "passive interface, No adjacency will be formed on this interface\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1320 | ) |
| 1321 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1322 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1323 | struct interface *ifp; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1324 | struct listnode *node, *nnode; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1325 | struct ospf6_neighbor *on; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1326 | |
| 1327 | ifp = (struct interface *) vty->index; |
| 1328 | assert (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1329 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1330 | oi = (struct ospf6_interface *) ifp->info; |
| 1331 | if (oi == NULL) |
| 1332 | oi = ospf6_interface_create (ifp); |
| 1333 | assert (oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1334 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1335 | SET_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE); |
| 1336 | THREAD_OFF (oi->thread_send_hello); |
| 1337 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1338 | for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1339 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1340 | THREAD_OFF (on->inactivity_timer); |
hasso | 3e834b1 | 2005-06-24 07:50:12 +0000 | [diff] [blame] | 1341 | thread_add_event (master, inactivity_timer, on, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1342 | } |
| 1343 | |
| 1344 | return CMD_SUCCESS; |
| 1345 | } |
| 1346 | |
| 1347 | DEFUN (no_ipv6_ospf6_passive, |
| 1348 | no_ipv6_ospf6_passive_cmd, |
| 1349 | "no ipv6 ospf6 passive", |
| 1350 | NO_STR |
| 1351 | IP6_STR |
| 1352 | OSPF6_STR |
| 1353 | "passive interface: No Adjacency will be formed on this I/F\n" |
| 1354 | ) |
| 1355 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1356 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1357 | struct interface *ifp; |
| 1358 | |
| 1359 | ifp = (struct interface *) vty->index; |
| 1360 | assert (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1361 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1362 | oi = (struct ospf6_interface *) ifp->info; |
| 1363 | if (oi == NULL) |
| 1364 | oi = ospf6_interface_create (ifp); |
| 1365 | assert (oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1366 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1367 | UNSET_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE); |
| 1368 | THREAD_OFF (oi->thread_send_hello); |
| 1369 | oi->thread_send_hello = |
| 1370 | thread_add_event (master, ospf6_hello_send, oi, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1371 | |
| 1372 | return CMD_SUCCESS; |
| 1373 | } |
| 1374 | |
Dmitrij Tejblum | d42306d | 2011-04-22 19:27:54 +0400 | [diff] [blame] | 1375 | DEFUN (ipv6_ospf6_mtu_ignore, |
| 1376 | ipv6_ospf6_mtu_ignore_cmd, |
| 1377 | "ipv6 ospf6 mtu-ignore", |
| 1378 | IP6_STR |
| 1379 | OSPF6_STR |
| 1380 | "Ignore MTU mismatch on this interface\n" |
| 1381 | ) |
| 1382 | { |
| 1383 | struct ospf6_interface *oi; |
| 1384 | struct interface *ifp; |
| 1385 | |
| 1386 | ifp = (struct interface *) vty->index; |
| 1387 | assert (ifp); |
| 1388 | |
| 1389 | oi = (struct ospf6_interface *) ifp->info; |
| 1390 | if (oi == NULL) |
| 1391 | oi = ospf6_interface_create (ifp); |
| 1392 | assert (oi); |
| 1393 | |
| 1394 | oi->mtu_ignore = 1; |
| 1395 | |
| 1396 | return CMD_SUCCESS; |
| 1397 | } |
| 1398 | |
| 1399 | DEFUN (no_ipv6_ospf6_mtu_ignore, |
| 1400 | no_ipv6_ospf6_mtu_ignore_cmd, |
| 1401 | "no ipv6 ospf6 mtu-ignore", |
| 1402 | NO_STR |
| 1403 | IP6_STR |
| 1404 | OSPF6_STR |
| 1405 | "Ignore MTU mismatch on this interface\n" |
| 1406 | ) |
| 1407 | { |
| 1408 | struct ospf6_interface *oi; |
| 1409 | struct interface *ifp; |
| 1410 | |
| 1411 | ifp = (struct interface *) vty->index; |
| 1412 | assert (ifp); |
| 1413 | |
| 1414 | oi = (struct ospf6_interface *) ifp->info; |
| 1415 | if (oi == NULL) |
| 1416 | oi = ospf6_interface_create (ifp); |
| 1417 | assert (oi); |
| 1418 | |
| 1419 | oi->mtu_ignore = 0; |
| 1420 | |
| 1421 | return CMD_SUCCESS; |
| 1422 | } |
| 1423 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1424 | DEFUN (ipv6_ospf6_advertise_prefix_list, |
| 1425 | ipv6_ospf6_advertise_prefix_list_cmd, |
| 1426 | "ipv6 ospf6 advertise prefix-list WORD", |
| 1427 | IP6_STR |
| 1428 | OSPF6_STR |
| 1429 | "Advertising options\n" |
| 1430 | "Filter prefix using prefix-list\n" |
| 1431 | "Prefix list name\n" |
| 1432 | ) |
| 1433 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1434 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1435 | struct interface *ifp; |
| 1436 | |
| 1437 | ifp = (struct interface *) vty->index; |
| 1438 | assert (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1439 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1440 | oi = (struct ospf6_interface *) ifp->info; |
| 1441 | if (oi == NULL) |
| 1442 | oi = ospf6_interface_create (ifp); |
| 1443 | assert (oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1444 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1445 | if (oi->plist_name) |
| 1446 | XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name); |
| 1447 | oi->plist_name = XSTRDUP (MTYPE_PREFIX_LIST_STR, argv[0]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1448 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1449 | ospf6_interface_connected_route_update (oi->interface); |
David Ward | 2470e99 | 2010-01-05 02:45:39 +0000 | [diff] [blame] | 1450 | |
| 1451 | if (oi->area) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1452 | { |
David Ward | 2470e99 | 2010-01-05 02:45:39 +0000 | [diff] [blame] | 1453 | OSPF6_LINK_LSA_SCHEDULE (oi); |
| 1454 | if (oi->state == OSPF6_INTERFACE_DR) |
| 1455 | { |
| 1456 | OSPF6_NETWORK_LSA_SCHEDULE (oi); |
| 1457 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi); |
| 1458 | } |
| 1459 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1460 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1461 | |
| 1462 | return CMD_SUCCESS; |
| 1463 | } |
| 1464 | |
| 1465 | DEFUN (no_ipv6_ospf6_advertise_prefix_list, |
| 1466 | no_ipv6_ospf6_advertise_prefix_list_cmd, |
| 1467 | "no ipv6 ospf6 advertise prefix-list", |
| 1468 | NO_STR |
| 1469 | IP6_STR |
| 1470 | OSPF6_STR |
| 1471 | "Advertising options\n" |
| 1472 | "Filter prefix using prefix-list\n" |
| 1473 | ) |
| 1474 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1475 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1476 | struct interface *ifp; |
| 1477 | |
| 1478 | ifp = (struct interface *) vty->index; |
| 1479 | assert (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1480 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1481 | oi = (struct ospf6_interface *) ifp->info; |
| 1482 | if (oi == NULL) |
| 1483 | oi = ospf6_interface_create (ifp); |
| 1484 | assert (oi); |
| 1485 | |
| 1486 | if (oi->plist_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1487 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1488 | XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name); |
| 1489 | oi->plist_name = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1490 | } |
| 1491 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1492 | ospf6_interface_connected_route_update (oi->interface); |
David Ward | 2470e99 | 2010-01-05 02:45:39 +0000 | [diff] [blame] | 1493 | |
| 1494 | if (oi->area) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1495 | { |
David Ward | 2470e99 | 2010-01-05 02:45:39 +0000 | [diff] [blame] | 1496 | OSPF6_LINK_LSA_SCHEDULE (oi); |
| 1497 | if (oi->state == OSPF6_INTERFACE_DR) |
| 1498 | { |
| 1499 | OSPF6_NETWORK_LSA_SCHEDULE (oi); |
| 1500 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi); |
| 1501 | } |
| 1502 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1503 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1504 | |
| 1505 | return CMD_SUCCESS; |
| 1506 | } |
| 1507 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 1508 | static int |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1509 | config_write_ospf6_interface (struct vty *vty) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1510 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 1511 | struct listnode *i; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1512 | struct ospf6_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1513 | struct interface *ifp; |
| 1514 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1515 | for (ALL_LIST_ELEMENTS_RO (iflist, i, ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1516 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1517 | oi = (struct ospf6_interface *) ifp->info; |
| 1518 | if (oi == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1519 | continue; |
| 1520 | |
| 1521 | vty_out (vty, "interface %s%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1522 | oi->interface->name, VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1523 | |
| 1524 | if (ifp->desc) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1525 | vty_out (vty, " description %s%s", ifp->desc, VNL); |
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); |
Vyacheslav Trushkin | b51a3a3 | 2012-02-10 10:42:45 +0400 | [diff] [blame] | 1528 | |
| 1529 | if (oi->cost != OSPF6_INTERFACE_COST) |
| 1530 | vty_out (vty, " ipv6 ospf6 cost %d%s", |
| 1531 | oi->cost, VNL); |
| 1532 | |
| 1533 | if (oi->hello_interval != OSPF6_INTERFACE_HELLO_INTERVAL) |
| 1534 | vty_out (vty, " ipv6 ospf6 hello-interval %d%s", |
| 1535 | oi->hello_interval, VNL); |
| 1536 | |
| 1537 | if (oi->dead_interval != OSPF6_INTERFACE_DEAD_INTERVAL) |
| 1538 | vty_out (vty, " ipv6 ospf6 dead-interval %d%s", |
| 1539 | oi->dead_interval, VNL); |
| 1540 | |
| 1541 | if (oi->rxmt_interval != OSPF6_INTERFACE_RXMT_INTERVAL) |
| 1542 | vty_out (vty, " ipv6 ospf6 retransmit-interval %d%s", |
| 1543 | oi->rxmt_interval, VNL); |
| 1544 | |
| 1545 | if (oi->priority != OSPF6_INTERFACE_PRIORITY) |
| 1546 | vty_out (vty, " ipv6 ospf6 priority %d%s", |
| 1547 | oi->priority, VNL); |
| 1548 | |
| 1549 | if (oi->transdelay != OSPF6_INTERFACE_TRANSDELAY) |
| 1550 | vty_out (vty, " ipv6 ospf6 transmit-delay %d%s", |
| 1551 | oi->transdelay, VNL); |
| 1552 | |
| 1553 | if (oi->instance_id != OSPF6_INTERFACE_INSTANCE_ID) |
| 1554 | vty_out (vty, " ipv6 ospf6 instance-id %d%s", |
| 1555 | oi->instance_id, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1556 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1557 | if (oi->plist_name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1558 | vty_out (vty, " ipv6 ospf6 advertise prefix-list %s%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1559 | oi->plist_name, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1560 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1561 | if (CHECK_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE)) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1562 | vty_out (vty, " ipv6 ospf6 passive%s", VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1563 | |
Dmitrij Tejblum | d42306d | 2011-04-22 19:27:54 +0400 | [diff] [blame] | 1564 | if (oi->mtu_ignore) |
| 1565 | vty_out (vty, " ipv6 ospf6 mtu-ignore%s", VNL); |
| 1566 | |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1567 | vty_out (vty, "!%s", VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1568 | } |
| 1569 | return 0; |
| 1570 | } |
| 1571 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 1572 | static struct cmd_node interface_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1573 | { |
| 1574 | INTERFACE_NODE, |
| 1575 | "%s(config-if)# ", |
hasso | 69b4a81 | 2004-08-26 18:10:36 +0000 | [diff] [blame] | 1576 | 1 /* VTYSH */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1577 | }; |
| 1578 | |
| 1579 | void |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 1580 | ospf6_interface_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1581 | { |
| 1582 | /* Install interface node. */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1583 | install_node (&interface_node, config_write_ospf6_interface); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1584 | |
| 1585 | install_element (VIEW_NODE, &show_ipv6_ospf6_interface_cmd); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1586 | install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_cmd); |
| 1587 | install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_detail_cmd); |
| 1588 | install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_match_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1589 | install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_cmd); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1590 | install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_cmd); |
| 1591 | install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd); |
| 1592 | install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1593 | install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_cmd); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1594 | install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_cmd); |
| 1595 | install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_detail_cmd); |
| 1596 | install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_match_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1597 | install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_cmd); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1598 | install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_cmd); |
| 1599 | install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd); |
| 1600 | install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1601 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1602 | install_element (CONFIG_NODE, &interface_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1603 | install_default (INTERFACE_NODE); |
| 1604 | install_element (INTERFACE_NODE, &interface_desc_cmd); |
| 1605 | install_element (INTERFACE_NODE, &no_interface_desc_cmd); |
| 1606 | install_element (INTERFACE_NODE, &ipv6_ospf6_cost_cmd); |
hasso | b596c71 | 2004-07-09 18:33:43 +0000 | [diff] [blame] | 1607 | install_element (INTERFACE_NODE, &ipv6_ospf6_ifmtu_cmd); |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1608 | install_element (INTERFACE_NODE, &no_ipv6_ospf6_ifmtu_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1609 | install_element (INTERFACE_NODE, &ipv6_ospf6_deadinterval_cmd); |
| 1610 | install_element (INTERFACE_NODE, &ipv6_ospf6_hellointerval_cmd); |
| 1611 | install_element (INTERFACE_NODE, &ipv6_ospf6_priority_cmd); |
| 1612 | install_element (INTERFACE_NODE, &ipv6_ospf6_retransmitinterval_cmd); |
| 1613 | install_element (INTERFACE_NODE, &ipv6_ospf6_transmitdelay_cmd); |
| 1614 | install_element (INTERFACE_NODE, &ipv6_ospf6_instance_cmd); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1615 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1616 | install_element (INTERFACE_NODE, &ipv6_ospf6_passive_cmd); |
| 1617 | install_element (INTERFACE_NODE, &no_ipv6_ospf6_passive_cmd); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1618 | |
Dmitrij Tejblum | d42306d | 2011-04-22 19:27:54 +0400 | [diff] [blame] | 1619 | install_element (INTERFACE_NODE, &ipv6_ospf6_mtu_ignore_cmd); |
| 1620 | install_element (INTERFACE_NODE, &no_ipv6_ospf6_mtu_ignore_cmd); |
| 1621 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1622 | install_element (INTERFACE_NODE, &ipv6_ospf6_advertise_prefix_list_cmd); |
| 1623 | install_element (INTERFACE_NODE, &no_ipv6_ospf6_advertise_prefix_list_cmd); |
| 1624 | } |
| 1625 | |
| 1626 | DEFUN (debug_ospf6_interface, |
| 1627 | debug_ospf6_interface_cmd, |
| 1628 | "debug ospf6 interface", |
| 1629 | DEBUG_STR |
| 1630 | OSPF6_STR |
| 1631 | "Debug OSPFv3 Interface\n" |
| 1632 | ) |
| 1633 | { |
| 1634 | OSPF6_DEBUG_INTERFACE_ON (); |
| 1635 | return CMD_SUCCESS; |
| 1636 | } |
| 1637 | |
| 1638 | DEFUN (no_debug_ospf6_interface, |
| 1639 | no_debug_ospf6_interface_cmd, |
| 1640 | "no debug ospf6 interface", |
| 1641 | NO_STR |
| 1642 | DEBUG_STR |
| 1643 | OSPF6_STR |
| 1644 | "Debug OSPFv3 Interface\n" |
| 1645 | ) |
| 1646 | { |
hasso | 3b68735 | 2004-08-19 06:56:53 +0000 | [diff] [blame] | 1647 | OSPF6_DEBUG_INTERFACE_OFF (); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1648 | return CMD_SUCCESS; |
| 1649 | } |
| 1650 | |
| 1651 | int |
| 1652 | config_write_ospf6_debug_interface (struct vty *vty) |
| 1653 | { |
| 1654 | if (IS_OSPF6_DEBUG_INTERFACE) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 1655 | vty_out (vty, "debug ospf6 interface%s", VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1656 | return 0; |
| 1657 | } |
| 1658 | |
| 1659 | void |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 1660 | install_element_ospf6_debug_interface (void) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 1661 | { |
| 1662 | install_element (ENABLE_NODE, &debug_ospf6_interface_cmd); |
| 1663 | install_element (ENABLE_NODE, &no_debug_ospf6_interface_cmd); |
| 1664 | install_element (CONFIG_NODE, &debug_ospf6_interface_cmd); |
| 1665 | install_element (CONFIG_NODE, &no_debug_ospf6_interface_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1666 | } |
| 1667 | |
| 1668 | |