On 05/13/15 13:59, Dixon Xavier wrote: > Hi, > > This is regarding net-snmp 5.7.3 in HPUX IA64. > We are using aCC to compile netsnmp libraries. > > While running snmptrapd, it is not receiving traps. > Further analysis shows that, fd_set returned by netsnmp_select_info is > not correct (incorrect bits are set in it). > > Issue seems to be related to follwing LFD_* macros defined in > snmplib/large_fd_set.c > > #define LFD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << > ((n) % NFDBITS))) > #define LFD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << > ((n) % NFDBITS))) > #define LFD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << > ((n) % NFDBITS))) > > In HP-UX 11.23 ia64 ( /usr/include/sys/_fd_macros.h) __fd_mask is > defined as int32_t and FD_* macros operate fds_bits as an array of 32 > bit items. > But, the LFD_* macros treat them as 64bit items on IA64 when compiled > in 64 bit mode. This leads to incorrect bits being set/cleared for > corresponding fd's > > So, the LFD_* macros need to be modified as below so that it is > handled correctly on all platforms. > > #define LFD_SET(n, p) (((__fd_mask > *)((p)->fds_bits))[(n)/NFDBITS] |= (1ULL << ((n) % NFDBITS))) > #define LFD_CLR(n, p) (((__fd_mask > *)((p)->fds_bits))[(n)/NFDBITS] &= ~(1ULL << ((n) % NFDBITS))) > #define LFD_ISSET(n, p) (((__fd_mask > *)((p)->fds_bits))[(n)/NFDBITS] & (1ULL << ((n) % NFDBITS))) > > I modified the code as above and verified that the traps are now > received by 'snmptrapd' correctly. > > Kindly let us know if you consider this as an 'issue' in NetSNMP and > if yes when can we expect a patch for the issue.
Hello Dixon, Sorry but I'm afraid that the proposed changes would not compile on non-HP-UX systems. Could you test the patch below ? Thanks, Bart. [PATCH] Large fd set bug fix for ia64 HP-UX systems --- snmplib/large_fd_set.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/snmplib/large_fd_set.c b/snmplib/large_fd_set.c index a90c06b..e591ff2 100644 --- a/snmplib/large_fd_set.c +++ b/snmplib/large_fd_set.c @@ -83,6 +83,7 @@ netsnmp_large_fd_is_set(SOCKET fd, netsnmp_large_fd_set * fdset) #else +#if defined(linux) /* * Recent versions of glibc trigger abort() if FD_SET(), FD_CLR() or * FD_ISSET() is invoked with n >= FD_SETSIZE. Hence these replacement macros. @@ -90,6 +91,14 @@ netsnmp_large_fd_is_set(SOCKET fd, netsnmp_large_fd_set * fdset) #define LFD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1ULL << ((n) % NFDBITS))) #define LFD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1ULL << ((n) % NFDBITS))) #define LFD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1ULL << ((n) % NFDBITS))) +#else +/* + * The above macros do not work correctly on HP-UX ia64. + */ +#define LFD_SET(n, p) FD_SET(n, p) +#define LFD_CLR(n, p) FD_CLR(n, p) +#define LFD_ISSET(n, p) FD_ISSET(n, p) +#endif void netsnmp_large_fd_setfd(int fd, netsnmp_large_fd_set * fdset) -- 2.1.4 ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders