2 * Copyright (C) 2003 Yasuhiro Ohara
4 * This file is part of GNU Zebra.
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
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.
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.
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"
42 unsigned char conf_debug_ospf6_zebra
= 0;
44 /* information about zebra. */
45 struct zclient
*zclient
= NULL
;
47 struct in_addr router_id_zebra
;
49 /* Router-id update message from zebra. */
51 ospf6_router_id_update_zebra (int command
, struct zclient
*zclient
,
52 zebra_size_t length
, vrf_id_t vrf_id
)
54 struct prefix router_id
;
55 struct ospf6
*o
= ospf6
;
57 zebra_router_id_update_read(zclient
->ibuf
,&router_id
);
58 router_id_zebra
= router_id
.u
.prefix4
;
63 if (o
->router_id
== 0)
64 o
->router_id
= (u_int32_t
) router_id_zebra
.s_addr
;
69 /* redistribute function */
71 ospf6_zebra_redistribute (int type
)
73 if (vrf_bitmap_check (zclient
->redist
[AFI_IP6
][type
], VRF_DEFAULT
))
75 vrf_bitmap_set (zclient
->redist
[AFI_IP6
][type
], VRF_DEFAULT
);
77 if (zclient
->sock
> 0)
78 zebra_redistribute_send (ZEBRA_REDISTRIBUTE_ADD
, zclient
, AFI_IP6
, type
, 0,
83 ospf6_zebra_no_redistribute (int type
)
85 if (!vrf_bitmap_check (zclient
->redist
[AFI_IP6
][type
], VRF_DEFAULT
))
87 vrf_bitmap_unset (zclient
->redist
[AFI_IP6
][type
], VRF_DEFAULT
);
88 if (zclient
->sock
> 0)
89 zebra_redistribute_send (ZEBRA_REDISTRIBUTE_DELETE
, zclient
, AFI_IP6
, type
,
93 /* Inteface addition message from zebra. */
95 ospf6_zebra_if_add (int command
, struct zclient
*zclient
, zebra_size_t length
,
98 struct interface
*ifp
;
100 ifp
= zebra_interface_add_read (zclient
->ibuf
, vrf_id
);
101 if (IS_OSPF6_DEBUG_ZEBRA (RECV
))
102 zlog_debug ("Zebra Interface add: %s index %d mtu %d",
103 ifp
->name
, ifp
->ifindex
, ifp
->mtu6
);
104 ospf6_interface_if_add (ifp
);
109 ospf6_zebra_if_del (int command
, struct zclient
*zclient
, zebra_size_t length
,
112 struct interface
*ifp
;
114 if (!(ifp
= zebra_interface_state_read (zclient
->ibuf
, vrf_id
)))
118 zlog_warn ("Zebra: got delete of %s, but interface is still up", ifp
->name
);
120 if (IS_OSPF6_DEBUG_ZEBRA (RECV
))
121 zlog_debug ("Zebra Interface delete: %s index %d mtu %d",
122 ifp
->name
, ifp
->ifindex
, ifp
->mtu6
);
125 /* XXX: ospf6_interface_if_del is not the right way to handle this,
126 * because among other thinkable issues, it will also clear all
127 * settings as they are contained in the struct ospf6_interface. */
128 ospf6_interface_if_del (ifp
);
131 ifp
->ifindex
= IFINDEX_DELETED
;
136 ospf6_zebra_if_state_update (int command
, struct zclient
*zclient
,
137 zebra_size_t length
, vrf_id_t vrf_id
)
139 struct interface
*ifp
;
141 ifp
= zebra_interface_state_read (zclient
->ibuf
, vrf_id
);
145 if (IS_OSPF6_DEBUG_ZEBRA (RECV
))
146 zlog_debug ("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
);
151 ospf6_interface_state_update (ifp
);
156 ospf6_zebra_if_address_update_add (int command
, struct zclient
*zclient
,
157 zebra_size_t length
, vrf_id_t vrf_id
)
162 c
= zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_ADD
, zclient
->ibuf
,
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
)), c
->address
->prefixlen
);
173 if (c
->address
->family
== AF_INET6
)
175 ospf6_interface_state_update (c
->ifp
);
176 ospf6_interface_connected_route_update (c
->ifp
);
182 ospf6_zebra_if_address_update_delete (int command
, struct zclient
*zclient
,
183 zebra_size_t length
, vrf_id_t vrf_id
)
188 c
= zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_DELETE
, zclient
->ibuf
,
193 if (IS_OSPF6_DEBUG_ZEBRA (RECV
))
194 zlog_debug ("Zebra Interface address delete: %s %5s %s/%d",
195 c
->ifp
->name
, prefix_family_str (c
->address
),
196 inet_ntop (c
->address
->family
, &c
->address
->u
.prefix
,
197 buf
, sizeof (buf
)), c
->address
->prefixlen
);
199 if (c
->address
->family
== AF_INET6
)
201 ospf6_interface_connected_route_update (c
->ifp
);
202 ospf6_interface_state_update (c
->ifp
);
209 ospf6_zebra_read_ipv6 (int command
, struct zclient
*zclient
,
210 zebra_size_t length
, vrf_id_t vrf_id
)
213 struct zapi_ipv6 api
;
214 unsigned long ifindex
;
215 struct prefix_ipv6 p
;
216 struct in6_addr
*nexthop
;
224 memset (&api
, 0, sizeof (api
));
226 /* Type, flags, message. */
227 api
.type
= stream_getc (s
);
228 api
.instance
= stream_getw (s
);
229 api
.flags
= stream_getc (s
);
230 api
.message
= stream_getc (s
);
233 memset (&p
, 0, sizeof (struct prefix_ipv6
));
235 p
.prefixlen
= stream_getc (s
);
236 stream_get (&p
.prefix
, s
, PSIZE (p
.prefixlen
));
238 /* Nexthop, ifindex, distance, metric. */
239 if (CHECK_FLAG (api
.message
, ZAPI_MESSAGE_NEXTHOP
))
241 api
.nexthop_num
= stream_getc (s
);
242 nexthop
= (struct in6_addr
*)
243 malloc (api
.nexthop_num
* sizeof (struct in6_addr
));
244 stream_get (nexthop
, s
, api
.nexthop_num
* sizeof (struct in6_addr
));
246 if (CHECK_FLAG (api
.message
, ZAPI_MESSAGE_IFINDEX
))
248 api
.ifindex_num
= stream_getc (s
);
249 ifindex
= stream_getl (s
);
251 if (CHECK_FLAG (api
.message
, ZAPI_MESSAGE_DISTANCE
))
252 api
.distance
= stream_getc (s
);
255 if (CHECK_FLAG (api
.message
, ZAPI_MESSAGE_METRIC
))
256 api
.metric
= stream_getl (s
);
260 if (IS_OSPF6_DEBUG_ZEBRA (RECV
))
262 char prefixstr
[PREFIX2STR_BUFFER
], nexthopstr
[128];
263 prefix2str ((struct prefix
*)&p
, prefixstr
, sizeof (prefixstr
));
265 inet_ntop (AF_INET6
, nexthop
, nexthopstr
, sizeof (nexthopstr
));
267 snprintf (nexthopstr
, sizeof (nexthopstr
), "::");
269 zlog_debug ("Zebra Receive route %s: %s %s nexthop %s ifindex %ld",
270 (command
== ZEBRA_IPV6_ROUTE_ADD
? "add" : "delete"),
271 zebra_route_string(api
.type
), prefixstr
, nexthopstr
, ifindex
);
274 if (command
== ZEBRA_REDISTRIBUTE_IPV6_ADD
)
275 ospf6_asbr_redistribute_add (api
.type
, ifindex
, (struct prefix
*) &p
,
276 api
.nexthop_num
, nexthop
);
278 ospf6_asbr_redistribute_remove (api
.type
, ifindex
, (struct prefix
*) &p
);
280 if (CHECK_FLAG (api
.message
, ZAPI_MESSAGE_NEXTHOP
))
293 "Zebra information\n")
298 vty_out (vty
, "Not connected to zebra%s", VNL
);
302 vty_out (vty
, "Zebra Infomation%s", VNL
);
303 vty_out (vty
, " enable: %d fail: %d%s",
304 zclient
->enable
, zclient
->fail
, VNL
);
305 vty_out (vty
, " redistribute default: %d%s",
306 vrf_bitmap_check (zclient
->default_information
, VRF_DEFAULT
),
308 vty_out (vty
, " redistribute:");
309 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++)
311 if (vrf_bitmap_check (zclient
->redist
[AFI_IP6
][i
], VRF_DEFAULT
))
312 vty_out (vty
, " %s", zebra_route_string(i
));
314 vty_out (vty
, "%s", VNL
);
321 "Enable a routing process\n"
322 "Make connection to zebra daemon\n")
324 vty
->node
= ZEBRA_NODE
;
326 zclient_start (zclient
);
330 DEFUN (no_router_zebra
,
334 "Configure routing process\n"
335 "Disable connection to zebra daemon\n")
338 zclient_stop (zclient
);
342 /* Zebra configuration write function. */
344 config_write_ospf6_zebra (struct vty
*vty
)
346 if (! zclient
->enable
)
348 vty_out (vty
, "no router zebra%s", VNL
);
349 vty_out (vty
, "!%s", VNL
);
351 else if (! vrf_bitmap_check (zclient
->redist
[AFI_IP6
][ZEBRA_ROUTE_OSPF6
],
354 vty_out (vty
, "router zebra%s", VNL
);
355 vty_out (vty
, " no redistribute ospf6%s", VNL
);
356 vty_out (vty
, "!%s", VNL
);
361 /* Zebra node structure. */
362 static struct cmd_node zebra_node
=
365 "%s(config-zebra)# ",
371 ospf6_zebra_route_update (int type
, struct ospf6_route
*request
)
373 struct zapi_ipv6 api
;
374 char buf
[PREFIX2STR_BUFFER
];
376 struct in6_addr
**nexthops
;
377 unsigned int *ifindexes
;
379 struct prefix_ipv6
*dest
;
381 if (IS_OSPF6_DEBUG_ZEBRA (SEND
))
383 prefix2str (&request
->prefix
, buf
, sizeof (buf
));
384 zlog_debug ("Send %s route: %s",
385 (type
== REM
? "remove" : "add"), buf
);
388 if (zclient
->sock
< 0)
390 if (IS_OSPF6_DEBUG_ZEBRA (SEND
))
391 zlog_debug (" Not connected to Zebra");
395 if (request
->path
.origin
.adv_router
== ospf6
->router_id
&&
396 (request
->path
.type
== OSPF6_PATH_TYPE_EXTERNAL1
||
397 request
->path
.type
== OSPF6_PATH_TYPE_EXTERNAL2
))
399 if (IS_OSPF6_DEBUG_ZEBRA (SEND
))
400 zlog_debug (" Ignore self-originated external route");
404 /* If removing is the best path and if there's another path,
405 treat this request as add the secondary path */
406 if (type
== REM
&& ospf6_route_is_best (request
) &&
407 request
->next
&& ospf6_route_is_same (request
, request
->next
))
409 if (IS_OSPF6_DEBUG_ZEBRA (SEND
))
410 zlog_debug (" Best-path removal resulted Sencondary addition");
412 request
= request
->next
;
415 /* Only the best path will be sent to zebra. */
416 if (! ospf6_route_is_best (request
))
418 /* this is not preferred best route, ignore */
419 if (IS_OSPF6_DEBUG_ZEBRA (SEND
))
420 zlog_debug (" Ignore non-best route");
424 nhcount
= ospf6_route_num_nexthops (request
);
427 if (IS_OSPF6_DEBUG_ZEBRA (SEND
))
428 zlog_debug (" No nexthop, ignore");
432 /* allocate memory for nexthop_list */
433 nexthops
= XCALLOC (MTYPE_OSPF6_OTHER
,
434 nhcount
* sizeof (struct in6_addr
*));
435 if (nexthops
== NULL
)
437 zlog_warn ("Can't send route to zebra: malloc failed");
441 /* allocate memory for ifindex_list */
442 ifindexes
= XCALLOC (MTYPE_OSPF6_OTHER
,
443 nhcount
* sizeof (unsigned int));
444 if (ifindexes
== NULL
)
446 zlog_warn ("Can't send route to zebra: malloc failed");
447 XFREE (MTYPE_OSPF6_OTHER
, nexthops
);
451 ospf6_route_zebra_copy_nexthops (request
, ifindexes
, nexthops
, nhcount
);
453 api
.vrf_id
= VRF_DEFAULT
;
454 api
.type
= ZEBRA_ROUTE_OSPF6
;
458 api
.safi
= SAFI_UNICAST
;
459 SET_FLAG (api
.message
, ZAPI_MESSAGE_NEXTHOP
);
460 api
.nexthop_num
= nhcount
;
461 api
.nexthop
= nexthops
;
462 SET_FLAG (api
.message
, ZAPI_MESSAGE_IFINDEX
);
463 api
.ifindex_num
= nhcount
;
464 api
.ifindex
= ifindexes
;
465 SET_FLAG (api
.message
, ZAPI_MESSAGE_METRIC
);
466 api
.metric
= (request
->path
.metric_type
== 2 ?
467 request
->path
.u
.cost_e2
: request
->path
.cost
);
469 dest
= (struct prefix_ipv6
*) &request
->prefix
;
471 ret
= zapi_ipv6_route (ZEBRA_IPV6_ROUTE_DELETE
, zclient
, dest
, &api
);
473 ret
= zapi_ipv6_route (ZEBRA_IPV6_ROUTE_ADD
, zclient
, dest
, &api
);
476 zlog_err ("zapi_ipv6_route() %s failed: %s",
477 (type
== REM
? "delete" : "add"), safe_strerror (errno
));
479 XFREE (MTYPE_OSPF6_OTHER
, nexthops
);
480 XFREE (MTYPE_OSPF6_OTHER
, ifindexes
);
486 ospf6_zebra_route_update_add (struct ospf6_route
*request
)
488 if (! vrf_bitmap_check (zclient
->redist
[AFI_IP6
][ZEBRA_ROUTE_OSPF6
],
491 ospf6
->route_table
->hook_add
= NULL
;
492 ospf6
->route_table
->hook_remove
= NULL
;
495 ospf6_zebra_route_update (ADD
, request
);
499 ospf6_zebra_route_update_remove (struct ospf6_route
*request
)
501 if (! vrf_bitmap_check (zclient
->redist
[AFI_IP6
][ZEBRA_ROUTE_OSPF6
],
504 ospf6
->route_table
->hook_add
= NULL
;
505 ospf6
->route_table
->hook_remove
= NULL
;
508 ospf6_zebra_route_update (REM
, request
);
512 ospf6_zebra_add_discard (struct ospf6_route
*request
)
514 struct zapi_ipv6 api
;
515 char buf
[INET6_ADDRSTRLEN
];
516 struct prefix_ipv6
*dest
;
518 if (vrf_bitmap_check (zclient
->redist
[AFI_IP6
][ZEBRA_ROUTE_OSPF6
],
521 if (!CHECK_FLAG (request
->flag
, OSPF6_ROUTE_BLACKHOLE_ADDED
))
523 api
.vrf_id
= VRF_DEFAULT
;
524 api
.type
= ZEBRA_ROUTE_OSPF6
;
525 api
.flags
= ZEBRA_FLAG_BLACKHOLE
;
528 api
.safi
= SAFI_UNICAST
;
529 SET_FLAG (api
.message
, ZAPI_MESSAGE_NEXTHOP
);
533 dest
= (struct prefix_ipv6
*) &request
->prefix
;
535 zapi_ipv6_route (ZEBRA_IPV6_ROUTE_ADD
, zclient
, dest
, &api
);
537 if (IS_OSPF6_DEBUG_ZEBRA (SEND
))
538 zlog_debug ("Zebra: Route add discard %s/%d",
539 inet_ntop (AF_INET6
, &dest
->prefix
,
540 buf
, INET6_ADDRSTRLEN
),
542 SET_FLAG (request
->flag
, OSPF6_ROUTE_BLACKHOLE_ADDED
);
546 dest
= (struct prefix_ipv6
*) &request
->prefix
;
548 if (IS_OSPF6_DEBUG_ZEBRA (SEND
))
549 zlog_debug ("Zebra: Blackhole route present already %s/%d",
550 inet_ntop (AF_INET6
, &dest
->prefix
,
551 buf
, INET6_ADDRSTRLEN
),
558 ospf6_zebra_delete_discard (struct ospf6_route
*request
)
560 struct zapi_ipv6 api
;
561 char buf
[INET6_ADDRSTRLEN
];
562 struct prefix_ipv6
*dest
;
564 if (vrf_bitmap_check (zclient
->redist
[AFI_IP6
][ZEBRA_ROUTE_OSPF6
], VRF_DEFAULT
))
566 if (CHECK_FLAG (request
->flag
, OSPF6_ROUTE_BLACKHOLE_ADDED
))
568 api
.vrf_id
= VRF_DEFAULT
;
569 api
.type
= ZEBRA_ROUTE_OSPF6
;
570 api
.flags
= ZEBRA_FLAG_BLACKHOLE
;
573 api
.safi
= SAFI_UNICAST
;
574 SET_FLAG (api
.message
, ZAPI_MESSAGE_NEXTHOP
);
578 dest
= (struct prefix_ipv6
*) &request
->prefix
;
580 zapi_ipv6_route (ZEBRA_IPV6_ROUTE_DELETE
, zclient
, dest
, &api
);
582 if (IS_OSPF6_DEBUG_ZEBRA (SEND
))
583 zlog_debug ("Zebra: Route delete discard %s/%d",
584 inet_ntop (AF_INET6
, &dest
->prefix
, buf
,
585 INET6_ADDRSTRLEN
), dest
->prefixlen
);
586 UNSET_FLAG (request
->flag
, OSPF6_ROUTE_BLACKHOLE_ADDED
);
590 dest
= (struct prefix_ipv6
*) &request
->prefix
;
591 if (IS_OSPF6_DEBUG_ZEBRA (SEND
))
592 zlog_debug ("Zebra: Blackhole route already deleted %s/%d",
593 inet_ntop (AF_INET6
, &dest
->prefix
, buf
,
594 INET6_ADDRSTRLEN
), dest
->prefixlen
);
599 DEFUN (redistribute_ospf6
,
600 redistribute_ospf6_cmd
,
601 "redistribute ospf6",
602 "Redistribute control\n"
605 struct ospf6_route
*route
;
607 if (vrf_bitmap_check (zclient
->redist
[AFI_IP6
][ZEBRA_ROUTE_OSPF6
], VRF_DEFAULT
))
610 vrf_bitmap_set (zclient
->redist
[AFI_IP6
][ZEBRA_ROUTE_OSPF6
], VRF_DEFAULT
);
615 /* send ospf6 route to zebra route table */
616 for (route
= ospf6_route_head (ospf6
->route_table
); route
;
617 route
= ospf6_route_next (route
))
618 ospf6_zebra_route_update_add (route
);
620 ospf6
->route_table
->hook_add
= ospf6_zebra_route_update_add
;
621 ospf6
->route_table
->hook_remove
= ospf6_zebra_route_update_remove
;
626 DEFUN (no_redistribute_ospf6
,
627 no_redistribute_ospf6_cmd
,
628 "no redistribute ospf6",
630 "Redistribute control\n"
633 struct ospf6_route
*route
;
635 if (! vrf_bitmap_check (zclient
->redist
[AFI_IP6
][ZEBRA_ROUTE_OSPF6
], VRF_DEFAULT
))
638 vrf_bitmap_unset (zclient
->redist
[AFI_IP6
][ZEBRA_ROUTE_OSPF6
], VRF_DEFAULT
);
643 ospf6
->route_table
->hook_add
= NULL
;
644 ospf6
->route_table
->hook_remove
= NULL
;
646 /* withdraw ospf6 route from zebra route table */
647 for (route
= ospf6_route_head (ospf6
->route_table
); route
;
648 route
= ospf6_route_next (route
))
649 ospf6_zebra_route_update_remove (route
);
655 ospf6_zebra_connected (struct zclient
*zclient
)
657 zclient_send_reg_requests (zclient
, VRF_DEFAULT
);
661 ospf6_zebra_init (struct thread_master
*master
)
663 /* Allocate zebra structure. */
664 zclient
= zclient_new(master
);
665 zclient_init (zclient
, ZEBRA_ROUTE_OSPF6
, 0);
666 zclient
->zebra_connected
= ospf6_zebra_connected
;
667 zclient
->router_id_update
= ospf6_router_id_update_zebra
;
668 zclient
->interface_add
= ospf6_zebra_if_add
;
669 zclient
->interface_delete
= ospf6_zebra_if_del
;
670 zclient
->interface_up
= ospf6_zebra_if_state_update
;
671 zclient
->interface_down
= ospf6_zebra_if_state_update
;
672 zclient
->interface_address_add
= ospf6_zebra_if_address_update_add
;
673 zclient
->interface_address_delete
= ospf6_zebra_if_address_update_delete
;
674 zclient
->ipv4_route_add
= NULL
;
675 zclient
->ipv4_route_delete
= NULL
;
676 zclient
->redistribute_route_ipv4_add
= NULL
;
677 zclient
->redistribute_route_ipv4_del
= NULL
;
678 zclient
->ipv6_route_add
= ospf6_zebra_read_ipv6
;
679 zclient
->ipv6_route_delete
= ospf6_zebra_read_ipv6
;
680 zclient
->redistribute_route_ipv6_add
= ospf6_zebra_read_ipv6
;
681 zclient
->redistribute_route_ipv6_del
= ospf6_zebra_read_ipv6
;
683 /* redistribute connected route by default */
684 /* ospf6_zebra_redistribute (ZEBRA_ROUTE_CONNECT); */
686 /* Install zebra node. */
687 install_node (&zebra_node
, config_write_ospf6_zebra
);
689 /* Install command element for zebra node. */
690 install_element (VIEW_NODE
, &show_zebra_cmd
);
691 install_element (ENABLE_NODE
, &show_zebra_cmd
);
692 install_element (CONFIG_NODE
, &router_zebra_cmd
);
693 install_element (CONFIG_NODE
, &no_router_zebra_cmd
);
695 install_default (ZEBRA_NODE
);
696 install_element (ZEBRA_NODE
, &redistribute_ospf6_cmd
);
697 install_element (ZEBRA_NODE
, &no_redistribute_ospf6_cmd
);
704 DEFUN (debug_ospf6_zebra_sendrecv
,
705 debug_ospf6_zebra_sendrecv_cmd
,
706 "debug ospf6 zebra (send|recv)",
709 "Debug connection between zebra\n"
710 "Debug Sending zebra\n"
711 "Debug Receiving zebra\n"
714 unsigned char level
= 0;
718 if (! strncmp (argv
[0], "s", 1))
719 level
= OSPF6_DEBUG_ZEBRA_SEND
;
720 else if (! strncmp (argv
[0], "r", 1))
721 level
= OSPF6_DEBUG_ZEBRA_RECV
;
724 level
= OSPF6_DEBUG_ZEBRA_SEND
| OSPF6_DEBUG_ZEBRA_RECV
;
726 OSPF6_DEBUG_ZEBRA_ON (level
);
730 ALIAS (debug_ospf6_zebra_sendrecv
,
731 debug_ospf6_zebra_cmd
,
735 "Debug connection between zebra\n"
739 DEFUN (no_debug_ospf6_zebra_sendrecv
,
740 no_debug_ospf6_zebra_sendrecv_cmd
,
741 "no debug ospf6 zebra (send|recv)",
745 "Debug connection between zebra\n"
746 "Debug Sending zebra\n"
747 "Debug Receiving zebra\n"
750 unsigned char level
= 0;
754 if (! strncmp (argv
[0], "s", 1))
755 level
= OSPF6_DEBUG_ZEBRA_SEND
;
756 else if (! strncmp (argv
[0], "r", 1))
757 level
= OSPF6_DEBUG_ZEBRA_RECV
;
760 level
= OSPF6_DEBUG_ZEBRA_SEND
| OSPF6_DEBUG_ZEBRA_RECV
;
762 OSPF6_DEBUG_ZEBRA_OFF (level
);
766 ALIAS (no_debug_ospf6_zebra_sendrecv
,
767 no_debug_ospf6_zebra_cmd
,
768 "no debug ospf6 zebra",
772 "Debug connection between zebra\n"
776 config_write_ospf6_debug_zebra (struct vty
*vty
)
778 if (IS_OSPF6_DEBUG_ZEBRA (SEND
) && IS_OSPF6_DEBUG_ZEBRA (RECV
))
779 vty_out (vty
, "debug ospf6 zebra%s", VNL
);
782 if (IS_OSPF6_DEBUG_ZEBRA (SEND
))
783 vty_out (vty
, "debug ospf6 zebra send%s", VNL
);
784 if (IS_OSPF6_DEBUG_ZEBRA (RECV
))
785 vty_out (vty
, "debug ospf6 zebra recv%s", VNL
);
791 install_element_ospf6_debug_zebra (void)
793 install_element (ENABLE_NODE
, &debug_ospf6_zebra_cmd
);
794 install_element (ENABLE_NODE
, &no_debug_ospf6_zebra_cmd
);
795 install_element (ENABLE_NODE
, &debug_ospf6_zebra_sendrecv_cmd
);
796 install_element (ENABLE_NODE
, &no_debug_ospf6_zebra_sendrecv_cmd
);
797 install_element (CONFIG_NODE
, &debug_ospf6_zebra_cmd
);
798 install_element (CONFIG_NODE
, &no_debug_ospf6_zebra_cmd
);
799 install_element (CONFIG_NODE
, &debug_ospf6_zebra_sendrecv_cmd
);
800 install_element (CONFIG_NODE
, &no_debug_ospf6_zebra_sendrecv_cmd
);