diff options
Diffstat (limited to 'src/ipcpd')
| -rw-r--r-- | src/ipcpd/ipcp.c | 7 | ||||
| -rw-r--r-- | src/ipcpd/shim-eth-llc/main.c | 2 | 
2 files changed, 8 insertions, 1 deletions
diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c index a9f2b77b..784d845a 100644 --- a/src/ipcpd/ipcp.c +++ b/src/ipcpd/ipcp.c @@ -113,6 +113,9 @@ void * ipcp_main_loop(void * o)          char * sock_path; +        struct timeval tv = {(SOCKET_TIMEOUT / 1000), +                             (SOCKET_TIMEOUT % 1000) * 1000}; +          if (_ipcp == NULL) {                  LOG_ERR("Invalid ipcp struct.");                  return (void *) 1; @@ -141,6 +144,10 @@ void * ipcp_main_loop(void * o)                          break;                  } +                if (setsockopt(lsockfd, SOL_SOCKET, SO_RCVTIMEO, +                               (void *) &tv, sizeof(tv))) +                        LOG_WARN("Failed to set timeout on socket."); +                  pthread_cleanup_push(close_ptr, (void *) &lsockfd);                  count = read(lsockfd, buf, IPCP_MSG_BUF_SIZE); diff --git a/src/ipcpd/shim-eth-llc/main.c b/src/ipcpd/shim-eth-llc/main.c index b8689ac7..c719f5c5 100644 --- a/src/ipcpd/shim-eth-llc/main.c +++ b/src/ipcpd/shim-eth-llc/main.c @@ -379,7 +379,7 @@ static int eth_llc_ipcp_send_frame(uint8_t   dst_addr[MAC_SIZE],          header->tp_len = frame_len;          header->tp_status = TP_STATUS_SEND_REQUEST; -        if (send(fd, NULL, 0, 0) < 0) { +        if (send(fd, NULL, 0, MSG_DONTWAIT) < 0) {                  LOG_ERR("Failed to write frame into TX_RING.");                  return -1;          }  | 
