SNMP Trap send to non existent IP address hangs

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

SNMP Trap send to non existent IP address hangs

ソリューションへジャンプ
1,446件の閲覧回数
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,143件の閲覧回数
Mohsin455
Contributor IV

Hi,

 

    Try using the socket option send_nowait on the tx socket.

 

Regards,

Mohsin455

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,144件の閲覧回数
Mohsin455
Contributor IV

Hi,

 

    Try using the socket option send_nowait on the tx socket.

 

Regards,

Mohsin455

0 件の賞賛
返信
1,143件の閲覧回数
sw_bob
Contributor I

This seems to resolve the problem.

Thank you!

0 件の賞賛
返信