"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/agent/subagents/linux/net.cpp" between
netxms-3.1.352.tar.gz and netxms-3.1.361.tar.gz

About: NetXMS is a multi-platform open source network management and monitoring system.

net.cpp  (netxms-3.1.352):net.cpp  (netxms-3.1.361)
skipping to change at line 93 skipping to change at line 93
if (fgets(szBuff, sizeof(szBuff), hFile) != NULL) // skip first line if (fgets(szBuff, sizeof(szBuff), hFile) != NULL) // skip first line
{ {
int nFd = socket(AF_INET, SOCK_DGRAM, 0); int nFd = socket(AF_INET, SOCK_DGRAM, 0);
if (nFd > 0) if (nFd > 0)
{ {
nRet = SYSINFO_RC_SUCCESS; nRet = SYSINFO_RC_SUCCESS;
while(fgets(szBuff, sizeof(szBuff), hFile) != NULL) while(fgets(szBuff, sizeof(szBuff), hFile) != NULL)
{ {
int nIP1, nIP2, nIP3, nIP4; int nIP1, nIP2, nIP3, nIP4;
int nMAC1, nMAC2, nMAC3, nMAC4, nMAC5, nMAC6; UINT32 nMAC1, nMAC2, nMAC3, nMAC4, nMAC5, nMAC6;
char szTmp1[256];
char szTmp2[256];
char szTmp3[256];
char szIf[256]; char szIf[256];
if (sscanf(szBuff, if (sscanf(szBuff,
"%d.%d.%d.%d %s %s %02X:%02X:%02X:%02X:%02X:%02X %s %s ", "%d.%d.%d.%d %*s %*s %02X:%02X:%02X:%02X:%02X:%02X %*s %255s",
&nIP1, &nIP2, &nIP3, &nIP4, &nIP1, &nIP2, &nIP3, &nIP4,
szTmp1, szTmp2,
&nMAC1, &nMAC2, &nMAC3, &nMAC4, &nMAC5, &nMAC6, &nMAC1, &nMAC2, &nMAC3, &nMAC4, &nMAC5, &nMAC6,
szTmp3, szIf) == 14) szIf) == 14)
{ {
int nIndex; int nIndex;
struct ifreq irq; struct ifreq irq;
if (nMAC1 == 0 && nMAC2 == 0 && if (nMAC1 == 0 && nMAC2 == 0 &&
nMAC3 == 0 && nMAC4 == 0 && nMAC3 == 0 && nMAC4 == 0 &&
nMAC5 == 0 && nMAC6 == 0) nMAC5 == 0 && nMAC6 == 0)
{ {
// incomplete // incomplete
continue; continue;
skipping to change at line 181 skipping to change at line 177
{ {
if (!strncmp(szLine, if (!strncmp(szLine,
"Iface\tDestination\tGateway \tFlags\tRefCnt\t" "Iface\tDestination\tGateway \tFlags\tRefCnt\t"
"Use\tMetric\tMask", 55)) "Use\tMetric\tMask", 55))
{ {
nRet = SYSINFO_RC_SUCCESS; nRet = SYSINFO_RC_SUCCESS;
while(fgets(szLine, sizeof(szLine), hFile) != NULL) while(fgets(szLine, sizeof(szLine), hFile) != NULL)
{ {
char szIF[64]; char szIF[64];
int nTmp, nType = 0; int nType = 0;
unsigned int nDestination, nGateway, nMask; unsigned int nDestination, nGateway, nMask;
if (sscanf(szLine, if (sscanf(szLine,
"%s\t%08X\t%08X\t%d\t%d\t%d\t%d\t%08X", "%63s\t%08X\t%08X\t%*d\t%*d\t%*d\t%*d\t%08X",
szIF, szIF,
&nDestination, &nDestination,
&nGateway, &nGateway,
&nTmp, &nTmp, &nTmp, &nTmp,
&nMask) == 8) &nMask) == 8)
{ {
int nIndex; int nIndex;
struct ifreq irq; struct ifreq irq;
strncpy(irq.ifr_name, szIF, IFNAMSIZ); strncpy(irq.ifr_name, szIF, IFNAMSIZ);
if (ioctl(nFd, SIOCGIFINDEX, &irq) != 0) if (ioctl(nFd, SIOCGIFINDEX, &irq) != 0)
{ {
perror("ioctl()"); AgentWriteDebugLog(4, _T("H_NetRoutingTable: ioctl() failed (% s)"), _tcserror(errno));
nIndex = 0; nIndex = 0;
} }
else else
{ {
nIndex = irq.ifr_ifindex; nIndex = irq.ifr_ifindex;
} }
TCHAR output[256], szBuf1[64], szBuf2[64]; TCHAR output[256], szBuf1[64], szBuf2[64];
_sntprintf(output, 256, _T("%s/%d %s %d %d"), _sntprintf(output, 256, _T("%s/%d %s %d %d"),
IpToStr(ntohl(nDestination), szBuf1), IpToStr(ntohl(nDestination), szBuf1),
skipping to change at line 252 skipping to change at line 247
//request.message.rtgen_family = AF_PACKET; //request.message.rtgen_family = AF_PACKET;
request.message.rtgen_family = AF_UNSPEC; request.message.rtgen_family = AF_UNSPEC;
io.iov_base = &request; io.iov_base = &request;
io.iov_len = request.header.nlmsg_len; io.iov_len = request.header.nlmsg_len;
message.msg_iov = &io; message.msg_iov = &io;
message.msg_iovlen = 1; message.msg_iovlen = 1;
message.msg_name = &kernel; message.msg_name = &kernel;
message.msg_namelen = sizeof(kernel); message.msg_namelen = sizeof(kernel);
return sendmsg(socket, (msghdr*) &message, 0); return sendmsg(socket, &message, 0);
} }
/** /**
* Receive netlink message * Receive netlink message
*/ */
static int ReceiveMessage(int socket, char *replyBuffer, size_t replyBufferSize) static int ReceiveMessage(int socket, char *replyBuffer, size_t replyBufferSize)
{ {
iovec io; iovec io;
msghdr reply = {}; msghdr reply = {};
sockaddr_nl kernel; sockaddr_nl kernel;
 End of changes. 9 change blocks. 
12 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)