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