diff options
author | Joseph Henry <joseph.henry@zerotier.com> | 2015-10-13 14:27:30 -0400 |
---|---|---|
committer | Joseph Henry <joseph.henry@zerotier.com> | 2015-10-13 14:27:30 -0400 |
commit | 73145de618e29032816eb753be8763b6710ea30b (patch) | |
tree | 4c160d8abc001b3e5e2ef897b926273d9d39ec7a /netcon/NetconEthernetTap.cpp | |
parent | 82052459a238334154938d296aa16e29d169b551 (diff) | |
download | infinitytier-73145de618e29032816eb753be8763b6710ea30b.tar.gz infinitytier-73145de618e29032816eb753be8763b6710ea30b.zip |
Added some parameter checks from linux kernel syscall source
Diffstat (limited to 'netcon/NetconEthernetTap.cpp')
-rw-r--r-- | netcon/NetconEthernetTap.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/netcon/NetconEthernetTap.cpp b/netcon/NetconEthernetTap.cpp index 88cd3d97..824f1734 100644 --- a/netcon/NetconEthernetTap.cpp +++ b/netcon/NetconEthernetTap.cpp @@ -700,17 +700,13 @@ void NetconEthernetTap::nc_err(void *arg, err_t err) */ err_t NetconEthernetTap::nc_poll(void* arg, struct tcp_pcb *tpcb) { - uint64_t now = OSUtils::now(); - //fprintf(stderr, "nc_poll(): now = %u\n", now); - //fprintf(stderr, "nc_poll\n"); - - + /* Larg *l = (Larg*)arg; TcpConnection *conn = l->conn; NetconEthernetTap *tap = l->tap; if(conn && conn->idx) // if valid connection and non-zero index (indicating data present) tap->handle_write(conn); - + */ return ERR_OK; } @@ -736,7 +732,6 @@ err_t NetconEthernetTap::nc_sent(void* arg, struct tcp_pcb *tpcb, u16_t len) //uint64_t now = OSUtils::now(); //fprintf(stderr, "nc_sent(): now = %u\n", now); l->tap->_phy.whack(); - //l->tap->handle_write(l->conn); } return ERR_OK; } @@ -856,10 +851,10 @@ void NetconEthernetTap::handle_bind(PhySocket *sock, void **uptr, struct bind_st * @param structure containing the data and parameters for this client's RPC * - [ ] EADDRINUSE - Another socket is already listening on the same port. + [?] EADDRINUSE - Another socket is already listening on the same port. [X] EBADF - The argument sockfd is not a valid descriptor. - [ ] ENOTSOCK - The argument sockfd is not a socket. - [ ] EOPNOTSUPP - The socket is not of a type that supports the listen() operation. + [i] ENOTSOCK - The argument sockfd is not a socket. + [i] EOPNOTSUPP - The socket is not of a type that supports the listen() operation. */ void NetconEthernetTap::handle_listen(PhySocket *sock, void **uptr, struct listen_st *listen_rpc) @@ -886,6 +881,7 @@ void NetconEthernetTap::handle_listen(PhySocket *sock, void **uptr, struct liste } } else { + // We can't find a connection mapped to the socket fd provided fprintf(stderr, "handle_listen(): can't locate connection for PCB\n"); send_return_value(conn, -1, EBADF); } @@ -954,7 +950,7 @@ void NetconEthernetTap::handle_socket(PhySocket *sock, void **uptr, struct socke [i] EACCES - For UNIX domain sockets, which are identified by pathname: Write permission is denied ... [ ] EACCES, EPERM - The user tried to connect to a broadcast address without having the socket broadcast flag enabled ... [i] EADDRINUSE - Local address is already in use. - [?] EAFNOSUPPORT - The passed address didn't have the correct address family in its sa_family field. + [i] EAFNOSUPPORT - The passed address didn't have the correct address family in its sa_family field. [ ] EAGAIN - No more free local ports or insufficient entries in the routing cache. [ ] EALREADY - The socket is nonblocking and a previous connection attempt has not yet been completed. [ ] EBADF - The file descriptor is not a valid index in the descriptor table. |