Skip to content
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

Cannot configure WebSocket Plugin to bind to IPv4 #1131

Closed
houserockr opened this issue Apr 29, 2023 · 4 comments
Closed

Cannot configure WebSocket Plugin to bind to IPv4 #1131

houserockr opened this issue Apr 29, 2023 · 4 comments

Comments

@houserockr
Copy link

houserockr commented Apr 29, 2023

Operating System Info

Other

Other OS

Alma Linux 9.1

OBS Studio Version

29.0.2

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/mXBleDTVMQcit4B7

OBS Studio Crash Log URL

No response

Expected Behavior

The user should be able to configure the option --websocket_ipv4_only provided by obs-websocket in the WebSocket configuration dialog of OBS.

Current Behavior

With ipv6 disabled on Alma Linux 9, the WebSocket plugin doesn't work, because it will bind to ipv6 by default, which will fail:

14:54:42.836: [obs-websocket] [WebSocketServer::onObsLoaded] WebSocket server is enabled, starting...
14:54:42.837: [obs-websocket] [WebSocketServer::Start] Not locked to IPv4 bindings
14:54:42.839: [obs-websocket] [WebSocketServer::Start] Listen failed: Address family not supported by protocol

However, I cannot find a way to configure the option --websocket_ipv4_only which obs-websocket provides. Me, personally, I wouldn't necessarily need an HMI option if there's another way to add that parameter to a script in the background.

The option has been added with:
#559
#928

Steps to Reproduce

Precondition: Linux with ipv6 disabled by kernel option

  1. Enable the WebSocket plugin in the configuration
  2. Restart OBS
  3. Check the log or
  4. $ sudo netstat -tapn | grep LISTEN
    ...

Anything else we should know?

No response

@houserockr
Copy link
Author

In case this might be relevant, this is how my WebSocket configuration dialog looks like
Screenshot from 2023-04-29 15-24-13

@Fenrirthviti Fenrirthviti transferred this issue from obsproject/obs-studio Apr 29, 2023
@tt2468
Copy link
Member

tt2468 commented Apr 29, 2023

Do you have a use-case where you need to bind to IPv4 specifically? By default, obs-websocket binds to all interfaces on v6, which still allows v4 connections to be created. Someone previously had claimed that they could only connect if obs-websocket was locked to only IPv4, so I added the feature. I never added it to the UI because one user having an issue did not seem to warrant changing the UI.

@houserockr
Copy link
Author

First of all, I can mitigate this observation to some extent, because it works now.

Here's how the observation came about:

  • I started OBS with WebSocket enabled and I couldn't connect from the iOS OBS Controller app, even though both devices were logged into the same wifi network
  • $ netstat -tapn revealed that OBS is only bound to ipv6
  • I thought that must be the problem and disabled ipv6 via kernel option (ipv6.disable=1) to force WebSocket to bind to ipv4
  • WebSocket failed to start, because I had no way to tell it to use --websocket_ipv4_only
  • I created this issue cough 👼
  • I found an additional WebSocket extension called WebSocket 4.x compat on Alma Linux with flatpak
  • Funnily enough said compat WebSocket extension integrates into the OBS ui and looks like this:
    Screenshot from 2023-04-30 11-26-32
  • See that it has a dedicated checkbox for the --websocket_ipv4_only option.
  • However, it still didn't work, so I fired up wireshark to see what's happening
  • No incoming connection at all - omg is the firewall active and blocking this port?
  • # iptables -L showed no active chains and I deemed the firewall to be disabled
  • But that wasn't the case, iptables is inconclusive, I had to # systemctl stop firewalld (and ultimately # systemctl disable firewalld)
  • But it still didn't work with the compat extension
  • I reverted everything with regard to OBS any my kernel back to ipv6 (i.e. "normal")
  • It worked

Here's how/why it still works:

  • Even though WebSocket is only bound to ipv6 in netstat (tcp6 0 0 :::4455 :::* LISTEN) it's accepting ipv4 connections, which I didn't know was possible 🙌

Here's the use case that still stands imho:
It's more of a precondition than a use case. If OBS is running on a machine with ipv6 disabled, WebSocket won't run at all. I don't know if this only applies to Linux, but I assume it also applies to other OSs. Me personally, I've seen many machines with ipv6 still disabled by default, but I don't have any stats on that. I let you guys decide whether that's relevant or not.

@tt2468
Copy link
Member

tt2468 commented May 28, 2023

Fixed by creating a fallback to IPv4 if we get the address family not supported error: 6434c42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants