Re: [oe] [meta-networking][dunfell][PATCH] net-snmp: Traps/Notifications aren't sent when configured by snmpNotifyTable
On Wed, Apr 13, 2022 at 07:14 AM, Armin Kuster wrote: > > What version of net-snmp was this fixed in? is it already fixed in > Master? > > -armin It was released in v5.9.1.pre1. It was already fixed in Master. Thanks & Regards Anand -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#96646): https://lists.openembedded.org/g/openembedded-devel/message/96646 Mute This Topic: https://lists.openembedded.org/mt/90406993/21656 Group Owner: openembedded-devel+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [oe] [meta-networking][dunfell][PATCH] net-snmp: Traps/Notifications aren't sent when configured by snmpNotifyTable
On 4/11/22 15:26, Jeremy Puhlman wrote: From: Anand Je Sypureddy Source: https://github.com/net-snmp/net-snmp.git MR: 114066 Type: Defect Fix Disposition: Backport from https://github.com/net-snmp/net-snmp/commit/951fd2d9b07e29455ff0251b0f44ed76d935ff00 ChangeID: af87abf2aeefdac65fcd57b7f0e3679fe57f Description: snmpd: Restore SNMPD_CALLBACK_SEND_TRAP[12] behavior What version of net-snmp was this fixed in? is it already fixed in Master? -armin Instead of only invoking the SNMPD_CALLBACK_SEND_TRAP[12] callbacks if one or more sessions with the corresponding SNMP version exist, invoke these callbacks unconditionally. Signed-off-by: Anand Je Sypureddy Reviewed-by: Sam Kappen Signed-off-by: Jeremy Puhlman --- ...SNMPD_CALLBACK_SEND_TRAP-12-behavior.patch | 133 ++ .../net-snmp/net-snmp_5.8.bb | 1 + 2 files changed, 134 insertions(+) create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmpd-Restore-SNMPD_CALLBACK_SEND_TRAP-12-behavior.patch diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmpd-Restore-SNMPD_CALLBACK_SEND_TRAP-12-behavior.patch b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmpd-Restore-SNMPD_CALLBACK_SEND_TRAP-12-behavior.patch new file mode 100644 index 0..8279aff32 --- /dev/null +++ b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmpd-Restore-SNMPD_CALLBACK_SEND_TRAP-12-behavior.patch @@ -0,0 +1,133 @@ +From 6be94cf81d56f9395b85848bbf7129eb9f992d96 Mon Sep 17 00:00:00 2001 +From: Bart Van Assche +Date: Tue, 29 Dec 2020 15:22:42 -0800 +Subject: [PATCH] snmpd: Restore SNMPD_CALLBACK_SEND_TRAP[12] behavior + +Instead of only invoking the SNMPD_CALLBACK_SEND_TRAP[12] callbacks if one +or more sessions with the corresponding SNMP version exist, invoke these +callbacks unconditionally. + +Fixes: f770e0f74932 ("skip send_trap callbacks if no sessions for version") +Fixes: https://github.com/net-snmp/net-snmp/issues/247 + +Upstream Status: Backport https://github.com/net-snmp/net-snmp/commit/951fd2d9b07e29455ff0251b0f44ed76d935ff00 + +Signed-off-by: Anand Je Sypureddy +--- + agent/agent_trap.c | 62 ++ + 1 file changed, 2 insertions(+), 60 deletions(-) + +diff --git a/agent/agent_trap.c b/agent/agent_trap.c +index d49c2dc..0289901 100644 +--- a/agent/agent_trap.c b/agent/agent_trap.c +@@ -92,11 +92,6 @@ struct trap_sink { + + struct trap_sink *sinks = NULL; + +-#ifndef NETSNMP_DISABLE_SNMPV1 +-static int _v1_sessions = 0; +-#endif /* NETSNMP_DISABLE_SNMPV1 */ +-static int _v2_sessions = 0; +- + const oid objid_enterprisetrap[] = { NETSNMP_NOTIFICATION_MIB }; + const oid trap_version_id[] = { NETSNMP_SYSTEM_MIB }; + const int enterprisetrap_len = OID_LENGTH(objid_enterprisetrap); +@@ -159,55 +154,6 @@ free_trap_session(struct trap_sink *sp) + free(sp); + } + +-static void +-_trap_version_incr(int version) +-{ +-switch (version) { +-#ifndef NETSNMP_DISABLE_SNMPV1 +-case SNMP_VERSION_1: +-++_v1_sessions; +-break; +-#endif +-#ifndef NETSNMP_DISABLE_SNMPV2C +-case SNMP_VERSION_2c: +-#endif +-case SNMP_VERSION_3: +-++_v2_sessions; +-break; +-default: +-snmp_log(LOG_ERR, "unknown snmp version %d\n", version); +-} +-return; +-} +- +-static void +-_trap_version_decr(int version) +-{ +-switch (version) { +-#ifndef NETSNMP_DISABLE_SNMPV1 +-case SNMP_VERSION_1: +-if (--_v1_sessions < 0) { +-snmp_log(LOG_ERR,"v1 session count < 0! fixed.\n"); +-_v1_sessions = 0; +-} +-break; +-#endif +-#ifndef NETSNMP_DISABLE_SNMPV2C +-case SNMP_VERSION_2c: +-#endif +-case SNMP_VERSION_3: +-if (--_v2_sessions < 0) { +-snmp_log(LOG_ERR,"v2 session count < 0! fixed.\n"); +-_v2_sessions = 0; +-} +-break; +-default: +-snmp_log(LOG_ERR, "unknown snmp version %d\n", version); +-} +-return; +-} +- +- + #ifndef NETSNMP_NO_TRAP_STATS + static void + _dump_trap_stats(netsnmp_session *sess) +@@ -285,8 +231,6 @@ netsnmp_add_notification_session(netsnmp_session * ss, int pdutype, + sinks = new_sink; + } + +-_trap_version_incr(version); +- + return 1; + } + +@@ -338,7 +282,6 @@ remove_trap_session(netsnmp_session * ss) + } else { + sinks = sp->next; + } +-_trap_version_decr(ss->version); + /* + * I don't believe you *really* want to close the session here; + * it may still be in use for other purposes. In particular this +@@ -490,7 +433,6 @@ snmpd_free_trapsinks(void) + DEBUGMSGTL(("trap", "freeing trap sessions\n")); + while (sp) { + sinks = sinks->next; +-_trap_version_decr(sp->version); +
[oe] [meta-networking][dunfell][PATCH] net-snmp: Traps/Notifications aren't sent when configured by snmpNotifyTable
From: Anand Je Sypureddy Source: https://github.com/net-snmp/net-snmp.git MR: 114066 Type: Defect Fix Disposition: Backport from https://github.com/net-snmp/net-snmp/commit/951fd2d9b07e29455ff0251b0f44ed76d935ff00 ChangeID: af87abf2aeefdac65fcd57b7f0e3679fe57f Description: snmpd: Restore SNMPD_CALLBACK_SEND_TRAP[12] behavior Instead of only invoking the SNMPD_CALLBACK_SEND_TRAP[12] callbacks if one or more sessions with the corresponding SNMP version exist, invoke these callbacks unconditionally. Signed-off-by: Anand Je Sypureddy Reviewed-by: Sam Kappen Signed-off-by: Jeremy Puhlman --- ...SNMPD_CALLBACK_SEND_TRAP-12-behavior.patch | 133 ++ .../net-snmp/net-snmp_5.8.bb | 1 + 2 files changed, 134 insertions(+) create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmpd-Restore-SNMPD_CALLBACK_SEND_TRAP-12-behavior.patch diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmpd-Restore-SNMPD_CALLBACK_SEND_TRAP-12-behavior.patch b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmpd-Restore-SNMPD_CALLBACK_SEND_TRAP-12-behavior.patch new file mode 100644 index 0..8279aff32 --- /dev/null +++ b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmpd-Restore-SNMPD_CALLBACK_SEND_TRAP-12-behavior.patch @@ -0,0 +1,133 @@ +From 6be94cf81d56f9395b85848bbf7129eb9f992d96 Mon Sep 17 00:00:00 2001 +From: Bart Van Assche +Date: Tue, 29 Dec 2020 15:22:42 -0800 +Subject: [PATCH] snmpd: Restore SNMPD_CALLBACK_SEND_TRAP[12] behavior + +Instead of only invoking the SNMPD_CALLBACK_SEND_TRAP[12] callbacks if one +or more sessions with the corresponding SNMP version exist, invoke these +callbacks unconditionally. + +Fixes: f770e0f74932 ("skip send_trap callbacks if no sessions for version") +Fixes: https://github.com/net-snmp/net-snmp/issues/247 + +Upstream Status: Backport https://github.com/net-snmp/net-snmp/commit/951fd2d9b07e29455ff0251b0f44ed76d935ff00 + +Signed-off-by: Anand Je Sypureddy +--- + agent/agent_trap.c | 62 ++ + 1 file changed, 2 insertions(+), 60 deletions(-) + +diff --git a/agent/agent_trap.c b/agent/agent_trap.c +index d49c2dc..0289901 100644 +--- a/agent/agent_trap.c b/agent/agent_trap.c +@@ -92,11 +92,6 @@ struct trap_sink { + + struct trap_sink *sinks = NULL; + +-#ifndef NETSNMP_DISABLE_SNMPV1 +-static int _v1_sessions = 0; +-#endif /* NETSNMP_DISABLE_SNMPV1 */ +-static int _v2_sessions = 0; +- + const oid objid_enterprisetrap[] = { NETSNMP_NOTIFICATION_MIB }; + const oid trap_version_id[] = { NETSNMP_SYSTEM_MIB }; + const int enterprisetrap_len = OID_LENGTH(objid_enterprisetrap); +@@ -159,55 +154,6 @@ free_trap_session(struct trap_sink *sp) + free(sp); + } + +-static void +-_trap_version_incr(int version) +-{ +-switch (version) { +-#ifndef NETSNMP_DISABLE_SNMPV1 +-case SNMP_VERSION_1: +-++_v1_sessions; +-break; +-#endif +-#ifndef NETSNMP_DISABLE_SNMPV2C +-case SNMP_VERSION_2c: +-#endif +-case SNMP_VERSION_3: +-++_v2_sessions; +-break; +-default: +-snmp_log(LOG_ERR, "unknown snmp version %d\n", version); +-} +-return; +-} +- +-static void +-_trap_version_decr(int version) +-{ +-switch (version) { +-#ifndef NETSNMP_DISABLE_SNMPV1 +-case SNMP_VERSION_1: +-if (--_v1_sessions < 0) { +-snmp_log(LOG_ERR,"v1 session count < 0! fixed.\n"); +-_v1_sessions = 0; +-} +-break; +-#endif +-#ifndef NETSNMP_DISABLE_SNMPV2C +-case SNMP_VERSION_2c: +-#endif +-case SNMP_VERSION_3: +-if (--_v2_sessions < 0) { +-snmp_log(LOG_ERR,"v2 session count < 0! fixed.\n"); +-_v2_sessions = 0; +-} +-break; +-default: +-snmp_log(LOG_ERR, "unknown snmp version %d\n", version); +-} +-return; +-} +- +- + #ifndef NETSNMP_NO_TRAP_STATS + static void + _dump_trap_stats(netsnmp_session *sess) +@@ -285,8 +231,6 @@ netsnmp_add_notification_session(netsnmp_session * ss, int pdutype, + sinks = new_sink; + } + +-_trap_version_incr(version); +- + return 1; + } + +@@ -338,7 +282,6 @@ remove_trap_session(netsnmp_session * ss) + } else { + sinks = sp->next; + } +-_trap_version_decr(ss->version); + /* + * I don't believe you *really* want to close the session here; + * it may still be in use for other purposes. In particular this +@@ -490,7 +433,6 @@ snmpd_free_trapsinks(void) + DEBUGMSGTL(("trap", "freeing trap sessions\n")); + while (sp) { + sinks = sinks->next; +-_trap_version_decr(sp->version); + free_trap_session(sp); + sp = sinks; + } +@@ -1025,11 +967,11 @@ netsnmp_send_traps(int trap, int specific, +