Fix issue with statistics from autofs
This commit is contained in:
parent
080b7fe91d
commit
4309199ccc
199
net-snmp-5.7.3-autofs.patch
Normal file
199
net-snmp-5.7.3-autofs.patch
Normal file
@ -0,0 +1,199 @@
|
||||
diff -urNp oold/agent/mibgroup/hardware/fsys/fsys_mntctl.c nnew/agent/mibgroup/hardware/fsys/fsys_mntctl.c
|
||||
--- oold/agent/mibgroup/hardware/fsys/fsys_mntctl.c 2012-10-10 00:28:58.000000000 +0200
|
||||
+++ nnew/agent/mibgroup/hardware/fsys/fsys_mntctl.c 2017-10-31 10:21:53.433280099 +0100
|
||||
@@ -43,8 +43,9 @@ _fsys_type( int type)
|
||||
|
||||
case MNT_NFS:
|
||||
case MNT_NFS3:
|
||||
- case MNT_AUTOFS:
|
||||
return NETSNMP_FS_TYPE_NFS;
|
||||
+ case MNT_AUTOFS:
|
||||
+ return NETSNMP_FS_TYPE_AUTOFS;
|
||||
|
||||
/*
|
||||
* The following code covers selected filesystems
|
||||
@@ -153,10 +154,12 @@ netsnmp_fsys_arch_load( void )
|
||||
|
||||
/*
|
||||
* Optionally skip retrieving statistics for remote mounts
|
||||
+ * AUTOFS is skipped by default
|
||||
*/
|
||||
- if ( (entry->flags & NETSNMP_FS_FLAG_REMOTE) &&
|
||||
+ if ( ((entry->flags & NETSNMP_FS_FLAG_REMOTE) &&
|
||||
netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
|
||||
- NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES))
|
||||
+ NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES)) ||
|
||||
+ entry->type == (NETSNMP_FS_TYPE_AUTOFS))
|
||||
continue;
|
||||
|
||||
if ( statfs( entry->path, &stat_buf ) < 0 ) {
|
||||
diff -urNp oold/agent/mibgroup/hardware/fsys/fsys_mntent.c nnew/agent/mibgroup/hardware/fsys/fsys_mntent.c
|
||||
--- oold/agent/mibgroup/hardware/fsys/fsys_mntent.c 2017-10-30 14:50:41.784743150 +0100
|
||||
+++ nnew/agent/mibgroup/hardware/fsys/fsys_mntent.c 2017-10-31 08:59:08.953114110 +0100
|
||||
@@ -145,6 +145,13 @@ _fsys_type( char *typename )
|
||||
!strcmp(typename, MNTTYPE_LOFS))
|
||||
return NETSNMP_FS_TYPE_OTHER;
|
||||
|
||||
+ /* Detection of AUTOFS.
|
||||
+ * This file system will be ignored by default
|
||||
+ */
|
||||
+ else if ( !strcmp(typename, MNTTYPE_AUTOFS))
|
||||
+ return NETSNMP_FS_TYPE_AUTOFS;
|
||||
+
|
||||
+
|
||||
/*
|
||||
* All other types are silently skipped
|
||||
*/
|
||||
@@ -239,6 +246,10 @@ netsnmp_fsys_arch_load( void )
|
||||
NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES))
|
||||
continue;
|
||||
|
||||
+ /* Skip AUTOFS enteries */
|
||||
+ if ( entry->type == (NETSNMP_FS_TYPE_AUTOFS))
|
||||
+ continue;
|
||||
+
|
||||
#ifdef irix6
|
||||
if ( NSFS_STATFS( entry->path, &stat_buf, sizeof(struct statfs), 0) < 0 )
|
||||
#else
|
||||
diff -urNp oold/agent/mibgroup/hardware/fsys/mnttypes.h nnew/agent/mibgroup/hardware/fsys/mnttypes.h
|
||||
--- oold/agent/mibgroup/hardware/fsys/mnttypes.h 2017-10-30 14:50:41.741743139 +0100
|
||||
+++ nnew/agent/mibgroup/hardware/fsys/mnttypes.h 2017-10-31 09:01:40.462427047 +0100
|
||||
@@ -159,6 +159,9 @@
|
||||
#ifndef MNTTYPE_APP
|
||||
#define MNTTYPE_APP "app"
|
||||
#endif
|
||||
+#ifndef MNTTYPE_AUTOFS
|
||||
+#define MNTTYPE_AUTOFS "autofs"
|
||||
+#endif
|
||||
#ifndef MNTTYPE_DEVPTS
|
||||
#define MNTTYPE_DEVPTS "devpts"
|
||||
#endif
|
||||
diff -urNp oold/agent/mibgroup/host/hr_filesys.c nnew/agent/mibgroup/host/hr_filesys.c
|
||||
--- oold/agent/mibgroup/host/hr_filesys.c 2012-10-10 00:28:58.000000000 +0200
|
||||
+++ nnew/agent/mibgroup/host/hr_filesys.c 2017-10-31 09:28:46.926093897 +0100
|
||||
@@ -839,6 +839,27 @@ Check_HR_FileSys_NFS (void)
|
||||
return 0; /* no NFS file system */
|
||||
}
|
||||
|
||||
+/* This function checks whether current file system is an AutoFs
|
||||
+ * HRFS_entry must be valid prior to calling this function
|
||||
+ * return 1 if AutoFs, 0 otherwise
|
||||
+ */
|
||||
+int
|
||||
+Check_HR_FileSys_AutoFs (void)
|
||||
+{
|
||||
+#if HAVE_GETFSSTAT
|
||||
+ if ( HRFS_entry->HRFS_type != NULL &&
|
||||
+#if defined(MNTTYPE_AUTOFS)
|
||||
+ !strcmp( HRFS_entry->HRFS_type, MNTTYPE_AUTOFS)
|
||||
+#else
|
||||
+ !strcmp( HRFS_entry->HRFS_type, "autofs")
|
||||
+#endif
|
||||
+ )
|
||||
+#endif /* HAVE_GETFSSTAT */
|
||||
+ return 1; /* AUTOFS */
|
||||
+
|
||||
+ return 0; /* no AUTOFS */
|
||||
+}
|
||||
+
|
||||
void
|
||||
End_HR_FileSys(void)
|
||||
{
|
||||
diff -urNp oold/agent/mibgroup/host/hr_filesys.h nnew/agent/mibgroup/host/hr_filesys.h
|
||||
--- oold/agent/mibgroup/host/hr_filesys.h 2012-10-10 00:28:58.000000000 +0200
|
||||
+++ nnew/agent/mibgroup/host/hr_filesys.h 2017-10-31 09:29:44.541837515 +0100
|
||||
@@ -10,6 +10,7 @@ extern void Init_HR_FileSys(void);
|
||||
extern FindVarMethod var_hrfilesys;
|
||||
extern int Get_Next_HR_FileSys(void);
|
||||
extern int Check_HR_FileSys_NFS(void);
|
||||
+extern int Check_HR_FileSys_AutoFs(void);
|
||||
|
||||
extern int Get_FSIndex(char *);
|
||||
extern long Get_FSSize(char *); /* Temporary */
|
||||
diff -urNp oold/agent/mibgroup/host/hrh_filesys.c nnew/agent/mibgroup/host/hrh_filesys.c
|
||||
--- oold/agent/mibgroup/host/hrh_filesys.c 2012-10-10 00:28:58.000000000 +0200
|
||||
+++ nnew/agent/mibgroup/host/hrh_filesys.c 2017-10-31 09:37:36.787634605 +0100
|
||||
@@ -427,3 +427,9 @@ Check_HR_FileSys_NFS (void)
|
||||
{
|
||||
return (HRFS_entry->flags & NETSNMP_FS_FLAG_REMOTE) ? 1 : 0;
|
||||
}
|
||||
+
|
||||
+int
|
||||
+Check_HR_FileSys_AutoFs (void)
|
||||
+{
|
||||
+ return (HRFS_entry->type == (NETSNMP_FS_TYPE_AUTOFS)) ? 1 : 0;
|
||||
+}
|
||||
diff -urNp oold/agent/mibgroup/host/hrh_filesys.h nnew/agent/mibgroup/host/hrh_filesys.h
|
||||
--- oold/agent/mibgroup/host/hrh_filesys.h 2012-10-10 00:28:58.000000000 +0200
|
||||
+++ nnew/agent/mibgroup/host/hrh_filesys.h 2017-10-31 09:38:00.644616572 +0100
|
||||
@@ -10,6 +10,7 @@ extern void Init_HR_FileSys(void);
|
||||
extern FindVarMethod var_hrhfilesys;
|
||||
extern int Get_Next_HR_FileSys(void);
|
||||
extern int Check_HR_FileSys_NFS(void);
|
||||
+extern int Check_HR_FileSys_AutoFs(void);
|
||||
|
||||
extern int Get_FSIndex(char *);
|
||||
extern long Get_FSSize(char *); /* Temporary */
|
||||
diff -urNp oold/agent/mibgroup/host/hrh_storage.c nnew/agent/mibgroup/host/hrh_storage.c
|
||||
--- oold/agent/mibgroup/host/hrh_storage.c 2017-10-30 14:50:41.766743146 +0100
|
||||
+++ nnew/agent/mibgroup/host/hrh_storage.c 2017-10-31 10:08:25.482217951 +0100
|
||||
@@ -368,9 +368,10 @@ really_try_next:
|
||||
store_idx = name[ HRSTORE_ENTRY_NAME_LENGTH ];
|
||||
if (HRFS_entry &&
|
||||
store_idx > NETSNMP_MEM_TYPE_MAX &&
|
||||
- netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
|
||||
+ ((netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
|
||||
NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) &&
|
||||
- Check_HR_FileSys_NFS())
|
||||
+ Check_HR_FileSys_NFS()) ||
|
||||
+ Check_HR_FileSys_AutoFs()))
|
||||
return NULL;
|
||||
if (store_idx <= NETSNMP_MEM_TYPE_MAX ) {
|
||||
mem = (netsnmp_memory_info*)ptr;
|
||||
@@ -509,7 +510,8 @@ Get_Next_HR_Store(void)
|
||||
if (HRS_index >= 0) {
|
||||
if (!(netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
|
||||
NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) &&
|
||||
- Check_HR_FileSys_NFS())) {
|
||||
+ Check_HR_FileSys_NFS()) &&
|
||||
+ !Check_HR_FileSys_AutoFs()) {
|
||||
return HRS_index + NETSNMP_MEM_TYPE_MAX;
|
||||
}
|
||||
} else {
|
||||
diff -urNp oold/agent/mibgroup/host/hr_storage.c nnew/agent/mibgroup/host/hr_storage.c
|
||||
--- oold/agent/mibgroup/host/hr_storage.c 2012-10-10 00:28:58.000000000 +0200
|
||||
+++ nnew/agent/mibgroup/host/hr_storage.c 2017-10-31 10:11:41.161064352 +0100
|
||||
@@ -545,9 +545,10 @@ really_try_next:
|
||||
|
||||
store_idx = name[ HRSTORE_ENTRY_NAME_LENGTH ];
|
||||
if (store_idx > NETSNMP_MEM_TYPE_MAX ) {
|
||||
- if ( netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
|
||||
+ if ( (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
|
||||
NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) &&
|
||||
- Check_HR_FileSys_NFS())
|
||||
+ Check_HR_FileSys_NFS()) ||
|
||||
+ Check_HR_FileSys_AutoFs())
|
||||
return NULL; /* or goto try_next; */
|
||||
if (HRFS_statfs(HRFS_entry->HRFS_mount, &stat_buf) < 0) {
|
||||
snmp_log_perror(HRFS_entry->HRFS_mount);
|
||||
@@ -688,7 +689,8 @@ Get_Next_HR_Store(void)
|
||||
if (HRS_index >= 0) {
|
||||
if (!(netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
|
||||
NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) &&
|
||||
- Check_HR_FileSys_NFS())) {
|
||||
+ Check_HR_FileSys_NFS()) &&
|
||||
+ !Check_HR_FileSys_AutoFs()) {
|
||||
return HRS_index + NETSNMP_MEM_TYPE_MAX;
|
||||
}
|
||||
} else {
|
||||
diff -urNp oold/include/net-snmp/agent/hardware/fsys.h nnew/include/net-snmp/agent/hardware/fsys.h
|
||||
--- oold/include/net-snmp/agent/hardware/fsys.h 2012-10-10 00:28:58.000000000 +0200
|
||||
+++ nnew/include/net-snmp/agent/hardware/fsys.h 2017-10-31 10:14:59.560581680 +0100
|
||||
@@ -41,6 +41,7 @@ typedef struct netsnmp_fsys_info_s netsn
|
||||
#define NETSNMP_FS_TYPE_SYSFS 4 | _NETSNMP_FS_TYPE_LOCAL | _NETSNMP_FS_TYPE_SKIP_BIT
|
||||
#define NETSNMP_FS_TYPE_TMPFS 5 | _NETSNMP_FS_TYPE_LOCAL
|
||||
#define NETSNMP_FS_TYPE_USBFS 6 | _NETSNMP_FS_TYPE_LOCAL
|
||||
+#define NETSNMP_FS_TYPE_AUTOFS 7 | _NETSNMP_FS_TYPE_LOCAL | _NETSNMP_FS_TYPE_SKIP_BIT
|
||||
|
||||
#define NETSNMP_FS_FLAG_ACTIVE 0x01
|
||||
#define NETSNMP_FS_FLAG_REMOTE 0x02
|
@ -61,6 +61,7 @@ Patch18: 0001-Link-libnetsnmptrapd-against-MYSQL_LIBS.patch
|
||||
Patch19: net-snmp-5.7.3-mariadb-connector-c.patch
|
||||
Patch20: net-snmp-5.7.3-strstr.patch
|
||||
Patch21: net-snmp-5.7.3-iterator-fix.patch
|
||||
Patch22: net-snmp-5.7.3-autofs.patch
|
||||
|
||||
# This patch fix issue with new OpenSLL library in rawhide (f26+)
|
||||
# !!!WARNING!!! DO NOT USE IT FOR OLDER FEDORA RELEASES (>f26)
|
||||
@ -222,6 +223,7 @@ cp %{SOURCE10} .
|
||||
%patch19 -p1 -b .mariadb-connector-c
|
||||
%patch20 -p1 -b .strstr
|
||||
%patch21 -p1 -b .iterator-fix
|
||||
%patch22 -p1 -b .autofs-skip
|
||||
%patch100 -p1 -b .openssl
|
||||
%patch101 -p1 -b .modern-rpm-api
|
||||
|
||||
@ -492,6 +494,7 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test
|
||||
* Thu Feb 08 2018 Josef Ridky <jridky@redhat.com> - 1:5.7.3-33
|
||||
- Fix strstr() crash when looking for RPM Group tag
|
||||
- Fix wrong usage of structure iterator
|
||||
- Fix issue with statistics from autofs
|
||||
|
||||
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1:5.7.3-32
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||
|
Loading…
Reference in New Issue
Block a user