summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_interface.c
diff options
context:
space:
mode:
authorlynne <lynne@voltanet.io>2021-05-04 11:06:49 -0400
committerlynne <lynne@voltanet.io>2021-05-11 09:43:07 -0400
commitf85b76195aeeb80b6f834da32459a05e297a0a78 (patch)
treed04aaa357a21c9a76c930813aaaa7850c85a4eb4 /ospf6d/ospf6_interface.c
parent449e54fd12372273dcac68781eb77c1297aeb2ba (diff)
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_interface.c')
-rw-r--r--ospf6d/ospf6_interface.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index 11bdd1e355..c2f9c3362e 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -405,6 +405,7 @@ void ospf6_interface_connected_route_update(struct interface *ifp)
struct connected *c;
struct listnode *node, *nnode;
struct in6_addr nh_addr;
+ int count = 0, max_addr_count;
oi = (struct ospf6_interface *)ifp->info;
if (oi == NULL)
@@ -423,10 +424,22 @@ void ospf6_interface_connected_route_update(struct interface *ifp)
/* update "route to advertise" interface route table */
ospf6_route_remove_all(oi->route_connected);
+ if (oi->ifmtu >= OSPF6_JUMBO_MTU)
+ max_addr_count = OSPF6_MAX_IF_ADDRS_JUMBO;
+ else
+ max_addr_count = OSPF6_MAX_IF_ADDRS;
+
for (ALL_LIST_ELEMENTS(oi->interface->connected, node, nnode, c)) {
if (c->address->family != AF_INET6)
continue;
+ /* number of interface addresses supported is based on MTU
+ * size of OSPFv3 packet
+ */
+ count++;
+ if (count >= max_addr_count)
+ break;
+
CONTINUE_IF_ADDRESS_LINKLOCAL(IS_OSPF6_DEBUG_INTERFACE,
c->address);
CONTINUE_IF_ADDRESS_UNSPECIFIED(IS_OSPF6_DEBUG_INTERFACE,