wiki:network_model

Error transitions in NetCheck's network model

Note: This table is based on our code and the focus is on error conditions (successful transitions are not shown). There are three categories of errors:

  • Local Errors
  • In-Network Errors
  • Portability Issues

Items in italics are the returned values or parameters of a syscall in the trace.

Syscall Condition Error Diagnoses Category

socket

socket type is SOCK_STREAM but protocol is not TCP, or the socket type is SOCK_DGRAM but the protocol is not UDP

EPROTOTYPE: The socket type is not supported by the protocol

Local Error

bind

errno == 'EADDRINUSE'

EADDRINUSE: Address already in use

Local Error

sockets struct has either local IP or peer IP non-empty for this socket

EINVAL: Socket is already bound to an address

Local Error

the socket shares the same local IP and local port with another active socket in the sockets struct

EADDRINUSE: Another socket is already bound to that address and port

Local Error

the socket shares the same local port with another active socket in the sockets struct, and addr is 0.0.0.0 or ::

EADDRINUSE: Binding to unspecified address when port is already in use

Local Error

the socket shares the same local port with another active socket in the sockets struct, and local IP is 0.0.0.0 or ::

EADDRINUSE: Another socket is already bound to an unspecified address and that port

Local Error

the other active socket uses SO_REUSEADDR to allow rebinding

EADDRINUSE: not portable

Portability Issue

listen

socket local IP is empty and socket state is not BOUND

EDESTADDRREQ: socket is not bound to a local address, and the protocol does not support listening on an unbound socket

Local Error

socket state is CONNECTED

EINVAL: The socket is already connected

In-Network Error

socket protocol is UDP or IP

EOPNOTSUPP: socket protocol does not support listen()

Local Error

accept

connected_socket == -1 and errno == 'EAGAIN' or errno == 'EWOULDBLOCK' and socket's nonblocking flag is set to 1 explicitly (by fcntl or ioctl)

EAGAIN/EWOULDBLOCK: Resource temporarily unavailable

Local Error

connected_socket == -1 and errno == 'EAGAIN' or errno == 'EWOULDBLOCK' and socket's nonblocking flag is set to 1 by inheritance

COULD_HAVE_BLOCKED: The socket inherited the nonblocking flag from the server socket that returned it, which does not consistently happen across operating systems

Portability Issue

connected_socket == -1 and errno == 'EAGAIN' or errno == 'EWOULDBLOCK' and not the two cases above

EXPECTED_BLOCKING: Socket does not have the nonblocking flag set

Local Error

socket not in struct pending_connections

NO_PENDING_CONN: There are no pending connections

In-Network Error

connect

UDP: addr is a broadcast IP and socket's broadcast flag is 0 by inheritance

Warning: Socket has inherited SO_BROADCAST flag from parent and cannot send data

Portability Issue

UDP: addr is a broadcast IP and socket's broadcast flag is 0

EACCES: Sockets's trying to connect to broadcast address without using the broadcast flag

Local Error

UDP: addr is not loopback and socket local IP is loopback

EINVAL: UDP connect on socket bound to loopback to non-loopback IP

Local Error

UDP: errno is not None and not of any cases above

UNEXPECTED_FAILURE: UDP connect failed unexpectedly

Local Error

TCP: socket state is CONNECTED

EISCONN: Socket is already connected

In-Network Error

TCP: errno == 'EINPROGRESS' or 'EALREADY' or "EWOULDBLOCK" and socket state is PENDING

EALREADY: The socket is nonblocking and a previous connection attempt has not yet been completed

In-Network Error

TCP: errno == 'EINPROGRESS' or 'EALREADY' or "EWOULDBLOCK" and in struct active_sockets node==node_name and fd != sock and socket state is PENDING

OVERLAPPING_CONNECTS: This trace already has one or more nonblocking connects pending, which may mean that the corresponding accepts are improperly matched

In-Network Error

TCP: addr is not loopback and socket local IP is loopback

EINVAL: TCP connect on socket bound to loopback to non-loopback IP

Local Error

TCP: errno == 'EINPROGRESS' or 'EALREADY' or "EWOULDBLOCK" and socket's nonblocking flag is set to 1 explicitly (by fcntl or ioctl)

EINPROGRESS: socket is nonblocking and the connection cannot be completed immediately

In-Network Error

TCP: errno == 'EINPROGRESS' or 'EALREADY' or "EWOULDBLOCK" and socket's nonblocking flag is set to 1 by inheritance

COULD_HAVE_BLOCKED: The socket inherited the nonblocking flag from the server socket that returned it, which does not consistently happen across operating systems

Portability Issue

TCP: errno == 'EINPROGRESS' or 'EALREADY' or "EWOULDBLOCK" and not the above two cases

EXPECTED_BLOCKING: Socket does not have the nonblocking flag set

Local Error

TCP: errno == 'ECONNREFUSED' or 'EINVAL'

ECONNREFUSED: The target address was not listening for connections

In-Network Error

TCP: addr is not loopback and socket local IP is loopback

EINVAL: TCP connect on socket bound to loopback to non-loopback IP

Local Error

TCP: errno is not None and not of any cases above

UNEXPECTED_FAILURE: TCP connect failed unexpectedly

Local Error

send

socket state is PENDING and errno == 'EAGAIN' or 'EWOULDBLOCK'

EAGAIN/EWOULDBLOCK: No data was sent

In-Network Error

socket state is not CONNECTED

ENOTCONN: descriptor is not connected

In-Network Error

flags == MSG_OOB and socket type is not SOCK_STREAM

EOPNOTSUPP: some bit in the flags argument is inappropriate for socket type

Local Error

msg_len == -1 and errno != 'EPIPE' and errno != 'ECONNRESET' and errno == 'EAGAIN' or 'EWOULDBLOCK' and socket's nonblocking flag is set to 1 explicitly (by fcntl or ioctl)

EAGAIN/EWOULDBLOCK: No data was sent

In-Network Error

msg_len == -1 and errno != 'EPIPE' and errno != 'ECONNRESET' and errno == 'EAGAIN' or 'EWOULDBLOCK' and socket's nonblocking flag is set to 1 by inheritance

COULD_HAVE_BLOCKED: The socket inherited the nonblocking flag from the server socket that returned it, which does not consistently happen across operating systems

Portability Issue

msg_len == -1 and errno != 'EPIPE' and errno != 'ECONNRESET' and errno == 'EAGAIN' or 'EWOULDBLOCK' and not the above two cases

EXPECTED_BLOCKING: Socket does not have the nonblocking flag set

Local Error

socket is accepting socket, and msg_len < 0 and in struct tcp_tuples, shutdown or connected socket is not in active_sockets

EPIPE/ECONNRESET: connection has been closed

In-Network Error

socket is accepting socket, and msg_len < 0 and not the above case

CONN_NOT_CLOSED: connection has not been closed

In-Network Error

in struct tcp_tuples, socket is accepting socket, and message length > send buffer size

MSG_>_BUFSIZE: Sending this message has caused data in the buffer to exceed the buffer size

Local Error

connected fd is in struct poll_timeout

NETWORK_ERROR: Poll/ Select returned nothing although data in the air

In-Network Error

socket is connected socket, and msg_len < 0 and in struct tcp_tuples, shutdown or accepting socket is not in active_sockets

EPIPE/ECONNRESET: connection has been closed

In-Network Error

socket is connected socket, and msg_len < 0 and not the above case

CONN_NOT_CLOSED: connection has not been closed

In-Network Error

in struct tcp_tuples, socket is connected socket, and message length > send buffer size

MSG_>_BUFSIZE: Sending this message has caused data in the buffer to exceed the buffer size

Local Error

accepting fd is in struct poll_timeout

NETWORK_ERROR: Poll/ Select returned nothing although data in the air

In-Network Error

sendto

dest_addr == None and dest_port == None and socket peer IP is None

EDESTADDRREQ: socket is not connection-mode, and no peer address is set

Local Error

msg_len > send buffer size

MSG_>_BUFSIZE: socket is trying to send a message larger than its send buffer size, which is not portable

Local Error

dest_addr is a broadcast IP and socket's broadcast flag is 0 by inheritance

Warning: Socket has inherited SO_BROADCAST flag from parent and cannot send data

Portability Issue

dest_addr is a broadcast IP and socket's broadcast flag is 0

EACCES: Sockets's trying to connect to broadcast address without using the broadcast flag

Local Error

dest_addr is not loopback and socket local IP is loopback

EINVAL: UDP connect on socket bound to loopback to non-loopback IP

Local Error

msg_len == -1 and errno == 'EAGAIN' or 'EWOULDBLOCK' and socket's nonblocking flag is set to 1 explicitly (by fcntl or ioctl)

EAGAIN/EWOULDBLOCK: No data was sent

In-Network Error

msg_len == -1 and errno == 'EAGAIN' or 'EWOULDBLOCK' and socket's nonblocking flag is set to 1 by inheritance

COULD_HAVE_BLOCKED: The socket inherited the nonblocking flag from the server socket that returned it, which does not consistently happen across operating systems

Portability Issue

msg_len == -1 and not the above two cases

EXPECTED_BLOCKING: Socket does not have the nonblocking flag set

Local Error

socket is accepting fd, and connected_ip == dest_addr and connected_port == dest_port and socket connected fd in struct poll_timeout

NETWORK_ERROR: Poll/ Select returned nothing although there is 'data in the air'

In-Network Error

socket is connected fd, and connected_ip == dest_addr and connected_port == dest_port and socket accepting fd in struct poll_timeout

NETWORK_ERROR: Poll/ Select returned nothing although there is 'data in the air'

In-Network Error

recv

socket state is PENDING and errno == 'EAGAIN' or 'EWOULDBLOCK'

EAGAIN/EWOULDBLOCK: No data was received

In-Network Error

socket state is not CONNECTED

ENOTCONN: receive is attempted on a connection-mode socket that is not connected

In-Network Error

msg_len == -1 and errno == 'EAGAIN' or 'EWOULDBLOCK' and socket's nonblocking flag is set to 1 explicitly (by fcntl or ioctl)

EAGAIN/EWOULDBLOCK: No data was sent

In-Network Error

msg_len == -1 and errno == 'EAGAIN' or 'EWOULDBLOCK' and socket's nonblocking flag is set to 1 by inheritance

COULD_HAVE_BLOCKED: The socket inherited the nonblocking flag from the server socket that returned it, which does not consistently happen across operating systems

Portability Issue

msg_len == -1 and not the above two cases

EXPECTED_BLOCKING: Socket does not have the nonblocking flag set

Local Error

msg_len > buf_len

MSG_BIGGER_THAN_BUFFER: Message is bigger than the buffer size

Local Error

socket is accepting socket, and msg_len == 0 and connection is not shutdown and the corresponding connected socket's buffer is non-empty or the corresponding connected socket is in active_sockets

NETWORK_ERROR: Data 'in the air' or connection not closed but recv/read returns 0 bytes

In-Network Error

socket is accepting socket, and the received message != the message sent

MSG_DONT_MATCH: Message trying to be received does not match the data already sent by socket. Ignoring future traffic on this connection since we can't recover

In-Network Error

socket is accepting socket, and the length of the corresponding connected socket's buffer < msg_len

MSGNOTSENT: Message trying to be received has not yet been sent

In-Network Error

socket is connected socket, and the corresponding accepting socket is None

MSGNOTSENT: The message was not sent, because the other side has not accepted the connection

In-Network Error

socket is connected fd, and msg_len == 0 and connection is not shutdown and the corresponding accepting socket's buffer is non-empty or the corresponding accepting socket is in struct active_sockets

NETWORK_ERROR: Data 'in the air' or connection not closed but recv/read returns 0 bytes

In-Network Error

socket is connected socket, and the received message != the message sent

MSG_DONT_MATCH: Message trying to be received does not match the data already sent by socket. Ignoring future traffic on this connection since we can't recover

In-Network Error

socket is connected socket, and the length of the corresponding accepting socket's buffer < msg_len

MSGNOTSENT: Message trying to be received has not yet been sent

In-Network Error

recvfrom

msg_len > receive buffer size

MSG_>_BUFSIZE: The socket is receiving a message larger than its receive buffer size, which is not portable

Portability Issue

msg_len == -1 and errno == 'EAGAIN' or 'EWOULDBLOCK' and socket's nonblocking flag is set to 1 explicitly (by fcntl or ioctl)

EAGAIN/EWOULDBLOCK: No data was received

In-Network Error

msg_len == -1 and errno == 'EAGAIN' or 'EWOULDBLOCK' and socket's nonblocking flag is set to 1 by inheritance

COULD_HAVE_BLOCKED: The socket inherited the nonblocking flag from the server socket that returned it, which does not consistently happen across operating systems

Portability Issue

msg_len == -1 and not the above two cases

EXPECTED_BLOCKING: Socket does not have the nonblocking flag set

Local Error

msg_len > buf_len

MSG_BIGGER_THAN_BUFFER: Message is bigger than the buffer size

Local Error

socket is accepting socket, and the corresponding connected socket's IP == rem_ip and port == rem_port, for any datagram on this connection, if # of times it has been sent > received, or multicast address is non-empty, and this datagram starts with msg

MSGNOTSENT: The message was not sent, but may have been truncated from a longer message

In-Network Error

socket is connected socket, and the corresponding accepting socket's IP == rem_ip and port == rem_port, for any datagram on this connection, if # of times it has been sent > received, or multicast address is non-empty, and this datagram starts with msg

MSGNOTSENT: The message was not sent, but may have been truncated from a longer message

In-Network Error

peer socket is accepting socket, for any datagram on this connection, if # of times it has been sent > received, or multicast address is non-empty, and this datagram starts with msg

MSGNOTSENT: The message was not sent, but may have been truncated from a longer message

In-Network Error

peer socket is connected socket, and for any datagram on this connection, if # of times it has been sent > received, or multicast address is non-empty, and this datagram starts with msg

MSGNOTSENT: The message was not sent, but may have been truncated from a longer message

In-Network Error

close

errno == 'EAGAIN' or 'EWOULDBLOCK' and the linger option of socket has either l_onoff set to 0, or l_linger set to 0 (reference [1])

EXPECTED_BLOCKING: Socket does not have the linger option set

In-Network Error

errno == 'EAGAIN' or 'EWOULDBLOCK' and socket's nonblocking flag is set to 1 explicitly (by fcntl or ioctl)

EAGAIN/EWOULDBLOCK: Close did not complete

In-Network Error

errno == 'EAGAIN' or 'EWOULDBLOCK' and socket's nonblocking flag is set to 1 by inheritance

COULD_HAVE_BLOCKED: The socket inherited the nonblocking flag from the server socket that returned it, which does not consistently happen across operating systems

Portability Issue

errno == 'EAGAIN' or 'EWOULDBLOCK' and not above three cases

EXPECTED_BLOCKING: Socket does not have the nonblocking flag set

Local Error

socket is a connected TCP socket and the corresponding accepting socket's buffer is non-empty

NONEMPTY_BUFFERS: Socket's closed while there is data in the buffer

Local Error

socket is an accepting TCP socket and the corresponding connected socket's buffer is non-empty

NONEMPTY_BUFFERS: Socket's closed while there is data in the buffer

Local Error

UDP: connected IP == sockets local IP and connected port == sockets local port, for any datagram sent by this socket, if # of times it has been sent > received

NONEMPTY_BUFFERS: Socket's closed while there is data in the buffer

Local Error

shutdown

socket state is CREATED or BOUND or protocol is UDP

ENOTCONN: Attempted to shutdown a socket that is not connected

Local Error

socket state is not CONNECTED

ENOTCONN: Attempted to shutdown a socket that is not connected

In-Network Error

setsockopt

level == SOL_SOCKET and optname == SO_ERROR or SO_ACCEPTCONN or SO_TYPE or SO_SNDLOWAT or SO_RCVLOWAT

ENOPROTOOPT: The option is unknown at the level indicated

Local Error

level == SOL_SOCKET and optname == SO_KEEPALIVE or SO_OOBINLINE and protocol is not TCP

ENOPROTOOPT: The option is unknown for that protocol

Local Error

level == SOL_SOCKET and optname == SO_BROADCAST and protocol is not UDP

ENOPROTOOPT: The option is unknown for that protocol

Local Error

level == SOL_IP and protocol is not UDP

ENOPROTOOPT: The option is unknown for that protocol

Local Error

level == SOL_IP and multiaddr = socket.inet_ntoa(optval[:4]) andmultiaddr is not multicast

EINVAL: Trying to add multicast membership for a non-multicast IP

Local Error

getsockopt

level == SOL_SOCKET and optname == SO_SNDLOWAT or SO_RCVLOWAT

ENOPROTOOPT: The option is unknown for that protocol

Local Error

getpeername

socket peer IP is None

ENOTCONN: descriptor is not connected

In-Network Error

getsockname

socket state is CREATED

STATE_CREATED: No addr/port have been assigned to the socket, since it's only been created

Local Error

socket local IP != addr or socket local port != port

BOUND_ADDR_DIFFERENT: The IP addr that getsockname returns is different than the one that the socket is already bound to

Local Error

select

Timeout returned and readfd state == LISTEN and readfd in struct pending_connections

NETWORK_ERROR: Available connection but select sees nothing

In-Network Error

TCP: Timeout returned and readfd is accepting socket and the corresponding connected socket's buffer is non-empty; or readfd is connected socket and the corresponding accepting socket's buffer is non-empty

NETWORK_ERROR: Data 'in the air' but select sees nothing

In-Network Error

UDP: Timeout returned and readfd is accepting socket and for any datagram on this connection, if # of times it has been sent > received

NETWORK_ERROR: Data 'in the air' but select sees nothing

In-Network Error

UDP: Timeout returned and readfd is connected socket and for any datagram on this connection, if # of times it has been sent > received

NETWORK_ERROR: Data 'in the air' but select sees nothing

In-Network Error

TCP: select returned socket descriptor is accepting socket and the corresponding connected socket's buffer is empty and connection not shutdown and the corresponding connected socket is in struct active_sockets

NETWORK_ERROR: No data 'in the air' but select sees something

In-Network Error

TCP: select returned socket descriptor is connected socket and the corresponding accepting socket's buffer is empty and connection not shutdown and the corresponding accepting socket is in struct active_sockets

NETWORK_ERROR: No data 'in the air' but select sees something

In-Network Error

UDP: select returned socket descriptor is accepting socket and for any datagram on this connection, if # of times it has been sent > received

NETWORK_ERROR: No data 'in the air' but select sees something

In-Network Error

UDP: select returned socket descriptor is connected socket, and for any datagram on this connection, if # of times it has been sent > received

NETWORK_ERROR: No data 'in the air' but select sees something

In-Network Error

None of the above

*

UNKNOWN_SYSCALL:The call is not currently handled by the model

Local Error

References

[1] Setting the SO_LINGER Option, http://alas.matf.bg.ac.rs/manuals/lspe/snode=105.html

Last modified 3 years ago Last modified on Feb 10, 2014 1:06:13 PM