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