summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_zebra.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospf6d/ospf6_zebra.c')
-rw-r--r--ospf6d/ospf6_zebra.c96
1 files changed, 31 insertions, 65 deletions
diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c
index 3e4042d65d..1904623e71 100644
--- a/ospf6d/ospf6_zebra.c
+++ b/ospf6d/ospf6_zebra.c
@@ -217,7 +217,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 +235,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))
@@ -282,10 +294,10 @@ ospf6_zebra_read_ipv6 (int command, struct zclient *zclient,
}
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);
@@ -325,30 +337,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 +475,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 +539,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 +584,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",
@@ -850,9 +838,6 @@ ospf6_zebra_init (struct thread_master *master)
/* 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_default (ZEBRA_NODE);
install_element (ZEBRA_NODE, &redistribute_ospf6_cmd);
install_element (ZEBRA_NODE, &no_redistribute_ospf6_cmd);
@@ -864,7 +849,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 +857,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 +874,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 +885,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 +902,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 +921,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);
}