protect IPPROTO_SCTP with WOLFSSL_SCTP in test.h

This commit is contained in:
Chris Conlon
2016-10-04 15:49:03 -06:00
parent 81a8ad0a48
commit 29cf90a425

View File

@@ -632,10 +632,13 @@ static INLINE void build_addr(SOCKADDR_IN_T* addr, const char* peer,
if (udp) { if (udp) {
hints.ai_socktype = SOCK_DGRAM; hints.ai_socktype = SOCK_DGRAM;
hints.ai_protocol = IPPROTO_UDP; hints.ai_protocol = IPPROTO_UDP;
} else if (sctp) { }
#ifdef WOLFSSL_SCTP
else if (sctp) {
hints.ai_socktype = SOCK_STREAM; hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_SCTP; hints.ai_protocol = IPPROTO_SCTP;
} }
#endif
else { else {
hints.ai_socktype = SOCK_STREAM; hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP; hints.ai_protocol = IPPROTO_TCP;
@@ -663,8 +666,10 @@ static INLINE void tcp_socket(SOCKET_T* sockfd, int udp, int sctp)
{ {
if (udp) if (udp)
*sockfd = socket(AF_INET_V, SOCK_DGRAM, IPPROTO_UDP); *sockfd = socket(AF_INET_V, SOCK_DGRAM, IPPROTO_UDP);
#ifdef WOLFSSL_SCTP
else if (sctp) else if (sctp)
*sockfd = socket(AF_INET_V, SOCK_STREAM, IPPROTO_SCTP); *sockfd = socket(AF_INET_V, SOCK_STREAM, IPPROTO_SCTP);
#endif
else else
*sockfd = socket(AF_INET_V, SOCK_STREAM, IPPROTO_TCP); *sockfd = socket(AF_INET_V, SOCK_STREAM, IPPROTO_TCP);