Hi!

This is a followup to patch #1759178. I am unable to attach a new
patch to an existing patch. Therefore, I send a proposition here.

 
https://sourceforge.net/tracker/?func=detail&atid=312694&aid=1759178&group_id=12694#

As stated in a comment (by Wes Hardaker):

   I haven't finished reviewing this yet (but will). I'm sort of
   thinking that using the monitor line to continue registering things
   via netlink is a bit odd... It would make more sense to me to
   handle linkup/down traps directly. The monitor/disman hack was only
   put in place because there wasn't a better way to receive direct
   notifications when links happened.  If there is, I don't think
   there is any reason to do disman at all.

This is also my opinion. I have started to add the necessary bits into
if-mib module to not rely on disman and I have finally discovered this
is far easier than I though. In fact, notifications are now directly
handled by ifTable_interface.c once the change is detected. The cache
is also refreshed every 5 seconds without need to poll the
MIB. Therefore, if notifications are enabled, we get linkUp/linkDown
notifications without doing anything.

However, I still need "instant" notifications. Therefore, I have added
the netlink bits in interface_linux.c.

The first patch tries to factor a bit what was already existing, but
this is still a bit ugly. It is equivalent of rtnl_open_by_proto() we
could get from any libnl library [1].

The second patch registers a new Netlink socket which will trigger a
refresh. I am unsure if this is the "right" way to do such a thing. I
didn't find something appropriate in cache_handler.c and therefore I
invalidate the cache manually (->valid = 0) and invoke
netsnmp_cache_check_and_reload().

The third patch is a bit audacious: it removes most of the netlink
parsing stuff since we, in almost all cases, end up triggering cache
update. Therefore, at each Netlink message received, just update the
cache.

Comments welcome.

[1]: Moreover, the code for IPv6 prefix is buggy: in case of a
     truncated netlink message, we get into an infinite loop because
     the appropriate variables are only updated at the end of the loop
     and therefore "continue" skips those updates. I tried to fix this
     but I don't know how to get anything from this code:
     ipAddressTable only lists IPv4 addresses on my PC.


------------------------------------------------------------------------------
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
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to