diff options
Diffstat (limited to 'ospf6d/ospf6_zebra.c')
| -rw-r--r-- | ospf6d/ospf6_zebra.c | 116 |
1 files changed, 40 insertions, 76 deletions
diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index 3e4042d65d..305870a64f 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -13,10 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; see the file COPYING; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <zebra.h> @@ -217,7 +216,7 @@ ospf6_zebra_read_ipv6 (int command, struct zclient *zclient, struct stream *s; struct zapi_ipv6 api; unsigned long ifindex; - struct prefix_ipv6 p; + struct prefix p, src_p; struct in6_addr *nexthop; if (ospf6 == NULL) @@ -235,10 +234,22 @@ ospf6_zebra_read_ipv6 (int command, struct zclient *zclient, api.message = stream_getc (s); /* IPv6 prefix. */ - memset (&p, 0, sizeof (struct prefix_ipv6)); + memset (&p, 0, sizeof (struct prefix)); p.family = AF_INET6; p.prefixlen = MIN(IPV6_MAX_PREFIXLEN, stream_getc (s)); - stream_get (&p.prefix, s, PSIZE (p.prefixlen)); + stream_get (&p.u.prefix6, s, PSIZE (p.prefixlen)); + + memset (&src_p, 0, sizeof (struct prefix)); + src_p.family = AF_INET6; + if (CHECK_FLAG (api.message, ZAPI_MESSAGE_SRCPFX)) + { + src_p.prefixlen = stream_getc (s); + stream_get (&src_p.u.prefix6, s, PSIZE (src_p.prefixlen)); + } + + if (src_p.prefixlen) + /* we completely ignore srcdest routes for now. */ + return 0; /* Nexthop, ifindex, distance, metric. */ if (CHECK_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP)) @@ -277,15 +288,15 @@ ospf6_zebra_read_ipv6 (int command, struct zclient *zclient, snprintf (nexthopstr, sizeof (nexthopstr), "::"); zlog_debug ("Zebra Receive route %s: %s %s nexthop %s ifindex %ld tag %"ROUTE_TAG_PRI, - (command == ZEBRA_IPV6_ROUTE_ADD ? "add" : "delete"), + (command == ZEBRA_REDISTRIBUTE_IPV6_ADD ? "add" : "delete"), zebra_route_string(api.type), prefixstr, nexthopstr, ifindex, api.tag); } if (command == ZEBRA_REDISTRIBUTE_IPV6_ADD) - ospf6_asbr_redistribute_add (api.type, ifindex, (struct prefix *) &p, + ospf6_asbr_redistribute_add (api.type, ifindex, &p, api.nexthop_num, nexthop, api.tag); else - ospf6_asbr_redistribute_remove (api.type, ifindex, (struct prefix *) &p); + ospf6_asbr_redistribute_remove (api.type, ifindex, &p); if (CHECK_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP)) free (nexthop); @@ -293,13 +304,12 @@ ospf6_zebra_read_ipv6 (int command, struct zclient *zclient, return 0; } - - - DEFUN (show_zebra, - show_zebra_cmd, - "show zebra", + show_ospf6_zebra_cmd, + "show ipv6 ospf6 zebra", SHOW_STR + IPV6_STR + OSPF6_STR "Zebra information\n") { int i; @@ -325,30 +335,6 @@ DEFUN (show_zebra, return CMD_SUCCESS; } -DEFUN (router_zebra, - router_zebra_cmd, - "router zebra", - "Enable a routing process\n" - "Make connection to zebra daemon\n") -{ - vty->node = ZEBRA_NODE; - zclient->enable = 1; - zclient_start (zclient); - return CMD_SUCCESS; -} - -DEFUN (no_router_zebra, - no_router_zebra_cmd, - "no router zebra", - NO_STR - "Configure routing process\n" - "Disable connection to zebra daemon\n") -{ - zclient->enable = 0; - zclient_stop (zclient); - return CMD_SUCCESS; -} - /* Zebra configuration write function. */ static int config_write_ospf6_zebra (struct vty *vty) @@ -487,9 +473,9 @@ ospf6_zebra_route_update (int type, struct ospf6_route *request) api.distance = ospf6_distance_apply (dest, request); if (type == REM) - ret = zapi_ipv6_route (ZEBRA_IPV6_ROUTE_DELETE, zclient, dest, &api); + ret = zapi_ipv6_route (ZEBRA_IPV6_ROUTE_DELETE, zclient, dest, NULL, &api); else - ret = zapi_ipv6_route (ZEBRA_IPV6_ROUTE_ADD, zclient, dest, &api); + ret = zapi_ipv6_route (ZEBRA_IPV6_ROUTE_ADD, zclient, dest, NULL, &api); if (ret < 0) zlog_err ("zapi_ipv6_route() %s failed: %s", @@ -551,7 +537,7 @@ ospf6_zebra_add_discard (struct ospf6_route *request) dest = (struct prefix_ipv6 *) &request->prefix; - zapi_ipv6_route (ZEBRA_IPV6_ROUTE_ADD, zclient, dest, &api); + zapi_ipv6_route (ZEBRA_IPV6_ROUTE_ADD, zclient, dest, NULL, &api); if (IS_OSPF6_DEBUG_ZEBRA (SEND)) zlog_debug ("Zebra: Route add discard %s/%d", @@ -596,7 +582,7 @@ ospf6_zebra_delete_discard (struct ospf6_route *request) dest = (struct prefix_ipv6 *) &request->prefix; - zapi_ipv6_route (ZEBRA_IPV6_ROUTE_DELETE, zclient, dest, &api); + zapi_ipv6_route (ZEBRA_IPV6_ROUTE_DELETE, zclient, dest, NULL, &api); if (IS_OSPF6_DEBUG_ZEBRA (SEND)) zlog_debug ("Zebra: Route delete discard %s/%d", @@ -849,10 +835,7 @@ ospf6_zebra_init (struct thread_master *master) install_node (&zebra_node, config_write_ospf6_zebra); /* Install command element for zebra node. */ - install_element (VIEW_NODE, &show_zebra_cmd); - install_element (CONFIG_NODE, &router_zebra_cmd); - install_element (CONFIG_NODE, &no_router_zebra_cmd); - + install_element (VIEW_NODE, &show_ospf6_zebra_cmd); install_default (ZEBRA_NODE); install_element (ZEBRA_NODE, &redistribute_ospf6_cmd); install_element (ZEBRA_NODE, &no_redistribute_ospf6_cmd); @@ -864,7 +847,7 @@ ospf6_zebra_init (struct thread_master *master) DEFUN (debug_ospf6_zebra_sendrecv, debug_ospf6_zebra_sendrecv_cmd, - "debug ospf6 zebra (send|recv)", + "debug ospf6 zebra [<send|recv>]", DEBUG_STR OSPF6_STR "Debug connection between zebra\n" @@ -872,13 +855,14 @@ DEFUN (debug_ospf6_zebra_sendrecv, "Debug Receiving zebra\n" ) { + int idx_send_recv = 3; unsigned char level = 0; - if (argc) + if (argc == 4) { - if (! strncmp (argv[0], "s", 1)) + if (strmatch(argv[idx_send_recv]->text, "send")) level = OSPF6_DEBUG_ZEBRA_SEND; - else if (! strncmp (argv[0], "r", 1)) + else if (strmatch(argv[idx_send_recv]->text, "recv")) level = OSPF6_DEBUG_ZEBRA_RECV; } else @@ -888,18 +872,9 @@ DEFUN (debug_ospf6_zebra_sendrecv, return CMD_SUCCESS; } -ALIAS (debug_ospf6_zebra_sendrecv, - debug_ospf6_zebra_cmd, - "debug ospf6 zebra", - DEBUG_STR - OSPF6_STR - "Debug connection between zebra\n" - ) - - DEFUN (no_debug_ospf6_zebra_sendrecv, no_debug_ospf6_zebra_sendrecv_cmd, - "no debug ospf6 zebra (send|recv)", + "no debug ospf6 zebra [<send|recv>]", NO_STR DEBUG_STR OSPF6_STR @@ -908,13 +883,14 @@ DEFUN (no_debug_ospf6_zebra_sendrecv, "Debug Receiving zebra\n" ) { + int idx_send_recv = 4; unsigned char level = 0; - if (argc) + if (argc == 5) { - if (! strncmp (argv[0], "s", 1)) + if (strmatch(argv[idx_send_recv]->text, "send")) level = OSPF6_DEBUG_ZEBRA_SEND; - else if (! strncmp (argv[0], "r", 1)) + else if (strmatch(argv[idx_send_recv]->text, "recv")) level = OSPF6_DEBUG_ZEBRA_RECV; } else @@ -924,14 +900,6 @@ DEFUN (no_debug_ospf6_zebra_sendrecv, return CMD_SUCCESS; } -ALIAS (no_debug_ospf6_zebra_sendrecv, - no_debug_ospf6_zebra_cmd, - "no debug ospf6 zebra", - NO_STR - DEBUG_STR - OSPF6_STR - "Debug connection between zebra\n" - ) int config_write_ospf6_debug_zebra (struct vty *vty) @@ -951,12 +919,8 @@ config_write_ospf6_debug_zebra (struct vty *vty) void install_element_ospf6_debug_zebra (void) { - install_element (ENABLE_NODE, &debug_ospf6_zebra_cmd); - install_element (ENABLE_NODE, &no_debug_ospf6_zebra_cmd); install_element (ENABLE_NODE, &debug_ospf6_zebra_sendrecv_cmd); install_element (ENABLE_NODE, &no_debug_ospf6_zebra_sendrecv_cmd); - install_element (CONFIG_NODE, &debug_ospf6_zebra_cmd); - install_element (CONFIG_NODE, &no_debug_ospf6_zebra_cmd); install_element (CONFIG_NODE, &debug_ospf6_zebra_sendrecv_cmd); install_element (CONFIG_NODE, &no_debug_ospf6_zebra_sendrecv_cmd); } |
