Hi Robert,

The following patch uses the known_missing flag to make sure that the 
transient interfaces that are known to have gone away are not sent in 
response to GET* requests.  If it is an acceptable solution to the 
missing-interfaces-being-displayed-by-snmpwalk, I will post it to 
net-snmp.org/patches.

Thanks
- Tushar


Index: net-snmp-5.4/agent/mibgroup/if-mib/ifTable/ifTable_interface.c
===================================================================
--- net-snmp-5.4.orig/agent/mibgroup/if-mib/ifTable/ifTable_interface.c
+++ net-snmp-5.4/agent/mibgroup/if-mib/ifTable/ifTable_interface.c
@@ -997,8 +997,15 @@ _mfd_ifTable_get_values(netsnmp_mib_hand
         if (NULL == tri)
             continue;
 
-        rc = _ifTable_get_column(rowreq_ctx, requests->requestvb,
-                                 tri->colnum);
+        /* Don't report interfaces for which known_missing flag is set */
+        if (!rowreq_ctx->known_missing)
+            rc = _ifTable_get_column(rowreq_ctx, requests->requestvb,
+                                      tri->colnum);
+        else {
+            requests->requestvb->type = SNMP_NOSUCHINSTANCE;
+            rc = SNMP_ERR_NOERROR;
+        }
+
         if (rc) {
             if (MFD_SKIP == rc) {
                 requests->requestvb->type = SNMP_NOSUCHINSTANCE;
Index: net-snmp-5.4/agent/mibgroup/if-mib/ifXTable/ifXTable_interface.c
===================================================================
--- net-snmp-5.4.orig/agent/mibgroup/if-mib/ifXTable/ifXTable_interface.c
+++ net-snmp-5.4/agent/mibgroup/if-mib/ifXTable/ifXTable_interface.c
@@ -872,8 +872,15 @@ _mfd_ifXTable_get_values(netsnmp_mib_han
         if (NULL == tri)
             continue;
 
-        rc = _ifXTable_get_column(rowreq_ctx, requests->requestvb,
-                                  tri->colnum);
+        /* Don't report interfaces for which known_missing flag is set */
+        if (!rowreq_ctx->known_missing)
+            rc = _ifXTable_get_column(rowreq_ctx, requests->requestvb,
+                                      tri->colnum);
+        else {
+            requests->requestvb->type = SNMP_NOSUCHINSTANCE;
+            rc = SNMP_ERR_NOERROR;
+        }
+
         if (rc) {
             if (MFD_SKIP == rc) {
                 requests->requestvb->type = SNMP_NOSUCHINSTANCE;










Tushar Gohad wrote:
> Hi Robert,
>
> Looking at the _check_interface_entry_for_updates() function, I realize 
> now, how the 'missing' interfaces are handled.  Sorry about the 
> confusion on the interface status.
>
> For now, I will post a patch that utilizes the known_missing flag so 
> that the 'missing' interfaces are not in response to the GET* requests.
>
> Many thanks,
>
> - Tushar
>
>
>
>
> Tushar Gohad wrote:
>> Thanks Robert for the response.  I sent a reply few minutes ago when I 
>> had not seen this email.
>>
>> I will look closer at the net-snmp ifStatus of the interfaces and see 
>> how to use the known_missing flag.  IMO, a distinction needs to be 
>> made between interfaces that have ifStatus down vs interfaces that are 
>> completely removed from the kernel's interface list.
>>
>> Many thanks,
>> - Tushar
>>
>>
>>
>> Robert Story wrote:
>>> On Fri, 13 Mar 2009 12:00:09 -0700 Tushar wrote:
>>> TG> > Is the ifStatus down?
>>> TG> >   TG> TG> The interface is not down, but is removed using the 
>>> command:
>>>
>>> right.. but I'm asking about the net-snmp ifStatus.
>>>   
>>
>>> TG> It is not an issue to keep the entry if the vlan interface is 
>>> down.  But TG> the entry remains in the cache even after you remove 
>>> the vlan TG> interface.  How should this situation be handled?
>>>
>>> That's a matter of opinion. Some people, like yourself, might want the
>>> interface and all it's stats to completely disappear. Others might 
>>> want it to
>>> remain, so that cumulative stats for a particular interface can be 
>>> graphed.
>>>
>>> TG> I see a known_missing flag indicating the interface is not to be 
>>> found TG> anymore.  That flag seems to be set after I remove the 
>>> interface using TG> 'vconfig rem.'  It is not set when the vlan 
>>> interface is down.
>>>
>>> Right. So, if you would like to come up with a patch that optionally 
>>> remove the
>>> interface in that case, it could be considered for a future release.
>>>   
>>
>
>
> ------------------------------------------------------------------------------
> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
> software that enables intelligent coding and step-through debugging.
> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> _______________________________________________
> Net-snmp-coders mailing list
> Net-snmp-coders@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to