-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes to build under Xcode12 for iOS ARM64 #593
Conversation
c6c9676
to
2827f88
Compare
@tuexen Would you consider the changes? I'd be useful for libdatachannel. Thanks for your work on usrsctp! |
Sure. Most of them are related to implicit conversions from |
@tuexen Indeed, and a property added in CMakeLists. Thanks. |
@weinrank Are you fine with the cmake related change? |
You're setting these properties for all platforms. Best |
The CMake property is only used by the Xcode generator. It only applies to iOS and OS X with no adverse effect on either platform. |
Any news on this? @agnickolov could you introduce a |
2827f88
to
c5e73c2
Compare
@weinrank What do you think about the |
Is there still anything wrong with this PR? |
No it looks good. Just need to find some time to apply this in parts to the FreeBSD code repo and then merging this... |
Any estimate as to when can we expect this to get merged? |
I plan to work on it next week. |
programs/CMakeLists.txt
Outdated
if(APPLE) | ||
set_target_properties(${source_file_we} PROPERTIES | ||
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER com.github.sctplab.usrsctp.${source_file_we}) | ||
endif() | ||
endforeach () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Committed in d52bb17 with whitespace changes.
This was brought to my attention in #593
programs/st_client.c
Outdated
@@ -78,7 +78,7 @@ get_milliseconds_count(void) | |||
unsigned int milliseconds; | |||
|
|||
gettimeofday(&tv, NULL); /* get current time */ | |||
milliseconds = tv.tv_sec*1000LL + tv.tv_usec/1000; /* calculate milliseconds */ | |||
milliseconds = (unsigned int)(tv.tv_sec*1000LL + tv.tv_usec/1000); /* calculate milliseconds */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this always overflows nowadays? Avoiding these overflows by moving to 64-bit entities in 7077e0e.
usrsctplib/user_recv_thread.c
Outdated
@@ -32,6 +32,9 @@ | |||
#include <sys/types.h> | |||
#if !defined(_WIN32) | |||
#include <sys/socket.h> | |||
#if defined(__APPLE__) && !defined(__APPLE_USE_RFC_2292) | |||
# define __APPLE_USE_RFC_2292 | |||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't you set this in your build environment?
usrsctplib/netinet/sctp_input.c
Outdated
@@ -2821,7 +2821,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset, | |||
if ((uint32_t)diff.tv_sec > UINT32_MAX / 1000000) { | |||
staleness = UINT32_MAX; | |||
} else { | |||
staleness = diff.tv_sec * 1000000; | |||
staleness = (uint32_t)diff.tv_sec * 1000000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 87859a5.
usrsctplib/user_recv_thread.c
Outdated
@@ -346,7 +349,7 @@ recv_function_raw(void *arg) | |||
msg.msg_iovlen = MAXLEN_MBUF_CHAIN; | |||
msg.msg_control = NULL; | |||
msg.msg_controllen = 0; | |||
ncounter = n = recvmsg(SCTP_BASE_VAR(userspace_rawsctp), &msg, 0); | |||
ncounter = n = (int)recvmsg(SCTP_BASE_VAR(userspace_rawsctp), &msg, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in a8adc4a
usrsctplib/user_recv_thread.c
Outdated
@@ -545,7 +548,7 @@ recv_function_raw6(void *arg) | |||
msg.msg_controllen = (socklen_t)CMSG_SPACE(sizeof (struct in6_pktinfo)); | |||
msg.msg_flags = 0; | |||
|
|||
ncounter = n = recvmsg(SCTP_BASE_VAR(userspace_rawsctp6), &msg, 0); | |||
ncounter = n = (int)recvmsg(SCTP_BASE_VAR(userspace_rawsctp6), &msg, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in a8adc4a
usrsctplib/user_recv_thread.c
Outdated
@@ -721,7 +724,7 @@ recv_function_udp(void *arg) | |||
msg.msg_controllen = sizeof(cmsgbuf); | |||
msg.msg_flags = 0; | |||
|
|||
ncounter = n = recvmsg(SCTP_BASE_VAR(userspace_udpsctp), &msg, 0); | |||
ncounter = n = (int)recvmsg(SCTP_BASE_VAR(userspace_udpsctp), &msg, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in a8adc4a
usrsctplib/user_recv_thread.c
Outdated
@@ -930,7 +933,7 @@ recv_function_udp6(void *arg) | |||
msg.msg_controllen = (socklen_t)CMSG_SPACE(sizeof (struct in6_pktinfo)); | |||
msg.msg_flags = 0; | |||
|
|||
ncounter = n = recvmsg(SCTP_BASE_VAR(userspace_udpsctp6), &msg, 0); | |||
ncounter = n = (int)recvmsg(SCTP_BASE_VAR(userspace_udpsctp6), &msg, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in a8adc4a
usrsctplib/netinet/sctp_usrreq.c
Outdated
@@ -3396,7 +3396,7 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize, | |||
sasoc->sasoc_asocmaxrxt = inp->sctp_ep.max_send_times; | |||
sasoc->sasoc_number_peer_destinations = 0; | |||
sasoc->sasoc_peer_rwnd = 0; | |||
sasoc->sasoc_local_rwnd = sbspace(&inp->sctp_socket->so_rcv); | |||
sasoc->sasoc_local_rwnd = (uint32_t)sbspace(&inp->sctp_socket->so_rcv); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in f2efa09
usrsctplib/netinet/sctp_timer.c
Outdated
@@ -864,7 +864,7 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp, | |||
|
|||
(void)SCTP_GETTIME_TIMEVAL(&now); | |||
if (net->last_sent_time.tv_sec) { | |||
ms_goneby = (now.tv_sec - net->last_sent_time.tv_sec) * 1000; | |||
ms_goneby = (unsigned int)(now.tv_sec - net->last_sent_time.tv_sec) * 1000u; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 8463f3a.
usrsctplib/netinet/sctputil.c
Outdated
@@ -6704,10 +6704,10 @@ sctp_sorecvmsg(struct socket *so, | |||
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SB_LOGGING_ENABLE) { | |||
sctp_sblog(&so->so_rcv, control->do_not_ref_stcb?NULL:stcb, SCTP_LOG_SBFREE, (int)cp_len); | |||
} | |||
atomic_subtract_int(&so->so_rcv.sb_cc, cp_len); | |||
atomic_subtract_int(&so->so_rcv.sb_cc, (int32_t)cp_len); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 078bd24.
usrsctplib/netinet/sctputil.c
Outdated
if ((control->do_not_ref_stcb == 0) && | ||
stcb) { | ||
atomic_subtract_int(&stcb->asoc.sb_cc, cp_len); | ||
atomic_subtract_int(&stcb->asoc.sb_cc, (int32_t)cp_len); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 078bd24.
usrsctplib/netinet/sctputil.c
Outdated
@@ -6716,7 +6716,7 @@ sctp_sorecvmsg(struct socket *so, | |||
sctp_sblog(&so->so_rcv, control->do_not_ref_stcb?NULL:stcb, | |||
SCTP_LOG_SBRESULT, 0); | |||
} | |||
atomic_subtract_int(&control->length, cp_len); | |||
atomic_subtract_int(&control->length, (int32_t)cp_len); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 078bd24.
Stay with 32-bit, since the chunk is only 32-bit aligned. This was reported in #593
usrsctplib/netinet/sctp_output.c
Outdated
@@ -12084,7 +12084,7 @@ sctp_send_hb(struct sctp_tcb *stcb, struct sctp_nets *net,int so_locked) | |||
/* Fill out hb parameter */ | |||
hb->heartbeat.hb_info.ph.param_type = htons(SCTP_HEARTBEAT_INFO); | |||
hb->heartbeat.hb_info.ph.param_length = htons(sizeof(struct sctp_heartbeat_info_param)); | |||
hb->heartbeat.hb_info.time_value_1 = now.tv_sec; | |||
hb->heartbeat.hb_info.time_value_1 = (uint32_t)now.tv_sec; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 2d65548.
usrsctplib/netinet/sctputil.c
Outdated
@@ -2009,7 +2009,7 @@ sctp_timeout_handler(void *t) | |||
type, inp, stcb, net)); | |||
SCTP_STAT_INCR(sctps_timosecret); | |||
(void)SCTP_GETTIME_TIMEVAL(&tv); | |||
inp->sctp_ep.time_of_secret_change = tv.tv_sec; | |||
inp->sctp_ep.time_of_secret_change = (unsigned int)tv.tv_sec; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in f2c2b60.
usrsctplib/netinet/sctp_pcb.c
Outdated
@@ -3004,7 +3004,7 @@ sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id) | |||
|
|||
/* Setup the initial secret */ | |||
(void)SCTP_GETTIME_TIMEVAL(&time); | |||
m->time_of_secret_change = time.tv_sec; | |||
m->time_of_secret_change = (unsigned int)time.tv_sec; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in f2c2b60.
usrsctplib/netinet/sctp_pcb.c
Outdated
@@ -5311,7 +5311,7 @@ sctp_add_vtag_to_timewait(uint32_t tag, uint32_t time, uint16_t lport, uint16_t | |||
if ((twait_block->vtag_block[i].v_tag == 0) && | |||
!set) { | |||
twait_block->vtag_block[i].tv_sec_at_expire = | |||
now.tv_sec + time; | |||
(uint32_t)now.tv_sec + time; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed in 4ec13f7.
usrsctplib/netinet/sctp_pcb.c
Outdated
@@ -5325,7 +5325,7 @@ sctp_add_vtag_to_timewait(uint32_t tag, uint32_t time, uint16_t lport, uint16_t | |||
twait_block->vtag_block[i].rport = 0; | |||
if (set == 0) { | |||
/* Reuse it for my new tag */ | |||
twait_block->vtag_block[i].tv_sec_at_expire = now.tv_sec + time; | |||
twait_block->vtag_block[i].tv_sec_at_expire = (uint32_t)now.tv_sec + time; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed in 4ec13f7.
usrsctplib/netinet/sctp_pcb.c
Outdated
@@ -5350,7 +5350,7 @@ sctp_add_vtag_to_timewait(uint32_t tag, uint32_t time, uint16_t lport, uint16_t | |||
} | |||
memset(twait_block, 0, sizeof(struct sctp_tagblock)); | |||
LIST_INSERT_HEAD(chain, twait_block, sctp_nxt_tagblock); | |||
twait_block->vtag_block[0].tv_sec_at_expire = now.tv_sec + time; | |||
twait_block->vtag_block[0].tv_sec_at_expire = (uint32_t)now.tv_sec + time; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed in 4ec13f7.
I think all issues except for the one, which I think should be fixed in the build environment, should be fixed now. Please test and report. |
c5e73c2
to
15e54d2
Compare
@agnickolov Why can't you define |
15e54d2
to
5c96330
Compare
I moved the preprocessor symbol definition into the CMake project. There was another compilation issue so I had to add another typecast too. This one was probably introduced recently. It'd be nice if an iOS build target is introduced into the build system so these are caught early on. |
usrsctplib/netinet/sctp_pcb.c
Outdated
@@ -5293,7 +5293,7 @@ sctp_add_vtag_to_timewait(uint32_t tag, uint16_t lport, uint16_t rport) | |||
|
|||
SCTP_INP_INFO_WLOCK_ASSERT(); | |||
(void)SCTP_GETTIME_TIMEVAL(&now); | |||
time = now.tv_sec + SCTP_BASE_SYSCTL(sctp_vtag_time_wait); | |||
time = (uint32_t)(now.tv_sec + SCTP_BASE_SYSCTL(sctp_vtag_time_wait)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 6470706
usrsctplib/CMakeLists.txt
Outdated
if(APPLE) | ||
target_compile_definitions(usrsctp PRIVATE __APPLE_USE_RFC_2292) | ||
endif() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why doesn't work https://github.com/sctplab/usrsctp/blob/master/usrsctplib/CMakeLists.txt#L87 for you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I didn't notice that one. You asked me to move the fix to the build system so I did. Your change should work just as fine I expect.
Yepp, sorry I rewrote the timewait stuff (since there was dead code and locking issues) and introduced that. Sorry about that.
You mean a buildbot instance? @weinrank can we build on the Mac OS buildbot for iOS? |
@agnickolov Does the following patch fix your build issue with respect to
|
5c96330
to
11595f6
Compare
Typecasts Added bundle identifiers to executables
11595f6
to
dabf6b0
Compare
Yes, those changes work for iOS. The symbol is only needed for the library, but it shouldn't hurt to have it defined for the apps as well. |
Fixed in b56b430. This should address all issues brought up. Thanks for reporting and the patience! |
@tuexen Thank you! |
Typecasts
Added bundle identifiers to executables