diff options
author | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-05-15 12:15:20 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-05-15 12:15:20 +0200 |
commit | a7cfeec50d962d6c56f9d3e4d60c2d1d49c23734 (patch) | |
tree | 4b0a50e3f53b33095fbfd850cb6bd881fe361604 /src | |
parent | bc94dd6436a62bda6bf3ba11a20dbc50f7094e5a (diff) | |
parent | 810fb7625b00298ec6c36e9aa291d2fda54bf506 (diff) | |
download | ouroboros-a7cfeec50d962d6c56f9d3e4d60c2d1d49c23734.tar.gz ouroboros-a7cfeec50d962d6c56f9d3e4d60c2d1d49c23734.zip |
Merged in dstaesse/ouroboros/be-udp (pull request #87)
ipcpd: shim-udp: added missing checks
Diffstat (limited to 'src')
-rw-r--r-- | src/ipcpd/shim-udp/main.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c index 2d1691aa..9c295e30 100644 --- a/src/ipcpd/shim-udp/main.c +++ b/src/ipcpd/shim-udp/main.c @@ -196,10 +196,8 @@ static int port_id_to_fd(int port_id) for (i = 0; i < AP_MAX_FLOWS; ++i) { if (_ap_instance->flows[i].port_id == port_id - && _ap_instance->flows[i].state != FLOW_NULL) { - + && _ap_instance->flows[i].state != FLOW_NULL) return i; - } } return -1; @@ -457,15 +455,17 @@ static void * ipcp_udp_sdu_reader() continue; n = sizeof r_saddr; - n = recvfrom(fd, - buf, - SHIM_UDP_MAX_SDU_SIZE, - 0, - (struct sockaddr *) &r_saddr, - (unsigned *) &n); + if ((n = recvfrom(fd, + buf, + SHIM_UDP_MAX_SDU_SIZE, + 0, + (struct sockaddr *) &r_saddr, + (unsigned *) &n)) <= 0) + continue; /* send the sdu to the correct port_id */ - ipcp_udp_flow_write(fd, buf, n); + if (ipcp_udp_flow_write(fd, buf, n) < 0) + LOG_ERR("Failed to write SDU."); } } |