Skip to content

Commit

Permalink
fix icmp socket type on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Apr 23, 2017
1 parent 342e950 commit 046ddbe
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/tbox/platform/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ typedef enum __tb_socket_type_e
// socket for udp
, TB_SOCKET_TYPE_UDP = TB_SOCKET_TYPE_SOCK_DGRAM | TB_SOCKET_TYPE_IPPROTO_UDP

// socket for icmp, need root permission on linux/macOS
#ifdef TB_CONFIG_OS_WINDOWS
, TB_SOCKET_TYPE_ICMP = TB_SOCKET_TYPE_SOCK_RAW | TB_SOCKET_TYPE_IPPROTO_ICMP
#else
#ifdef TB_CONFIG_OS_MACOSX
// socket for icmp, only need user permission on macOS
, TB_SOCKET_TYPE_ICMP = TB_SOCKET_TYPE_SOCK_DGRAM | TB_SOCKET_TYPE_IPPROTO_ICMP
#else
// socket for icmp, need root permission on linux/macOS
, TB_SOCKET_TYPE_ICMP = TB_SOCKET_TYPE_SOCK_RAW | TB_SOCKET_TYPE_IPPROTO_ICMP
#endif

}tb_socket_type_e;
Expand Down

0 comments on commit 046ddbe

Please sign in to comment.