diff options
author | lynne <lynne@voltanet.io> | 2021-05-04 17:06:49 +0200 |
---|---|---|
committer | lynne <lynne@voltanet.io> | 2021-05-11 15:43:07 +0200 |
commit | f85b76195aeeb80b6f834da32459a05e297a0a78 (patch) | |
tree | d04aaa357a21c9a76c930813aaaa7850c85a4eb4 /ospf6d/ospf6_zebra.c | |
parent | Merge pull request #8652 from ton31337/fix/doc_bgp_alias (diff) | |
download | frr-f85b76195aeeb80b6f834da32459a05e297a0a78.tar.xz frr-f85b76195aeeb80b6f834da32459a05e297a0a78.zip |
ospf6d: Limit the number of interface addresses being supported
The code had no limits on addresses configured on an interface running
ospf6d. The code would crash when more than 100 addresses were added.
This change limits the number of interface address to 100 if mtu is set
to the default value. If the mtu is set to a jumbo packet size or larger
we will support 200 interface addresses.
Signed-off-by: Lynne Morrison <lynne@voltanet.io>
Diffstat (limited to 'ospf6d/ospf6_zebra.c')
-rw-r--r-- | ospf6d/ospf6_zebra.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index 76e717287..170d545c4 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -130,17 +130,38 @@ void ospf6_zebra_no_redistribute(int type, vrf_id_t vrf_id) static int ospf6_zebra_if_address_update_add(ZAPI_CALLBACK_ARGS) { struct connected *c; + struct ospf6_interface *oi; + int ipv6_count = 0; c = zebra_interface_address_read(ZEBRA_INTERFACE_ADDRESS_ADD, zclient->ibuf, vrf_id); if (c == NULL) return 0; + oi = (struct ospf6_interface *)c->ifp->info; + if (oi == NULL) + oi = ospf6_interface_create(c->ifp); + assert(oi); + if (IS_OSPF6_DEBUG_ZEBRA(RECV)) zlog_debug("Zebra Interface address add: %s %5s %pFX", c->ifp->name, prefix_family_str(c->address), c->address); + ipv6_count = connected_count_by_family(c->ifp, AF_INET6); + if (oi->ifmtu == OSPF6_DEFAULT_MTU && ipv6_count > OSPF6_MAX_IF_ADDRS) { + zlog_warn( + "Zebra Interface : %s has too many interface addresses %d only support %d, increase MTU", + c->ifp->name, ipv6_count, OSPF6_MAX_IF_ADDRS); + return 0; + } else if (oi->ifmtu >= OSPF6_JUMBO_MTU + && ipv6_count > OSPF6_MAX_IF_ADDRS_JUMBO) { + zlog_warn( + "Zebra Interface : %s has too many interface addresses %d only support %d", + c->ifp->name, ipv6_count, OSPF6_MAX_IF_ADDRS_JUMBO); + return 0; + } + if (c->address->family == AF_INET6) { ospf6_interface_state_update(c->ifp); ospf6_interface_connected_route_update(c->ifp); @@ -303,7 +324,7 @@ static void ospf6_zebra_route_update(int type, struct ospf6_route *request, struct prefix *dest; if (IS_OSPF6_DEBUG_ZEBRA(SEND)) - zlog_debug("Send %s route: %pFX", + zlog_debug("Zebra Send %s route: %pFX", (type == REM ? "remove" : "add"), &request->prefix); if (zclient->sock < 0) { |