We need to trigger a cache reload in almost all legit
cases. Therefore, we can just ignore the content of the netlink
message. As long as we have received one, we trigger a cache
refresh.
---
 .../mibgroup/if-mib/data_access/interface_linux.c  |   42 ++------------------
 1 file changed, 3 insertions(+), 39 deletions(-)

diff --git a/agent/mibgroup/if-mib/data_access/interface_linux.c 
b/agent/mibgroup/if-mib/data_access/interface_linux.c
index c1ed508..ac4e4e3 100644
--- a/agent/mibgroup/if-mib/data_access/interface_linux.c
+++ b/agent/mibgroup/if-mib/data_access/interface_linux.c
@@ -1058,9 +1058,6 @@ static void netsnmp_iflink_process(int fd, void *data)
 {
     int                status;
     char               buf[16384];
-    struct nlmsghdr    *nlmp;
-    struct ifinfomsg   *ifi;
-    int                len, req_len, length; 
 
     status = recv(fd, buf, sizeof(buf), 0);
     if (status < 0) {
@@ -1068,42 +1065,9 @@ static void netsnmp_iflink_process(int fd, void *data)
         return;
     }
 
-    if (status == 0){
-        DEBUGMSGTL(("access:interface:iflink", "End of File\n"));
-        return;
-    }
-
-    for (nlmp = (struct nlmsghdr *)buf;
-        status > sizeof(*nlmp);
-        status -= NLMSG_ALIGN(len),
-            nlmp = (struct nlmsghdr*)((char*)nlmp + NLMSG_ALIGN(len))) {
-       len = nlmp->nlmsg_len;
-        req_len = len - sizeof(*nlmp);
-
-        if (req_len < 0 || len > status) {
-            snmp_log(LOG_ERR,"netsnmp_iflink_listen: Error in length\n");
-            return;
-        }
-
-        if (!NLMSG_OK(nlmp, status)) {
-            DEBUGMSGTL(("access:interface:iflink", "NLMSG not OK\n"));
-            return;
-        }
-
-        if (nlmp->nlmsg_type == RTM_NEWLINK ||
-           nlmp->nlmsg_type == RTM_DELLINK) {
-           ifi = NLMSG_DATA(nlmp);
-            length = nlmp->nlmsg_len - NLMSG_LENGTH(sizeof(*ifi));
-
-            if (length < 0) {
-                DEBUGMSGTL(("access:interface:iflink", "wrong nlmsg length 
%d\n", length));
-                return;
-            }
-
-           /* Just request a refresh! */
-           ifTable_cache_reload();
-        }
-    }
+    /* Skip any complex parsing of the message, we don't really
+     * care. Just request a refresh! */
+    ifTable_cache_reload();
 }
 
 static int netsnmp_iflink_listen()
-- 
1.7.10.4


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to