diff options
author | Jack Mitchell <jack.mitchell@dbbroadcast.co.uk> | 2013-04-17 10:36:07 +0100 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2013-04-19 02:45:28 +0200 |
commit | a5cbd7c856f838913f8d3faca7765760cb01fe77 (patch) | |
tree | 8b6d577035c29c2e25887a9054bb27b60612274d /meta-oe/recipes-extended | |
parent | c43b56f6d66412998cb4635f5bf40c9e499eaabd (diff) | |
download | meta-openembedded-a5cbd7c856f838913f8d3faca7765760cb01fe77.tar.gz |
net-snmp: fix failure when starting on system without pci bus
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>
Diffstat (limited to 'meta-oe/recipes-extended')
-rw-r--r-- | meta-oe/recipes-extended/net-snmp/files/ifmib.patch | 66 | ||||
-rw-r--r-- | meta-oe/recipes-extended/net-snmp/net-snmp_5.7.1.bb | 1 |
2 files changed, 67 insertions, 0 deletions
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 000000000..859c52c3e --- /dev/null +++ b/meta-oe/recipes-extended/net-snmp/files/ifmib.patch | |||
@@ -0,0 +1,66 @@ | |||
1 | Signed-off-by: Jack Mitchell <jack@embed.me.uk> | ||
2 | Upstream-Status: Pending | ||
3 | Bug-Report: http://sourceforge.net/p/net-snmp/bugs/2449/ | ||
4 | |||
5 | diff --git a/agent/mibgroup/if-mib/data_access/interface_linux.c b/agent/mibgroup/if-mib/data_access/interface_linux.c | ||
6 | index 3419811..d6eb91a 100644 | ||
7 | --- a/agent/mibgroup/if-mib/data_access/interface_linux.c | ||
8 | +++ b/agent/mibgroup/if-mib/data_access/interface_linux.c | ||
9 | @@ -18,7 +18,31 @@ netsnmp_feature_require(interface_ioctl_flags_set) | ||
10 | |||
11 | #ifdef HAVE_PCI_LOOKUP_NAME | ||
12 | #include <pci/pci.h> | ||
13 | +#include <setjmp.h> | ||
14 | static struct pci_access *pci_access; | ||
15 | + | ||
16 | +/* Avoid letting libpci call exit(1) when no PCI bus is available. */ | ||
17 | +static int do_longjmp =0; | ||
18 | +static jmp_buf err_buf; | ||
19 | +static void | ||
20 | +netsnmp_pci_error(char *msg, ...) | ||
21 | +{ | ||
22 | + va_list args; | ||
23 | + char *buf; | ||
24 | + int buflen; | ||
25 | + | ||
26 | + va_start(args, msg); | ||
27 | + buflen = strlen("pcilib: ")+strlen(msg)+2; | ||
28 | + buf = malloc(buflen); | ||
29 | + snprintf(buf, buflen, "pcilib: %s\n", msg); | ||
30 | + snmp_vlog(LOG_ERR, buf, args); | ||
31 | + free(buf); | ||
32 | + va_end(args); | ||
33 | + if (do_longjmp) | ||
34 | + longjmp(err_buf, 1); | ||
35 | + else | ||
36 | + exit(1); | ||
37 | +} | ||
38 | #endif | ||
39 | |||
40 | #ifdef HAVE_LINUX_ETHTOOL_H | ||
41 | @@ -147,10 +171,22 @@ netsnmp_arch_interface_init(void) | ||
42 | |||
43 | #ifdef HAVE_PCI_LOOKUP_NAME | ||
44 | pci_access = pci_alloc(); | ||
45 | - if (pci_access) | ||
46 | + if (!pci_access) { | ||
47 | + snmp_log(LOG_ERR, "pcilib: pci_alloc failed\n"); | ||
48 | + return; | ||
49 | + } | ||
50 | + | ||
51 | + pci_access->error = netsnmp_pci_error; | ||
52 | + | ||
53 | + do_longjmp = 1; | ||
54 | + if (setjmp(err_buf)) { | ||
55 | + pci_cleanup(pci_access); | ||
56 | + snmp_log(LOG_ERR, "pcilib: pci_init failed\n"); | ||
57 | + pci_access = NULL; | ||
58 | + } | ||
59 | + else if (pci_access) | ||
60 | pci_init(pci_access); | ||
61 | - else | ||
62 | - snmp_log(LOG_ERR, "Unable to create pci access method\n"); | ||
63 | + do_longjmp = 0; | ||
64 | #endif | ||
65 | } | ||
66 | |||
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 14c103601..19aa163c8 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 \ | |||
12 | file://systemd-support.patch \ | 12 | file://systemd-support.patch \ |
13 | file://snmpd.service \ | 13 | file://snmpd.service \ |
14 | file://snmptrapd.service \ | 14 | file://snmptrapd.service \ |
15 | file://ifmib.patch \ | ||
15 | " | 16 | " |
16 | 17 | ||
17 | EXTRA_OECONF += "--disable-embedded-perl --with-perl-modules=no" | 18 | EXTRA_OECONF += "--disable-embedded-perl --with-perl-modules=no" |