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