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. Please find below snippet from /usr/include/sys/_fd_macros.h: ... /* * The FD_* macros below are used for select(2). They operate on a bit mask * of file descriptors contained in an fd_set. In user-land XPG4 requires * the bit mask to be an array of longs. The macros pretend it is an array * of int32_t's so the binary layout is the same for both Narrow and Wide * processes. */ typedef int32_t __fd_mask; #define _NFDBITS (sizeof(__fd_mask) * 8) /* 8 bits per byte */ #define __howmany(x,y) (((x)+((y)-1))/(y)) #ifndef _FD_SET # define _FD_SET typedef struct __fd_set { long fds_bits[__howmany(FD_SETSIZE, (sizeof(long) * 8))]; } fd_set; ... #ifdef _INCLUDE_HPUX_SOURCE # define FD_SET(n,p) (((__fd_mask *)((p)->fds_bits))[(n)/_NFDBITS] |= (1 << ((n) % _NFDBITS))) # define FD_CLR(n,p) (((__fd_mask *)((p)->fds_bits))[(n)/_NFDBITS] &= ~(1 << ((n) % _NFDBITS))) # define FD_ISSET(n,p) (((__fd_mask *)((p)->fds_bits))[(n)/_NFDBITS] & (1 << ((n) % _NFDBITS))) # define FD_ZERO(p) memset((void *)(p), (int) 0, sizeof(*(p))) #else ... Regards, Dixon Xavier ------------------------------------------------------------------------------ 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