diff options
| -rw-r--r-- | meta-networking/recipes-protocols/net-snmp/files/ifmib.patch | 66 | ||||
| -rw-r--r-- | meta-networking/recipes-protocols/net-snmp/net-snmp/0001-Added-checks-for-printing-variables-with-wrong-types.patch | 455 | ||||
| -rw-r--r-- | meta-networking/recipes-protocols/net-snmp/net-snmp/0001-Fix-CVE-2014-2285.patch | 49 | ||||
| -rw-r--r-- | meta-networking/recipes-protocols/net-snmp/net-snmp/0001-config_os_headers-Error-Fix.patch | 37 | ||||
| -rw-r--r-- | meta-networking/recipes-protocols/net-snmp/net-snmp/dont-return-incompletely-parsed-varbinds.patch | 55 | ||||
| -rw-r--r-- | meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-5.7.2-fix-mib-timeout-values.patch | 56 | ||||
| -rw-r--r-- | meta-networking/recipes-protocols/net-snmp/net-snmp/systemd-support.patch | 178 | ||||
| -rw-r--r-- | meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb (renamed from meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.2.1.bb) | 12 |
8 files changed, 176 insertions, 732 deletions
diff --git a/meta-networking/recipes-protocols/net-snmp/files/ifmib.patch b/meta-networking/recipes-protocols/net-snmp/files/ifmib.patch deleted file mode 100644 index 859c52c3e3..0000000000 --- a/meta-networking/recipes-protocols/net-snmp/files/ifmib.patch +++ /dev/null | |||
| @@ -1,66 +0,0 @@ | |||
| 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-networking/recipes-protocols/net-snmp/net-snmp/0001-Added-checks-for-printing-variables-with-wrong-types.patch b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-Added-checks-for-printing-variables-with-wrong-types.patch deleted file mode 100644 index 30374cfe96..0000000000 --- a/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-Added-checks-for-printing-variables-with-wrong-types.patch +++ /dev/null | |||
| @@ -1,455 +0,0 @@ | |||
| 1 | From 7f4a7b891332899cea26e95be0337aae01648742 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jan Safranek <jsafranek@users.sourceforge.net> | ||
| 3 | Date: Thu, 31 Jul 2014 13:46:49 +0200 | ||
| 4 | Subject: [PATCH] Added checks for printing variables with wrong types. | ||
| 5 | |||
| 6 | Upstream-Status: Backport | ||
| 7 | |||
| 8 | When -OQ command line argument is used, variable formatter preffers the type | ||
| 9 | of the varible parsed from a MIB file instead of checking type of the variable | ||
| 10 | as parsed from SNMP message. | ||
| 11 | |||
| 12 | This can lead to crashes when incoming packets contains a variable with | ||
| 13 | NULL type, while the MIB says the variable should be non-NULL, like Integer. | ||
| 14 | The formatter then tries to interpret the NULL (from packet) as Integer (from | ||
| 15 | MIB file). | ||
| 16 | |||
| 17 | Signed-off-by: Jan Safranek <jsafranek@users.sourceforge.net> | ||
| 18 | --- | ||
| 19 | snmplib/mib.c | 270 ++++++++++++++++++++++++++++----------------------------- | ||
| 20 | 1 file changed, 135 insertions(+), 135 deletions(-) | ||
| 21 | |||
| 22 | diff --git a/snmplib/mib.c b/snmplib/mib.c | ||
| 23 | index 9d3ca41..c6e0010 100644 | ||
| 24 | --- a/snmplib/mib.c | ||
| 25 | +++ b/snmplib/mib.c | ||
| 26 | @@ -439,17 +439,16 @@ sprint_realloc_octet_string(u_char ** buf, size_t * buf_len, | ||
| 27 | u_char *cp; | ||
| 28 | int output_format, cnt; | ||
| 29 | |||
| 30 | - if ((var->type != ASN_OCTET_STR) && | ||
| 31 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
| 32 | - const char str[] = "Wrong Type (should be OCTET STRING): "; | ||
| 33 | - if (snmp_cstrcat | ||
| 34 | - (buf, buf_len, out_len, allow_realloc, str)) { | ||
| 35 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 36 | + if (var->type != ASN_OCTET_STR) { | ||
| 37 | + if (!netsnmp_ds_get_boolean( | ||
| 38 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
| 39 | + const char str[] = "Wrong Type (should be OCTET STRING): "; | ||
| 40 | + if (!snmp_cstrcat(buf, buf_len, out_len, allow_realloc, str)) | ||
| 41 | + return 0; | ||
| 42 | + } | ||
| 43 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 44 | allow_realloc, var, NULL, NULL, | ||
| 45 | NULL); | ||
| 46 | - } else { | ||
| 47 | - return 0; | ||
| 48 | - } | ||
| 49 | } | ||
| 50 | |||
| 51 | |||
| 52 | @@ -702,16 +701,16 @@ sprint_realloc_float(u_char ** buf, size_t * buf_len, | ||
| 53 | const struct enum_list *enums, | ||
| 54 | const char *hint, const char *units) | ||
| 55 | { | ||
| 56 | - if ((var->type != ASN_OPAQUE_FLOAT) && | ||
| 57 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
| 58 | - if (snmp_cstrcat(buf, buf_len, out_len, allow_realloc, | ||
| 59 | - "Wrong Type (should be Float): ")) { | ||
| 60 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 61 | + if (var->type != ASN_OPAQUE_FLOAT) { | ||
| 62 | + if (!netsnmp_ds_get_boolean( | ||
| 63 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
| 64 | + u_char str[] = "Wrong Type (should be Float): "; | ||
| 65 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
| 66 | + return 0; | ||
| 67 | + } | ||
| 68 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 69 | allow_realloc, var, NULL, NULL, | ||
| 70 | NULL); | ||
| 71 | - } else { | ||
| 72 | - return 0; | ||
| 73 | - } | ||
| 74 | } | ||
| 75 | |||
| 76 | if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) { | ||
| 77 | @@ -772,17 +771,16 @@ sprint_realloc_double(u_char ** buf, size_t * buf_len, | ||
| 78 | const struct enum_list *enums, | ||
| 79 | const char *hint, const char *units) | ||
| 80 | { | ||
| 81 | - if ((var->type != ASN_OPAQUE_DOUBLE) && | ||
| 82 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
| 83 | - if (snmp_cstrcat | ||
| 84 | - (buf, buf_len, out_len, allow_realloc, | ||
| 85 | - "Wrong Type (should be Double): ")) { | ||
| 86 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 87 | + if (var->type != ASN_OPAQUE_DOUBLE) { | ||
| 88 | + if (!netsnmp_ds_get_boolean( | ||
| 89 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
| 90 | + u_char str[] = "Wrong Type (should be Double): "; | ||
| 91 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
| 92 | + return 0; | ||
| 93 | + } | ||
| 94 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 95 | allow_realloc, var, NULL, NULL, | ||
| 96 | NULL); | ||
| 97 | - } else { | ||
| 98 | - return 0; | ||
| 99 | - } | ||
| 100 | } | ||
| 101 | |||
| 102 | if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) { | ||
| 103 | @@ -847,20 +845,21 @@ sprint_realloc_counter64(u_char ** buf, size_t * buf_len, size_t * out_len, | ||
| 104 | { | ||
| 105 | char a64buf[I64CHARSZ + 1]; | ||
| 106 | |||
| 107 | - if ((var->type != ASN_COUNTER64 | ||
| 108 | + if (var->type != ASN_COUNTER64 | ||
| 109 | #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES | ||
| 110 | && var->type != ASN_OPAQUE_COUNTER64 | ||
| 111 | && var->type != ASN_OPAQUE_I64 && var->type != ASN_OPAQUE_U64 | ||
| 112 | #endif | ||
| 113 | - ) && (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
| 114 | - if (snmp_cstrcat(buf, buf_len, out_len, allow_realloc, | ||
| 115 | - "Wrong Type (should be Counter64): ")) { | ||
| 116 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 117 | + ) { | ||
| 118 | + if (!netsnmp_ds_get_boolean( | ||
| 119 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
| 120 | + u_char str[] = "Wrong Type (should be Counter64): "; | ||
| 121 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
| 122 | + return 0; | ||
| 123 | + } | ||
| 124 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 125 | allow_realloc, var, NULL, NULL, | ||
| 126 | NULL); | ||
| 127 | - } else { | ||
| 128 | - return 0; | ||
| 129 | - } | ||
| 130 | } | ||
| 131 | |||
| 132 | if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) { | ||
| 133 | @@ -948,23 +947,25 @@ sprint_realloc_opaque(u_char ** buf, size_t * buf_len, | ||
| 134 | const struct enum_list *enums, | ||
| 135 | const char *hint, const char *units) | ||
| 136 | { | ||
| 137 | - if ((var->type != ASN_OPAQUE | ||
| 138 | + if (var->type != ASN_OPAQUE | ||
| 139 | #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES | ||
| 140 | && var->type != ASN_OPAQUE_COUNTER64 | ||
| 141 | && var->type != ASN_OPAQUE_U64 | ||
| 142 | && var->type != ASN_OPAQUE_I64 | ||
| 143 | && var->type != ASN_OPAQUE_FLOAT && var->type != ASN_OPAQUE_DOUBLE | ||
| 144 | #endif /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */ | ||
| 145 | - ) && (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
| 146 | - if (snmp_cstrcat(buf, buf_len, out_len, allow_realloc, | ||
| 147 | - "Wrong Type (should be Opaque): ")) { | ||
| 148 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 149 | + ) { | ||
| 150 | + if (!netsnmp_ds_get_boolean( | ||
| 151 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
| 152 | + u_char str[] = "Wrong Type (should be Opaque): "; | ||
| 153 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
| 154 | + return 0; | ||
| 155 | + } | ||
| 156 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 157 | allow_realloc, var, NULL, NULL, | ||
| 158 | NULL); | ||
| 159 | - } else { | ||
| 160 | - return 0; | ||
| 161 | - } | ||
| 162 | } | ||
| 163 | + | ||
| 164 | #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES | ||
| 165 | switch (var->type) { | ||
| 166 | case ASN_OPAQUE_COUNTER64: | ||
| 167 | @@ -1040,17 +1041,16 @@ sprint_realloc_object_identifier(u_char ** buf, size_t * buf_len, | ||
| 168 | { | ||
| 169 | int buf_overflow = 0; | ||
| 170 | |||
| 171 | - if ((var->type != ASN_OBJECT_ID) && | ||
| 172 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
| 173 | - u_char str[] = | ||
| 174 | - "Wrong Type (should be OBJECT IDENTIFIER): "; | ||
| 175 | - if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) { | ||
| 176 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 177 | + if (var->type != ASN_OBJECT_ID) { | ||
| 178 | + if (!netsnmp_ds_get_boolean( | ||
| 179 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
| 180 | + u_char str[] = "Wrong Type (should be OBJECT IDENTIFIER): "; | ||
| 181 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
| 182 | + return 0; | ||
| 183 | + } | ||
| 184 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 185 | allow_realloc, var, NULL, NULL, | ||
| 186 | NULL); | ||
| 187 | - } else { | ||
| 188 | - return 0; | ||
| 189 | - } | ||
| 190 | } | ||
| 191 | |||
| 192 | if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) { | ||
| 193 | @@ -1110,16 +1110,16 @@ sprint_realloc_timeticks(u_char ** buf, size_t * buf_len, size_t * out_len, | ||
| 194 | { | ||
| 195 | char timebuf[40]; | ||
| 196 | |||
| 197 | - if ((var->type != ASN_TIMETICKS) && | ||
| 198 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
| 199 | - u_char str[] = "Wrong Type (should be Timeticks): "; | ||
| 200 | - if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) { | ||
| 201 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 202 | + if (var->type != ASN_TIMETICKS) { | ||
| 203 | + if (!netsnmp_ds_get_boolean( | ||
| 204 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
| 205 | + u_char str[] = "Wrong Type (should be Timeticks): "; | ||
| 206 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
| 207 | + return 0; | ||
| 208 | + } | ||
| 209 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 210 | allow_realloc, var, NULL, NULL, | ||
| 211 | NULL); | ||
| 212 | - } else { | ||
| 213 | - return 0; | ||
| 214 | - } | ||
| 215 | } | ||
| 216 | |||
| 217 | if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NUMERIC_TIMETICKS)) { | ||
| 218 | @@ -1277,17 +1277,18 @@ sprint_realloc_integer(u_char ** buf, size_t * buf_len, size_t * out_len, | ||
| 219 | { | ||
| 220 | char *enum_string = NULL; | ||
| 221 | |||
| 222 | - if ((var->type != ASN_INTEGER) && | ||
| 223 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
| 224 | - u_char str[] = "Wrong Type (should be INTEGER): "; | ||
| 225 | - if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) { | ||
| 226 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 227 | + if (var->type != ASN_INTEGER) { | ||
| 228 | + if (!netsnmp_ds_get_boolean( | ||
| 229 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
| 230 | + u_char str[] = "Wrong Type (should be INTEGER): "; | ||
| 231 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
| 232 | + return 0; | ||
| 233 | + } | ||
| 234 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 235 | allow_realloc, var, NULL, NULL, | ||
| 236 | NULL); | ||
| 237 | - } else { | ||
| 238 | - return 0; | ||
| 239 | - } | ||
| 240 | } | ||
| 241 | + | ||
| 242 | for (; enums; enums = enums->next) { | ||
| 243 | if (enums->value == *var->val.integer) { | ||
| 244 | enum_string = enums->label; | ||
| 245 | @@ -1380,16 +1381,16 @@ sprint_realloc_uinteger(u_char ** buf, size_t * buf_len, size_t * out_len, | ||
| 246 | { | ||
| 247 | char *enum_string = NULL; | ||
| 248 | |||
| 249 | - if ((var->type != ASN_UINTEGER) && | ||
| 250 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
| 251 | - u_char str[] = "Wrong Type (should be UInteger32): "; | ||
| 252 | - if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) { | ||
| 253 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 254 | + if (var->type != ASN_UINTEGER) { | ||
| 255 | + if (!netsnmp_ds_get_boolean( | ||
| 256 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
| 257 | + u_char str[] = "Wrong Type (should be UInteger32): "; | ||
| 258 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
| 259 | + return 0; | ||
| 260 | + } | ||
| 261 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 262 | allow_realloc, var, NULL, NULL, | ||
| 263 | NULL); | ||
| 264 | - } else { | ||
| 265 | - return 0; | ||
| 266 | - } | ||
| 267 | } | ||
| 268 | |||
| 269 | for (; enums; enums = enums->next) { | ||
| 270 | @@ -1477,17 +1478,16 @@ sprint_realloc_gauge(u_char ** buf, size_t * buf_len, size_t * out_len, | ||
| 271 | { | ||
| 272 | char tmp[32]; | ||
| 273 | |||
| 274 | - if ((var->type != ASN_GAUGE) && | ||
| 275 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
| 276 | - u_char str[] = | ||
| 277 | - "Wrong Type (should be Gauge32 or Unsigned32): "; | ||
| 278 | - if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) { | ||
| 279 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 280 | + if (var->type != ASN_GAUGE) { | ||
| 281 | + if (!netsnmp_ds_get_boolean( | ||
| 282 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
| 283 | + u_char str[] = "Wrong Type (should be Gauge32 or Unsigned32): "; | ||
| 284 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
| 285 | + return 0; | ||
| 286 | + } | ||
| 287 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 288 | allow_realloc, var, NULL, NULL, | ||
| 289 | NULL); | ||
| 290 | - } else { | ||
| 291 | - return 0; | ||
| 292 | - } | ||
| 293 | } | ||
| 294 | |||
| 295 | if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) { | ||
| 296 | @@ -1550,16 +1550,16 @@ sprint_realloc_counter(u_char ** buf, size_t * buf_len, size_t * out_len, | ||
| 297 | { | ||
| 298 | char tmp[32]; | ||
| 299 | |||
| 300 | - if ((var->type != ASN_COUNTER) && | ||
| 301 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
| 302 | - u_char str[] = "Wrong Type (should be Counter32): "; | ||
| 303 | - if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) { | ||
| 304 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 305 | + if (var->type != ASN_COUNTER) { | ||
| 306 | + if (!netsnmp_ds_get_boolean( | ||
| 307 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
| 308 | + u_char str[] = "Wrong Type (should be Counter32): "; | ||
| 309 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
| 310 | + return 0; | ||
| 311 | + } | ||
| 312 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 313 | allow_realloc, var, NULL, NULL, | ||
| 314 | NULL); | ||
| 315 | - } else { | ||
| 316 | - return 0; | ||
| 317 | - } | ||
| 318 | } | ||
| 319 | |||
| 320 | if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) { | ||
| 321 | @@ -1613,16 +1613,16 @@ sprint_realloc_networkaddress(u_char ** buf, size_t * buf_len, | ||
| 322 | { | ||
| 323 | size_t i; | ||
| 324 | |||
| 325 | - if ((var->type != ASN_IPADDRESS) && | ||
| 326 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
| 327 | - u_char str[] = "Wrong Type (should be NetworkAddress): "; | ||
| 328 | - if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) { | ||
| 329 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 330 | + if (var->type != ASN_IPADDRESS) { | ||
| 331 | + if (!netsnmp_ds_get_boolean( | ||
| 332 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
| 333 | + u_char str[] = "Wrong Type (should be NetworkAddress): "; | ||
| 334 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
| 335 | + return 0; | ||
| 336 | + } | ||
| 337 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 338 | allow_realloc, var, NULL, NULL, | ||
| 339 | NULL); | ||
| 340 | - } else { | ||
| 341 | - return 0; | ||
| 342 | - } | ||
| 343 | } | ||
| 344 | |||
| 345 | if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) { | ||
| 346 | @@ -1679,16 +1679,16 @@ sprint_realloc_ipaddress(u_char ** buf, size_t * buf_len, size_t * out_len, | ||
| 347 | { | ||
| 348 | u_char *ip = var->val.string; | ||
| 349 | |||
| 350 | - if ((var->type != ASN_IPADDRESS) && | ||
| 351 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
| 352 | - u_char str[] = "Wrong Type (should be IpAddress): "; | ||
| 353 | - if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) { | ||
| 354 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 355 | + if (var->type != ASN_IPADDRESS) { | ||
| 356 | + if (!netsnmp_ds_get_boolean( | ||
| 357 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
| 358 | + u_char str[] = "Wrong Type (should be IpAddress): "; | ||
| 359 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
| 360 | + return 0; | ||
| 361 | + } | ||
| 362 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 363 | allow_realloc, var, NULL, NULL, | ||
| 364 | NULL); | ||
| 365 | - } else { | ||
| 366 | - return 0; | ||
| 367 | - } | ||
| 368 | } | ||
| 369 | |||
| 370 | if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) { | ||
| 371 | @@ -1737,20 +1737,20 @@ sprint_realloc_null(u_char ** buf, size_t * buf_len, size_t * out_len, | ||
| 372 | const struct enum_list *enums, | ||
| 373 | const char *hint, const char *units) | ||
| 374 | { | ||
| 375 | - if ((var->type != ASN_NULL) && | ||
| 376 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
| 377 | - u_char str[] = "Wrong Type (should be NULL): "; | ||
| 378 | - if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) { | ||
| 379 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 380 | + if (var->type != ASN_NULL) { | ||
| 381 | + if (!netsnmp_ds_get_boolean( | ||
| 382 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
| 383 | + u_char str[] = "Wrong Type (should be NULL): "; | ||
| 384 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
| 385 | + return 0; | ||
| 386 | + } | ||
| 387 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 388 | allow_realloc, var, NULL, NULL, | ||
| 389 | NULL); | ||
| 390 | - } else { | ||
| 391 | - return 0; | ||
| 392 | - } | ||
| 393 | - } else { | ||
| 394 | - u_char str[] = "NULL"; | ||
| 395 | - return snmp_strcat(buf, buf_len, out_len, allow_realloc, str); | ||
| 396 | } | ||
| 397 | + | ||
| 398 | + u_char str[] = "NULL"; | ||
| 399 | + return snmp_strcat(buf, buf_len, out_len, allow_realloc, str); | ||
| 400 | } | ||
| 401 | |||
| 402 | |||
| 403 | @@ -1785,16 +1785,16 @@ sprint_realloc_bitstring(u_char ** buf, size_t * buf_len, size_t * out_len, | ||
| 404 | u_char *cp; | ||
| 405 | char *enum_string; | ||
| 406 | |||
| 407 | - if ((var->type != ASN_BIT_STR && var->type != ASN_OCTET_STR) && | ||
| 408 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
| 409 | - u_char str[] = "Wrong Type (should be BITS): "; | ||
| 410 | - if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) { | ||
| 411 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 412 | + if (var->type != ASN_BIT_STR && var->type != ASN_OCTET_STR) { | ||
| 413 | + if (!netsnmp_ds_get_boolean( | ||
| 414 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
| 415 | + u_char str[] = "Wrong Type (should be BITS): "; | ||
| 416 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
| 417 | + return 0; | ||
| 418 | + } | ||
| 419 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 420 | allow_realloc, var, NULL, NULL, | ||
| 421 | NULL); | ||
| 422 | - } else { | ||
| 423 | - return 0; | ||
| 424 | - } | ||
| 425 | } | ||
| 426 | |||
| 427 | if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) { | ||
| 428 | @@ -1869,16 +1869,16 @@ sprint_realloc_nsapaddress(u_char ** buf, size_t * buf_len, | ||
| 429 | const struct enum_list *enums, const char *hint, | ||
| 430 | const char *units) | ||
| 431 | { | ||
| 432 | - if ((var->type != ASN_NSAP) && | ||
| 433 | - (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) { | ||
| 434 | - u_char str[] = "Wrong Type (should be NsapAddress): "; | ||
| 435 | - if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) { | ||
| 436 | - return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 437 | + if (var->type != ASN_NSAP) { | ||
| 438 | + if (!netsnmp_ds_get_boolean( | ||
| 439 | + NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) { | ||
| 440 | + u_char str[] = "Wrong Type (should be NsapAddress): "; | ||
| 441 | + if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) | ||
| 442 | + return 0; | ||
| 443 | + } | ||
| 444 | + return sprint_realloc_by_type(buf, buf_len, out_len, | ||
| 445 | allow_realloc, var, NULL, NULL, | ||
| 446 | NULL); | ||
| 447 | - } else { | ||
| 448 | - return 0; | ||
| 449 | - } | ||
| 450 | } | ||
| 451 | |||
| 452 | if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) { | ||
| 453 | -- | ||
| 454 | 1.7.10.4 | ||
| 455 | |||
diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-Fix-CVE-2014-2285.patch b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-Fix-CVE-2014-2285.patch deleted file mode 100644 index b1514b97f9..0000000000 --- a/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-Fix-CVE-2014-2285.patch +++ /dev/null | |||
| @@ -1,49 +0,0 @@ | |||
| 1 | From 87a0d27102ceffb92e5c1d6fbbd24972a9dd33ac Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Junling Zheng <zhengjunling@huawei.com> | ||
| 3 | Date: Mon, 20 Apr 2015 10:23:08 +0000 | ||
| 4 | Subject: [PATCH] Fix CVE-2014-2285 | ||
| 5 | |||
| 6 | Sending SNMP trap with empty community string crashes snmptrapd if Perl | ||
| 7 | handler is enabled. | ||
| 8 | |||
| 9 | Refer to: | ||
| 10 | https://bugzilla.redhat.com/show_bug.cgi?id=1072044 | ||
| 11 | |||
| 12 | Upstream Status: Backported | ||
| 13 | |||
| 14 | Signed-off-by: Junling Zheng <zhengjunling@huawei.com> | ||
| 15 | --- | ||
| 16 | perl/TrapReceiver/TrapReceiver.xs | 10 +++++----- | ||
| 17 | 1 file changed, 5 insertions(+), 5 deletions(-) | ||
| 18 | |||
| 19 | diff --git a/perl/TrapReceiver/TrapReceiver.xs b/perl/TrapReceiver/TrapReceiver.xs | ||
| 20 | index 531bfa4..ac94370 100644 | ||
| 21 | --- a/perl/TrapReceiver/TrapReceiver.xs | ||
| 22 | +++ b/perl/TrapReceiver/TrapReceiver.xs | ||
| 23 | @@ -81,18 +81,18 @@ int perl_trapd_handler( netsnmp_pdu *pdu, | ||
| 24 | STOREPDUi("securitymodel", pdu->securityModel); | ||
| 25 | STOREPDUi("securitylevel", pdu->securityLevel); | ||
| 26 | STOREPDU("contextName", | ||
| 27 | - newSVpv(pdu->contextName, pdu->contextNameLen)); | ||
| 28 | + newSVpv(pdu->contextName ? pdu->contextName : "", pdu->contextNameLen)); | ||
| 29 | STOREPDU("contextEngineID", | ||
| 30 | - newSVpv((char *) pdu->contextEngineID, | ||
| 31 | + newSVpv((char *)(pdu->contextEngineID ? pdu->contextEngineID : ""), | ||
| 32 | pdu->contextEngineIDLen)); | ||
| 33 | STOREPDU("securityEngineID", | ||
| 34 | - newSVpv((char *) pdu->securityEngineID, | ||
| 35 | + newSVpv((char *)(pdu->securityEngineID ? pdu->securityEngineID : ""), | ||
| 36 | pdu->securityEngineIDLen)); | ||
| 37 | STOREPDU("securityName", | ||
| 38 | - newSVpv((char *) pdu->securityName, pdu->securityNameLen)); | ||
| 39 | + newSVpv((char *)(pdu->securityName ? pdu->securityName : ""), pdu->securityNameLen)); | ||
| 40 | } else { | ||
| 41 | STOREPDU("community", | ||
| 42 | - newSVpv((char *) pdu->community, pdu->community_len)); | ||
| 43 | + newSVpv((char *)(pdu->community ? pdu->community : ""), pdu->community_len)); | ||
| 44 | } | ||
| 45 | |||
| 46 | if (transport && transport->f_fmtaddr) { | ||
| 47 | -- | ||
| 48 | 1.8.3.4 | ||
| 49 | |||
diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-config_os_headers-Error-Fix.patch b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-config_os_headers-Error-Fix.patch new file mode 100644 index 0000000000..c6401fed39 --- /dev/null +++ b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-config_os_headers-Error-Fix.patch | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | From 261a22096c79f8e6ef7b387514a74d208e4e5945 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Li xin <lixin.fnst@cn.fujitsu.com> | ||
| 3 | Date: Fri, 21 Aug 2015 18:23:13 +0900 | ||
| 4 | Subject: [PATCH] config_os_headers: Error Fix | ||
| 5 | |||
| 6 | ERROR: This autoconf log indicates errors, it looked at host include | ||
| 7 | and/or library paths while determining system capabilities. | ||
| 8 | cc1: warning: include location "/usr/local/include" is unsafe for cross-compilation [-Wpoison-system-directories] | ||
| 9 | conftest.c:168:17: fatal error: pkg.h: No such file or directory | ||
| 10 | #include <pkg.h> | ||
| 11 | ^ | ||
| 12 | |||
| 13 | Upstream-Status: pending | ||
| 14 | |||
| 15 | Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com> | ||
| 16 | --- | ||
| 17 | configure.d/config_os_headers | 4 ++-- | ||
| 18 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
| 19 | |||
| 20 | diff --git a/configure.d/config_os_headers b/configure.d/config_os_headers | ||
| 21 | index 708aa09..0df32ca 100644 | ||
| 22 | --- a/configure.d/config_os_headers | ||
| 23 | +++ b/configure.d/config_os_headers | ||
| 24 | @@ -482,8 +482,8 @@ then | ||
| 25 | unset ac_cv_header_pkg_h | ||
| 26 | netsnmp_save_CPPFLAGS="$CPPFLAGS" | ||
| 27 | netsnmp_save_LDFLAGS="$LDFLAGS" | ||
| 28 | - CPPFLAGS="$CPPFLAGS -I/usr/local/include" | ||
| 29 | - LDFLAGS="$LDFLAGS -L/usr/local/lib" | ||
| 30 | + CPPFLAGS="$CPPFLAGS" | ||
| 31 | + LDFLAGS="$LDFLAGS" | ||
| 32 | AC_CHECK_HEADERS(pkg.h, | ||
| 33 | NETSNMP_SEARCH_LIBS(pkg_init, pkg, | ||
| 34 | AC_DEFINE(HAVE_LIBPKG, 1, [define if you have BSD pkg-ng]))) | ||
| 35 | -- | ||
| 36 | 1.8.4.2 | ||
| 37 | |||
diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp/dont-return-incompletely-parsed-varbinds.patch b/meta-networking/recipes-protocols/net-snmp/net-snmp/dont-return-incompletely-parsed-varbinds.patch index 04f2110f39..6bd0f93c4b 100644 --- a/meta-networking/recipes-protocols/net-snmp/net-snmp/dont-return-incompletely-parsed-varbinds.patch +++ b/meta-networking/recipes-protocols/net-snmp/net-snmp/dont-return-incompletely-parsed-varbinds.patch | |||
| @@ -1,18 +1,24 @@ | |||
| 1 | the snmp_pdu_parse() function could leave | 1 | From 6b93e686bdb6a908d00595608646a05527a5326b Mon Sep 17 00:00:00 2001 |
| 2 | incompletely parsed varBind variables in the list of variables in | 2 | From: Li xin <lixin.fnst@cn.fujitsu.com> |
| 3 | case the parsing of the SNMP PDU failed. If later processing tries to | 3 | Date: Fri, 21 Aug 2015 12:39:12 +0900 |
| 4 | operate on the stale and incompletely processed varBind (e.g. when | 4 | Subject: [PATCH] the snmp_pdu_parse() function could leave incompletely parsed |
| 5 | printing the variables), this can lead to e.g. crashes or, possibly, | 5 | varBind variables in the list of variables in case the parsing of the SNMP |
| 6 | execution of arbitrary code | 6 | PDU failed. If later processing tries to operate on the stale and |
| 7 | incompletely processed varBind (e.g. when printing the variables), this can | ||
| 8 | lead to e.g. crashes or, possibly, execution of arbitrary code | ||
| 7 | 9 | ||
| 8 | Upstream-Status: Backport [net-snmp] | 10 | Upstream-Status: Backport [net-snmp] |
| 9 | 11 | ||
| 10 | Written-by: Robert Story | 12 | Written-by: Robert Story |
| 13 | --- | ||
| 14 | snmplib/snmp_api.c | 53 ++++++++++++++++++++++++++++------------------------- | ||
| 15 | 1 file changed, 28 insertions(+), 25 deletions(-) | ||
| 11 | 16 | ||
| 12 | diff -Nur net-snmp-5.7.2.1.orig/snmplib/snmp_api.c net-snmp-5.7.2.1/snmplib/snmp_api.c | 17 | diff --git a/snmplib/snmp_api.c b/snmplib/snmp_api.c |
| 13 | --- net-snmp-5.7.2.1.orig/snmplib/snmp_api.c 2015-05-27 11:25:11.563747471 +0800 | 18 | index 191debf..15a2d39 100644 |
| 14 | +++ net-snmp-5.7.2.1/snmplib/snmp_api.c 2015-05-27 13:27:27.724748201 +0800 | 19 | --- a/snmplib/snmp_api.c |
| 15 | @@ -4345,10 +4345,9 @@ | 20 | +++ b/snmplib/snmp_api.c |
| 21 | @@ -4350,10 +4350,9 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length) | ||
| 16 | u_char type; | 22 | u_char type; |
| 17 | u_char msg_type; | 23 | u_char msg_type; |
| 18 | u_char *var_val; | 24 | u_char *var_val; |
| @@ -22,9 +28,9 @@ diff -Nur net-snmp-5.7.2.1.orig/snmplib/snmp_api.c net-snmp-5.7.2.1/snmplib/snmp | |||
| 22 | - netsnmp_variable_list *vp = NULL; | 28 | - netsnmp_variable_list *vp = NULL; |
| 23 | + netsnmp_variable_list *vp = NULL, *vplast = NULL; | 29 | + netsnmp_variable_list *vp = NULL, *vplast = NULL; |
| 24 | oid objid[MAX_OID_LEN]; | 30 | oid objid[MAX_OID_LEN]; |
| 31 | u_char *p; | ||
| 25 | 32 | ||
| 26 | /* | 33 | @@ -4493,31 +4492,17 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length) |
| 27 | @@ -4487,38 +4486,24 @@ | ||
| 28 | (ASN_SEQUENCE | ASN_CONSTRUCTOR), | 34 | (ASN_SEQUENCE | ASN_CONSTRUCTOR), |
| 29 | "varbinds"); | 35 | "varbinds"); |
| 30 | if (data == NULL) | 36 | if (data == NULL) |
| @@ -60,25 +66,16 @@ diff -Nur net-snmp-5.7.2.1.orig/snmplib/snmp_api.c net-snmp-5.7.2.1/snmplib/snmp | |||
| 60 | DEBUGDUMPSECTION("recv", "VarBind"); | 66 | DEBUGDUMPSECTION("recv", "VarBind"); |
| 61 | data = snmp_parse_var_op(data, objid, &vp->name_length, &vp->type, | 67 | data = snmp_parse_var_op(data, objid, &vp->name_length, &vp->type, |
| 62 | &vp->val_len, &var_val, length); | 68 | &vp->val_len, &var_val, length); |
| 63 | if (data == NULL) | 69 | @@ -4604,7 +4589,7 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length) |
| 64 | - return -1; | ||
| 65 | + goto fail; | ||
| 66 | if (snmp_set_var_objid(vp, objid, vp->name_length)) | ||
| 67 | - return -1; | ||
| 68 | + goto fail; | ||
| 69 | |||
| 70 | len = MAX_PACKET_LENGTH; | ||
| 71 | DEBUGDUMPHEADER("recv", "Value"); | ||
| 72 | @@ -4583,7 +4568,7 @@ | ||
| 73 | vp->val.string = (u_char *) malloc(vp->val_len); | 70 | vp->val.string = (u_char *) malloc(vp->val_len); |
| 74 | } | 71 | } |
| 75 | if (vp->val.string == NULL) { | 72 | if (vp->val.string == NULL) { |
| 76 | - return -1; | 73 | - return -1; |
| 77 | + goto fail; | 74 | + goto fail; |
| 78 | } | 75 | } |
| 79 | asn_parse_string(var_val, &len, &vp->type, vp->val.string, | 76 | p = asn_parse_string(var_val, &len, &vp->type, vp->val.string, |
| 80 | &vp->val_len); | 77 | &vp->val_len); |
| 81 | @@ -4594,7 +4579,7 @@ | 78 | @@ -4619,7 +4604,7 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length) |
| 82 | vp->val_len *= sizeof(oid); | 79 | vp->val_len *= sizeof(oid); |
| 83 | vp->val.objid = (oid *) malloc(vp->val_len); | 80 | vp->val.objid = (oid *) malloc(vp->val_len); |
| 84 | if (vp->val.objid == NULL) { | 81 | if (vp->val.objid == NULL) { |
| @@ -87,15 +84,16 @@ diff -Nur net-snmp-5.7.2.1.orig/snmplib/snmp_api.c net-snmp-5.7.2.1/snmplib/snmp | |||
| 87 | } | 84 | } |
| 88 | memmove(vp->val.objid, objid, vp->val_len); | 85 | memmove(vp->val.objid, objid, vp->val_len); |
| 89 | break; | 86 | break; |
| 90 | @@ -4606,19 +4591,35 @@ | 87 | @@ -4631,7 +4616,7 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length) |
| 91 | case ASN_BIT_STR: | 88 | case ASN_BIT_STR: |
| 92 | vp->val.bitstring = (u_char *) malloc(vp->val_len); | 89 | vp->val.bitstring = (u_char *) malloc(vp->val_len); |
| 93 | if (vp->val.bitstring == NULL) { | 90 | if (vp->val.bitstring == NULL) { |
| 94 | - return -1; | 91 | - return -1; |
| 95 | + goto fail; | 92 | + goto fail; |
| 96 | } | 93 | } |
| 97 | asn_parse_bitstring(var_val, &len, &vp->type, | 94 | p = asn_parse_bitstring(var_val, &len, &vp->type, |
| 98 | vp->val.bitstring, &vp->val_len); | 95 | vp->val.bitstring, &vp->val_len); |
| 96 | @@ -4640,12 +4625,30 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length) | ||
| 99 | break; | 97 | break; |
| 100 | default: | 98 | default: |
| 101 | snmp_log(LOG_ERR, "bad type returned (%x)\n", vp->type); | 99 | snmp_log(LOG_ERR, "bad type returned (%x)\n", vp->type); |
| @@ -112,6 +110,7 @@ diff -Nur net-snmp-5.7.2.1.orig/snmplib/snmp_api.c net-snmp-5.7.2.1/snmplib/snmp | |||
| 112 | + } | 110 | + } |
| 113 | + vplast = vp; | 111 | + vplast = vp; |
| 114 | + vp = NULL; | 112 | + vp = NULL; |
| 113 | + | ||
| 115 | } | 114 | } |
| 116 | - return badtype; | 115 | - return badtype; |
| 117 | + return 0; | 116 | + return 0; |
| @@ -123,6 +122,10 @@ diff -Nur net-snmp-5.7.2.1.orig/snmplib/snmp_api.c net-snmp-5.7.2.1/snmplib/snmp | |||
| 123 | + snmp_free_var(vp); | 122 | + snmp_free_var(vp); |
| 124 | + | 123 | + |
| 125 | + return -1; | 124 | + return -1; |
| 125 | + | ||
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | /* | 128 | /* |
| 129 | -- | ||
| 130 | 1.8.4.2 | ||
| 131 | |||
diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-5.7.2-fix-mib-timeout-values.patch b/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-5.7.2-fix-mib-timeout-values.patch deleted file mode 100644 index 324d1c05ca..0000000000 --- a/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-5.7.2-fix-mib-timeout-values.patch +++ /dev/null | |||
| @@ -1,56 +0,0 @@ | |||
| 1 | net-snmp: fix mib representation of timeout values | ||
| 2 | |||
| 3 | The patch comes from the follow three commits on upstream: | ||
| 4 | 78dac6e37943d1ad99841898806ea60b0eede636 | ||
| 5 | 390303059fbd98b1ee7621ddd4ad4c11d100fff9 | ||
| 6 | 96302af7fc3108c208227432f0f0b75f3e7b906d | ||
| 7 | |||
| 8 | The first commit: | ||
| 9 | Fix bug number #a2478: fix mib representation of timeout values. | ||
| 10 | The second commit: | ||
| 11 | Reverts 78dac6e37943d1ad99841898806ea60b0eede636 and resolve a2478 | ||
| 12 | in a way that avoids truncating | ||
| 13 | The third commit: | ||
| 14 | Corrects conversion factor from microseconds to centiseconds. | ||
| 15 | |||
| 16 | Upstream-Status: Backport | ||
| 17 | |||
| 18 | Signed-off-by: Per Hallsmark <per.hallsmark@windriver.com> | ||
| 19 | Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com> | ||
| 20 | |||
| 21 | diff -uarN net-snmp-5.7.2-org/agent/mibgroup/notification/snmpNotifyTable.c net-snmp-5.7.2/agent/mibgroup/notification/snmpNotifyTable.c | ||
| 22 | --- net-snmp-5.7.2-org/agent/mibgroup/notification/snmpNotifyTable.c 2015-04-09 15:24:18.393570318 +0800 | ||
| 23 | +++ net-snmp-5.7.2/agent/mibgroup/notification/snmpNotifyTable.c 2015-04-09 15:25:23.547569858 +0800 | ||
| 24 | @@ -331,7 +331,7 @@ | ||
| 25 | ptr->tAddressLen = t->remote_length; | ||
| 26 | ptr->tAddress = t->remote; | ||
| 27 | |||
| 28 | - ptr->timeout = ss->timeout / 1000; | ||
| 29 | + ptr->timeout = ss->timeout / 10000; | ||
| 30 | ptr->retryCount = ss->retries; | ||
| 31 | SNMP_FREE(ptr->tagList); | ||
| 32 | ptr->tagList = strdup(ptr->name); | ||
| 33 | diff -uarN net-snmp-5.7.2-org/agent/mibgroup/target/snmpTargetAddrEntry.h net-snmp-5.7.2/agent/mibgroup/target/snmpTargetAddrEntry.h | ||
| 34 | --- net-snmp-5.7.2-org/agent/mibgroup/target/snmpTargetAddrEntry.h 2015-04-09 15:24:18.593570085 +0800 | ||
| 35 | +++ net-snmp-5.7.2/agent/mibgroup/target/snmpTargetAddrEntry.h 2015-04-09 15:26:41.250570178 +0800 | ||
| 36 | @@ -51,7 +51,7 @@ | ||
| 37 | int tDomainLen; | ||
| 38 | unsigned char *tAddress; | ||
| 39 | size_t tAddressLen; | ||
| 40 | - int timeout; | ||
| 41 | + int timeout; /* Timeout in centiseconds */ | ||
| 42 | int retryCount; | ||
| 43 | char *tagList; | ||
| 44 | char *params; | ||
| 45 | diff -uarN net-snmp-5.7.2-org/agent/mibgroup/target/target.c net-snmp-5.7.2/agent/mibgroup/target/target.c | ||
| 46 | --- net-snmp-5.7.2-org/agent/mibgroup/target/target.c 2015-04-09 15:24:18.592569768 +0800 | ||
| 47 | +++ net-snmp-5.7.2/agent/mibgroup/target/target.c 2015-04-09 15:25:52.586569961 +0800 | ||
| 48 | @@ -240,7 +240,7 @@ | ||
| 49 | } | ||
| 50 | #endif | ||
| 51 | memset(&thissess, 0, sizeof(thissess)); | ||
| 52 | - thissess.timeout = (targaddrs->timeout) * 1000; | ||
| 53 | + thissess.timeout = (targaddrs->timeout) * 10000; | ||
| 54 | thissess.retries = targaddrs->retryCount; | ||
| 55 | DEBUGMSGTL(("target_sessions", | ||
| 56 | "timeout: %d -> %ld\n", | ||
diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp/systemd-support.patch b/meta-networking/recipes-protocols/net-snmp/net-snmp/systemd-support.patch index e19153bbc4..c6af8c0f33 100644 --- a/meta-networking/recipes-protocols/net-snmp/net-snmp/systemd-support.patch +++ b/meta-networking/recipes-protocols/net-snmp/net-snmp/systemd-support.patch | |||
| @@ -1,4 +1,8 @@ | |||
| 1 | Systemd support backported from the master branch as of 23/04/2012 (post 5.7.1, pre 5.8). | 1 | From 0cad0c6c36af2a2d589563804c9ed2b37b7085fb Mon Sep 17 00:00:00 2001 |
| 2 | From: Li xin <lixin.fnst@cn.fujitsu.com> | ||
| 3 | Date: Fri, 21 Aug 2015 14:37:02 +0900 | ||
| 4 | Subject: [PATCH] ystemd support backported from the master branch as of | ||
| 5 | 23/04/2012 (post 5.7.1, pre 5.8). | ||
| 2 | 6 | ||
| 3 | The following commits have been cherry-picked: | 7 | The following commits have been cherry-picked: |
| 4 | 8 | ||
| @@ -15,15 +19,44 @@ bf108d7f1354f6276fc43c129963f2c49b9fc242 | |||
| 15 | Upstream-Status: Backport | 19 | Upstream-Status: Backport |
| 16 | 20 | ||
| 17 | Signed-off-by: Thomas Fitzsimmons <fitzsim@cisco.com> | 21 | Signed-off-by: Thomas Fitzsimmons <fitzsim@cisco.com> |
| 22 | --- | ||
| 23 | README.systemd | 41 +++ | ||
| 24 | agent/snmpd.c | 33 +- | ||
| 25 | apps/snmptrapd.c | 32 +- | ||
| 26 | configure.d/config_modules_lib | 8 + | ||
| 27 | configure.d/config_project_with_enable | 9 + | ||
| 28 | dist/snmpd.servic | 18 + | ||
| 29 | dist/snmpd.socket | 17 + | ||
| 30 | dist/snmptrapd.service | 16 + | ||
| 31 | dist/snmptrapd.socket | 14 + | ||
| 32 | include/net-snmp/library/sd-daemon.h | 290 ++++++++++++++++ | ||
| 33 | snmplib/sd-daemon.c | 532 +++++++++++++++++++++++++++++ | ||
| 34 | snmplib/transports/snmpTCPDomain.c | 43 ++- | ||
| 35 | snmplib/transports/snmpTCPIPv6Domain.c | 46 ++- | ||
| 36 | snmplib/transports/snmpUDPIPv4BaseDomain.c | 33 +- | ||
| 37 | snmplib/transports/snmpUDPIPv6Domain.c | 34 +- | ||
| 38 | snmplib/transports/snmpUnixDomain.c | 66 ++-- | ||
| 39 | win32/libsnmp/Makefile.in | 6 + | ||
| 40 | win32/net-snmp/net-snmp-config.h | 2 + | ||
| 41 | win32/net-snmp/net-snmp-config.h.in | 2 + | ||
| 42 | 19 files changed, 1176 insertions(+), 66 deletions(-) | ||
| 43 | create mode 100644 README.systemd | ||
| 44 | create mode 100644 dist/snmpd.servic | ||
| 45 | create mode 100644 dist/snmpd.socket | ||
| 46 | create mode 100644 dist/snmptrapd.service | ||
| 47 | create mode 100644 dist/snmptrapd.socket | ||
| 48 | create mode 100644 include/net-snmp/library/sd-daemon.h | ||
| 49 | create mode 100644 snmplib/sd-daemon.c | ||
| 50 | |||
| 18 | diff --git a/README.systemd b/README.systemd | 51 | diff --git a/README.systemd b/README.systemd |
| 19 | new file mode 100644 | 52 | new file mode 100644 |
| 20 | index 0000000..f731851 | 53 | index 0000000..dba15d1 |
| 21 | --- /dev/null | 54 | --- /dev/null |
| 22 | +++ b/README.systemd | 55 | +++ b/README.systemd |
| 23 | @@ -0,0 +1,41 @@ | 56 | @@ -0,0 +1,41 @@ |
| 24 | +README.systemd | 57 | +README.systemd |
| 25 | +-------------- | 58 | +-------------- |
| 26 | +Net-SNMP provides two daemons, which support systemd system manager. | 59 | +Net-SNMP provides two daemons, which support systemd system manager. |
| 27 | +See http://www.freedesktop.org/wiki/Software/systemd to learn how | 60 | +See http://www.freedesktop.org/wiki/Software/systemd to learn how |
| 28 | +systemd works. Both socket activation and notification is supported by these | 61 | +systemd works. Both socket activation and notification is supported by these |
| 29 | +daemons. | 62 | +daemons. |
| @@ -62,9 +95,8 @@ index 0000000..f731851 | |||
| 62 | +If integration with SNMP agent using AgentX protocol is enabled, snmptrapd should | 95 | +If integration with SNMP agent using AgentX protocol is enabled, snmptrapd should |
| 63 | +start during boot and not after first SNMP trap arrives. Same rules as for snmpd | 96 | +start during boot and not after first SNMP trap arrives. Same rules as for snmpd |
| 64 | +applies then. | 97 | +applies then. |
| 65 | \ No newline at end of file | ||
| 66 | diff --git a/agent/snmpd.c b/agent/snmpd.c | 98 | diff --git a/agent/snmpd.c b/agent/snmpd.c |
| 67 | index b177d5b..08bdfc7 100644 | 99 | index cfc7bce..116ee5c 100644 |
| 68 | --- a/agent/snmpd.c | 100 | --- a/agent/snmpd.c |
| 69 | +++ b/agent/snmpd.c | 101 | +++ b/agent/snmpd.c |
| 70 | @@ -164,6 +164,10 @@ typedef long fd_mask; | 102 | @@ -164,6 +164,10 @@ typedef long fd_mask; |
| @@ -78,7 +110,7 @@ index b177d5b..08bdfc7 100644 | |||
| 78 | netsnmp_feature_want(logging_file) | 110 | netsnmp_feature_want(logging_file) |
| 79 | netsnmp_feature_want(logging_stdio) | 111 | netsnmp_feature_want(logging_stdio) |
| 80 | netsnmp_feature_want(logging_syslog) | 112 | netsnmp_feature_want(logging_syslog) |
| 81 | @@ -441,18 +445,28 @@ main(int argc, char *argv[]) | 113 | @@ -443,19 +447,29 @@ main(int argc, char *argv[]) |
| 82 | int agent_mode = -1; | 114 | int agent_mode = -1; |
| 83 | char *pid_file = NULL; | 115 | char *pid_file = NULL; |
| 84 | char option_compatability[] = "-Le"; | 116 | char option_compatability[] = "-Le"; |
| @@ -102,14 +134,16 @@ index b177d5b..08bdfc7 100644 | |||
| 102 | */ | 134 | */ |
| 103 | - for (i = getdtablesize() - 1; i > 2; --i) { | 135 | - for (i = getdtablesize() - 1; i > 2; --i) { |
| 104 | - (void) close(i); | 136 | - (void) close(i); |
| 137 | - } | ||
| 105 | + if (!prepared_sockets) { | 138 | + if (!prepared_sockets) { |
| 106 | + for (i = getdtablesize() - 1; i > 2; --i) { | 139 | + for (i = getdtablesize() - 1; i > 2; --i) { |
| 107 | + (void) close(i); | 140 | + (void) close(i); |
| 108 | + } | 141 | + } |
| 109 | } | 142 | +} |
| 110 | #endif /* #WIN32 */ | 143 | #endif /* #WIN32 */ |
| 111 | 144 | ||
| 112 | @@ -1100,6 +1114,19 @@ main(int argc, char *argv[]) | 145 | /* |
| 146 | @@ -1107,6 +1121,19 @@ main(int argc, char *argv[]) | ||
| 113 | netsnmp_addrcache_initialise(); | 147 | netsnmp_addrcache_initialise(); |
| 114 | 148 | ||
| 115 | /* | 149 | /* |
| @@ -130,7 +164,7 @@ index b177d5b..08bdfc7 100644 | |||
| 130 | */ | 164 | */ |
| 131 | DEBUGMSGTL(("snmpd/main", "We're up. Starting to process data.\n")); | 165 | DEBUGMSGTL(("snmpd/main", "We're up. Starting to process data.\n")); |
| 132 | diff --git a/apps/snmptrapd.c b/apps/snmptrapd.c | 166 | diff --git a/apps/snmptrapd.c b/apps/snmptrapd.c |
| 133 | index 1a52080..0857ae1 100644 | 167 | index bce0d47..c6a74ec 100644 |
| 134 | --- a/apps/snmptrapd.c | 168 | --- a/apps/snmptrapd.c |
| 135 | +++ b/apps/snmptrapd.c | 169 | +++ b/apps/snmptrapd.c |
| 136 | @@ -125,6 +125,10 @@ SOFTWARE. | 170 | @@ -125,6 +125,10 @@ SOFTWARE. |
| @@ -144,7 +178,7 @@ index 1a52080..0857ae1 100644 | |||
| 144 | #ifndef BSD4_3 | 178 | #ifndef BSD4_3 |
| 145 | #define BSD4_2 | 179 | #define BSD4_2 |
| 146 | #endif | 180 | #endif |
| 147 | @@ -655,15 +659,24 @@ main(int argc, char *argv[]) | 181 | @@ -657,16 +661,25 @@ main(int argc, char *argv[]) |
| 148 | int agentx_subagent = 1; | 182 | int agentx_subagent = 1; |
| 149 | #endif | 183 | #endif |
| 150 | netsnmp_trapd_handler *traph; | 184 | netsnmp_trapd_handler *traph; |
| @@ -164,14 +198,16 @@ index 1a52080..0857ae1 100644 | |||
| 164 | */ | 198 | */ |
| 165 | - for (i = getdtablesize() - 1; i > 2; --i) { | 199 | - for (i = getdtablesize() - 1; i > 2; --i) { |
| 166 | - (void) close(i); | 200 | - (void) close(i); |
| 201 | - } | ||
| 167 | + if (!prepared_sockets) { | 202 | + if (!prepared_sockets) { |
| 168 | + for (i = getdtablesize() - 1; i > 2; --i) { | 203 | + for (i = getdtablesize() - 1; i > 2; --i) { |
| 169 | + (void) close(i); | 204 | + (void) close(i); |
| 170 | + } | 205 | + } |
| 171 | } | 206 | +} |
| 172 | #endif /* #WIN32 */ | 207 | #endif /* #WIN32 */ |
| 173 | 208 | ||
| 174 | @@ -1311,6 +1324,19 @@ main(int argc, char *argv[]) | 209 | #ifdef SIGTERM |
| 210 | @@ -1318,6 +1331,19 @@ main(int argc, char *argv[]) | ||
| 175 | #endif | 211 | #endif |
| 176 | #endif | 212 | #endif |
| 177 | 213 | ||
| @@ -192,7 +228,7 @@ index 1a52080..0857ae1 100644 | |||
| 192 | trapd_status = SNMPTRAPD_RUNNING; | 228 | trapd_status = SNMPTRAPD_RUNNING; |
| 193 | #endif | 229 | #endif |
| 194 | diff --git a/configure.d/config_modules_lib b/configure.d/config_modules_lib | 230 | diff --git a/configure.d/config_modules_lib b/configure.d/config_modules_lib |
| 195 | index b6609c1..5849072 100644 | 231 | index 362ba0a..bb69daa 100644 |
| 196 | --- a/configure.d/config_modules_lib | 232 | --- a/configure.d/config_modules_lib |
| 197 | +++ b/configure.d/config_modules_lib | 233 | +++ b/configure.d/config_modules_lib |
| 198 | @@ -53,6 +53,14 @@ if test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc" | 234 | @@ -53,6 +53,14 @@ if test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc" |
| @@ -211,10 +247,10 @@ index b6609c1..5849072 100644 | |||
| 211 | AC_SUBST(other_objs_list) | 247 | AC_SUBST(other_objs_list) |
| 212 | AC_SUBST(other_lobjs_list) | 248 | AC_SUBST(other_lobjs_list) |
| 213 | diff --git a/configure.d/config_project_with_enable b/configure.d/config_project_with_enable | 249 | diff --git a/configure.d/config_project_with_enable b/configure.d/config_project_with_enable |
| 214 | index 8b46ad2..59d6d5c 100644 | 250 | index 61ba026..d782d12 100644 |
| 215 | --- a/configure.d/config_project_with_enable | 251 | --- a/configure.d/config_project_with_enable |
| 216 | +++ b/configure.d/config_project_with_enable | 252 | +++ b/configure.d/config_project_with_enable |
| 217 | @@ -689,6 +689,15 @@ if test "x$with_dummy_values" != "xyes"; then | 253 | @@ -690,6 +690,15 @@ if test "x$with_dummy_values" != "xyes"; then |
| 218 | data for]) | 254 | data for]) |
| 219 | fi | 255 | fi |
| 220 | 256 | ||
| @@ -230,11 +266,11 @@ index 8b46ad2..59d6d5c 100644 | |||
| 230 | NETSNMP_ARG_ENABLE(set-support, | 266 | NETSNMP_ARG_ENABLE(set-support, |
| 231 | [ --disable-set-support Do not allow SNMP set requests.]) | 267 | [ --disable-set-support Do not allow SNMP set requests.]) |
| 232 | if test "x$enable_set_support" = "xno"; then | 268 | if test "x$enable_set_support" = "xno"; then |
| 233 | diff --git a/dist/snmpd.service b/dist/snmpd.service | 269 | diff --git a/dist/snmpd.servic b/dist/snmpd.servic |
| 234 | new file mode 100644 | 270 | new file mode 100644 |
| 235 | index 0000000..31391e5 | 271 | index 0000000..31391e5 |
| 236 | --- /dev/null | 272 | --- /dev/null |
| 237 | +++ b/dist/snmpd.service | 273 | +++ b/dist/snmpd.servic |
| 238 | @@ -0,0 +1,18 @@ | 274 | @@ -0,0 +1,18 @@ |
| 239 | +# | 275 | +# |
| 240 | +# SNMP agent service file for systemd | 276 | +# SNMP agent service file for systemd |
| @@ -301,24 +337,24 @@ index 0000000..e88a5b4 | |||
| 301 | +WantedBy=multi-user.target | 337 | +WantedBy=multi-user.target |
| 302 | diff --git a/dist/snmptrapd.socket b/dist/snmptrapd.socket | 338 | diff --git a/dist/snmptrapd.socket b/dist/snmptrapd.socket |
| 303 | new file mode 100644 | 339 | new file mode 100644 |
| 304 | index 0000000..0fc8a7c | 340 | index 0000000..2d24fb8 |
| 305 | --- /dev/null | 341 | --- /dev/null |
| 306 | +++ b/dist/snmptrapd.socket | 342 | +++ b/dist/snmptrapd.socket |
| 307 | @@ -0,0 +1,14 @@ | 343 | @@ -0,0 +1,14 @@ |
| 308 | +[Unit] | 344 | ++[Unit] |
| 309 | +Description=Socket listening for SNMP trap messages | 345 | ++Description=Socket listening for SNMP trap messages |
| 310 | + | 346 | ++ |
| 311 | +[Socket] | 347 | ++[Socket] |
| 312 | +ListenDatagram=0.0.0.0:162 | 348 | ++ListenDatagram=0.0.0.0:162 |
| 313 | +# Uncomment other listening addresses as needed - TCP, UDP6, TCP6. | 349 | ++# Uncomment other listening addresses as needed - TCP, UDP6, TCP6. |
| 314 | +# It must match listening addresses/ports defined in snmptrapd.service | 350 | ++# It must match listening addresses/ports defined in snmptrapd.service |
| 315 | +# or snmptrapd.conf. | 351 | ++# or snmptrapd.conf. |
| 316 | +# ListenStream=0.0.0.0:162 | 352 | ++# ListenStream=0.0.0.0:162 |
| 317 | +# ListenDatagram=[::]:162 | 353 | ++# ListenDatagram=[::]:162 |
| 318 | +# ListenStream=[::]:162 | 354 | ++# ListenStream=[::]:162 |
| 319 | + | 355 | ++ |
| 320 | +[Install] | 356 | ++[Install] |
| 321 | +WantedBy=sockets.target | 357 | ++WantedBy=sockets.target |
| 322 | diff --git a/include/net-snmp/library/sd-daemon.h b/include/net-snmp/library/sd-daemon.h | 358 | diff --git a/include/net-snmp/library/sd-daemon.h b/include/net-snmp/library/sd-daemon.h |
| 323 | new file mode 100644 | 359 | new file mode 100644 |
| 324 | index 0000000..85274c9 | 360 | index 0000000..85274c9 |
| @@ -1154,7 +1190,7 @@ index 0000000..42dba29 | |||
| 1154 | + | 1190 | + |
| 1155 | +#endif /* ! NETSNMP_NO_SYSTEMD */ | 1191 | +#endif /* ! NETSNMP_NO_SYSTEMD */ |
| 1156 | diff --git a/snmplib/transports/snmpTCPDomain.c b/snmplib/transports/snmpTCPDomain.c | 1192 | diff --git a/snmplib/transports/snmpTCPDomain.c b/snmplib/transports/snmpTCPDomain.c |
| 1157 | index b8bdba4..ab7f3a1 100644 | 1193 | index 7feb028..a41b926 100644 |
| 1158 | --- a/snmplib/transports/snmpTCPDomain.c | 1194 | --- a/snmplib/transports/snmpTCPDomain.c |
| 1159 | +++ b/snmplib/transports/snmpTCPDomain.c | 1195 | +++ b/snmplib/transports/snmpTCPDomain.c |
| 1160 | @@ -43,6 +43,10 @@ | 1196 | @@ -43,6 +43,10 @@ |
| @@ -1216,11 +1252,10 @@ index b8bdba4..ab7f3a1 100644 | |||
| 1216 | } | 1252 | } |
| 1217 | 1253 | ||
| 1218 | /* | 1254 | /* |
| 1219 | @@ -235,12 +254,13 @@ netsnmp_tcp_transport(struct sockaddr_in *addr, int local) | 1255 | @@ -236,11 +255,13 @@ netsnmp_tcp_transport(struct sockaddr_in *addr, int local) |
| 1220 | /* | ||
| 1221 | * Now sit here and wait for connections to arrive. | 1256 | * Now sit here and wait for connections to arrive. |
| 1222 | */ | 1257 | */ |
| 1223 | - | 1258 | |
| 1224 | - rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN); | 1259 | - rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN); |
| 1225 | - if (rc != 0) { | 1260 | - if (rc != 0) { |
| 1226 | - netsnmp_socketbase_close(t); | 1261 | - netsnmp_socketbase_close(t); |
| @@ -1237,7 +1272,7 @@ index b8bdba4..ab7f3a1 100644 | |||
| 1237 | 1272 | ||
| 1238 | /* | 1273 | /* |
| 1239 | diff --git a/snmplib/transports/snmpTCPIPv6Domain.c b/snmplib/transports/snmpTCPIPv6Domain.c | 1274 | diff --git a/snmplib/transports/snmpTCPIPv6Domain.c b/snmplib/transports/snmpTCPIPv6Domain.c |
| 1240 | index 3c96856..305a861 100644 | 1275 | index d2e0a2d..22de6d4 100644 |
| 1241 | --- a/snmplib/transports/snmpTCPIPv6Domain.c | 1276 | --- a/snmplib/transports/snmpTCPIPv6Domain.c |
| 1242 | +++ b/snmplib/transports/snmpTCPIPv6Domain.c | 1277 | +++ b/snmplib/transports/snmpTCPIPv6Domain.c |
| 1243 | @@ -49,6 +49,10 @@ | 1278 | @@ -49,6 +49,10 @@ |
| @@ -1322,7 +1357,7 @@ index 3c96856..305a861 100644 | |||
| 1322 | 1357 | ||
| 1323 | /* | 1358 | /* |
| 1324 | diff --git a/snmplib/transports/snmpUDPIPv4BaseDomain.c b/snmplib/transports/snmpUDPIPv4BaseDomain.c | 1359 | diff --git a/snmplib/transports/snmpUDPIPv4BaseDomain.c b/snmplib/transports/snmpUDPIPv4BaseDomain.c |
| 1325 | index c67427b..428e6d6 100644 | 1360 | index 8c0fb05..00e5bbc 100644 |
| 1326 | --- a/snmplib/transports/snmpUDPIPv4BaseDomain.c | 1361 | --- a/snmplib/transports/snmpUDPIPv4BaseDomain.c |
| 1327 | +++ b/snmplib/transports/snmpUDPIPv4BaseDomain.c | 1362 | +++ b/snmplib/transports/snmpUDPIPv4BaseDomain.c |
| 1328 | @@ -40,6 +40,10 @@ | 1363 | @@ -40,6 +40,10 @@ |
| @@ -1333,10 +1368,10 @@ index c67427b..428e6d6 100644 | |||
| 1333 | +#include <net-snmp/library/sd-daemon.h> | 1368 | +#include <net-snmp/library/sd-daemon.h> |
| 1334 | +#endif | 1369 | +#endif |
| 1335 | + | 1370 | + |
| 1336 | #if (defined(linux) && defined(IP_PKTINFO)) \ | 1371 | #if defined(HAVE_IP_PKTINFO) || defined(HAVE_IP_RECVDSTADDR) |
| 1337 | || defined(IP_RECVDSTADDR) && HAVE_STRUCT_MSGHDR_MSG_CONTROL \ | 1372 | int netsnmp_udpipv4_recvfrom(int s, void *buf, int len, struct sockaddr *from, |
| 1338 | && HAVE_STRUCT_MSGHDR_MSG_FLAGS | 1373 | socklen_t *fromlen, struct sockaddr *dstip, |
| 1339 | @@ -67,6 +71,7 @@ netsnmp_udpipv4base_transport(struct sockaddr_in *addr, int local) | 1374 | @@ -64,6 +68,7 @@ netsnmp_udpipv4base_transport(struct sockaddr_in *addr, int local) |
| 1340 | char *client_socket = NULL; | 1375 | char *client_socket = NULL; |
| 1341 | netsnmp_indexed_addr_pair addr_pair; | 1376 | netsnmp_indexed_addr_pair addr_pair; |
| 1342 | socklen_t local_addr_len; | 1377 | socklen_t local_addr_len; |
| @@ -1344,7 +1379,7 @@ index c67427b..428e6d6 100644 | |||
| 1344 | 1379 | ||
| 1345 | #ifdef NETSNMP_NO_LISTEN_SUPPORT | 1380 | #ifdef NETSNMP_NO_LISTEN_SUPPORT |
| 1346 | if (local) | 1381 | if (local) |
| 1347 | @@ -91,7 +96,19 @@ netsnmp_udpipv4base_transport(struct sockaddr_in *addr, int local) | 1382 | @@ -88,7 +93,19 @@ netsnmp_udpipv4base_transport(struct sockaddr_in *addr, int local) |
| 1348 | free(str); | 1383 | free(str); |
| 1349 | } | 1384 | } |
| 1350 | 1385 | ||
| @@ -1365,10 +1400,10 @@ index c67427b..428e6d6 100644 | |||
| 1365 | DEBUGMSGTL(("UDPBase", "openned socket %d as local=%d\n", t->sock, local)); | 1400 | DEBUGMSGTL(("UDPBase", "openned socket %d as local=%d\n", t->sock, local)); |
| 1366 | if (t->sock < 0) { | 1401 | if (t->sock < 0) { |
| 1367 | netsnmp_transport_free(t); | 1402 | netsnmp_transport_free(t); |
| 1368 | @@ -141,12 +158,14 @@ netsnmp_udpipv4base_transport(struct sockaddr_in *addr, int local) | 1403 | @@ -151,12 +168,14 @@ netsnmp_udpipv4base_transport(struct sockaddr_in *addr, int local) |
| 1369 | DEBUGMSGTL(("netsnmp_udp", "set IP_RECVDSTADDR\n")); | 1404 | } |
| 1370 | } | 1405 | } |
| 1371 | #endif | 1406 | #endif /* !defined(WIN32) */ |
| 1372 | - rc = bind(t->sock, (struct sockaddr *) addr, | 1407 | - rc = bind(t->sock, (struct sockaddr *) addr, |
| 1373 | - sizeof(struct sockaddr)); | 1408 | - sizeof(struct sockaddr)); |
| 1374 | - if (rc != 0) { | 1409 | - if (rc != 0) { |
| @@ -1387,7 +1422,7 @@ index c67427b..428e6d6 100644 | |||
| 1387 | t->data = NULL; | 1422 | t->data = NULL; |
| 1388 | t->data_length = 0; | 1423 | t->data_length = 0; |
| 1389 | diff --git a/snmplib/transports/snmpUDPIPv6Domain.c b/snmplib/transports/snmpUDPIPv6Domain.c | 1424 | diff --git a/snmplib/transports/snmpUDPIPv6Domain.c b/snmplib/transports/snmpUDPIPv6Domain.c |
| 1390 | index b3eaae4..35b617f 100644 | 1425 | index 18de876..fd2ced4 100644 |
| 1391 | --- a/snmplib/transports/snmpUDPIPv6Domain.c | 1426 | --- a/snmplib/transports/snmpUDPIPv6Domain.c |
| 1392 | +++ b/snmplib/transports/snmpUDPIPv6Domain.c | 1427 | +++ b/snmplib/transports/snmpUDPIPv6Domain.c |
| 1393 | @@ -67,6 +67,10 @@ static const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT; | 1428 | @@ -67,6 +67,10 @@ static const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT; |
| @@ -1431,11 +1466,10 @@ index b3eaae4..35b617f 100644 | |||
| 1431 | if (t->sock < 0) { | 1466 | if (t->sock < 0) { |
| 1432 | netsnmp_transport_free(t); | 1467 | netsnmp_transport_free(t); |
| 1433 | return NULL; | 1468 | return NULL; |
| 1434 | @@ -242,13 +260,14 @@ netsnmp_udp6_transport(struct sockaddr_in6 *addr, int local) | 1469 | @@ -243,12 +261,14 @@ netsnmp_udp6_transport(struct sockaddr_in6 *addr, int local) |
| 1435 | } | 1470 | } |
| 1436 | } | ||
| 1437 | #endif | 1471 | #endif |
| 1438 | - | 1472 | |
| 1439 | - rc = bind(t->sock, (struct sockaddr *) addr, | 1473 | - rc = bind(t->sock, (struct sockaddr *) addr, |
| 1440 | - sizeof(struct sockaddr_in6)); | 1474 | - sizeof(struct sockaddr_in6)); |
| 1441 | - if (rc != 0) { | 1475 | - if (rc != 0) { |
| @@ -1454,7 +1488,7 @@ index b3eaae4..35b617f 100644 | |||
| 1454 | t->local = (unsigned char*)malloc(18); | 1488 | t->local = (unsigned char*)malloc(18); |
| 1455 | if (t->local == NULL) { | 1489 | if (t->local == NULL) { |
| 1456 | diff --git a/snmplib/transports/snmpUnixDomain.c b/snmplib/transports/snmpUnixDomain.c | 1490 | diff --git a/snmplib/transports/snmpUnixDomain.c b/snmplib/transports/snmpUnixDomain.c |
| 1457 | index 674dc2b..9f3d3cb 100644 | 1491 | index 47dffc1..8f34c37 100644 |
| 1458 | --- a/snmplib/transports/snmpUnixDomain.c | 1492 | --- a/snmplib/transports/snmpUnixDomain.c |
| 1459 | +++ b/snmplib/transports/snmpUnixDomain.c | 1493 | +++ b/snmplib/transports/snmpUnixDomain.c |
| 1460 | @@ -37,6 +37,10 @@ | 1494 | @@ -37,6 +37,10 @@ |
| @@ -1538,7 +1572,7 @@ index 674dc2b..9f3d3cb 100644 | |||
| 1538 | } | 1572 | } |
| 1539 | 1573 | ||
| 1540 | /* | 1574 | /* |
| 1541 | @@ -391,16 +409,17 @@ netsnmp_unix_transport(struct sockaddr_un *addr, int local) | 1575 | @@ -391,14 +409,16 @@ netsnmp_unix_transport(struct sockaddr_un *addr, int local) |
| 1542 | * Now sit here and listen for connections to arrive. | 1576 | * Now sit here and listen for connections to arrive. |
| 1543 | */ | 1577 | */ |
| 1544 | 1578 | ||
| @@ -1561,53 +1595,50 @@ index 674dc2b..9f3d3cb 100644 | |||
| 1561 | + return NULL; | 1595 | + return NULL; |
| 1562 | + } | 1596 | + } |
| 1563 | } | 1597 | } |
| 1564 | - | 1598 | |
| 1565 | } else { | 1599 | } else { |
| 1566 | t->remote = (u_char *)malloc(strlen(addr->sun_path)); | ||
| 1567 | if (t->remote == NULL) { | ||
| 1568 | diff --git a/win32/libsnmp/Makefile.in b/win32/libsnmp/Makefile.in | 1600 | diff --git a/win32/libsnmp/Makefile.in b/win32/libsnmp/Makefile.in |
| 1569 | index 98d83c8..dd5689b 100644 | 1601 | index 98d83c8..b228d20 100644 |
| 1570 | --- a/win32/libsnmp/Makefile.in | 1602 | --- a/win32/libsnmp/Makefile.in |
| 1571 | +++ b/win32/libsnmp/Makefile.in | 1603 | +++ b/win32/libsnmp/Makefile.in |
| 1572 | @@ -42,6 +42,7 @@ LIB32_OBJS= \ | 1604 | @@ -42,6 +42,7 @@ LIB32_OBJS= \ |
| 1573 | "$(INTDIR)\read_config.obj" \ | 1605 | "$(INTDIR)\read_config.obj" \ |
| 1574 | "$(INTDIR)\readdir.obj" \ | 1606 | "$(INTDIR)\readdir.obj" \ |
| 1575 | "$(INTDIR)\scapi.obj" \ | 1607 | "$(INTDIR)\scapi.obj" \ |
| 1576 | + "$(INTDIR)\sd-daemon.obj" \ | 1608 | + "$(INTDIR)\sd-daemon.obj" \ |
| 1577 | "$(INTDIR)\snmp-tc.obj" \ | 1609 | "$(INTDIR)\snmp-tc.obj" \ |
| 1578 | "$(INTDIR)\snmp.obj" \ | 1610 | "$(INTDIR)\snmp.obj" \ |
| 1579 | "$(INTDIR)\snmpCallbackDomain.obj" \ | 1611 | "$(INTDIR)\snmpCallbackDomain.obj" \ |
| 1580 | @@ -307,6 +308,12 @@ SOURCE=..\..\snmplib\scapi.c | 1612 | @@ -138,6 +139,11 @@ SOURCE=..\..\snmplib\asn1.c |
| 1613 | "$(INTDIR)\asn1.obj" : $(SOURCE) "$(INTDIR)" | ||
| 1581 | $(CPP) $(CPP_PROJ) $(SOURCE) | 1614 | $(CPP) $(CPP_PROJ) $(SOURCE) |
| 1582 | 1615 | ||
| 1583 | |||
| 1584 | +SOURCE=..\..\snmplib\sd-daemon.c | 1616 | +SOURCE=..\..\snmplib\sd-daemon.c |
| 1585 | + | 1617 | + |
| 1586 | +"$(INTDIR)\sd-daemon.obj" : $(SOURCE) "$(INTDIR)" | 1618 | +"$(INTDIR)\sd-daemon.obj" : $(SOURCE) "$(INTDIR)" |
| 1587 | + $(CPP) $(CPP_PROJ) $(SOURCE) | 1619 | + $(CPP) $(CPP_PROJ) $(SOURCE) |
| 1588 | + | 1620 | + |
| 1589 | + | ||
| 1590 | SOURCE="..\..\snmplib\snmp-tc.c" | ||
| 1591 | 1621 | ||
| 1592 | "$(INTDIR)\snmp-tc.obj" : $(SOURCE) "$(INTDIR)" | 1622 | SOURCE=..\..\snmplib\callback.c |
| 1623 | |||
| 1593 | diff --git a/win32/net-snmp/net-snmp-config.h b/win32/net-snmp/net-snmp-config.h | 1624 | diff --git a/win32/net-snmp/net-snmp-config.h b/win32/net-snmp/net-snmp-config.h |
| 1594 | index 7791ee0..1eccf42 100644 | 1625 | index 1608563..7aec547 100644 |
| 1595 | --- a/win32/net-snmp/net-snmp-config.h | 1626 | --- a/win32/net-snmp/net-snmp-config.h |
| 1596 | +++ b/win32/net-snmp/net-snmp-config.h | 1627 | +++ b/win32/net-snmp/net-snmp-config.h |
| 1597 | @@ -1705,6 +1705,8 @@ enum { | 1628 | @@ -1717,6 +1717,8 @@ enum { |
| 1598 | #define DMALLOC_FUNC_CHECK | 1629 | #define DMALLOC_FUNC_CHECK |
| 1599 | #endif | 1630 | #endif |
| 1600 | 1631 | ||
| 1601 | +#define NETSNMP_NO_SYSTEMD | 1632 | ++#define NETSNMP_NO_SYSTEMD |
| 1602 | + | 1633 | ++ |
| 1603 | /* #undef NETSNMP_ENABLE_LOCAL_SMUX */ | 1634 | /* #undef NETSNMP_ENABLE_LOCAL_SMUX */ |
| 1604 | 1635 | ||
| 1605 | /* define if agentx transport is to use domain sockets only */ | 1636 | /* define if agentx transport is to use domain sockets only */ |
| 1606 | diff --git a/win32/net-snmp/net-snmp-config.h.in b/win32/net-snmp/net-snmp-config.h.in | 1637 | diff --git a/win32/net-snmp/net-snmp-config.h.in b/win32/net-snmp/net-snmp-config.h.in |
| 1607 | index 5215865..1607bfa 100644 | 1638 | index 9693730..96ec3d9 100644 |
| 1608 | --- a/win32/net-snmp/net-snmp-config.h.in | 1639 | --- a/win32/net-snmp/net-snmp-config.h.in |
| 1609 | +++ b/win32/net-snmp/net-snmp-config.h.in | 1640 | +++ b/win32/net-snmp/net-snmp-config.h.in |
| 1610 | @@ -1705,6 +1705,8 @@ enum { | 1641 | @@ -1717,6 +1717,8 @@ enum { |
| 1611 | #define DMALLOC_FUNC_CHECK | 1642 | #define DMALLOC_FUNC_CHECK |
| 1612 | #endif | 1643 | #endif |
| 1613 | 1644 | ||
| @@ -1616,3 +1647,6 @@ index 5215865..1607bfa 100644 | |||
| 1616 | /* #undef NETSNMP_ENABLE_LOCAL_SMUX */ | 1647 | /* #undef NETSNMP_ENABLE_LOCAL_SMUX */ |
| 1617 | 1648 | ||
| 1618 | /* define if agentx transport is to use domain sockets only */ | 1649 | /* define if agentx transport is to use domain sockets only */ |
| 1650 | -- | ||
| 1651 | 1.8.4.2 | ||
| 1652 | |||
diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.2.1.bb b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb index 464473e2ab..431a6330f5 100644 --- a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.2.1.bb +++ b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb | |||
| @@ -8,27 +8,23 @@ LIC_FILES_CHKSUM = "file://README;beginline=3;endline=8;md5=7f7f00ba639ac8e8deb5 | |||
| 8 | DEPENDS = "openssl libnl pciutils" | 8 | DEPENDS = "openssl libnl pciutils" |
| 9 | 9 | ||
| 10 | SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.zip \ | 10 | SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.zip \ |
| 11 | file://0001-Added-checks-for-printing-variables-with-wrong-types.patch \ | ||
| 12 | file://init \ | 11 | file://init \ |
| 13 | file://snmpd.conf \ | 12 | file://snmpd.conf \ |
| 14 | file://snmptrapd.conf \ | 13 | file://snmptrapd.conf \ |
| 15 | file://systemd-support.patch \ | 14 | file://systemd-support.patch \ |
| 16 | file://snmpd.service \ | 15 | file://snmpd.service \ |
| 17 | file://snmptrapd.service \ | 16 | file://snmptrapd.service \ |
| 18 | file://ifmib.patch \ | ||
| 19 | file://net-snmp-add-knob-whether-nlist.h-are-checked.patch \ | 17 | file://net-snmp-add-knob-whether-nlist.h-are-checked.patch \ |
| 20 | file://fix-libtool-finish.patch \ | 18 | file://fix-libtool-finish.patch \ |
| 21 | file://net-snmp-testing-add-the-output-format-for-ptest.patch \ | 19 | file://net-snmp-testing-add-the-output-format-for-ptest.patch \ |
| 22 | file://run-ptest \ | 20 | file://run-ptest \ |
| 23 | file://0001-Fix-CVE-2014-2285.patch \ | ||
| 24 | file://dont-return-incompletely-parsed-varbinds.patch \ | 21 | file://dont-return-incompletely-parsed-varbinds.patch \ |
| 25 | file://net-snmp-5.7.2-fix-mib-timeout-values.patch \ | 22 | file://0001-config_os_headers-Error-Fix.patch \ |
| 26 | " | 23 | " |
| 24 | SRC_URI[md5sum] = "9f682bd70c717efdd9f15b686d07baee" | ||
| 25 | SRC_URI[sha256sum] = "e8dfc79b6539b71a6ff335746ce63d2da2239062ad41872fff4354cafed07a3e" | ||
| 27 | 26 | ||
| 28 | SRC_URI[md5sum] = "a2c83518648b0f2a5d378625e45c0e18" | 27 | inherit autotools update-rc.d siteinfo systemd pkgconfig |
| 29 | SRC_URI[sha256sum] = "ac9105539971f7cfb1456a86d479e18e8a8b3712212595ad40504347ba5843da" | ||
| 30 | |||
| 31 | inherit autotools update-rc.d siteinfo systemd | ||
| 32 | 28 | ||
| 33 | EXTRA_OEMAKE = "INSTALL_PREFIX=${D}" | 29 | EXTRA_OEMAKE = "INSTALL_PREFIX=${D}" |
| 34 | 30 | ||
