summaryrefslogtreecommitdiff
path: root/pimd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2024-12-04 10:47:33 -0500
committerDonald Sharp <sharpd@nvidia.com>2024-12-04 10:49:49 -0500
commit37b88191fb4736ff0a1e565fc22003d0ab853ea2 (patch)
tree153e120c27de7751127a85c1f414963a98692cfe /pimd
parent267dc19825eb1e5281fd6f6990bf0ee7c4664604 (diff)
pimd: Prevent crash of pim when auto-rp's socket is not initialized
If the socket associated with the auto-rp fails to initialize then the memory for the auto-rp is just dropped on the floor. Additionally any type of attempt at using the feature will just cause pimd to crash, when the pointer is derefed. Since it is derefed all over the place without checking. Clearly if you cannot bind/use the socket let's allow continuation. Fixes: #17540 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'pimd')
-rw-r--r--pimd/pim_autorp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/pimd/pim_autorp.c b/pimd/pim_autorp.c
index 3b46e7fb2b..caed914a87 100644
--- a/pimd/pim_autorp.c
+++ b/pimd/pim_autorp.c
@@ -1508,12 +1508,14 @@ void pim_autorp_init(struct pim_instance *pim)
autorp->discovery_holdtime = DEFAULT_AUTORP_DISCOVERY_HOLDTIME;
cand_addrsel_clear(&(autorp->mapping_agent_addrsel));
+ pim->autorp = autorp;
+
if (!pim_autorp_socket_enable(autorp)) {
- zlog_warn("%s: AutoRP failed to initialize", __func__);
+ zlog_warn("%s: AutoRP failed to initialize, feature will not work correctly",
+ __func__);
return;
}
- pim->autorp = autorp;
if (PIM_DEBUG_AUTORP)
zlog_debug("%s: AutoRP Initialized", __func__);