diff --git a/gtests/net/packetdrill/run_system_call.c b/gtests/net/packetdrill/run_system_call.c index 5c8b2b9b942dd12f783b2db68235fa0a5743ccfe..8f45e53cc2457ed7d4e3422c83f4e54687e2aab9 100644 --- a/gtests/net/packetdrill/run_system_call.c +++ b/gtests/net/packetdrill/run_system_call.c @@ -58,18 +58,18 @@ struct sctp_tlv { #if defined(__FreeBSD__) || defined(linux) static int check_sctp_notification(struct iovec *iov, struct expression *iovec_expr, char **error); -#endif -#if defined(__FreeBSD__) static int parse_expression_to_sctp_initmsg(struct expression *expr, struct sctp_initmsg *init, char **error); +static int parse_expression_to_sctp_sndrcvinfo(struct expression *expr, struct sctp_sndrcvinfo *info, + char **error); +#endif +#if defined(__FreeBSD__) static int parse_expression_to_sctp_sndinfo(struct expression *expr, struct sctp_sndinfo *info, char **error); static int parse_expression_to_sctp_prinfo(struct expression *expr, struct sctp_prinfo *info, char **error); static int parse_expression_to_sctp_authinfo(struct expression *expr, struct sctp_authinfo *info, char **error); -static int parse_expression_to_sctp_sndrcvinfo(struct expression *expr, struct sctp_sndrcvinfo *info, - char **error); #endif #if defined(SCTP_DEFAULT_SNDINFO) || defined(SCTP_SNDINFO) static int check_sctp_sndinfo(struct sctp_sndinfo_expr *expr, struct sctp_sndinfo *sctp_sndinfo, @@ -79,16 +79,17 @@ static int check_sctp_sndinfo(struct sctp_sndinfo_expr *expr, struct sctp_sndinf static int check_sctp_initmsg(struct sctp_initmsg_expr *expr, struct sctp_initmsg *sctp_initmsg, char **error); #endif -#if defined(Linux) || defined(__FreeBSD__) -static int check_sctp_sndrcvinfo(struct sctp_sndrcvinfo_expr *expr, struct sctp_sndrcvinfo *sctp_sndrcvinfo, - char** error); -#endif -#if defined(Linux) || defined(__FreeBSD__) +#if defined(linux) || defined(__FreeBSD__) static int check_sctp_rcvinfo(struct sctp_rcvinfo_expr *expr, struct sctp_rcvinfo *sctp_rcvinfo, char** error); #endif #if defined(Linux) || defined(__FreeBSD__) static int check_sctp_nxtinfo(struct sctp_nxtinfo_expr *expr, struct sctp_nxtinfo *sctp_nxtinfo, + char **error); +#endif +#if defined(linux) || defined(__FreeBSD__) +static int check_sctp_sndrcvinfo(struct sctp_sndrcvinfo_expr *expr, + struct sctp_sndrcvinfo *sctp_sndrcvinfo, char** error); #endif @@ -3498,31 +3499,7 @@ static int syscall_sctp_recvmsg(struct state *state, struct syscall_spec *syscal #endif } -#if defined(__FreeBSD__) -static int parse_expression_to_sctp_sndinfo(struct expression *expr, struct sctp_sndinfo *info, char **error) { - if (expr->type == EXPR_SCTP_SNDINFO) { - struct sctp_sndinfo_expr *sndinfo_expr = expr->value.sctp_sndinfo; - if (get_u16(sndinfo_expr->snd_sid, &info->snd_sid, error)) { - return STATUS_ERR; - } - if (get_u16(sndinfo_expr->snd_flags, &info->snd_flags, error)) { - return STATUS_ERR; - } - if (get_u32(sndinfo_expr->snd_ppid, &info->snd_ppid, error)) { - return STATUS_ERR; - } - if (get_u32(sndinfo_expr->snd_context, &info->snd_context, error)) { - return STATUS_ERR; - } - if (get_u32(sndinfo_expr->snd_assoc_id, &info->snd_assoc_id, error)) { - return STATUS_ERR; - } - } else { - return STATUS_ERR; - } - return STATUS_OK; -} - +#if defined(__FreeBSD__) || defined(linux) static int parse_expression_to_sctp_initmsg(struct expression *expr, struct sctp_initmsg *init, char **error) { if (expr->type == EXPR_SCTP_INITMSG) { struct sctp_initmsg_expr *init_expr = expr->value.sctp_initmsg; @@ -3571,7 +3548,33 @@ static int parse_expression_to_sctp_sndrcvinfo(struct expression *expr, struct s if (get_u32(sndrcvinfo_expr->sinfo_cumtsn, &info->sinfo_cumtsn, error)) { return STATUS_ERR; } - if (get_u32(sndrcvinfo_expr->sinfo_assoc_id, &info->sinfo_assoc_id, error)) { + if (get_u32(sndrcvinfo_expr->sinfo_assoc_id, (u32 *)&info->sinfo_assoc_id, error)) { + return STATUS_ERR; + } + } else { + return STATUS_ERR; + } + return STATUS_OK; +} +#endif + +#if defined(__FreeBSD__) +static int parse_expression_to_sctp_sndinfo(struct expression *expr, struct sctp_sndinfo *info, char **error) { + if (expr->type == EXPR_SCTP_SNDINFO) { + struct sctp_sndinfo_expr *sndinfo_expr = expr->value.sctp_sndinfo; + if (get_u16(sndinfo_expr->snd_sid, &info->snd_sid, error)) { + return STATUS_ERR; + } + if (get_u16(sndinfo_expr->snd_flags, &info->snd_flags, error)) { + return STATUS_ERR; + } + if (get_u32(sndinfo_expr->snd_ppid, &info->snd_ppid, error)) { + return STATUS_ERR; + } + if (get_u32(sndinfo_expr->snd_context, &info->snd_context, error)) { + return STATUS_ERR; + } + if (get_u32(sndinfo_expr->snd_assoc_id, &info->snd_assoc_id, error)) { return STATUS_ERR; } } else { diff --git a/gtests/net/packetdrill/tests/bsd/sctp/recvmsg.pkt b/gtests/net/packetdrill/tests/bsd/sctp/recvmsg.pkt index a991b0b3cc0d5343b34860a5803d615f1a422d80..e2d136004a719689073f1d9836abe3b0c0234854 100644 --- a/gtests/net/packetdrill/tests/bsd/sctp/recvmsg.pkt +++ b/gtests/net/packetdrill/tests/bsd/sctp/recvmsg.pkt @@ -52,3 +52,4 @@ spp_hbinterval=0, spp_pathmaxrxt=8, spp_pathmtu=1468, spp_flags=SPP_HB_DISABLE, {cmsg_len=28, cmsg_level=IPPROTO_SCTP, cmsg_type=SCTP_NXTINFO, cmsg_data= {nxt_sid=0, nxt_flags=SCTP_COMPLETE, nxt_ppid=htonl(9876), nxt_length=1000, nxt_assoc_id=3} }] ,msg_flags=MSG_EOR}, 0) = 1000 +