Skip to content
Snippets Groups Projects
Commit 1b35bb1d authored by hoelscher's avatar hoelscher
Browse files

Correcting errors for setsockopt with sctp_rtoinfo

parent 646f8749
No related branches found
No related tags found
No related merge requests found
...@@ -1586,8 +1586,9 @@ static int syscall_getsockopt(struct state *state, struct syscall_spec *syscall, ...@@ -1586,8 +1586,9 @@ static int syscall_getsockopt(struct state *state, struct syscall_spec *syscall,
live_optlen = (socklen_t)sizeof(struct linger); live_optlen = (socklen_t)sizeof(struct linger);
#ifdef SCTP_RTOINFO #ifdef SCTP_RTOINFO
} else if (val_expression->type == EXPR_SCTP_RTOINFO) { } else if (val_expression->type == EXPR_SCTP_RTOINFO) {
live_optval = malloc(sizeof(struct sctp_rtoinfo)); live_optval = calloc(1, sizeof(struct sctp_rtoinfo));
live_optlen = (socklen_t)sizeof(struct sctp_rtoinfo); live_optlen = (socklen_t)sizeof(struct sctp_rtoinfo);
((struct sctp_rtoinfo*)live_optval)->srto_assoc_id = 0;
#endif #endif
#ifdef SCTP_STATUS #ifdef SCTP_STATUS
} else if (val_expression->type == EXPR_SCTP_STATUS) { } else if (val_expression->type == EXPR_SCTP_STATUS) {
...@@ -1651,7 +1652,7 @@ static int syscall_getsockopt(struct state *state, struct syscall_spec *syscall, ...@@ -1651,7 +1652,7 @@ static int syscall_getsockopt(struct state *state, struct syscall_spec *syscall,
struct expression *srto_max = val_expression->value.sctp_rtoinfo->srto_max; struct expression *srto_max = val_expression->value.sctp_rtoinfo->srto_max;
struct expression *srto_min = val_expression->value.sctp_rtoinfo->srto_min; struct expression *srto_min = val_expression->value.sctp_rtoinfo->srto_min;
struct sctp_rtoinfo *rtoinfo = live_optval; struct sctp_rtoinfo *rtoinfo = live_optval;
int initial, max, min; int initial=0, max=0, min=0;
if (srto_initial->type == EXPR_INTEGER) { if (srto_initial->type == EXPR_INTEGER) {
if (get_s32(srto_initial, &initial, error)) { if (get_s32(srto_initial, &initial, error)) {
free(live_optval); free(live_optval);
...@@ -1776,16 +1777,17 @@ static int syscall_setsockopt(struct state *state, struct syscall_spec *syscall, ...@@ -1776,16 +1777,17 @@ static int syscall_setsockopt(struct state *state, struct syscall_spec *syscall,
optval = &optval_s32; optval = &optval_s32;
#ifdef SCTP_RTOINFO #ifdef SCTP_RTOINFO
} else if (val_expression->type == EXPR_SCTP_RTOINFO) { } else if (val_expression->type == EXPR_SCTP_RTOINFO) {
if(val_expression->value.sctp_rtoinfo->srto_initial->type != EXPR_INTEGER || if (val_expression->value.sctp_rtoinfo->srto_initial->type != EXPR_INTEGER ||
val_expression->value.sctp_rtoinfo->srto_max->type != EXPR_INTEGER || val_expression->value.sctp_rtoinfo->srto_max->type != EXPR_INTEGER ||
val_expression->value.sctp_rtoinfo->srto_min->type != EXPR_INTEGER) { val_expression->value.sctp_rtoinfo->srto_min->type != EXPR_INTEGER) {
asprintf(error, "Bad setsockopt, bad inputtype for rtoinfo");
return STATUS_ERR; return STATUS_ERR;
} }
optval = malloc(sizeof(struct sctp_rtoinfo)); optval = malloc(sizeof(struct sctp_rtoinfo));
((struct sctp_rtoinfo*) optval)->srto_initial = val_expression->value.sctp_rtoinfo->srto_initial->value.num; ((struct sctp_rtoinfo*) optval)->srto_initial = val_expression->value.sctp_rtoinfo->srto_initial->value.num;
((struct sctp_rtoinfo*) optval)->srto_max = val_expression->value.sctp_rtoinfo->srto_initial->value.num; ((struct sctp_rtoinfo*) optval)->srto_max = val_expression->value.sctp_rtoinfo->srto_max->value.num;
((struct sctp_rtoinfo*) optval)->srto_min = val_expression->value.sctp_rtoinfo->srto_initial->value.num; ((struct sctp_rtoinfo*) optval)->srto_min = val_expression->value.sctp_rtoinfo->srto_min->value.num;
optval = &val_expression->value.sctp_rtoinfo; ((struct sctp_rtoinfo*) optval)->srto_assoc_id = 0;
#endif #endif
#ifdef SCTP_INITMSG #ifdef SCTP_INITMSG
} else if (val_expression->type == EXPR_SCTP_INITMSG) { } else if (val_expression->type == EXPR_SCTP_INITMSG) {
......
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
+0.0 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 +0.0 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
+0 getsockopt(3, IPPROTO_SCTP, SCTP_STATUS, {sstat_state=8, sstat_rwnd=1500, sstat_unackdata=0, sstat_penddata=0, sstat_instrms=1, sstat_outstrms=1,
sstat_fragmentation_point=1452, sstat_primary=...}, [176])= 0
+0 setsockopt(3, SOL_SOCKET, SO_LINGER, {onoff=1, linger=30}, 8) = 0 +0 setsockopt(3, SOL_SOCKET, SO_LINGER, {onoff=1, linger=30}, 8) = 0
+0 getsockopt(3, SOL_SOCKET, SO_LINGER, {onoff=128, linger=30}, [8]) = 0 +0 getsockopt(3, SOL_SOCKET, SO_LINGER, {onoff=128, linger=30}, [8]) = 0
+0 getsockopt(3, SOL_SOCKET, SO_LINGER, {onoff=128, linger=...}, [8]) = 0 +0 getsockopt(3, SOL_SOCKET, SO_LINGER, {onoff=128, linger=...}, [8]) = 0
...@@ -18,9 +21,9 @@ ...@@ -18,9 +21,9 @@
+0 setsockopt(3, IPPROTO_SCTP, SCTP_RTOINFO, {srto_initial=100, srto_max=200, srto_min=50}, 16) = 0 +0 setsockopt(3, IPPROTO_SCTP, SCTP_RTOINFO, {srto_initial=100, srto_max=200, srto_min=50}, 16) = 0
+0 getsockopt(3, IPPROTO_SCTP, SCTP_RTOINFO, {srto_initial=100, srto_max=200, srto_min=50}, [16]) = 0 +0 getsockopt(3, IPPROTO_SCTP, SCTP_RTOINFO, {srto_initial=100, srto_max=200, srto_min=50}, [16]) = 0
+0 getsockopt(3, IPPROTO_SCTP, SCTP_RTOINFO, {srto_initial=..., srto_max=200, srto_min=50}, [16]) = 0
+0 getsockopt(3, IPPROTO_SCTP, SCTP_STATUS, {sstat_state=8, sstat_rwnd=1500, sstat_unackdata=0, sstat_penddata=0, sstat_instrms=1, sstat_outstrms=1, +0 getsockopt(3, IPPROTO_SCTP, SCTP_RTOINFO, {srto_initial=100, srto_max=..., srto_min=50}, [16]) = 0
sstat_fragmentation_point=1452, sstat_primary=...}, [176])= 0 +0 getsockopt(3, IPPROTO_SCTP, SCTP_RTOINFO, {srto_initial=100, srto_max=200, srto_min=...}, [16]) = 0
+0 close(3) = 0 +0 close(3) = 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment