All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-oe][PATCHv2 1/2] net-snmp: fix failure when starting on system without pci bus
@ 2013-04-17 10:46 Jack Mitchell
  2013-04-17 10:46 ` [meta-oe][PATCHv2 2/2] net-snmp: Update to 5.7.2 Jack Mitchell
  2013-04-17 11:09 ` [meta-oe][PATCHv2 1/2] net-snmp: fix failure when starting on system without pci bus Jack Mitchell
  0 siblings, 2 replies; 6+ messages in thread
From: Jack Mitchell @ 2013-04-17 10:46 UTC (permalink / raw)
  To: openembedded-core; +Cc: Jack Mitchell

From: Jack Mitchell <jack.mitchell@dbbroadcast.co.uk>

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.

Signed-off-by: Jack Mitchell <jack.mitchell@dbbroadcast.co.uk>
---
 .../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

diff --git a/meta-oe/recipes-extended/net-snmp/files/ifmib.patch b/meta-oe/recipes-extended/net-snmp/files/ifmib.patch
new file mode 100644
index 0000000..859c52c
--- /dev/null
+++ b/meta-oe/recipes-extended/net-snmp/files/ifmib.patch
@@ -0,0 +1,66 @@
+Signed-off-by: Jack Mitchell <jack@embed.me.uk>
+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
+ }
+ 
diff --git a/meta-oe/recipes-extended/net-snmp/net-snmp_5.7.1.bb b/meta-oe/recipes-extended/net-snmp/net-snmp_5.7.1.bb
index 14c1036..19aa163 100644
--- a/meta-oe/recipes-extended/net-snmp/net-snmp_5.7.1.bb
+++ b/meta-oe/recipes-extended/net-snmp/net-snmp_5.7.1.bb
@@ -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"
-- 
1.8.2




^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [meta-oe][PATCHv2 1/2] net-snmp: fix failure when starting on system without pci bus
@ 2013-04-17 11:10 Jack Mitchell
  2013-04-17 11:10 ` [meta-oe][PATCHv2 2/2] net-snmp: Update to 5.7.2 Jack Mitchell
  0 siblings, 1 reply; 6+ messages in thread
From: Jack Mitchell @ 2013-04-17 11:10 UTC (permalink / raw)
  To: openembedded-devel; +Cc: Jack Mitchell

From: Jack Mitchell <jack.mitchell@dbbroadcast.co.uk>

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.

Signed-off-by: Jack Mitchell <jack.mitchell@dbbroadcast.co.uk>
---
 .../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

diff --git a/meta-oe/recipes-extended/net-snmp/files/ifmib.patch b/meta-oe/recipes-extended/net-snmp/files/ifmib.patch
new file mode 100644
index 0000000..859c52c
--- /dev/null
+++ b/meta-oe/recipes-extended/net-snmp/files/ifmib.patch
@@ -0,0 +1,66 @@
+Signed-off-by: Jack Mitchell <jack@embed.me.uk>
+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
+ }
+ 
diff --git a/meta-oe/recipes-extended/net-snmp/net-snmp_5.7.1.bb b/meta-oe/recipes-extended/net-snmp/net-snmp_5.7.1.bb
index 14c1036..19aa163 100644
--- a/meta-oe/recipes-extended/net-snmp/net-snmp_5.7.1.bb
+++ b/meta-oe/recipes-extended/net-snmp/net-snmp_5.7.1.bb
@@ -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"
-- 
1.8.2




^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-04-17 11:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-17 10:46 [meta-oe][PATCHv2 1/2] net-snmp: fix failure when starting on system without pci bus Jack Mitchell
2013-04-17 10:46 ` [meta-oe][PATCHv2 2/2] net-snmp: Update to 5.7.2 Jack Mitchell
2013-04-17 11:10   ` Martin Jansa
2013-04-17 11:18     ` Jack Mitchell
2013-04-17 11:09 ` [meta-oe][PATCHv2 1/2] net-snmp: fix failure when starting on system without pci bus Jack Mitchell
  -- strict thread matches above, loose matches on Subject: below --
2013-04-17 11:10 Jack Mitchell
2013-04-17 11:10 ` [meta-oe][PATCHv2 2/2] net-snmp: Update to 5.7.2 Jack Mitchell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.