Skip to content

Commit 0c9e649

Browse files
committed
Set default MTU for an endpoint to 9000 bytes.
1 parent a427772 commit 0c9e649

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

programs/ekr_loop.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ main(int argc, char *argv[])
263263
{
264264
struct sockaddr_in sin_s, sin_c;
265265
struct sockaddr_conn sconn;
266+
struct sctp_paddrparams paddrparams;
266267
#ifdef _WIN32
267268
SOCKET fd_c, fd_s;
268269
#else
@@ -413,6 +414,17 @@ main(int argc, char *argv[])
413414
exit(EXIT_FAILURE);
414415
}
415416
debug_printf("to %d.\n", cur_buf_size);
417+
memset(&paddrparams, 0, sizeof(struct sctp_paddrparams));
418+
paddrparams.spp_address.ss_family = AF_CONN;
419+
#ifdef HAVE_SCONN_LEN
420+
paddrparams.spp_address.ss_len = sizeof(struct sockaddr_conn);
421+
#endif
422+
paddrparams.spp_flags = SPP_PMTUD_DISABLE;
423+
paddrparams.spp_pathmtu = 9000;
424+
if (usrsctp_setsockopt(s_c, IPPROTO_SCTP, SCTP_PEER_ADDR_PARAMS, &paddrparams, sizeof(struct sctp_paddrparams)) < 0) {
425+
perror("usrsctp_setsockopt");
426+
exit(EXIT_FAILURE);
427+
}
416428
if ((s_l = usrsctp_socket(AF_CONN, SOCK_STREAM, IPPROTO_SCTP, receive_cb, NULL, 0, &fd_s)) == NULL) {
417429
perror("usrsctp_socket");
418430
exit(EXIT_FAILURE);

0 commit comments

Comments
 (0)