--- net-snmp-5.5/agent/mibgroup/mibII/tcpTable.c 2009-06-12 21:02:02.000000000 -0500 +++ net-snmp-5.5-libnl/agent/mibgroup/mibII/tcpTable.c 2011-03-17 11:09:33.000000000 -0500 @@ -587,7 +587,13 @@ .idiag_states = TCP_ALL, }; +#ifdef RTM_GETDCB + /* some distros (RHEL6) have nlmsg_alloc_simple() */ struct nl_msg *nm = nlmsg_alloc_simple(TCPDIAG_GETSOCK, NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST); +#else + /* some distros (RHEL5) have nlmsg_build_simple() */ + struct nl_msg *nm = nlmsg_build_simple(TCPDIAG_GETSOCK, NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST); +#endif nlmsg_append(nm, &req, sizeof(struct inet_diag_req), 0); if (nl_send_auto_complete(nl, nm) < 0) { @@ -603,7 +609,13 @@ int running = 1, len; while (running) { +#ifdef RTM_GETDCB + /* New version of nl_recv */ if ((len = nl_recv(nl, &peer, &buf, NULL)) <= 0) { +#else + /* Old version of nl_recv (RHEL 5 */ + if ((len = nl_recv(nl, &peer, &buf)) <= 0) { +#endif DEBUGMSGTL(("mibII/tcpTable", "nl_recv(): %s\n", nl_geterror())); snmp_log(LOG_ERR, "snmpd: nl_recv(): %s\n", nl_geterror()); nl_handle_destroy(nl);