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