diff options
Diffstat (limited to 'ripngd/ripng_zebra.c')
| -rw-r--r-- | ripngd/ripng_zebra.c | 121 |
1 files changed, 45 insertions, 76 deletions
diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c index 67337caf28..964af81d1f 100644 --- a/ripngd/ripng_zebra.c +++ b/ripngd/ripng_zebra.c @@ -99,7 +99,7 @@ ripng_zebra_ipv6_send (struct route_node *rp, u_char cmd) } zapi_ipv6_route (cmd, zclient, - (struct prefix_ipv6 *)&rp->p, &api); + (struct prefix_ipv6 *)&rp->p, NULL, &api); if (IS_RIPNG_DEBUG_ZEBRA) { @@ -140,7 +140,7 @@ ripng_zebra_read_ipv6 (int command, struct zclient *zclient, struct zapi_ipv6 api; unsigned long ifindex; struct in6_addr nexthop; - struct prefix_ipv6 p; + struct prefix_ipv6 p, src_p; s = zclient->ibuf; ifindex = 0; @@ -158,6 +158,18 @@ ripng_zebra_read_ipv6 (int command, struct zclient *zclient, p.prefixlen = MIN(IPV6_MAX_PREFIXLEN, stream_getc (s)); stream_get (&p.prefix, s, PSIZE (p.prefixlen)); + memset (&src_p, 0, sizeof (struct prefix_ipv6)); + src_p.family = AF_INET6; + if (CHECK_FLAG (api.message, ZAPI_MESSAGE_SRCPFX)) + { + src_p.prefixlen = stream_getc (s); + stream_get (&src_p.prefix, 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)) { @@ -292,30 +304,6 @@ ripng_redistribute_clean () } } -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 - "Disable a routing process\n" - "Stop connection to zebra daemon\n") -{ - zclient->enable = 0; - zclient_stop (zclient); - return CMD_SUCCESS; -} - DEFUN (ripng_redistribute_ripng, ripng_redistribute_ripng_cmd, "redistribute ripng", @@ -345,11 +333,12 @@ DEFUN (ripng_redistribute_type, { int type; - type = proto_redistnum(AFI_IP6, argv[0]); + char *proto = argv[argc - 1]->text; + type = proto_redistnum(AFI_IP6, proto); if (type < 0) { - vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE); + vty_out(vty, "Invalid type %s%s", proto, VTY_NEWLINE); return CMD_WARNING; } @@ -359,18 +348,23 @@ DEFUN (ripng_redistribute_type, DEFUN (no_ripng_redistribute_type, no_ripng_redistribute_type_cmd, - "no redistribute " FRR_REDIST_STR_RIPNGD, + "no redistribute " FRR_REDIST_STR_RIPNGD " [metric (0-16)] [route-map WORD]", NO_STR "Redistribute\n" - FRR_REDIST_HELP_STR_RIPNGD) + FRR_REDIST_HELP_STR_RIPNGD + "Metric\n" + "Metric value\n" + "Route map reference\n" + "Pointer to route-map entries\n") { int type; - type = proto_redistnum(AFI_IP6, argv[0]); + char *proto = argv[2]->text; + type = proto_redistnum(AFI_IP6, proto); if (type < 0) { - vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE); + vty_out(vty, "Invalid type %s%s", proto, VTY_NEWLINE); return CMD_WARNING; } @@ -382,21 +376,23 @@ DEFUN (no_ripng_redistribute_type, DEFUN (ripng_redistribute_type_metric, ripng_redistribute_type_metric_cmd, - "redistribute " FRR_REDIST_STR_RIPNGD " metric <0-16>", + "redistribute " FRR_REDIST_STR_RIPNGD " metric (0-16)", "Redistribute\n" FRR_REDIST_HELP_STR_RIPNGD "Metric\n" "Metric value\n") { + int idx_protocol = 1; + int idx_number = 3; int type; int metric; - metric = atoi (argv[1]); - type = proto_redistnum(AFI_IP6, argv[0]); + metric = atoi (argv[idx_number]->arg); + type = proto_redistnum(AFI_IP6, argv[idx_protocol]->text); if (type < 0) { - vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE); + vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->text, VTY_NEWLINE); return CMD_WARNING; } @@ -406,15 +402,6 @@ DEFUN (ripng_redistribute_type_metric, return CMD_SUCCESS; } -ALIAS (no_ripng_redistribute_type, - no_ripng_redistribute_type_metric_cmd, - "no redistribute " FRR_REDIST_STR_RIPNGD " metric <0-16>", - NO_STR - "Redistribute\n" - FRR_REDIST_HELP_STR_RIPNGD - "Metric\n" - "Metric value\n") - DEFUN (ripng_redistribute_type_routemap, ripng_redistribute_type_routemap_cmd, "redistribute " FRR_REDIST_STR_RIPNGD " route-map WORD", @@ -423,34 +410,27 @@ DEFUN (ripng_redistribute_type_routemap, "Route map reference\n" "Pointer to route-map entries\n") { + int idx_protocol = 1; + int idx_word = 3; int type; - type = proto_redistnum(AFI_IP6, argv[0]); + type = proto_redistnum(AFI_IP6, argv[idx_protocol]->text); if (type < 0) { - vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE); + vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->text, VTY_NEWLINE); return CMD_WARNING; } - ripng_redistribute_routemap_set (type, argv[1]); + ripng_redistribute_routemap_set (type, argv[idx_word]->text); zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP6, type, 0, VRF_DEFAULT); return CMD_SUCCESS; } -ALIAS (no_ripng_redistribute_type, - no_ripng_redistribute_type_routemap_cmd, - "no redistribute " FRR_REDIST_STR_RIPNGD " route-map WORD", - NO_STR - "Redistribute\n" - FRR_REDIST_HELP_STR_RIPNGD - "Route map reference\n" - "Pointer to route-map entries\n") - DEFUN (ripng_redistribute_type_metric_routemap, ripng_redistribute_type_metric_routemap_cmd, - "redistribute " FRR_REDIST_STR_RIPNGD " metric <0-16> route-map WORD", + "redistribute " FRR_REDIST_STR_RIPNGD " metric (0-16) route-map WORD", "Redistribute\n" FRR_REDIST_HELP_STR_RIPNGD "Metric\n" @@ -458,33 +438,27 @@ DEFUN (ripng_redistribute_type_metric_routemap, "Route map reference\n" "Pointer to route-map entries\n") { + int idx_protocol = 1; + int idx_number = 3; + int idx_word = 5; int type; int metric; - type = proto_redistnum(AFI_IP6, argv[0]); - metric = atoi (argv[1]); + type = proto_redistnum(AFI_IP6, argv[idx_protocol]->text); + metric = atoi (argv[idx_number]->arg); if (type < 0) { - vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE); + vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->text, VTY_NEWLINE); return CMD_WARNING; } ripng_redistribute_metric_set (type, metric); - ripng_redistribute_routemap_set (type, argv[2]); + ripng_redistribute_routemap_set (type, argv[idx_word]->text); zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP6, type, 0, VRF_DEFAULT); return CMD_SUCCESS; } -ALIAS (no_ripng_redistribute_type, - no_ripng_redistribute_type_metric_routemap_cmd, - "no redistribute " FRR_REDIST_STR_RIPNGD " metric <0-16> route-map WORD", - NO_STR - "Redistribute\n" - FRR_REDIST_HELP_STR_RIPNGD - "Route map reference\n" - "Pointer to route-map entries\n") - void ripng_redistribute_write (struct vty *vty, int config_mode) { @@ -576,8 +550,6 @@ zebra_init (struct thread_master *master) install_node (&zebra_node, zebra_config_write); /* Install command element for zebra node. */ - install_element (CONFIG_NODE, &router_zebra_cmd); - install_element (CONFIG_NODE, &no_router_zebra_cmd); install_default (ZEBRA_NODE); install_element (ZEBRA_NODE, &ripng_redistribute_ripng_cmd); install_element (ZEBRA_NODE, &no_ripng_redistribute_ripng_cmd); @@ -588,7 +560,4 @@ zebra_init (struct thread_master *master) install_element (RIPNG_NODE, &ripng_redistribute_type_metric_cmd); install_element (RIPNG_NODE, &ripng_redistribute_type_metric_routemap_cmd); install_element (RIPNG_NODE, &no_ripng_redistribute_type_cmd); - install_element (RIPNG_NODE, &no_ripng_redistribute_type_routemap_cmd); - install_element (RIPNG_NODE, &no_ripng_redistribute_type_metric_cmd); - install_element (RIPNG_NODE, &no_ripng_redistribute_type_metric_routemap_cmd); } |
