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> |
| 23 | |
| 24 | #include "log.h" |
| 25 | #include "vty.h" |
| 26 | #include "command.h" |
| 27 | #include "prefix.h" |
| 28 | #include "stream.h" |
| 29 | #include "zclient.h" |
| 30 | #include "memory.h" |
| 31 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 32 | #include "ospf6_proto.h" |
| 33 | #include "ospf6_top.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 34 | #include "ospf6_interface.h" |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 35 | #include "ospf6_route.h" |
| 36 | #include "ospf6_lsa.h" |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 37 | #include "ospf6_lsdb.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 38 | #include "ospf6_asbr.h" |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 39 | #include "ospf6_zebra.h" |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 40 | #include "ospf6d.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 41 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 42 | unsigned char conf_debug_ospf6_zebra = 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 43 | |
| 44 | /* information about zebra. */ |
| 45 | struct zclient *zclient = NULL; |
| 46 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 47 | struct in_addr router_id_zebra; |
| 48 | |
| 49 | /* Router-id update message from zebra. */ |
| 50 | int |
| 51 | ospf6_router_id_update_zebra (int command, struct zclient *zclient, |
| 52 | zebra_size_t length) |
| 53 | { |
| 54 | struct prefix router_id; |
| 55 | struct ospf6 *o = ospf6; |
| 56 | |
| 57 | zebra_router_id_update_read(zclient->ibuf,&router_id); |
| 58 | router_id_zebra = router_id.u.prefix4; |
| 59 | |
jardin | c1ba9e8 | 2005-03-02 22:43:26 +0000 | [diff] [blame] | 60 | if (o == NULL) |
| 61 | return 0; |
| 62 | |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 63 | if (o->router_id == 0) |
| 64 | o->router_id = (u_int32_t) router_id_zebra.s_addr; |
| 65 | |
| 66 | return 0; |
| 67 | } |
| 68 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 69 | /* redistribute function */ |
| 70 | void |
| 71 | ospf6_zebra_redistribute (int type) |
| 72 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 73 | if (zclient->redist[type]) |
| 74 | return; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 75 | zclient->redist[type] = 1; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 76 | if (zclient->sock > 0) |
ajs | 634f9ea | 2005-04-11 15:51:40 +0000 | [diff] [blame^] | 77 | zebra_redistribute_send (ZEBRA_REDISTRIBUTE_ADD, zclient, type); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 78 | } |
| 79 | |
| 80 | void |
| 81 | ospf6_zebra_no_redistribute (int type) |
| 82 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 83 | if (! zclient->redist[type]) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 84 | return; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 85 | zclient->redist[type] = 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 86 | if (zclient->sock > 0) |
ajs | 634f9ea | 2005-04-11 15:51:40 +0000 | [diff] [blame^] | 87 | zebra_redistribute_send (ZEBRA_REDISTRIBUTE_DELETE, zclient, type); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 88 | } |
| 89 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 90 | /* Inteface addition message from zebra. */ |
| 91 | int |
| 92 | ospf6_zebra_if_add (int command, struct zclient *zclient, zebra_size_t length) |
| 93 | { |
| 94 | struct interface *ifp; |
| 95 | |
| 96 | ifp = zebra_interface_add_read (zclient->ibuf); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 97 | if (IS_OSPF6_DEBUG_ZEBRA (RECV)) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 98 | zlog_debug ("Zebra Interface add: %s index %d mtu %d", |
| 99 | ifp->name, ifp->ifindex, ifp->mtu6); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 100 | ospf6_interface_if_add (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 101 | return 0; |
| 102 | } |
| 103 | |
| 104 | int |
| 105 | ospf6_zebra_if_del (int command, struct zclient *zclient, zebra_size_t length) |
| 106 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 107 | struct interface *ifp; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 108 | |
ajs | d2fc889 | 2005-04-02 18:38:43 +0000 | [diff] [blame] | 109 | if (!(ifp = zebra_interface_state_read(zclient->ibuf))) |
| 110 | return 0; |
| 111 | |
| 112 | if (if_is_up (ifp)) |
| 113 | zlog_warn ("Zebra: got delete of %s, but interface is still up", ifp->name); |
| 114 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 115 | if (IS_OSPF6_DEBUG_ZEBRA (RECV)) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 116 | zlog_debug ("Zebra Interface delete: %s index %d mtu %d", |
| 117 | ifp->name, ifp->ifindex, ifp->mtu6); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 118 | |
ajs | d2fc889 | 2005-04-02 18:38:43 +0000 | [diff] [blame] | 119 | #if 0 |
| 120 | /* Why is this commented out? */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 121 | ospf6_interface_if_del (ifp); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 122 | #endif /*0*/ |
ajs | d2fc889 | 2005-04-02 18:38:43 +0000 | [diff] [blame] | 123 | |
| 124 | ifp->ifindex = IFINDEX_INTERNAL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 125 | return 0; |
| 126 | } |
| 127 | |
| 128 | int |
| 129 | ospf6_zebra_if_state_update (int command, struct zclient *zclient, |
| 130 | zebra_size_t length) |
| 131 | { |
| 132 | struct interface *ifp; |
| 133 | |
| 134 | ifp = zebra_interface_state_read (zclient->ibuf); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 135 | if (IS_OSPF6_DEBUG_ZEBRA (RECV)) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 136 | zlog_debug ("Zebra Interface state change: " |
| 137 | "%s index %d flags %ld metric %d mtu %d", |
| 138 | ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu6); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 139 | |
| 140 | ospf6_interface_state_update (ifp); |
| 141 | return 0; |
| 142 | } |
| 143 | |
| 144 | int |
| 145 | ospf6_zebra_if_address_update_add (int command, struct zclient *zclient, |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 146 | zebra_size_t length) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 147 | { |
| 148 | struct connected *c; |
| 149 | char buf[128]; |
| 150 | |
paul | 0a58935 | 2004-05-08 11:48:26 +0000 | [diff] [blame] | 151 | c = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_ADD, zclient->ibuf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 152 | if (c == NULL) |
| 153 | return 0; |
| 154 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 155 | if (IS_OSPF6_DEBUG_ZEBRA (RECV)) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 156 | zlog_debug ("Zebra Interface address add: %s %5s %s/%d", |
| 157 | c->ifp->name, prefix_family_str (c->address), |
| 158 | inet_ntop (c->address->family, &c->address->u.prefix, |
| 159 | buf, sizeof (buf)), c->address->prefixlen); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 160 | |
| 161 | if (c->address->family == AF_INET6) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 162 | ospf6_interface_connected_route_update (c->ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 163 | |
| 164 | return 0; |
| 165 | } |
| 166 | |
| 167 | int |
| 168 | ospf6_zebra_if_address_update_delete (int command, struct zclient *zclient, |
| 169 | zebra_size_t length) |
| 170 | { |
| 171 | struct connected *c; |
| 172 | char buf[128]; |
| 173 | |
paul | 0a58935 | 2004-05-08 11:48:26 +0000 | [diff] [blame] | 174 | c = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_DELETE, zclient->ibuf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 175 | if (c == NULL) |
| 176 | return 0; |
| 177 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 178 | if (IS_OSPF6_DEBUG_ZEBRA (RECV)) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 179 | zlog_debug ("Zebra Interface address delete: %s %5s %s/%d", |
| 180 | c->ifp->name, prefix_family_str (c->address), |
| 181 | inet_ntop (c->address->family, &c->address->u.prefix, |
| 182 | buf, sizeof (buf)), c->address->prefixlen); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 183 | |
| 184 | if (c->address->family == AF_INET6) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 185 | ospf6_interface_connected_route_update (c->ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 186 | |
| 187 | return 0; |
| 188 | } |
| 189 | |
| 190 | |
| 191 | |
| 192 | const char *zebra_route_name[ZEBRA_ROUTE_MAX] = |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 193 | { "System", "Kernel", "Connect", "Static", "RIP", "RIPng", "OSPF", |
hasso | f3f27f6 | 2004-09-10 18:07:57 +0000 | [diff] [blame] | 194 | "OSPF6", "ISIS", "BGP" }; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 195 | |
| 196 | const char *zebra_route_abname[ZEBRA_ROUTE_MAX] = |
hasso | f3f27f6 | 2004-09-10 18:07:57 +0000 | [diff] [blame] | 197 | { "X", "K", "C", "S", "r", "R", "o", "O", "I", "B" }; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 198 | |
| 199 | int |
| 200 | ospf6_zebra_read_ipv6 (int command, struct zclient *zclient, |
| 201 | zebra_size_t length) |
| 202 | { |
| 203 | struct stream *s; |
| 204 | struct zapi_ipv6 api; |
| 205 | unsigned long ifindex; |
| 206 | struct prefix_ipv6 p; |
| 207 | struct in6_addr *nexthop; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 208 | |
| 209 | s = zclient->ibuf; |
| 210 | ifindex = 0; |
| 211 | nexthop = NULL; |
| 212 | memset (&api, 0, sizeof (api)); |
| 213 | |
| 214 | /* Type, flags, message. */ |
| 215 | api.type = stream_getc (s); |
| 216 | api.flags = stream_getc (s); |
| 217 | api.message = stream_getc (s); |
| 218 | |
| 219 | /* IPv6 prefix. */ |
| 220 | memset (&p, 0, sizeof (struct prefix_ipv6)); |
| 221 | p.family = AF_INET6; |
| 222 | p.prefixlen = stream_getc (s); |
| 223 | stream_get (&p.prefix, s, PSIZE (p.prefixlen)); |
| 224 | |
| 225 | /* Nexthop, ifindex, distance, metric. */ |
| 226 | if (CHECK_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP)) |
| 227 | { |
| 228 | api.nexthop_num = stream_getc (s); |
| 229 | nexthop = (struct in6_addr *) |
| 230 | malloc (api.nexthop_num * sizeof (struct in6_addr)); |
| 231 | stream_get (nexthop, s, api.nexthop_num * sizeof (struct in6_addr)); |
| 232 | } |
| 233 | if (CHECK_FLAG (api.message, ZAPI_MESSAGE_IFINDEX)) |
| 234 | { |
| 235 | api.ifindex_num = stream_getc (s); |
| 236 | ifindex = stream_getl (s); |
| 237 | } |
| 238 | if (CHECK_FLAG (api.message, ZAPI_MESSAGE_DISTANCE)) |
| 239 | api.distance = stream_getc (s); |
| 240 | else |
| 241 | api.distance = 0; |
| 242 | if (CHECK_FLAG (api.message, ZAPI_MESSAGE_METRIC)) |
| 243 | api.metric = stream_getl (s); |
| 244 | else |
| 245 | api.metric = 0; |
| 246 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 247 | if (IS_OSPF6_DEBUG_ZEBRA (RECV)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 248 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 249 | char prefixstr[128], nexthopstr[128]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 250 | prefix2str ((struct prefix *)&p, prefixstr, sizeof (prefixstr)); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 251 | if (nexthop) |
| 252 | inet_ntop (AF_INET6, nexthop, nexthopstr, sizeof (nexthopstr)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 253 | else |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 254 | snprintf (nexthopstr, sizeof (nexthopstr), "::"); |
| 255 | |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 256 | zlog_debug ("Zebra Receive route %s: %s %s nexthop %s ifindex %ld", |
| 257 | (command == ZEBRA_IPV6_ROUTE_ADD ? "add" : "delete"), |
| 258 | zebra_route_name[api.type], prefixstr, nexthopstr, ifindex); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 259 | } |
| 260 | |
| 261 | if (command == ZEBRA_IPV6_ROUTE_ADD) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 262 | ospf6_asbr_redistribute_add (api.type, ifindex, (struct prefix *) &p, |
| 263 | api.nexthop_num, nexthop); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 264 | else |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 265 | ospf6_asbr_redistribute_remove (api.type, ifindex, (struct prefix *) &p); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 266 | |
| 267 | if (CHECK_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP)) |
| 268 | free (nexthop); |
| 269 | |
| 270 | return 0; |
| 271 | } |
| 272 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 273 | |
| 274 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 275 | |
| 276 | DEFUN (show_zebra, |
| 277 | show_zebra_cmd, |
| 278 | "show zebra", |
| 279 | SHOW_STR |
| 280 | "Zebra information\n") |
| 281 | { |
| 282 | int i; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 283 | if (zclient == NULL) |
| 284 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 285 | vty_out (vty, "Not connected to zebra%s", VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 286 | return CMD_SUCCESS; |
| 287 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 288 | |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 289 | vty_out (vty, "Zebra Infomation%s", VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 290 | vty_out (vty, " enable: %d fail: %d%s", |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 291 | zclient->enable, zclient->fail, VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 292 | vty_out (vty, " redistribute default: %d%s", zclient->redist_default, |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 293 | VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 294 | vty_out (vty, " redistribute:"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 295 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 296 | { |
| 297 | if (zclient->redist[i]) |
| 298 | vty_out (vty, " %s", zebra_route_name[i]); |
| 299 | } |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 300 | vty_out (vty, "%s", VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 301 | return CMD_SUCCESS; |
| 302 | } |
| 303 | |
| 304 | DEFUN (router_zebra, |
| 305 | router_zebra_cmd, |
| 306 | "router zebra", |
| 307 | "Enable a routing process\n" |
| 308 | "Make connection to zebra daemon\n") |
| 309 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 310 | vty->node = ZEBRA_NODE; |
| 311 | zclient->enable = 1; |
| 312 | zclient_start (zclient); |
| 313 | return CMD_SUCCESS; |
| 314 | } |
| 315 | |
| 316 | DEFUN (no_router_zebra, |
| 317 | no_router_zebra_cmd, |
| 318 | "no router zebra", |
| 319 | NO_STR |
| 320 | "Configure routing process\n" |
| 321 | "Disable connection to zebra daemon\n") |
| 322 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 323 | zclient->enable = 0; |
| 324 | zclient_stop (zclient); |
| 325 | return CMD_SUCCESS; |
| 326 | } |
| 327 | |
| 328 | /* Zebra configuration write function. */ |
| 329 | int |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 330 | config_write_ospf6_zebra (struct vty *vty) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 331 | { |
| 332 | if (! zclient->enable) |
| 333 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 334 | vty_out (vty, "no router zebra%s", VNL); |
| 335 | vty_out (vty, "!%s", VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 336 | } |
| 337 | else if (! zclient->redist[ZEBRA_ROUTE_OSPF6]) |
| 338 | { |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 339 | vty_out (vty, "router zebra%s", VNL); |
| 340 | vty_out (vty, " no redistribute ospf6%s", VNL); |
| 341 | vty_out (vty, "!%s", VNL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 342 | } |
| 343 | return 0; |
| 344 | } |
| 345 | |
| 346 | /* Zebra node structure. */ |
| 347 | struct cmd_node zebra_node = |
| 348 | { |
| 349 | ZEBRA_NODE, |
| 350 | "%s(config-zebra)# ", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 351 | }; |
| 352 | |
| 353 | #define ADD 0 |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 354 | #define REM 1 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 355 | static void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 356 | ospf6_zebra_route_update (int type, struct ospf6_route *request) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 357 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 358 | struct zapi_ipv6 api; |
ajs | d2fc889 | 2005-04-02 18:38:43 +0000 | [diff] [blame] | 359 | char buf[64]; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 360 | int nhcount; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 361 | struct in6_addr **nexthops; |
| 362 | unsigned int *ifindexes; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 363 | int i, ret = 0; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 364 | struct prefix_ipv6 *dest; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 365 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 366 | if (IS_OSPF6_DEBUG_ZEBRA (SEND)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 367 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 368 | prefix2str (&request->prefix, buf, sizeof (buf)); |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 369 | zlog_debug ("Send %s route: %s", |
| 370 | (type == REM ? "remove" : "add"), buf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 371 | } |
| 372 | |
| 373 | if (zclient->sock < 0) |
| 374 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 375 | if (IS_OSPF6_DEBUG_ZEBRA (SEND)) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 376 | zlog_debug (" Not connected to Zebra"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 377 | return; |
| 378 | } |
| 379 | |
| 380 | if (request->path.origin.adv_router == ospf6->router_id && |
| 381 | (request->path.type == OSPF6_PATH_TYPE_EXTERNAL1 || |
| 382 | request->path.type == OSPF6_PATH_TYPE_EXTERNAL2)) |
| 383 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 384 | if (IS_OSPF6_DEBUG_ZEBRA (SEND)) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 385 | zlog_debug (" Ignore self-originated external route"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 386 | return; |
| 387 | } |
| 388 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 389 | /* If removing is the best path and if there's another path, |
| 390 | treat this request as add the secondary path */ |
| 391 | if (type == REM && ospf6_route_is_best (request) && |
| 392 | request->next && ospf6_route_is_same (request, request->next)) |
| 393 | { |
| 394 | if (IS_OSPF6_DEBUG_ZEBRA (SEND)) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 395 | zlog_debug (" Best-path removal resulted Sencondary addition"); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 396 | type = ADD; |
| 397 | request = request->next; |
| 398 | } |
| 399 | |
| 400 | /* Only the best path will be sent to zebra. */ |
| 401 | if (! ospf6_route_is_best (request)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 402 | { |
| 403 | /* this is not preferred best route, ignore */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 404 | if (IS_OSPF6_DEBUG_ZEBRA (SEND)) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 405 | zlog_debug (" Ignore non-best route"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 406 | return; |
| 407 | } |
| 408 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 409 | nhcount = 0; |
| 410 | for (i = 0; i < OSPF6_MULTI_PATH_LIMIT; i++) |
| 411 | if (ospf6_nexthop_is_set (&request->nexthop[i])) |
| 412 | nhcount++; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 413 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 414 | if (nhcount == 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 415 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 416 | if (IS_OSPF6_DEBUG_ZEBRA (SEND)) |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 417 | zlog_debug (" No nexthop, ignore"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 418 | return; |
| 419 | } |
| 420 | |
| 421 | /* allocate memory for nexthop_list */ |
| 422 | nexthops = XCALLOC (MTYPE_OSPF6_OTHER, |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 423 | nhcount * sizeof (struct in6_addr *)); |
| 424 | if (nexthops == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 425 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 426 | zlog_warn ("Can't send route to zebra: malloc failed"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 427 | return; |
| 428 | } |
| 429 | |
| 430 | /* allocate memory for ifindex_list */ |
| 431 | ifindexes = XCALLOC (MTYPE_OSPF6_OTHER, |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 432 | nhcount * sizeof (unsigned int)); |
| 433 | if (ifindexes == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 434 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 435 | zlog_warn ("Can't send route to zebra: malloc failed"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 436 | XFREE (MTYPE_OSPF6_OTHER, nexthops); |
| 437 | return; |
| 438 | } |
| 439 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 440 | for (i = 0; i < nhcount; i++) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 441 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 442 | if (IS_OSPF6_DEBUG_ZEBRA (SEND)) |
ajs | d2fc889 | 2005-04-02 18:38:43 +0000 | [diff] [blame] | 443 | { |
| 444 | char ifname[IFNAMSIZ]; |
| 445 | inet_ntop (AF_INET6, &request->nexthop[i].address, |
| 446 | buf, sizeof (buf)); |
| 447 | if (!if_indextoname(request->nexthop[i].ifindex, ifname)) |
| 448 | strlcpy(ifname, "unknown", sizeof(ifname)); |
| 449 | zlog_debug (" nexthop: %s%%%.*s(%d)", buf, IFNAMSIZ, ifname, |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 450 | request->nexthop[i].ifindex); |
ajs | d2fc889 | 2005-04-02 18:38:43 +0000 | [diff] [blame] | 451 | } |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 452 | nexthops[i] = &request->nexthop[i].address; |
| 453 | ifindexes[i] = request->nexthop[i].ifindex; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 454 | } |
| 455 | |
| 456 | api.type = ZEBRA_ROUTE_OSPF6; |
| 457 | api.flags = 0; |
| 458 | api.message = 0; |
| 459 | SET_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 460 | api.nexthop_num = nhcount; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 461 | api.nexthop = nexthops; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 462 | SET_FLAG (api.message, ZAPI_MESSAGE_IFINDEX); |
| 463 | api.ifindex_num = nhcount; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 464 | api.ifindex = ifindexes; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 465 | SET_FLAG (api.message, ZAPI_MESSAGE_METRIC); |
| 466 | api.metric = (request->path.metric_type == 2 ? |
| 467 | request->path.cost_e2 : request->path.cost); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 468 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 469 | dest = (struct prefix_ipv6 *) &request->prefix; |
| 470 | if (type == REM) |
| 471 | ret = zapi_ipv6_route (ZEBRA_IPV6_ROUTE_DELETE, zclient, dest, &api); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 472 | else |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 473 | ret = zapi_ipv6_route (ZEBRA_IPV6_ROUTE_ADD, zclient, dest, &api); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 474 | |
| 475 | if (ret < 0) |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 476 | zlog_err ("zapi_ipv6_route() %s failed: %s", |
ajs | 6099b3b | 2004-11-20 02:06:59 +0000 | [diff] [blame] | 477 | (type == REM ? "delete" : "add"), safe_strerror (errno)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 478 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 479 | XFREE (MTYPE_OSPF6_OTHER, nexthops); |
| 480 | XFREE (MTYPE_OSPF6_OTHER, ifindexes); |
| 481 | |
| 482 | return; |
| 483 | } |
| 484 | |
| 485 | void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 486 | ospf6_zebra_route_update_add (struct ospf6_route *request) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 487 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 488 | if (! zclient->redist[ZEBRA_ROUTE_OSPF6]) |
| 489 | { |
| 490 | ospf6->route_table->hook_add = NULL; |
| 491 | ospf6->route_table->hook_remove = NULL; |
| 492 | return; |
| 493 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 494 | ospf6_zebra_route_update (ADD, request); |
| 495 | } |
| 496 | |
| 497 | void |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 498 | ospf6_zebra_route_update_remove (struct ospf6_route *request) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 499 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 500 | if (! zclient->redist[ZEBRA_ROUTE_OSPF6]) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 501 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 502 | ospf6->route_table->hook_add = NULL; |
| 503 | ospf6->route_table->hook_remove = NULL; |
| 504 | return; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 505 | } |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 506 | ospf6_zebra_route_update (REM, request); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 507 | } |
| 508 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 509 | DEFUN (redistribute_ospf6, |
| 510 | redistribute_ospf6_cmd, |
| 511 | "redistribute ospf6", |
| 512 | "Redistribute control\n" |
| 513 | "OSPF6 route\n") |
| 514 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 515 | struct ospf6_route *route; |
| 516 | |
| 517 | if (zclient->redist[ZEBRA_ROUTE_OSPF6]) |
| 518 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 519 | |
| 520 | zclient->redist[ZEBRA_ROUTE_OSPF6] = 1; |
| 521 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 522 | if (ospf6 == NULL) |
| 523 | return CMD_SUCCESS; |
| 524 | |
| 525 | /* send ospf6 route to zebra route table */ |
| 526 | for (route = ospf6_route_head (ospf6->route_table); route; |
| 527 | route = ospf6_route_next (route)) |
| 528 | ospf6_zebra_route_update_add (route); |
| 529 | |
| 530 | ospf6->route_table->hook_add = ospf6_zebra_route_update_add; |
| 531 | ospf6->route_table->hook_remove = ospf6_zebra_route_update_remove; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 532 | |
| 533 | return CMD_SUCCESS; |
| 534 | } |
| 535 | |
| 536 | DEFUN (no_redistribute_ospf6, |
| 537 | no_redistribute_ospf6_cmd, |
| 538 | "no redistribute ospf6", |
| 539 | NO_STR |
| 540 | "Redistribute control\n" |
| 541 | "OSPF6 route\n") |
| 542 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 543 | struct ospf6_route *route; |
| 544 | |
| 545 | if (! zclient->redist[ZEBRA_ROUTE_OSPF6]) |
| 546 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 547 | |
| 548 | zclient->redist[ZEBRA_ROUTE_OSPF6] = 0; |
| 549 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 550 | if (ospf6 == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 551 | return CMD_SUCCESS; |
| 552 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 553 | ospf6->route_table->hook_add = NULL; |
| 554 | ospf6->route_table->hook_remove = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 555 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 556 | /* withdraw ospf6 route from zebra route table */ |
| 557 | for (route = ospf6_route_head (ospf6->route_table); route; |
| 558 | route = ospf6_route_next (route)) |
| 559 | ospf6_zebra_route_update_remove (route); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 560 | |
| 561 | return CMD_SUCCESS; |
| 562 | } |
| 563 | |
| 564 | void |
| 565 | ospf6_zebra_init () |
| 566 | { |
| 567 | /* Allocate zebra structure. */ |
| 568 | zclient = zclient_new (); |
| 569 | zclient_init (zclient, ZEBRA_ROUTE_OSPF6); |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 570 | zclient->router_id_update = ospf6_router_id_update_zebra; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 571 | zclient->interface_add = ospf6_zebra_if_add; |
| 572 | zclient->interface_delete = ospf6_zebra_if_del; |
| 573 | zclient->interface_up = ospf6_zebra_if_state_update; |
| 574 | zclient->interface_down = ospf6_zebra_if_state_update; |
| 575 | zclient->interface_address_add = ospf6_zebra_if_address_update_add; |
| 576 | zclient->interface_address_delete = ospf6_zebra_if_address_update_delete; |
| 577 | zclient->ipv4_route_add = NULL; |
| 578 | zclient->ipv4_route_delete = NULL; |
| 579 | zclient->ipv6_route_add = ospf6_zebra_read_ipv6; |
| 580 | zclient->ipv6_route_delete = ospf6_zebra_read_ipv6; |
| 581 | |
| 582 | /* redistribute connected route by default */ |
| 583 | /* ospf6_zebra_redistribute (ZEBRA_ROUTE_CONNECT); */ |
| 584 | |
| 585 | /* Install zebra node. */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 586 | install_node (&zebra_node, config_write_ospf6_zebra); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 587 | |
| 588 | /* Install command element for zebra node. */ |
| 589 | install_element (VIEW_NODE, &show_zebra_cmd); |
| 590 | install_element (ENABLE_NODE, &show_zebra_cmd); |
| 591 | install_element (CONFIG_NODE, &router_zebra_cmd); |
| 592 | install_element (CONFIG_NODE, &no_router_zebra_cmd); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 593 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 594 | install_default (ZEBRA_NODE); |
| 595 | install_element (ZEBRA_NODE, &redistribute_ospf6_cmd); |
| 596 | install_element (ZEBRA_NODE, &no_redistribute_ospf6_cmd); |
| 597 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 598 | return; |
| 599 | } |
| 600 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 601 | /* Debug */ |
| 602 | |
| 603 | DEFUN (debug_ospf6_zebra_sendrecv, |
| 604 | debug_ospf6_zebra_sendrecv_cmd, |
| 605 | "debug ospf6 zebra (send|recv)", |
| 606 | DEBUG_STR |
| 607 | OSPF6_STR |
| 608 | "Debug connection between zebra\n" |
| 609 | "Debug Sending zebra\n" |
| 610 | "Debug Receiving zebra\n" |
| 611 | ) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 612 | { |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 613 | unsigned char level = 0; |
| 614 | |
| 615 | if (argc) |
| 616 | { |
| 617 | if (! strncmp (argv[0], "s", 1)) |
| 618 | level = OSPF6_DEBUG_ZEBRA_SEND; |
| 619 | else if (! strncmp (argv[0], "r", 1)) |
| 620 | level = OSPF6_DEBUG_ZEBRA_RECV; |
| 621 | } |
| 622 | else |
| 623 | level = OSPF6_DEBUG_ZEBRA_SEND | OSPF6_DEBUG_ZEBRA_RECV; |
| 624 | |
| 625 | OSPF6_DEBUG_ZEBRA_ON (level); |
| 626 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 627 | } |
| 628 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 629 | ALIAS (debug_ospf6_zebra_sendrecv, |
| 630 | debug_ospf6_zebra_cmd, |
| 631 | "debug ospf6 zebra", |
| 632 | DEBUG_STR |
| 633 | OSPF6_STR |
| 634 | "Debug connection between zebra\n" |
| 635 | ); |
| 636 | |
| 637 | |
| 638 | DEFUN (no_debug_ospf6_zebra_sendrecv, |
| 639 | no_debug_ospf6_zebra_sendrecv_cmd, |
| 640 | "no debug ospf6 zebra (send|recv)", |
| 641 | NO_STR |
| 642 | DEBUG_STR |
| 643 | OSPF6_STR |
| 644 | "Debug connection between zebra\n" |
| 645 | "Debug Sending zebra\n" |
| 646 | "Debug Receiving zebra\n" |
| 647 | ) |
| 648 | { |
| 649 | unsigned char level = 0; |
| 650 | |
| 651 | if (argc) |
| 652 | { |
| 653 | if (! strncmp (argv[0], "s", 1)) |
| 654 | level = OSPF6_DEBUG_ZEBRA_SEND; |
| 655 | else if (! strncmp (argv[0], "r", 1)) |
| 656 | level = OSPF6_DEBUG_ZEBRA_RECV; |
| 657 | } |
| 658 | else |
| 659 | level = OSPF6_DEBUG_ZEBRA_SEND | OSPF6_DEBUG_ZEBRA_RECV; |
| 660 | |
| 661 | OSPF6_DEBUG_ZEBRA_OFF (level); |
| 662 | return CMD_SUCCESS; |
| 663 | } |
| 664 | |
| 665 | ALIAS (no_debug_ospf6_zebra_sendrecv, |
| 666 | no_debug_ospf6_zebra_cmd, |
| 667 | "no debug ospf6 zebra", |
| 668 | NO_STR |
| 669 | DEBUG_STR |
| 670 | OSPF6_STR |
| 671 | "Debug connection between zebra\n" |
| 672 | ); |
| 673 | |
| 674 | int |
| 675 | config_write_ospf6_debug_zebra (struct vty *vty) |
| 676 | { |
| 677 | if (IS_OSPF6_DEBUG_ZEBRA (SEND) && IS_OSPF6_DEBUG_ZEBRA (RECV)) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 678 | vty_out (vty, "debug ospf6 zebra%s", VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 679 | else |
| 680 | { |
| 681 | if (IS_OSPF6_DEBUG_ZEBRA (SEND)) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 682 | vty_out (vty, "debug ospf6 zebra send%s", VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 683 | if (IS_OSPF6_DEBUG_ZEBRA (RECV)) |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 684 | vty_out (vty, "debug ospf6 zebra recv%s", VNL); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 685 | } |
| 686 | return 0; |
| 687 | } |
| 688 | |
| 689 | void |
| 690 | install_element_ospf6_debug_zebra () |
| 691 | { |
| 692 | install_element (ENABLE_NODE, &debug_ospf6_zebra_cmd); |
| 693 | install_element (ENABLE_NODE, &no_debug_ospf6_zebra_cmd); |
| 694 | install_element (ENABLE_NODE, &debug_ospf6_zebra_sendrecv_cmd); |
| 695 | install_element (ENABLE_NODE, &no_debug_ospf6_zebra_sendrecv_cmd); |
| 696 | install_element (CONFIG_NODE, &debug_ospf6_zebra_cmd); |
| 697 | install_element (CONFIG_NODE, &no_debug_ospf6_zebra_cmd); |
| 698 | install_element (CONFIG_NODE, &debug_ospf6_zebra_sendrecv_cmd); |
| 699 | install_element (CONFIG_NODE, &no_debug_ospf6_zebra_sendrecv_cmd); |
| 700 | } |
| 701 | |
| 702 | |