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