]> git.proxmox.com Git - mirror_frr.git/blob - ospf6d/ospf6_zebra.c
Merge branch 'master' into docuser
[mirror_frr.git] / ospf6d / ospf6_zebra.c
1 /*
2 * Copyright (C) 2003 Yasuhiro Ohara
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 along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #include <zebra.h>
22
23 #include "log.h"
24 #include "vty.h"
25 #include "command.h"
26 #include "prefix.h"
27 #include "stream.h"
28 #include "zclient.h"
29 #include "memory.h"
30 #include "lib/bfd.h"
31
32 #include "ospf6_proto.h"
33 #include "ospf6_top.h"
34 #include "ospf6_interface.h"
35 #include "ospf6_route.h"
36 #include "ospf6_lsa.h"
37 #include "ospf6_lsdb.h"
38 #include "ospf6_asbr.h"
39 #include "ospf6_zebra.h"
40 #include "ospf6d.h"
41
42 DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_DISTANCE, "OSPF6 distance")
43
44 unsigned char conf_debug_ospf6_zebra = 0;
45
46 /* information about zebra. */
47 struct zclient *zclient = NULL;
48
49 /* Router-id update message from zebra. */
50 static int ospf6_router_id_update_zebra(int command, struct zclient *zclient,
51 zebra_size_t length, vrf_id_t vrf_id)
52 {
53 struct prefix router_id;
54 struct ospf6 *o = ospf6;
55
56 zebra_router_id_update_read(zclient->ibuf, &router_id);
57
58 if (o == NULL)
59 return 0;
60
61 o->router_id_zebra = router_id.u.prefix4;
62
63 if (o->router_id == 0)
64 o->router_id = (uint32_t)o->router_id_zebra.s_addr;
65
66 return 0;
67 }
68
69 /* redistribute function */
70 void ospf6_zebra_redistribute(int type)
71 {
72 if (vrf_bitmap_check(zclient->redist[AFI_IP6][type], VRF_DEFAULT))
73 return;
74 vrf_bitmap_set(zclient->redist[AFI_IP6][type], VRF_DEFAULT);
75
76 if (zclient->sock > 0)
77 zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, zclient,
78 AFI_IP6, type, 0, VRF_DEFAULT);
79 }
80
81 void ospf6_zebra_no_redistribute(int type)
82 {
83 if (!vrf_bitmap_check(zclient->redist[AFI_IP6][type], VRF_DEFAULT))
84 return;
85 vrf_bitmap_unset(zclient->redist[AFI_IP6][type], VRF_DEFAULT);
86 if (zclient->sock > 0)
87 zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, zclient,
88 AFI_IP6, type, 0, VRF_DEFAULT);
89 }
90
91 /* Inteface addition message from zebra. */
92 static int ospf6_zebra_if_add(int command, struct zclient *zclient,
93 zebra_size_t length, vrf_id_t vrf_id)
94 {
95 struct interface *ifp;
96
97 ifp = zebra_interface_add_read(zclient->ibuf, vrf_id);
98 if (IS_OSPF6_DEBUG_ZEBRA(RECV))
99 zlog_debug("Zebra Interface add: %s index %d mtu %d", ifp->name,
100 ifp->ifindex, ifp->mtu6);
101 ospf6_interface_if_add(ifp);
102 return 0;
103 }
104
105 static int ospf6_zebra_if_del(int command, struct zclient *zclient,
106 zebra_size_t length, vrf_id_t vrf_id)
107 {
108 struct interface *ifp;
109
110 if (!(ifp = zebra_interface_state_read(zclient->ibuf, vrf_id)))
111 return 0;
112
113 if (if_is_up(ifp))
114 zlog_warn("Zebra: got delete of %s, but interface is still up",
115 ifp->name);
116
117 if (IS_OSPF6_DEBUG_ZEBRA(RECV))
118 zlog_debug("Zebra Interface delete: %s index %d mtu %d",
119 ifp->name, ifp->ifindex, ifp->mtu6);
120
121 #if 0
122 /* XXX: ospf6_interface_if_del is not the right way to handle this,
123 * because among other thinkable issues, it will also clear all
124 * settings as they are contained in the struct ospf6_interface. */
125 ospf6_interface_if_del (ifp);
126 #endif /*0*/
127
128 if_set_index(ifp, IFINDEX_INTERNAL);
129 return 0;
130 }
131
132 static int ospf6_zebra_if_state_update(int command, struct zclient *zclient,
133 zebra_size_t length, vrf_id_t vrf_id)
134 {
135 struct interface *ifp;
136
137 ifp = zebra_interface_state_read(zclient->ibuf, vrf_id);
138 if (ifp == NULL)
139 return 0;
140
141 if (IS_OSPF6_DEBUG_ZEBRA(RECV))
142 zlog_debug(
143 "Zebra Interface state change: "
144 "%s index %d flags %llx metric %d mtu %d bandwidth %d",
145 ifp->name, ifp->ifindex, (unsigned long long)ifp->flags,
146 ifp->metric, ifp->mtu6, ifp->bandwidth);
147
148 ospf6_interface_state_update(ifp);
149 return 0;
150 }
151
152 static int ospf6_zebra_if_address_update_add(int command,
153 struct zclient *zclient,
154 zebra_size_t length,
155 vrf_id_t vrf_id)
156 {
157 struct connected *c;
158 char buf[128];
159
160 c = zebra_interface_address_read(ZEBRA_INTERFACE_ADDRESS_ADD,
161 zclient->ibuf, vrf_id);
162 if (c == NULL)
163 return 0;
164
165 if (IS_OSPF6_DEBUG_ZEBRA(RECV))
166 zlog_debug("Zebra Interface address add: %s %5s %s/%d",
167 c->ifp->name, prefix_family_str(c->address),
168 inet_ntop(c->address->family, &c->address->u.prefix,
169 buf, sizeof(buf)),
170 c->address->prefixlen);
171
172 if (c->address->family == AF_INET6) {
173 ospf6_interface_state_update(c->ifp);
174 ospf6_interface_connected_route_update(c->ifp);
175 }
176 return 0;
177 }
178
179 static int ospf6_zebra_if_address_update_delete(int command,
180 struct zclient *zclient,
181 zebra_size_t length,
182 vrf_id_t vrf_id)
183 {
184 struct connected *c;
185 char buf[128];
186
187 c = zebra_interface_address_read(ZEBRA_INTERFACE_ADDRESS_DELETE,
188 zclient->ibuf, vrf_id);
189 if (c == NULL)
190 return 0;
191
192 if (IS_OSPF6_DEBUG_ZEBRA(RECV))
193 zlog_debug("Zebra Interface address delete: %s %5s %s/%d",
194 c->ifp->name, prefix_family_str(c->address),
195 inet_ntop(c->address->family, &c->address->u.prefix,
196 buf, sizeof(buf)),
197 c->address->prefixlen);
198
199 if (c->address->family == AF_INET6) {
200 ospf6_interface_connected_route_update(c->ifp);
201 ospf6_interface_state_update(c->ifp);
202 }
203
204 connected_free(c);
205
206 return 0;
207 }
208
209 static int ospf6_zebra_read_route(int command, struct zclient *zclient,
210 zebra_size_t length, vrf_id_t vrf_id)
211 {
212 struct zapi_route api;
213 unsigned long ifindex;
214 struct in6_addr *nexthop;
215
216 if (ospf6 == NULL)
217 return 0;
218
219 if (zapi_route_decode(zclient->ibuf, &api) < 0)
220 return -1;
221
222 /* we completely ignore srcdest routes for now. */
223 if (CHECK_FLAG(api.message, ZAPI_MESSAGE_SRCPFX))
224 return 0;
225
226 ifindex = api.nexthops[0].ifindex;
227 nexthop = &api.nexthops[0].gate.ipv6;
228
229 if (IS_OSPF6_DEBUG_ZEBRA(RECV)) {
230 char prefixstr[PREFIX2STR_BUFFER], nexthopstr[128];
231 prefix2str((struct prefix *)&api.prefix, prefixstr,
232 sizeof(prefixstr));
233 inet_ntop(AF_INET6, nexthop, nexthopstr, sizeof(nexthopstr));
234
235 zlog_debug(
236 "Zebra Receive route %s: %s %s nexthop %s ifindex %ld tag %" ROUTE_TAG_PRI,
237 (command == ZEBRA_REDISTRIBUTE_ROUTE_ADD ? "add"
238 : "delete"),
239 zebra_route_string(api.type), prefixstr, nexthopstr,
240 ifindex, api.tag);
241 }
242
243 if (command == ZEBRA_REDISTRIBUTE_ROUTE_ADD)
244 ospf6_asbr_redistribute_add(api.type, ifindex, &api.prefix,
245 api.nexthop_num, nexthop, api.tag);
246 else
247 ospf6_asbr_redistribute_remove(api.type, ifindex, &api.prefix);
248
249 return 0;
250 }
251
252 DEFUN (show_zebra,
253 show_ospf6_zebra_cmd,
254 "show ipv6 ospf6 zebra",
255 SHOW_STR
256 IPV6_STR
257 OSPF6_STR
258 ZEBRA_STR)
259 {
260 int i;
261 if (zclient == NULL) {
262 vty_out(vty, "Not connected to zebra\n");
263 return CMD_SUCCESS;
264 }
265
266 vty_out(vty, "Zebra Infomation\n");
267 vty_out(vty, " fail: %d\n", zclient->fail);
268 vty_out(vty, " redistribute default: %d\n",
269 vrf_bitmap_check(zclient->default_information, VRF_DEFAULT));
270 vty_out(vty, " redistribute:");
271 for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
272 if (vrf_bitmap_check(zclient->redist[AFI_IP6][i], VRF_DEFAULT))
273 vty_out(vty, " %s", zebra_route_string(i));
274 }
275 vty_out(vty, "\n");
276 return CMD_SUCCESS;
277 }
278
279 #define ADD 0
280 #define REM 1
281 static void ospf6_zebra_route_update(int type, struct ospf6_route *request)
282 {
283 struct zapi_route api;
284 char buf[PREFIX2STR_BUFFER];
285 int nhcount;
286 int ret = 0;
287 struct prefix *dest;
288
289 if (IS_OSPF6_DEBUG_ZEBRA(SEND)) {
290 prefix2str(&request->prefix, buf, sizeof(buf));
291 zlog_debug("Send %s route: %s",
292 (type == REM ? "remove" : "add"), buf);
293 }
294
295 if (zclient->sock < 0) {
296 if (IS_OSPF6_DEBUG_ZEBRA(SEND))
297 zlog_debug(" Not connected to Zebra");
298 return;
299 }
300
301 if (request->path.origin.adv_router == ospf6->router_id
302 && (request->path.type == OSPF6_PATH_TYPE_EXTERNAL1
303 || request->path.type == OSPF6_PATH_TYPE_EXTERNAL2)) {
304 if (IS_OSPF6_DEBUG_ZEBRA(SEND))
305 zlog_debug(" Ignore self-originated external route");
306 return;
307 }
308
309 /* If removing is the best path and if there's another path,
310 treat this request as add the secondary path */
311 if (type == REM && ospf6_route_is_best(request) && request->next
312 && ospf6_route_is_same(request, request->next)) {
313 if (IS_OSPF6_DEBUG_ZEBRA(SEND))
314 zlog_debug(
315 " Best-path removal resulted Sencondary addition");
316 type = ADD;
317 request = request->next;
318 }
319
320 /* Only the best path will be sent to zebra. */
321 if (!ospf6_route_is_best(request)) {
322 /* this is not preferred best route, ignore */
323 if (IS_OSPF6_DEBUG_ZEBRA(SEND))
324 zlog_debug(" Ignore non-best route");
325 return;
326 }
327
328 nhcount = ospf6_route_num_nexthops(request);
329 if (nhcount == 0) {
330 if (IS_OSPF6_DEBUG_ZEBRA(SEND))
331 zlog_debug(" No nexthop, ignore");
332 return;
333 }
334
335 dest = &request->prefix;
336
337 memset(&api, 0, sizeof(api));
338 api.vrf_id = VRF_DEFAULT;
339 api.type = ZEBRA_ROUTE_OSPF6;
340 api.safi = SAFI_UNICAST;
341 api.prefix = *dest;
342 SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
343 api.nexthop_num = MIN(nhcount, MULTIPATH_NUM);
344 ospf6_route_zebra_copy_nexthops(request, api.nexthops, api.nexthop_num);
345 SET_FLAG(api.message, ZAPI_MESSAGE_METRIC);
346 api.metric = (request->path.metric_type == 2 ? request->path.u.cost_e2
347 : request->path.cost);
348 if (request->path.tag) {
349 SET_FLAG(api.message, ZAPI_MESSAGE_TAG);
350 api.tag = request->path.tag;
351 }
352
353 SET_FLAG(api.message, ZAPI_MESSAGE_DISTANCE);
354 api.distance =
355 ospf6_distance_apply((struct prefix_ipv6 *)dest, request);
356
357 if (type == REM)
358 ret = zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
359 else
360 ret = zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
361
362 if (ret < 0)
363 zlog_err("zclient_route_send() %s failed: %s",
364 (type == REM ? "delete" : "add"),
365 safe_strerror(errno));
366
367 return;
368 }
369
370 void ospf6_zebra_route_update_add(struct ospf6_route *request)
371 {
372 ospf6_zebra_route_update(ADD, request);
373 }
374
375 void ospf6_zebra_route_update_remove(struct ospf6_route *request)
376 {
377 ospf6_zebra_route_update(REM, request);
378 }
379
380 void ospf6_zebra_add_discard(struct ospf6_route *request)
381 {
382 struct zapi_route api;
383 char buf[INET6_ADDRSTRLEN];
384 struct prefix *dest = &request->prefix;
385
386 if (!CHECK_FLAG(request->flag, OSPF6_ROUTE_BLACKHOLE_ADDED)) {
387 memset(&api, 0, sizeof(api));
388 api.vrf_id = VRF_DEFAULT;
389 api.type = ZEBRA_ROUTE_OSPF6;
390 api.safi = SAFI_UNICAST;
391 api.prefix = *dest;
392 zapi_route_set_blackhole(&api, BLACKHOLE_NULL);
393
394 zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
395
396 if (IS_OSPF6_DEBUG_ZEBRA(SEND))
397 zlog_debug("Zebra: Route add discard %s/%d",
398 inet_ntop(AF_INET6, &dest->u.prefix6, buf,
399 INET6_ADDRSTRLEN),
400 dest->prefixlen);
401
402 SET_FLAG(request->flag, OSPF6_ROUTE_BLACKHOLE_ADDED);
403 } else {
404 if (IS_OSPF6_DEBUG_ZEBRA(SEND))
405 zlog_debug(
406 "Zebra: Blackhole route present already %s/%d",
407 inet_ntop(AF_INET6, &dest->u.prefix6, buf,
408 INET6_ADDRSTRLEN),
409 dest->prefixlen);
410 }
411 }
412
413 void ospf6_zebra_delete_discard(struct ospf6_route *request)
414 {
415 struct zapi_route api;
416 char buf[INET6_ADDRSTRLEN];
417 struct prefix *dest = &request->prefix;
418
419 if (CHECK_FLAG(request->flag, OSPF6_ROUTE_BLACKHOLE_ADDED)) {
420 memset(&api, 0, sizeof(api));
421 api.vrf_id = VRF_DEFAULT;
422 api.type = ZEBRA_ROUTE_OSPF6;
423 api.safi = SAFI_UNICAST;
424 api.prefix = *dest;
425 zapi_route_set_blackhole(&api, BLACKHOLE_NULL);
426
427 zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
428
429 if (IS_OSPF6_DEBUG_ZEBRA(SEND))
430 zlog_debug("Zebra: Route delete discard %s/%d",
431 inet_ntop(AF_INET6, &dest->u.prefix6, buf,
432 INET6_ADDRSTRLEN),
433 dest->prefixlen);
434
435 UNSET_FLAG(request->flag, OSPF6_ROUTE_BLACKHOLE_ADDED);
436 } else {
437 if (IS_OSPF6_DEBUG_ZEBRA(SEND))
438 zlog_debug(
439 "Zebra: Blackhole route already deleted %s/%d",
440 inet_ntop(AF_INET6, &dest->u.prefix6, buf,
441 INET6_ADDRSTRLEN),
442 dest->prefixlen);
443 }
444 }
445
446 static struct ospf6_distance *ospf6_distance_new(void)
447 {
448 return XCALLOC(MTYPE_OSPF6_DISTANCE, sizeof(struct ospf6_distance));
449 }
450
451 static void ospf6_distance_free(struct ospf6_distance *odistance)
452 {
453 XFREE(MTYPE_OSPF6_DISTANCE, odistance);
454 }
455
456 int ospf6_distance_set(struct vty *vty, struct ospf6 *o,
457 const char *distance_str, const char *ip_str,
458 const char *access_list_str)
459 {
460 int ret;
461 struct prefix_ipv6 p;
462 u_char distance;
463 struct route_node *rn;
464 struct ospf6_distance *odistance;
465
466 ret = str2prefix_ipv6(ip_str, &p);
467 if (ret == 0) {
468 vty_out(vty, "Malformed prefix\n");
469 return CMD_WARNING_CONFIG_FAILED;
470 }
471
472 distance = atoi(distance_str);
473
474 /* Get OSPF6 distance node. */
475 rn = route_node_get(o->distance_table, (struct prefix *)&p);
476 if (rn->info) {
477 odistance = rn->info;
478 route_unlock_node(rn);
479 } else {
480 odistance = ospf6_distance_new();
481 rn->info = odistance;
482 }
483
484 /* Set distance value. */
485 odistance->distance = distance;
486
487 /* Reset access-list configuration. */
488 if (odistance->access_list) {
489 free(odistance->access_list);
490 odistance->access_list = NULL;
491 }
492 if (access_list_str)
493 odistance->access_list = strdup(access_list_str);
494
495 return CMD_SUCCESS;
496 }
497
498 int ospf6_distance_unset(struct vty *vty, struct ospf6 *o,
499 const char *distance_str, const char *ip_str,
500 const char *access_list_str)
501 {
502 int ret;
503 struct prefix_ipv6 p;
504 struct route_node *rn;
505 struct ospf6_distance *odistance;
506
507 ret = str2prefix_ipv6(ip_str, &p);
508 if (ret == 0) {
509 vty_out(vty, "Malformed prefix\n");
510 return CMD_WARNING_CONFIG_FAILED;
511 }
512
513 rn = route_node_lookup(o->distance_table, (struct prefix *)&p);
514 if (!rn) {
515 vty_out(vty, "Cant't find specified prefix\n");
516 return CMD_WARNING_CONFIG_FAILED;
517 }
518
519 odistance = rn->info;
520
521 if (odistance->access_list)
522 free(odistance->access_list);
523 ospf6_distance_free(odistance);
524
525 rn->info = NULL;
526 route_unlock_node(rn);
527 route_unlock_node(rn);
528
529 return CMD_SUCCESS;
530 }
531
532 void ospf6_distance_reset(struct ospf6 *o)
533 {
534 struct route_node *rn;
535 struct ospf6_distance *odistance;
536
537 for (rn = route_top(o->distance_table); rn; rn = route_next(rn))
538 if ((odistance = rn->info) != NULL) {
539 if (odistance->access_list)
540 free(odistance->access_list);
541 ospf6_distance_free(odistance);
542 rn->info = NULL;
543 route_unlock_node(rn);
544 }
545 }
546
547 u_char ospf6_distance_apply(struct prefix_ipv6 *p, struct ospf6_route * or)
548 {
549 struct ospf6 *o;
550
551 o = ospf6;
552 if (o == NULL)
553 return 0;
554
555 if (o->distance_intra)
556 if (or->path.type == OSPF6_PATH_TYPE_INTRA)
557 return o->distance_intra;
558
559 if (o->distance_inter)
560 if (or->path.type == OSPF6_PATH_TYPE_INTER)
561 return o->distance_inter;
562
563 if (o->distance_external)
564 if (or->path.type == OSPF6_PATH_TYPE_EXTERNAL1 ||
565 or->path.type == OSPF6_PATH_TYPE_EXTERNAL2)
566 return o->distance_external;
567
568 if (o->distance_all)
569 return o->distance_all;
570
571 return 0;
572 }
573
574 static void ospf6_zebra_connected(struct zclient *zclient)
575 {
576 /* Send the client registration */
577 bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER);
578
579 zclient_send_reg_requests(zclient, VRF_DEFAULT);
580 }
581
582 void ospf6_zebra_init(struct thread_master *master)
583 {
584 /* Allocate zebra structure. */
585 zclient = zclient_new_notify(master, &zclient_options_default);
586 zclient_init(zclient, ZEBRA_ROUTE_OSPF6, 0, &ospf6d_privs);
587 zclient->zebra_connected = ospf6_zebra_connected;
588 zclient->router_id_update = ospf6_router_id_update_zebra;
589 zclient->interface_add = ospf6_zebra_if_add;
590 zclient->interface_delete = ospf6_zebra_if_del;
591 zclient->interface_up = ospf6_zebra_if_state_update;
592 zclient->interface_down = ospf6_zebra_if_state_update;
593 zclient->interface_address_add = ospf6_zebra_if_address_update_add;
594 zclient->interface_address_delete =
595 ospf6_zebra_if_address_update_delete;
596 zclient->redistribute_route_add = ospf6_zebra_read_route;
597 zclient->redistribute_route_del = ospf6_zebra_read_route;
598
599 /* Install command element for zebra node. */
600 install_element(VIEW_NODE, &show_ospf6_zebra_cmd);
601 }
602
603 /* Debug */
604
605 DEFUN (debug_ospf6_zebra_sendrecv,
606 debug_ospf6_zebra_sendrecv_cmd,
607 "debug ospf6 zebra [<send|recv>]",
608 DEBUG_STR
609 OSPF6_STR
610 "Debug connection between zebra\n"
611 "Debug Sending zebra\n"
612 "Debug Receiving zebra\n"
613 )
614 {
615 int idx_send_recv = 3;
616 unsigned char level = 0;
617
618 if (argc == 4) {
619 if (strmatch(argv[idx_send_recv]->text, "send"))
620 level = OSPF6_DEBUG_ZEBRA_SEND;
621 else if (strmatch(argv[idx_send_recv]->text, "recv"))
622 level = OSPF6_DEBUG_ZEBRA_RECV;
623 } else
624 level = OSPF6_DEBUG_ZEBRA_SEND | OSPF6_DEBUG_ZEBRA_RECV;
625
626 OSPF6_DEBUG_ZEBRA_ON(level);
627 return CMD_SUCCESS;
628 }
629
630 DEFUN (no_debug_ospf6_zebra_sendrecv,
631 no_debug_ospf6_zebra_sendrecv_cmd,
632 "no debug ospf6 zebra [<send|recv>]",
633 NO_STR
634 DEBUG_STR
635 OSPF6_STR
636 "Debug connection between zebra\n"
637 "Debug Sending zebra\n"
638 "Debug Receiving zebra\n"
639 )
640 {
641 int idx_send_recv = 4;
642 unsigned char level = 0;
643
644 if (argc == 5) {
645 if (strmatch(argv[idx_send_recv]->text, "send"))
646 level = OSPF6_DEBUG_ZEBRA_SEND;
647 else if (strmatch(argv[idx_send_recv]->text, "recv"))
648 level = OSPF6_DEBUG_ZEBRA_RECV;
649 } else
650 level = OSPF6_DEBUG_ZEBRA_SEND | OSPF6_DEBUG_ZEBRA_RECV;
651
652 OSPF6_DEBUG_ZEBRA_OFF(level);
653 return CMD_SUCCESS;
654 }
655
656
657 int config_write_ospf6_debug_zebra(struct vty *vty)
658 {
659 if (IS_OSPF6_DEBUG_ZEBRA(SEND) && IS_OSPF6_DEBUG_ZEBRA(RECV))
660 vty_out(vty, "debug ospf6 zebra\n");
661 else {
662 if (IS_OSPF6_DEBUG_ZEBRA(SEND))
663 vty_out(vty, "debug ospf6 zebra send\n");
664 if (IS_OSPF6_DEBUG_ZEBRA(RECV))
665 vty_out(vty, "debug ospf6 zebra recv\n");
666 }
667 return 0;
668 }
669
670 void install_element_ospf6_debug_zebra(void)
671 {
672 install_element(ENABLE_NODE, &debug_ospf6_zebra_sendrecv_cmd);
673 install_element(ENABLE_NODE, &no_debug_ospf6_zebra_sendrecv_cmd);
674 install_element(CONFIG_NODE, &debug_ospf6_zebra_sendrecv_cmd);
675 install_element(CONFIG_NODE, &no_debug_ospf6_zebra_sendrecv_cmd);
676 }