Correct ifdefs
@@ -4531,12 +4531,11 @@ neat_write_to_lower_layer(struct neat_ctx *ctx, struct neat_flow *flow,
// int has_dest_addr = 0;
// const char *dest_addr = "";
-#if !defined(NEAT_SCTP_DTLS) && (defined(SCTP_SNDINFO) || defined (SCTP_SNDRCV))
+#if defined(SCTP_SNDINFO) || defined (SCTP_SNDRCV)
struct cmsghdr *cmsg;
#endif
struct msghdr msghdr;
struct iovec iov;
-#if !defined(NEAT_SCTP_DTLS)
#if defined(SCTP_SNDINFO)
char cmsgbuf[CMSG_SPACE(sizeof(struct sctp_sndinfo))];
struct sctp_sndinfo *sndinfo = NULL;
@@ -4546,7 +4545,7 @@ neat_write_to_lower_layer(struct neat_ctx *ctx, struct neat_flow *flow,
struct sctp_sndrcvinfo *sndrcvinfo;
memset(&cmsgbuf, 0, sizeof(cmsgbuf));
#endif
-#endif
+
neat_log(ctx, NEAT_LOG_DEBUG, "%s", __func__);
HANDLE_OPTIONAL_ARGUMENTS_START()
@@ -4630,8 +4629,9 @@ neat_write_to_lower_layer(struct neat_ctx *ctx, struct neat_flow *flow,
memset(&sinfo, 0, sizeof(struct bio_dgram_sctp_sndinfo));
sinfo.snd_sid = stream_id;
BIO_ctrl(private->dtlsBIO, BIO_CTRL_DGRAM_SCTP_SET_SNDINFO, sizeof(struct bio_dgram_sctp_sndinfo), &sinfo);
- } else {
-#else
+ }
+#endif
+ if (!flow->security_needed) {
#if defined(SCTP_SNDINFO)
msghdr.msg_control = cmsgbuf;
msghdr.msg_controllen = CMSG_SPACE(sizeof(struct sctp_sndinfo));
@@ -4673,10 +4673,7 @@ neat_write_to_lower_layer(struct neat_ctx *ctx, struct neat_flow *flow,
msghdr.msg_control = NULL;
msghdr.msg_controllen = 0;
#endif
-#endif
-#ifdef NEAT_SCTP_DTLS
}
-#endif
} else {
msghdr.msg_control = NULL;
msghdr.msg_controllen = 0;
