-
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
Add support for domain names (and IPv6) to RTP forwarders #1778
Conversation
Just added an optional What doesn't seem to be working yet is forwarding on IPv6, at least looking at Wireshark dumps... I'll work on that next, together with IPv6 support in the Streaming plugin. |
I will give it a test as soon as I get free time :D |
This should complete the refactoring of the RTP forwarder, to support name resolving and IPv6. I'll work on IPv6 support in the Streaming plugin in a separate effort, as that might take longer and I don't want to block this PR. Feedback welcome! |
@mirkobrankovic did you have a chance to test if this works 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.
lgtm, submitted just some hints
plugins/janus_videoroom.c
Outdated
if(getaddrinfo(host, NULL, NULL, &res) == 0) { | ||
start = res; | ||
while(res != NULL) { | ||
if(family != 0 && family != res->ai_family) { |
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 output from getaddrinfo
can be filtered by the requested family just using the third param
/* get only IPv4 */
struct addrinfo hints;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_INET;
getaddrinfo(host, NULL, &hints, &res);
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 👍
inet_pton(AF_INET, host, &(forward->serv_addr.sin_addr)); | ||
forward->serv_addr.sin_port = htons(port); | ||
/* Check if the host address is IPv4 or IPv6 */ | ||
if(strstr(host, ":") != NULL) { |
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.
A RegEx would be better imho, but given that host
has been sanitized in the caller method it should be ok.
Merging. |
As the title says, this is an alternative implementation to #1774. It adds support for domain names as the
host
part of RTP forwarders, which so far they had to be IP addresses. Incidentally, it also includes support for IPv6, as that's that the domain name may resolve to: this meant updating all the socket stuff related to RTP forwarders in both AudioBridge and VideoRoom, as they were hardcoded to IPv4.What still needs to be updated is the Streaming plugin, which still only supports binding to IPv4 addresses: as such, you won't be able to test an IPv6 RTP forwarder with the Streaming plugin for now. I'll probably add that as part of this pull request, so that everything is updated consistently.
Please test and provide feedback.