libcoap
libcoap copied to clipboard
Crashed at response data received when resources more than 13 or 14
I'v registered almost 20 resources as a coap server. when POST data send out and response received the program crashed. And I'v modified the libcoap source code, enabled broadcast and removed IP hash.
I want to know why crashed
platform: MT7621 linux-2.6.36
coap_io.c:150
on = 1;
if (setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on)) < 0)
coap_log(LOG_WARNING, "coap_new_endpoint: setsockopt SO_BROADCAST");
net.c:508
void
coap_transaction_id(const coap_address_t *peer, const coap_pdu_t *pdu,
coap_tid_t *id) {
...
case AF_INET:
coap_hash((const unsigned char *)&peer->addr.sin.sin_port,
sizeof(peer->addr.sin.sin_port), h);
// coap_hash((const unsigned char *)&peer->addr.sin.sin_addr,
// sizeof(peer->addr.sin.sin_addr), h);
break;
...
}
log
Feb 18 10:16:29 DEBG msgq: 2147194712
Feb 18 10:16:29 DEBG workq: 2147194712
Jan 15 10:37:58 DEBG created endpoint 0.0.0.0:5683
Jan 15 10:37:58 DEBG Register uri handler: 0x40329c
Jan 15 10:37:58 DEBG Register uri handler: 0x402ef4
Jan 15 10:37:58 DEBG Register uri handler: 0x404e60
Jan 15 10:37:58 DEBG Register uri handler: 0x405ce0
Jan 15 10:37:58 DEBG Register uri handler: 0x406074
Jan 15 10:37:58 DEBG Register uri handler: 0x4065c8
Jan 15 10:37:58 DEBG Register uri handler: 0x406a94
Jan 15 10:37:58 DEBG Register uri handler: 0x406d40
Jan 15 10:37:58 DEBG Register uri handler: 0x402dc4
Jan 15 10:37:58 DEBG Register uri handler: 0x402c0c
Jan 15 10:37:58 DEBG Register uri handler: 0x401f00
Jan 15 10:37:58 DEBG Register uri handler: 0x401f08
Jan 15 10:37:58 DEBG Register uri handler: 0x401f10
Jan 15 10:37:58 DEBG Register uri handler: 0x401f18
Jan 15 10:37:58 DEBG FUNC: (check_system_ready), ARG: ((null))
Jan 15 10:37:58 DEBG FUNC: (detect_link), ARG: ((null))
Jan 15 10:37:58 DEBG FUNC: (send_discover), ARG: ((null))
v:1 t:CON c:POST i:074c {} [ ]
Jan 15 10:37:58 DEBG uri.host.s: 192.168.1.255:5683/qlink/searchgw, uri.host.length: 13
Jan 15 10:37:58 DEBG host:::::::192.168.1.255
Jan 15 10:37:58 DEBG node: 192.168.1.255, port: 5683
Jan 15 10:37:58 DEBG Register rsp message id handler: 0x401f28
Jan 15 10:37:58 DEBG received 72 bytes on fd 3
Jan 15 10:37:58 DEBG set data to 0x421f1c (pdu ends at 0x421f50)
v:1 t:CON c:POST i:074c {} [ Uri-Path:qlink, Uri-Path:searchgw ] :: '{"searchKey":"ANDLINK-DEVICE","andlinkVersion":"V2"}'
Jan 15 10:37:58 DEBG request for unknown resource 0x73654a87, return 4.04
Jan 15 10:37:58 CRIT coap_send_impl: Success
Jan 15 10:37:58 WARN cannot send response for transaction 49301
Jan 15 10:37:58 DEBG received 54 bytes on fd 3
Jan 15 10:37:58 DEBG set data to 0x420eee (pdu ends at 0x420f1e)
v:1 t:ACK c:2.05 i:074c {} [ Content-Format:text/plain ] :: '{"searchAck":"ANDLINK-GW","andlinkVersion":"V2"}'
Jan 15 10:37:58 DEBG *** removed transaction 49301
Jan 15 10:37:58 DEBG (searchgw_rsp_handler):::::::::::RESPONSE: (2) <48> [{"searchAck":"ANDLINK-GW","andlinkVersion":"V2"}]
2.05 {"searchAck":"ANDLINK-GW","andlinkVersion":"V2"}
Segmentation fault
This may have been fixed by Pull Request #133 which is now in develop
@kevinjen1031: can you contact me off github? [email protected]
Does this issue still exist?