net-snmp: fix failure when starting on system without pci bus
PATCH v2 1/2 net-snmp: fix failure when starting on system without pci bus
From: Jack Mitchell <[email protected]>
The snmpd daemon cannot start on platforms without a pci bus:
snmpd[15460]: pcilib: Cannot open /proc/bus/pci snmpd[15460]: pcilib: Cannot find any working access method.
snmpd should not depend on a PCI bus and should simply move on.
--- .../recipes-extended/net-snmp/files/ifmib.patch | 66 ++++++++++++++++++++++ .../recipes-extended/net-snmp/net-snmp_5.7.1.bb | 1 + 2 files changed, 67 insertions(+) create mode 100644 meta-oe/recipes-extended/net-snmp/files/ifmib.patch
meta-oe/recipes-extended/net-snmp/files/ifmib.patch new file +66 -0
@@ -0,0 +1,66 @@ +Signed-off-by: Jack Mitchell <[email protected]> +Upstream-Status: Pending +Bug-Report: http://sourceforge.net/p/net-snmp/bugs/2449/ + +diff --git a/agent/mibgroup/if-mib/data_access/interface_linux.c b/agent/mibgroup/if-mib/data_access/interface_linux.c +index 3419811..d6eb91a 100644 +--- a/agent/mibgroup/if-mib/data_access/interface_linux.c ++++ b/agent/mibgroup/if-mib/data_access/interface_linux.c +@@ -18,7 +18,31 @@ netsnmp_feature_require(interface_ioctl_flags_set) + + #ifdef HAVE_PCI_LOOKUP_NAME + #include <pci/pci.h> ++#include <setjmp.h> + static struct pci_access *pci_access; ++ ++/* Avoid letting libpci call exit(1) when no PCI bus is available. */ ++static int do_longjmp =0; ++static jmp_buf err_buf; ++static void ++netsnmp_pci_error(char *msg, ...) ++{ ++ va_list args; ++ char *buf; ++ int buflen; ++ ++ va_start(args, msg); ++ buflen = strlen("pcilib: ")+strlen(msg)+2; ++ buf = malloc(buflen); ++ snprintf(buf, buflen, "pcilib: %s\n", msg); ++ snmp_vlog(LOG_ERR, buf, args); ++ free(buf); ++ va_end(args); ++ if (do_longjmp) ++ longjmp(err_buf, 1); ++ else ++ exit(1); ++} + #endif + + #ifdef HAVE_LINUX_ETHTOOL_H +@@ -147,10 +171,22 @@ netsnmp_arch_interface_init(void) + + #ifdef HAVE_PCI_LOOKUP_NAME + pci_access = pci_alloc(); +- if (pci_access) ++ if (!pci_access) { ++ snmp_log(LOG_ERR, "pcilib: pci_alloc failed\n"); ++ return; ++ } ++ ++ pci_access->error = netsnmp_pci_error; ++ ++ do_longjmp = 1; ++ if (setjmp(err_buf)) { ++ pci_cleanup(pci_access); ++ snmp_log(LOG_ERR, "pcilib: pci_init failed\n"); ++ pci_access = NULL; ++ } ++ else if (pci_access) + pci_init(pci_access); +- else +- snmp_log(LOG_ERR, "Unable to create pci access method\n"); ++ do_longjmp = 0; + #endif + } +
meta-oe/recipes-extended/net-snmp/net-snmp_5.7.1.bb +1 -0
@@ -12,6 +12,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.tar.gz \ file://systemd-support.patch \ file://snmpd.service \ file://snmptrapd.service \ + file://ifmib.patch \ " EXTRA_OECONF += "--disable-embedded-perl --with-perl-modules=no"
Signature · 1 line
1.8.2
PATCH v2 2/2 net-snmp: Update to 5.7.2
From: Jack Mitchell <[email protected]>
- Removed some un-needed patches
---
.../net-snmp/files/libnl-3-support.patch | 69 -
.../net-snmp/files/sync-with-5.7-branch.patch | 19998 -------------------
.../{net-snmp_5.7.1.bb => net-snmp_5.7.2.bb} | 7 +-
3 files changed, 2 insertions(+), 20072 deletions(-)
delete mode 100644 meta-oe/recipes-extended/net-snmp/files/libnl-3-support.patch
delete mode 100644 meta-oe/recipes-extended/net-snmp/files/sync-with-5.7-branch.patch
rename meta-oe/recipes-extended/net-snmp/{net-snmp_5.7.1.bb => net-snmp_5.7.2.bb} (76%)meta-oe/recipes-extended/net-snmp/files/libnl-3-support.patch deleted +0 -69
@@ -1,69 +0,0 @@ -Add support to libnl-3 - -Upstream-Status: Pending - ---- net-snmp-5.6.1/agent/mibgroup/mibII/tcpTable.c.org 2011-03-27 22:39:13.428728506 +0200 -+++ net-snmp-5.6.1/agent/mibgroup/mibII/tcpTable.c 2011-03-27 22:39:47.606956561 +0200 -@@ -555,8 +555,9 @@ - static int - tcpTable_load_netlink(void) - { -+ int err; - /* TODO: perhaps use permanent nl handle? */ -- struct nl_handle *nl = nl_handle_alloc(); -+ struct nl_sock *nl = nl_socket_alloc(); - - if (nl == NULL) { - DEBUGMSGTL(("mibII/tcpTable", "Failed to allocate netlink handle\n")); -@@ -564,10 +565,10 @@ - return -1; - } - -- if (nl_connect(nl, NETLINK_INET_DIAG) < 0) { -- DEBUGMSGTL(("mibII/tcpTable", "Failed to connect to netlink: %s\n", nl_geterror())); -- snmp_log(LOG_ERR, "snmpd: Couldn't connect to netlink: %s\n", nl_geterror()); -- nl_handle_destroy(nl); -+ if ((err = nl_connect(nl, NETLINK_INET_DIAG)) < 0) { -+ DEBUGMSGTL(("mibII/tcpTable", "Failed to connect to netlink: %s\n", nl_geterror(err))); -+ snmp_log(LOG_ERR, "snmpd: Couldn't connect to netlink: %s\n", nl_geterror(err)); -+ nl_socket_free(nl); - return -1; - } - -@@ -579,10 +580,10 @@ - struct nl_msg *nm = nlmsg_alloc_simple(TCPDIAG_GETSOCK, NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST); - nlmsg_append(nm, &req, sizeof(struct inet_diag_req), 0); - -- if (nl_send_auto_complete(nl, nm) < 0) { -- DEBUGMSGTL(("mibII/tcpTable", "nl_send_autocomplete(): %s\n", nl_geterror())); -- snmp_log(LOG_ERR, "snmpd: nl_send_autocomplete(): %s\n", nl_geterror()); -- nl_handle_destroy(nl); -+ if ((err = nl_send_auto_complete(nl, nm)) < 0) { -+ DEBUGMSGTL(("mibII/tcpTable", "nl_send_autocomplete(): %s\n", nl_geterror(err))); -+ snmp_log(LOG_ERR, "snmpd: nl_send_autocomplete(): %s\n", nl_geterror(err)); -+ nl_socket_free(nl); - return -1; - } - nlmsg_free(nm); -@@ -593,9 +594,9 @@ - - while (running) { - if ((len = nl_recv(nl, &peer, &buf, NULL)) <= 0) { -- DEBUGMSGTL(("mibII/tcpTable", "nl_recv(): %s\n", nl_geterror())); -- snmp_log(LOG_ERR, "snmpd: nl_recv(): %s\n", nl_geterror()); -- nl_handle_destroy(nl); -+ DEBUGMSGTL(("mibII/tcpTable", "nl_recv(): %s\n", nl_geterror(len))); -+ snmp_log(LOG_ERR, "snmpd: nl_recv(): %s\n", nl_geterror(len)); -+ nl_socket_free(nl); - return -1; - } - -@@ -644,7 +645,7 @@ - free(buf); - } - -- nl_handle_destroy(nl); -+ nl_socket_free(nl); - - if (tcp_head) { - DEBUGMSGTL(("mibII/tcpTable", "Loaded TCP Table using netlink\n"));
meta-oe/recipes-extended/net-snmp/files/sync-with-5.7-branch.patch deleted +0 -19998
2,931 lines not on this page · raw message
meta-oe/recipes-extended/net-snmp/net-snmp_5.7.2.bb renamed from meta-oe/recipes-extended/net-snmp/net-snmp_5.7.1.bb +2 -5
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.8.2
Part of the diff is not shown here. View the raw message.
Re: [meta-oe][PATCHv2 2/2] net-snmp: Update to 5.7.2
Quoted 12 lines · Jack Mitchell
From: Jack Mitchell <[email protected]>
- Removed some un-needed patches
meta-oe/recipes-extended/net-snmp/net-snmp_5.7.2.bb renamed from meta-oe/recipes-extended/net-snmp/net-snmp_5.7.1.bb +0
-0
meta-oe/recipes-extended/net-snmp/net-snmp_5.7.2.bb line 3
Quoted 3 lines
meta-oe/recipes-extended/net-snmp/net-snmp_5.7.2.bb renamed from meta-oe/recipes-extended/net-snmp/net-snmp_5.7.1.bb +0
-1@@ -1,11 +1,8 @@ require net-snmp.inc -PR = "${INC_PR}.4"
This can surprise people editing net-snmp.inc and bumping INC_PR there without any effect on net-snmp_5.7.2.bb.
I understand why you wanted to remove it, but I would prefer to keep PR = "${INC_PR}.0" there as long as we have .inc with INC_PR.
I wouldn't mind merging .inc in .bb as people probably don't have own versions of net-snmp in their layers (just guessing here).
And it was send to wrong ML this time..
Quoted 24 lines
meta-oe/recipes-extended/net-snmp/net-snmp_5.7.2.bb renamed from meta-oe/recipes-extended/net-snmp/net-snmp_5.7.1.bb +2
-4LIC_FILES_CHKSUM = "file://README;beginline=3;endline=8;md5=7f7f00ba639ac8e8deb5a622ea24634e" SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.tar.gz \ - file://sync-with-5.7-branch.patch \ - file://libnl-3-support.patch \ file://init \ file://snmpd.conf \ file://snmptrapd.conf \@@ -30,5 +27,5 @@ do_configure_prepend() { PARALLEL_MAKE = "" CCACHE = "" -SRC_URI[md5sum] = "c95d08fd5d93df0c11a2e1bdf0e01e0b" -SRC_URI[sha256sum] = "7c71c9650c65b715356547e20ca2dbe6313944278af8cc19c32a5337f46b181f" +SRC_URI[md5sum] = "5bddd02e2f82b62daa79f82717737a14" +SRC_URI[sha256sum] = "09ed31b4cc1f3c0411ef9a16eff79ef3b30d89c32ca46d5a01a41826c4ceb816"Signature · 7 lines
1.8.2 _______________________________________________ Openembedded-core mailing list [email protected] http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Signature · 1 line
Martin 'JaMa' Jansa jabber: [email protected]
Re: [meta-oe][PATCHv2 2/2] net-snmp: Update to 5.7.2
Quoted 19 lines · Martin Jansa
Quoted 12 lines · Jack Mitchell
From: Jack Mitchell <[email protected]>
- Removed some un-needed patches
meta-oe/recipes-extended/net-snmp/net-snmp_5.7.2.bb renamed from meta-oe/recipes-extended/net-snmp/net-snmp_5.7.1.bb +0
-0meta-oe/recipes-extended/net-snmp/net-snmp_5.7.2.bb line 3
Quoted 3 lines
meta-oe/recipes-extended/net-snmp/net-snmp_5.7.2.bb renamed from meta-oe/recipes-extended/net-snmp/net-snmp_5.7.1.bb +0
-1@@ -1,11 +1,8 @@ require net-snmp.inc -PR = "${INC_PR}.4"This can surprise people editing net-snmp.inc and bumping
INC_PRthere without any effect on net-snmp_5.7.2.bb.
Quoted 7 lines
I understand why you wanted to remove it, but I would prefer to keep PR = "${INC_PR}.0" there as long as we have .inc with
INC_PR.I wouldn't mind merging .inc in .bb as people probably don't have own versions of net-snmp in their layers (just guessing here).
And it was send to wrong ML this time..
V3 incoming.
Quoted 25 lines
Quoted 25 lines
meta-oe/recipes-extended/net-snmp/net-snmp_5.7.2.bb renamed from meta-oe/recipes-extended/net-snmp/net-snmp_5.7.1.bb +2
-4LIC_FILES_CHKSUM = "file://README;beginline=3;endline=8;md5=7f7f00ba639ac8e8deb5a622ea24634e" SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.tar.gz \ - file://sync-with-5.7-branch.patch \ - file://libnl-3-support.patch \ file://init \ file://snmpd.conf \ file://snmptrapd.conf \@@ -30,5 +27,5 @@ do_configure_prepend() { PARALLEL_MAKE = "" CCACHE = "" -SRC_URI[md5sum] = "c95d08fd5d93df0c11a2e1bdf0e01e0b" -SRC_URI[sha256sum] = "7c71c9650c65b715356547e20ca2dbe6313944278af8cc19c32a5337f46b181f" +SRC_URI[md5sum] = "5bddd02e2f82b62daa79f82717737a14" +SRC_URI[sha256sum] = "09ed31b4cc1f3c0411ef9a16eff79ef3b30d89c32ca46d5a01a41826c4ceb816"Signature · 7 lines
1.8.2 _______________________________________________ Openembedded-core mailing list [email protected] http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Signature · 5 lines
Jack Mitchell ([email protected]) Embedded Systems Engineer http://www.embed.me.uk --
Quoted 7 lines · Jack Mitchell
From: Jack Mitchell <[email protected]>
The snmpd daemon cannot start on platforms without a pci bus:
snmpd[15460]: pcilib: Cannot open
/proc/bus/pcisnmpd[15460]: pcilib: Cannot find any working access method.
Quoted 9 lines
snmpd should not depend on a PCI bus and should simply move on.
Signed-off-by Jack Mitchell <[email protected]>--- .../recipes-extended/net-snmp/files/ifmib.patch | 66 ++++++++++++++++++++++ .../recipes-extended/net-snmp/net-snmp_5.7.1.bb | 1 + 2 files changed, 67 insertions(+)create mode 100644
meta-oe/recipes-extended/net-snmp/files/ifmib.patch
Apologies, wrong list.
Signature · 5 lines
Jack Mitchell ([email protected]) Embedded Systems Engineer http://www.embed.me.uk --