mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-20 05:13:58 -07:00
Fixed socket protocol check logic in socket()
This commit is contained in:
parent
73145de618
commit
0912d4be59
4 changed files with 21 additions and 10 deletions
|
@ -515,15 +515,16 @@ void sock_domain_to_str(int domain)
|
|||
int socket(SOCKET_SIG)
|
||||
{
|
||||
#ifdef CHECKS
|
||||
/* Check that type makes sense */
|
||||
int flags = socket_type & ~SOCK_TYPE_MASK;
|
||||
if (flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK))
|
||||
return -EINVAL;
|
||||
socket_type &= SOCK_TYPE_MASK;
|
||||
/* Check protocol is in range */
|
||||
if (socket_family < 0 || socket_family >= NPROTO)
|
||||
return -EAFNOSUPPORT;
|
||||
if (socket_type < 0 || socket_type >= SOCK_MAX)
|
||||
return -EINVAL;
|
||||
/* Check that type makes sense */
|
||||
int flags = socket_type & ~SOCK_TYPE_MASK;
|
||||
if (flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK))
|
||||
return -EINVAL;
|
||||
#endif
|
||||
|
||||
#ifdef DUMMY
|
||||
|
@ -658,7 +659,8 @@ int connect(CONNECT_SIG)
|
|||
---------------------------------- select() ------------------------------------
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout */
|
||||
/* int n, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *exceptfds, struct timeval *timeout */
|
||||
int select(SELECT_SIG)
|
||||
{
|
||||
#ifdef DUMMY
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue