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