-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
FreeBSD support #2508
FreeBSD support #2508
Conversation
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.
thanks for the effort @jsm222 !
I don't have a FreeBSD machine and I don't know much about the OS, so I can't comment about the endiannes and macro stuff.
Anyway I noticed some minor points I'd be glad to discuss.
Add LWS_SERVER_OPTION_DISABLE_IPV6 only for FreeBSD.
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.
Thanks, I've added some more notes.
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.
we're almost there, just some more empty lines to fix here and there!
transports/janus_websockets.c
Outdated
@@ -706,6 +726,13 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi | |||
#else | |||
info.options = 0; | |||
#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.
forgot this one
transports/janus_websockets.c
Outdated
@@ -818,10 +865,18 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi | |||
info.ssl_cipher_list = ciphers; | |||
info.gid = -1; | |||
info.uid = -1; | |||
|
|||
|
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.
forgot these
The empty lines should be fixed now.. |
lgtm 👍 |
I'll need a few days to review, as I'm still on my holiday break. Thanks for the effort! |
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.
Thanks for this effort, and apologies for the late review: I've only recently come back to work after the holidays. I see Alessandro already provided good notes, so I've just added a few myself that are mostly related to form.
As a side note, is the ipv4/ipv6 libwebsockets issue on FreeBSD going to be an issue in Streaming plugin as well, as I think we always binding using an IPv6 struct by default, unless explicitly specifying IPv4 there? There may be issues with RTP forwarders too (VideoRoom and AudioBridge), as IIRC we do the same.
@@ -207,6 +207,30 @@ If Doxygen and graphviz are available, the process can also build the documentat | |||
|
|||
You can also selectively enable/disable other features (e.g., specific plugins you don't care about, or whether or not you want to build the recordings post-processor). Use the --help option when configuring for more info. | |||
|
|||
### Building on FreeBSD |
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.
Please add some more descriptive description here too, as we do for MacOs. The pkg
line should be "compacted" a bit too (like what we do above for yum
and apt-get
), as there's too many lines now I believe.
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.
Done
README.md
Outdated
sh autogen.sh | ||
./configure | ||
gmake | ||
gmake install |
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 is there a gmake
here? I don't think the lines from autogen.sh on are needed at all, as they're shared for all systems (they're not there for the MacOS instructions for instance).
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.
gmake is for GNU make. BSDs has its own make
transports/janus_websockets.c
Outdated
@@ -618,6 +621,12 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi | |||
item = janus_config_get(config, config_general, janus_config_type_item, "ws_ip"); | |||
if(item && item->value) { | |||
ip = (char *)item->value; | |||
#ifdef __FreeBSD__ | |||
struct in_addr addr; | |||
if(inet_net_pton(AF_INET, ip, &addr, sizeof(addr))>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.
Code style: there should be spaces before and after the >
comparator.
Besides, since the action is simple, I don't think it's needed to wrap it in curly brackets.
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.
done
transports/janus_websockets.c
Outdated
@@ -664,6 +679,12 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi | |||
item = janus_config_get(config, config_general, janus_config_type_item, "wss_ip"); | |||
if(item && item->value) { | |||
ip = (char *)item->value; | |||
#ifdef __FreeBSD__ | |||
struct in_addr addr; | |||
if(inet_net_pton(AF_INET, ip, &addr, sizeof(addr))>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.
See above.
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.
done
transports/janus_websockets.c
Outdated
@@ -735,6 +762,12 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi | |||
item = janus_config_get(config, config_admin, janus_config_type_item, "admin_ws_ip"); | |||
if(item && item->value) { | |||
ip = (char *)item->value; | |||
#ifdef __FreeBSD__ | |||
struct in_addr addr; | |||
if(inet_net_pton(AF_INET, ip, &addr, sizeof(addr))>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.
See above.
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.
done
transports/janus_websockets.c
Outdated
@@ -781,6 +820,12 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi | |||
item = janus_config_get(config, config_admin, janus_config_type_item, "admin_wss_ip"); | |||
if(item && item->value) { | |||
ip = (char *)item->value; | |||
#ifdef __FreeBSD__ | |||
struct in_addr addr; | |||
if(inet_net_pton(AF_INET, ip, &addr, sizeof(addr))>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.
See above.
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.
done
Videoroom seem to work. I did not test audiobridge.. The issue with listening (lib)websockets is that it does not listen on both Ipv4 and IPv6 when ipv6 is enabled it is ipv6 only.. Can you provide more details of what you think might not work, and how to test it? |
What I'm thinking about is what is described in #2051. I just noticed you actually already commented there, at the time. |
I get the following errors trying to rtp_forward from videoroom: |
specifyi
I can send to ipv6 but i do not manage to read from it.. |
ffmeg can read it my vlc cannot.. well it works over ipv6 so issue #2051 applies. |
This may be because we always open an |
man inet6 So yes. |
For the time being this feature should be considered unsupported in FreeBSD then. We don't plan to revisit the implementation until the multistream branch is merged. |
I agree. Should it be added in README? |
That's probably a good idea, thanks! |
@@ -14,7 +14,7 @@ | |||
#define JANUS_RTP_H | |||
|
|||
#include <arpa/inet.h> | |||
#ifdef __MACH__ | |||
#if defined (__MACH__) || defined(__FreeBSD__) |
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.
We have the same definition in pp-rtp.h, which is in the post-processor code. Have you checked if postprocessing MJR recordings does indeed work as expected on FreeBSD?
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.
Sorry for the delay, I could not find the docs to acutally do a test, but I did change pp-rtp.h
I tested with /usr/local/bin/janus-pp-rec /usr/local/share/janus/recordings/rec-sample-audio.mjr test.opus |
Hi, any reason not to merge this? Thanks :-) |
@jsm222 no reason beyond the fact it's a lot of changes that I need to review again, and test to make sure there's no regression, so entirely my fault, sorry. I've been very busy these past few weeks, I'll try to do that in the next few days. Thanks! |
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.
Added some more small notes on the PR: nothing major, just small nits. I'll make some tests as well to see the parts that have changed the most still work (which I expect to do, since it's all happening in #ifdefs
)
README.md
Outdated
@@ -207,6 +207,19 @@ If Doxygen and graphviz are available, the process can also build the documentat | |||
|
|||
You can also selectively enable/disable other features (e.g., specific plugins you don't care about, or whether or not you want to build the recordings post-processor). Use the --help option when configuring for more info. | |||
|
|||
### Building on FreeBSD | |||
* *Note*: rtp_forward of streams only works streaming to IPv6, | |||
because of [2051](https://github.com/meetecho/janus-gateway/issues/2051) and thus the feature |
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.
I think you can just put #2051
as text, and it should create a link to the issue automatically.
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
* *Note*: rtp_forward of streams only works streaming to IPv6, | ||
because of [2051](https://github.com/meetecho/janus-gateway/issues/2051) and thus the feature | ||
is not supported on FreeBSD at the moment | ||
|
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.
Small note: missing full stop at the end of the sentence? Also, extra empty line can be removed (I see two).
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
README.md
Outdated
|
||
When building on FreeBSD you can install the depencencies from ports or packages, here only pkg method is used. You also need to use gmake instead of make, | ||
since it is a GNU makefile. ./configure can be run without arguments since the default prefix is /usr/local which is your default LOCALBASE. | ||
Note that the configure.ac is coded to use openssl in base. If you wish to use openssl from ports or any other ssl you must change configure.ac accordingly. |
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.
The ./configure
, make
, gmake
, /usr/local
, LOCALBASE
and configure.ac
texts should be in inverted quotes, to follow the style we use in the README.
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
transports/janus_websockets.c
Outdated
if (ipv4_only) { | ||
info.options |= LWS_SERVER_OPTION_DISABLE_IPV6; | ||
ipv4_only = 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.
Indentation seems broken? Spaces are used, but we use tabs.
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
Thanks for the quick fixes! I'll make a couple of tests after lunch, and if all looks fine, I'll finally merge 👍 |
I made a few checks and all seems to be working. Of course the actual checks should be made on FreeBSD, to ensure Janus does work there now, but I assume you've made all these tests already. This looks good to me, so I'll merge, thanks again! |
@jsm222 FYI, I got rid of the |
I mostly corrected endianness includes and defines.
Most notable change is in transports/janus_websockets.c
There I set LWS_SERVER_OPTION_DISABLE_IPV6, because of
warmcat/libwebsockets#1947.
This is probably a FreeBSD only issue, and perhaps it should be in preprocessor macros.
I also did comment ip = iface out, since ws_ip is supposed to only bind to the ws_ip set.
This might be a bug common to all systems though. I have only tested build on FreeBSD.
Also see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219444
See also #2232