{"action":"created","issue":{"url":"https://api.github.com/repos/espressif/ESP8266_RTOS_SDK/issues/224","repository_url":"https://api.github.com/repos/espressif/ESP8266_RTOS_SDK","labels_url":"https://api.github.com/repos/espressif/ESP8266_RTOS_SDK/issues/224/labels{/name}","comments_url":"https://api.github.com/repos/espressif/ESP8266_RTOS_SDK/issues/224/comments","events_url":"https://api.github.com/repos/espressif/ESP8266_RTOS_SDK/issues/224/events","html_url":"https://github.com/espressif/ESP8266_RTOS_SDK/issues/224","id":331474905,"node_id":"MDU6SXNzdWUzMzE0NzQ5MDU=","number":224,"title":"[TW#24230] lwip raw UDP sendto not working as expected","user":{"login":"malachib","id":1586399,"node_id":"MDQ6VXNlcjE1ODYzOTk=","avatar_url":"https://avatars0.githubusercontent.com/u/1586399?v=4","gravatar_id":"","url":"https://api.github.com/users/malachib","html_url":"https://github.com/malachib","followers_url":"https://api.github.com/users/malachib/followers","following_url":"https://api.github.com/users/malachib/following{/other_user}","gists_url":"https://api.github.com/users/malachib/gists{/gist_id}","starred_url":"https://api.github.com/users/malachib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/malachib/subscriptions","organizations_url":"https://api.github.com/users/malachib/orgs","repos_url":"https://api.github.com/users/malachib/repos","events_url":"https://api.github.com/users/malachib/events{/privacy}","received_events_url":"https://api.github.com/users/malachib/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"Junhao-Espressif","id":33280035,"node_id":"MDQ6VXNlcjMzMjgwMDM1","avatar_url":"https://avatars2.githubusercontent.com/u/33280035?v=4","gravatar_id":"","url":"https://api.github.com/users/Junhao-Espressif","html_url":"https://github.com/Junhao-Espressif","followers_url":"https://api.github.com/users/Junhao-Espressif/followers","following_url":"https://api.github.com/users/Junhao-Espressif/following{/other_user}","gists_url":"https://api.github.com/users/Junhao-Espressif/gists{/gist_id}","starred_url":"https://api.github.com/users/Junhao-Espressif/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Junhao-Espressif/subscriptions","organizations_url":"https://api.github.com/users/Junhao-Espressif/orgs","repos_url":"https://api.github.com/users/Junhao-Espressif/repos","events_url":"https://api.github.com/users/Junhao-Espressif/events{/privacy}","received_events_url":"https://api.github.com/users/Junhao-Espressif/received_events","type":"User","site_admin":false},"assignees":[{"login":"Junhao-Espressif","id":33280035,"node_id":"MDQ6VXNlcjMzMjgwMDM1","avatar_url":"https://avatars2.githubusercontent.com/u/33280035?v=4","gravatar_id":"","url":"https://api.github.com/users/Junhao-Espressif","html_url":"https://github.com/Junhao-Espressif","followers_url":"https://api.github.com/users/Junhao-Espressif/followers","following_url":"https://api.github.com/users/Junhao-Espressif/following{/other_user}","gists_url":"https://api.github.com/users/Junhao-Espressif/gists{/gist_id}","starred_url":"https://api.github.com/users/Junhao-Espressif/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Junhao-Espressif/subscriptions","organizations_url":"https://api.github.com/users/Junhao-Espressif/orgs","repos_url":"https://api.github.com/users/Junhao-Espressif/repos","events_url":"https://api.github.com/users/Junhao-Espressif/events{/privacy}","received_events_url":"https://api.github.com/users/Junhao-Espressif/received_events","type":"User","site_admin":false}],"milestone":null,"comments":15,"created_at":"2018-06-12T07:48:32Z","updated_at":"2018-12-20T03:37:48Z","closed_at":null,"author_association":"NONE","body":"Using lwip raw udp API, notice that only one UDP echo works then the device  echoes back improperly after that (UDP packet seems to be malformed, missing payload)\r\n\r\n\r\n``` c++\r\n#include \"lwip/api.h\"\r\n#include \"lwip/udp.h\"\r\n\r\nvoid udp_echo_recv(void *arg, \r\n    struct udp_pcb *pcb, struct pbuf *p,  \r\n    const ip_addr_t *addr, u16_t port)\r\n{\r\n    if (p != NULL) {\r\n        /* send received packet back to sender */\r\n        udp_sendto(pcb, p, addr, port);\r\n        /* free the pbuf */\r\n        pbuf_free(p);\r\n    }\r\n}\r\n\r\n\r\nvoid udp_echo_init(void)\r\n{\r\n    struct udp_pcb * pcb;\r\n\r\n    /* get new pcb */\r\n    pcb = udp_new();\r\n    if (pcb == NULL) {\r\n        LWIP_DEBUGF(UDP_DEBUG, (\"udp_new failed!\\n\"));\r\n        return;\r\n    }\r\n\r\n    /* bind to any IP address on port 7 */\r\n    if (udp_bind(pcb, IP_ADDR_ANY, 7) != ERR_OK) {\r\n        LWIP_DEBUGF(UDP_DEBUG, (\"udp_bind failed!\\n\"));\r\n        return;\r\n    }\r\n\r\n    /* set udp_echo_recv() as callback function\r\n       for received packets */\r\n    udp_recv(pcb, udp_echo_recv, NULL);\r\n}\r\n```\r\n\r\ntcpdump after asking to echo '123':\r\n\r\n```\r\n00:09:21.434673 IP (tos 0x0, ttl 64, id 11414, offset 0, flags [none], proto UDP (17), length 32)\r\n    192.168.2.2.49738 > 192.168.2.179.echo: [udp sum ok] UDP, length 4\r\n\t0x0000:  5ccf 7f3a 08ba 58b0 3561 d381 0800 4500  \\..:..X.5a....E.\r\n\t0x0010:  0020 2c96 0000 4011 c831 c0a8 0202 c0a8  ..,...@..1......\r\n\t0x0020:  02b3 c24a 0007 000c 5342 3132 330a       ...J....SB123.\r\n00:09:21.636659 IP truncated-ip - 4 bytes missing! (tos 0x0, ttl 255, id 5, offset 0, flags [none], proto UDP (17), length 32)\r\n    192.168.2.179.echo > 192.168.2.2.49738: UDP, length 4\r\n\t0x0000:  58b0 3561 d381 5ccf 7f3a 08ba 0800 4500  X.5a..\\..:....E.\r\n\t0x0010:  0020 0005 0000 ff11 35c2 c0a8 02b3 c0a8  ........5.......\r\n\t0x0020:  0202 0007 c24a 000c 5342  \r\n```\r\n\r\nFull code [here](https://bitbucket.org/malachib/playground.esp/src/master/src/PGESP-12/poc1/) \r\n\r\nAny thoughts?"},"comment":{"url":"https://api.github.com/repos/espressif/ESP8266_RTOS_SDK/issues/comments/448850665","html_url":"https://github.com/espressif/ESP8266_RTOS_SDK/issues/224#issuecomment-448850665","issue_url":"https://api.github.com/repos/espressif/ESP8266_RTOS_SDK/issues/224","id":448850665,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0ODg1MDY2NQ==","user":{"login":"FayeY","id":26587571,"node_id":"MDQ6VXNlcjI2NTg3NTcx","avatar_url":"https://avatars2.githubusercontent.com/u/26587571?v=4","gravatar_id":"","url":"https://api.github.com/users/FayeY","html_url":"https://github.com/FayeY","followers_url":"https://api.github.com/users/FayeY/followers","following_url":"https://api.github.com/users/FayeY/following{/other_user}","gists_url":"https://api.github.com/users/FayeY/gists{/gist_id}","starred_url":"https://api.github.com/users/FayeY/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FayeY/subscriptions","organizations_url":"https://api.github.com/users/FayeY/orgs","repos_url":"https://api.github.com/users/FayeY/repos","events_url":"https://api.github.com/users/FayeY/events{/privacy}","received_events_url":"https://api.github.com/users/FayeY/received_events","type":"User","site_admin":false},"created_at":"2018-12-20T03:37:48Z","updated_at":"2018-12-20T03:37:48Z","author_association":"COLLABORATOR","body":"Any update?"}}
{"actor":{"display_login":"FayeY"}}