test_fragments.c | test_fragments.c | |||
---|---|---|---|---|
skipping to change at line 89 | skipping to change at line 89 | |||
sockaddr_storage_t loop2; | sockaddr_storage_t loop2; | |||
struct iovec iov; | struct iovec iov; | |||
struct msghdr inmessage; | struct msghdr inmessage; | |||
struct msghdr outmessage; | struct msghdr outmessage; | |||
char incmsg[CMSG_SPACE(sizeof(sctp_cmsg_data_t))]; | char incmsg[CMSG_SPACE(sizeof(sctp_cmsg_data_t))]; | |||
char outcmsg[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))]; | char outcmsg[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))]; | |||
struct cmsghdr *cmsg; | struct cmsghdr *cmsg; | |||
struct sctp_sndrcvinfo *sinfo; | struct sctp_sndrcvinfo *sinfo; | |||
struct iovec out_iov; | struct iovec out_iov; | |||
int error, bytes_sent; | int error, bytes_sent; | |||
int pf_class, af_family; | int pf_class; | |||
uint32_t ppid; | uint32_t ppid; | |||
uint32_t stream; | uint32_t stream; | |||
sctp_assoc_t associd1, associd2; | ||||
struct sctp_assoc_change *sac; | ||||
char *big_buffer; | char *big_buffer; | |||
int msg_len, msg_cnt, i; | int msg_len, msg_cnt, i; | |||
void *msg_buf; | void *msg_buf; | |||
int disable_frag; | int disable_frag; | |||
socklen_t optlen; | socklen_t optlen; | |||
/* Rather than fflush() throughout the code, set stdout to | /* Rather than fflush() throughout the code, set stdout to | |||
* be unbuffered. | * be unbuffered. | |||
*/ | */ | |||
setvbuf(stdout, NULL, _IONBF, 0); | setvbuf(stdout, NULL, _IONBF, 0); | |||
/* Set some basic values which depend on the address family. */ | /* Set some basic values which depend on the address family. */ | |||
#if TEST_V6 | #if TEST_V6 | |||
pf_class = PF_INET6; | pf_class = PF_INET6; | |||
af_family = AF_INET6; | ||||
loop1.v6.sin6_family = AF_INET6; | loop1.v6.sin6_family = AF_INET6; | |||
loop1.v6.sin6_addr = in6addr_loopback; | loop1.v6.sin6_addr = in6addr_loopback; | |||
loop1.v6.sin6_port = htons(SCTP_TESTPORT_1); | loop1.v6.sin6_port = htons(SCTP_TESTPORT_1); | |||
loop2.v6.sin6_family = AF_INET6; | loop2.v6.sin6_family = AF_INET6; | |||
loop2.v6.sin6_addr = in6addr_loopback; | loop2.v6.sin6_addr = in6addr_loopback; | |||
loop2.v6.sin6_port = htons(SCTP_TESTPORT_2); | loop2.v6.sin6_port = htons(SCTP_TESTPORT_2); | |||
#else | #else | |||
pf_class = PF_INET; | pf_class = PF_INET; | |||
af_family = AF_INET; | ||||
loop1.v4.sin_family = AF_INET; | loop1.v4.sin_family = AF_INET; | |||
loop1.v4.sin_addr.s_addr = SCTP_IP_LOOPBACK; | loop1.v4.sin_addr.s_addr = SCTP_IP_LOOPBACK; | |||
loop1.v4.sin_port = htons(SCTP_TESTPORT_1); | loop1.v4.sin_port = htons(SCTP_TESTPORT_1); | |||
loop2.v4.sin_family = AF_INET; | loop2.v4.sin_family = AF_INET; | |||
loop2.v4.sin_addr.s_addr = SCTP_IP_LOOPBACK; | loop2.v4.sin_addr.s_addr = SCTP_IP_LOOPBACK; | |||
loop2.v4.sin_port = htons(SCTP_TESTPORT_2); | loop2.v4.sin_port = htons(SCTP_TESTPORT_2); | |||
#endif /* TEST_V6 */ | #endif /* TEST_V6 */ | |||
skipping to change at line 185 | skipping to change at line 181 | |||
inmessage.msg_iov = &iov; | inmessage.msg_iov = &iov; | |||
inmessage.msg_iovlen = 1; | inmessage.msg_iovlen = 1; | |||
inmessage.msg_control = incmsg; | inmessage.msg_control = incmsg; | |||
/* Get the communication up message on sk2. */ | /* Get the communication up message on sk2. */ | |||
inmessage.msg_controllen = sizeof(incmsg); | inmessage.msg_controllen = sizeof(incmsg); | |||
error = test_recvmsg(sk2, &inmessage, MSG_WAITALL); | error = test_recvmsg(sk2, &inmessage, MSG_WAITALL); | |||
test_check_msg_notification(&inmessage, error, | test_check_msg_notification(&inmessage, error, | |||
sizeof(struct sctp_assoc_change), | sizeof(struct sctp_assoc_change), | |||
SCTP_ASSOC_CHANGE, SCTP_COMM_UP); | SCTP_ASSOC_CHANGE, SCTP_COMM_UP); | |||
#if 0 | ||||
sac = (struct sctp_assoc_change *)iov.iov_base; | sac = (struct sctp_assoc_change *)iov.iov_base; | |||
associd2 = sac->sac_assoc_id; | associd2 = sac->sac_assoc_id; | |||
#endif | ||||
/* Get the communication up message on sk1. */ | /* Get the communication up message on sk1. */ | |||
inmessage.msg_controllen = sizeof(incmsg); | inmessage.msg_controllen = sizeof(incmsg); | |||
error = test_recvmsg(sk1, &inmessage, MSG_WAITALL); | error = test_recvmsg(sk1, &inmessage, MSG_WAITALL); | |||
test_check_msg_notification(&inmessage, error, | test_check_msg_notification(&inmessage, error, | |||
sizeof(struct sctp_assoc_change), | sizeof(struct sctp_assoc_change), | |||
SCTP_ASSOC_CHANGE, SCTP_COMM_UP); | SCTP_ASSOC_CHANGE, SCTP_COMM_UP); | |||
#if 0 | ||||
sac = (struct sctp_assoc_change *)iov.iov_base; | sac = (struct sctp_assoc_change *)iov.iov_base; | |||
associd1 = sac->sac_assoc_id; | associd1 = sac->sac_assoc_id; | |||
#endif | ||||
/* Get the first message which was sent. */ | /* Get the first message which was sent. */ | |||
inmessage.msg_controllen = sizeof(incmsg); | inmessage.msg_controllen = sizeof(incmsg); | |||
error = test_recvmsg(sk2, &inmessage, MSG_WAITALL); | error = test_recvmsg(sk2, &inmessage, MSG_WAITALL); | |||
test_check_msg_data(&inmessage, error, msg_len, MSG_EOR, stream, pp id); | test_check_msg_data(&inmessage, error, msg_len, MSG_EOR, stream, pp id); | |||
free(msg_buf); | free(msg_buf); | |||
/* Disable fragmentation. */ | /* Disable fragmentation. */ | |||
disable_frag = 1; | disable_frag = 1; | |||
test_setsockopt(sk1, SCTP_DISABLE_FRAGMENTS, &disable_frag, | test_setsockopt(sk1, SCTP_DISABLE_FRAGMENTS, &disable_frag, | |||
skipping to change at line 226 | skipping to change at line 224 | |||
if ((error != 0) && (disable_frag != 1)) | if ((error != 0) && (disable_frag != 1)) | |||
tst_brkm(TBROK, tst_exit, "getsockopt(SCTP_DISABLE_FRAGMENTS ) " | tst_brkm(TBROK, tst_exit, "getsockopt(SCTP_DISABLE_FRAGMENTS ) " | |||
"error:%d errno:%d disable_frag:%d", | "error:%d errno:%d disable_frag:%d", | |||
error, errno, disable_frag); | error, errno, disable_frag); | |||
tst_resm(TPASS, "getsockopt(SCTP_DISABLE_FRAGMENTS)"); | tst_resm(TPASS, "getsockopt(SCTP_DISABLE_FRAGMENTS)"); | |||
/* Try to send a messsage that exceeds association fragmentation poi nt | /* Try to send a messsage that exceeds association fragmentation poi nt | |||
* and verify that it fails. | * and verify that it fails. | |||
*/ | */ | |||
msg_len = 30000; | msg_len = 100000; | |||
msg_buf = test_build_msg(msg_len); | msg_buf = test_build_msg(msg_len); | |||
outmessage.msg_iov->iov_base = msg_buf; | outmessage.msg_iov->iov_base = msg_buf; | |||
outmessage.msg_iov->iov_len = msg_len; | outmessage.msg_iov->iov_len = msg_len; | |||
error = sendmsg(sk1, &outmessage, 0); | error = sendmsg(sk1, &outmessage, 0); | |||
if ((error != -1) || (errno != EMSGSIZE)) | if ((error != -1) || (errno != EMSGSIZE)) | |||
tst_brkm(TBROK, tst_exit, "Send a message that excee ds " | tst_brkm(TBROK, tst_exit, "Send a message that excee ds " | |||
"assoc frag point error:%d errno:%d", error, errno) ; | "assoc frag point error:%d errno:%d", error, errno) ; | |||
tst_resm(TPASS, "Send a message that exceeds assoc frag point"); | tst_resm(TPASS, "Send a message that exceeds assoc frag point"); | |||
End of changes. 9 change blocks. | ||||
8 lines changed or deleted | 6 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |