From 73b75c8aa40b459c9c9f0f527b21e672af97e625 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Tue, 10 Feb 2026 16:39:32 -0600 Subject: [PATCH] Disable MIB loading in forked SNMP child processes Net-SNMP was crashing (signal 11) on every operation despite fork isolation. The issue was that init_snmp() tries to load MIB files by default, which can cause crashes if MIB files are missing, corrupted, or incompatible. Since we only use numeric OIDs (e.g., "1.3.6.1.2.1.1.1.0"), we don't need MIB name resolution at all. This change explicitly disables MIB loading in the child process by: 1. Setting MIBS and MIBDIRS environment variables to empty 2. Calling netsnmp_set_mib_directory("") to disable MIB directory search 3. These must happen BEFORE calling init_snmp() This should fix the persistent SIGSEGV crashes in SNMP operations. Co-Authored-By: Claude Sonnet 4.5 --- native/snmp_helper.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/native/snmp_helper.c b/native/snmp_helper.c index fc0222a..5a1f8be 100644 --- a/native/snmp_helper.c +++ b/native/snmp_helper.c @@ -596,6 +596,11 @@ void snmp_get_isolated( child_reset_signals(); alarm(60); /* watchdog: kill child if stuck */ + /* Disable MIB loading to prevent crashes from missing/corrupt MIB files */ + setenv("MIBS", "", 1); /* Don't load any MIBs */ + setenv("MIBDIRS", "", 1); /* Don't search for MIB directories */ + netsnmp_set_mib_directory(""); /* Explicitly set empty MIB directory */ + /* Initialize net-snmp fresh in child */ init_snmp("towerops-child"); netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, @@ -725,6 +730,11 @@ void snmp_walk_isolated( child_reset_signals(); alarm(60); /* watchdog */ + /* Disable MIB loading to prevent crashes from missing/corrupt MIB files */ + setenv("MIBS", "", 1); /* Don't load any MIBs */ + setenv("MIBDIRS", "", 1); /* Don't search for MIB directories */ + netsnmp_set_mib_directory(""); /* Explicitly set empty MIB directory */ + /* Initialize net-snmp fresh in child */ init_snmp("towerops-child"); netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,