SNMP Trap send to non existent IP address hangs

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

SNMP Trap send to non existent IP address hangs

跳至解决方案
1,488 次查看
sw_bob
Contributor I

Hello all,

 

I have an applicaiton that sends  a few SNMP traps right at power up.

After initializing web server and telnet server, I initialize SNMP by calling this:

 

error = SNMP_init_with_traps("SNMP", 7, 2500, my_trap_list);

 

Then I make a few calls to send some traps out (just like SNMP demo provided with MQX 3.8).

What I found is that if trap destination IP address diesn't exist on the network (or if ethernet cable is unplugged), the trap sending function never returns.  I happens for all generic trap functions: SNMP_trap_coldStart(), SNMP_trap_linkUp(), etc.

I traced it down to this call inside these functions (highlighted in red):

 

   for (i = 0; i < SNMPCFG_MAX_TRAP_RECEIVERS; i++) {      if (snmpcfg->trap_receiver_list[i] != 0) {         ipaddr = snmpcfg->trap_receiver_list[i];         ipsrc=IP_route_find(ipaddr, 0);         htonl(ipsrcp, ipsrc);         addr.sin_addr.s_addr = ipaddr;         sendto(snmpcfg->trapsock, snmp.outbuf, traplen, 0, &addr, sizeof(addr));      } /* Endif */   } /* Endfor */

This function never returns and it looks like it keeps sending ARP queries without ever timing out.

 

Has anyone encountered this issue or maybe even found a solution?

 

Thanks,
Boris 

 

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
1,185 次查看
Mohsin455
Contributor IV

Hi,

 

    Try using the socket option send_nowait on the tx socket.

 

Regards,

Mohsin455

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,186 次查看
Mohsin455
Contributor IV

Hi,

 

    Try using the socket option send_nowait on the tx socket.

 

Regards,

Mohsin455

0 项奖励
回复
1,185 次查看
sw_bob
Contributor I

This seems to resolve the problem.

Thank you!

0 项奖励
回复