[SNMP] fix issue #1874, ERR snmpd[34]: Error allocating more space for arpcache. Cache will continue to be limited to 4096 entries (#1989)
This commit is contained in:
parent
2cce4aec1c
commit
4715dbb796
@ -23,7 +23,14 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
|
||||
dpkg-source -x net-snmp_$(SNMPD_VERSION_FULL).dsc
|
||||
|
||||
pushd net-snmp-$(SNMPD_VERSION)
|
||||
patch -p0 < ../statfs_error.patch
|
||||
git init
|
||||
git add -f *
|
||||
git commit -m "unmodified snmpd source"
|
||||
|
||||
# Apply patches
|
||||
stg init
|
||||
stg import -s ../patch-$(SNMPD_VERSION)/series
|
||||
|
||||
fakeroot debian/rules -j$(SONIC_CONFIG_MAKE_JOBS) binary
|
||||
popd
|
||||
|
||||
|
@ -0,0 +1,40 @@
|
||||
From a1edbce39e46b5c8bd5bd7db17fc11fa30e7dd73 Mon Sep 17 00:00:00 2001
|
||||
From: pavel-shirshov <pavelsh@microsoft.com>
|
||||
Date: Mon, 27 Aug 2018 16:50:16 +0800
|
||||
Subject: [PATCH] [SNMP] Stop spamming logs with statfs permission denied log
|
||||
message #1668
|
||||
|
||||
---
|
||||
agent/mibgroup/hardware/fsys/fsys_mntctl.c | 2 --
|
||||
agent/mibgroup/hardware/fsys/fsys_mntent.c | 2 --
|
||||
2 files changed, 4 deletions(-)
|
||||
|
||||
diff --git a/agent/mibgroup/hardware/fsys/fsys_mntctl.c b/agent/mibgroup/hardware/fsys/fsys_mntctl.c
|
||||
index 9fbb068..adc38d6 100644
|
||||
--- a/agent/mibgroup/hardware/fsys/fsys_mntctl.c
|
||||
+++ b/agent/mibgroup/hardware/fsys/fsys_mntctl.c
|
||||
@@ -163,8 +163,6 @@ netsnmp_fsys_arch_load( void )
|
||||
continue;
|
||||
|
||||
if ( statfs( entry->path, &stat_buf ) < 0 ) {
|
||||
- snprintf( tmpbuf, sizeof(tmpbuf), "Cannot statfs %s", entry->path );
|
||||
- snmp_log_perror( tmpbuf );
|
||||
continue;
|
||||
}
|
||||
entry->units = stat_buf.f_bsize;
|
||||
diff --git a/agent/mibgroup/hardware/fsys/fsys_mntent.c b/agent/mibgroup/hardware/fsys/fsys_mntent.c
|
||||
index 94d23db..5ad5e43 100644
|
||||
--- a/agent/mibgroup/hardware/fsys/fsys_mntent.c
|
||||
+++ b/agent/mibgroup/hardware/fsys/fsys_mntent.c
|
||||
@@ -238,8 +238,6 @@ netsnmp_fsys_arch_load( void )
|
||||
if ( NSFS_STATFS( entry->path, &stat_buf ) < 0 )
|
||||
#endif
|
||||
{
|
||||
- snprintf( tmpbuf, sizeof(tmpbuf), "Cannot statfs %s", entry->path );
|
||||
- snmp_log_perror( tmpbuf );
|
||||
continue;
|
||||
}
|
||||
entry->units = stat_buf.NSFS_SIZE;
|
||||
--
|
||||
2.7.4
|
||||
|
@ -0,0 +1,31 @@
|
||||
From e370973f273ffc1b32673bc94c5a46f75a846d82 Mon Sep 17 00:00:00 2001
|
||||
From: Niels Baggesen <nba@users.sourceforge.net>
|
||||
Date: Wed, 31 Aug 2016 21:43:36 +0200
|
||||
Subject: [PATCH] at.c: properly check return status from realloc. Thanks to
|
||||
Daniel Eiland (bug 2678)
|
||||
|
||||
---
|
||||
agent/mibgroup/mibII/at.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/agent/mibgroup/mibII/at.c b/agent/mibgroup/mibII/at.c
|
||||
index f57ba2a..a73fb8c 100644
|
||||
--- a/agent/mibgroup/mibII/at.c
|
||||
+++ b/agent/mibgroup/mibII/at.c
|
||||
@@ -638,11 +638,12 @@ ARP_Scan_Init(void)
|
||||
struct arptab *newtab = (struct arptab *)
|
||||
realloc(at, (sizeof(struct arptab) *
|
||||
(arptab_curr_max_size + ARP_CACHE_INCR)));
|
||||
- if (newtab == at) {
|
||||
+ if (newtab == NULL) {
|
||||
snmp_log(LOG_ERR,
|
||||
"Error allocating more space for arpcache. "
|
||||
"Cache will continue to be limited to %d entries",
|
||||
arptab_curr_max_size);
|
||||
+ newtab = at;
|
||||
break;
|
||||
} else {
|
||||
arptab_curr_max_size += ARP_CACHE_INCR;
|
||||
--
|
||||
2.7.4
|
||||
|
2
src/snmpd/patch-5.7.3+dfsg/series
Normal file
2
src/snmpd/patch-5.7.3+dfsg/series
Normal file
@ -0,0 +1,2 @@
|
||||
0001-SNMP-Stop-spamming-logs-with-statfs-permission-denie.patch
|
||||
0002-at.c-properly-check-return-status-from-realloc.-Than.patch
|
@ -1,22 +0,0 @@
|
||||
--- agent/mibgroup/hardware/fsys/fsys_mntctl.c.old 2018-04-30 23:26:58.097636453 +0000
|
||||
+++ agent/mibgroup/hardware/fsys/fsys_mntctl.c 2018-04-30 23:27:36.189499479 +0000
|
||||
@@ -163,8 +163,6 @@
|
||||
continue;
|
||||
|
||||
if ( statfs( entry->path, &stat_buf ) < 0 ) {
|
||||
- snprintf( tmpbuf, sizeof(tmpbuf), "Cannot statfs %s", entry->path );
|
||||
- snmp_log_perror( tmpbuf );
|
||||
continue;
|
||||
}
|
||||
entry->units = stat_buf.f_bsize;
|
||||
--- agent/mibgroup/hardware/fsys/fsys_mntent.c.old 2018-04-30 23:26:54.569649140 +0000
|
||||
+++ agent/mibgroup/hardware/fsys/fsys_mntent.c 2018-04-30 23:27:22.001550497 +0000
|
||||
@@ -238,8 +238,6 @@
|
||||
if ( NSFS_STATFS( entry->path, &stat_buf ) < 0 )
|
||||
#endif
|
||||
{
|
||||
- snprintf( tmpbuf, sizeof(tmpbuf), "Cannot statfs %s", entry->path );
|
||||
- snmp_log_perror( tmpbuf );
|
||||
continue;
|
||||
}
|
||||
entry->units = stat_buf.NSFS_SIZE;
|
Reference in New Issue
Block a user