diff options
| author | Yash Ranjan <ranjany@vmware.com> | 2021-02-09 20:53:46 -0800 |
|---|---|---|
| committer | Yash Ranjan <ranjany@vmware.com> | 2021-03-29 06:37:10 -0700 |
| commit | b19502d3b0d53c8c50e8e47124beb760b41e286d (patch) | |
| tree | 3d3646a466d67099055fe4e724726304e66076d5 /ospf6d/ospf6_zebra.c | |
| parent | dc66229da852c4e651b2f9e183e6974ddfe4a263 (diff) | |
ospf6d: Add CLI and logic for default-information originate command
Signed-off-by: Yash Ranjan <ranjany@vmware.com>
Diffstat (limited to 'ospf6d/ospf6_zebra.c')
| -rw-r--r-- | ospf6d/ospf6_zebra.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index 8d5e0f0a39..76e7172870 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -172,12 +172,23 @@ static int ospf6_zebra_if_address_update_delete(ZAPI_CALLBACK_ARGS) return 0; } +static int is_prefix_default(struct prefix_ipv6 *p) +{ + struct prefix_ipv6 q = {}; + + q.family = AF_INET6; + q.prefixlen = 0; + + return prefix_same((struct prefix *)p, (struct prefix *)&q); +} + static int ospf6_zebra_read_route(ZAPI_CALLBACK_ARGS) { struct zapi_route api; unsigned long ifindex; struct in6_addr *nexthop; struct ospf6 *ospf6; + struct prefix_ipv6 p; ospf6 = ospf6_lookup_by_vrf_id(vrf_id); @@ -205,6 +216,10 @@ static int ospf6_zebra_read_route(ZAPI_CALLBACK_ARGS) zebra_route_string(api.type), &api.prefix, nexthop, ifindex, api.tag); + memcpy(&p, &api.prefix, sizeof(p)); + if (is_prefix_default(&p)) + api.type = DEFAULT_ROUTE; + if (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD) ospf6_asbr_redistribute_add(api.type, ifindex, &api.prefix, api.nexthop_num, nexthop, api.tag, |
