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

SSDPD fail with openvpn #6

Closed
mmaret opened this issue Oct 2, 2020 · 5 comments
Closed

SSDPD fail with openvpn #6

mmaret opened this issue Oct 2, 2020 · 5 comments

Comments

@mmaret
Copy link
Contributor

mmaret commented Oct 2, 2020

Hi,

First, thanks a lot for your software!

I'm trying to use it on a network with openvpn.
It's a TUN Server, and, on the client, the network configuration look like:

ip addr show tun0 
9: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 100
    link/none 
    inet 10.8.0.6 peer 10.8.0.5/32 scope global tun0
       valid_lft forever preferred_lft forever
    inet6 fe80::5ad9:1f85:5605:8bd4/64 scope link stable-privacy 
       valid_lft forever preferred_lft forever

As you can see, it's declare as a peer interface so ssdpd detect the netmask as 255.255.255.255.
Even if the route is correct

 ip route
default via 192.168.0.254 dev eno1 proto dhcp metric 100 
10.8.0.0/24 via 10.8.0.5 dev tun0 
...

So when an SSDP request is received, I can see

No matching socket for client 10.8.0.1

To work around this, I use this "as ugly as possible" patch:

diff --git a/src/ssdp.c b/src/ssdp.c
index 9198251..82e8e23 100644
--- a/src/ssdp.c
+++ b/src/ssdp.c
@@ -262,8 +262,13 @@ int ssdp_register(int sd, struct sockaddr *addr, struct sockaddr *mask, void (*c
 	ifs->cb   = cb;
 	if (address)
 		ifs->addr = *address;
-	if (mask)
+	if (mask){
+		if (netmask->sin_addr.s_addr == htonl(INADDR_BROADCAST)){
+			inet_aton("255.255.0.0", &netmask->sin_addr);
+			logit(LOG_DEBUG, "Changing mask");
+		}
 		ifs->mask = *netmask;
+	}
 	LIST_INSERT_HEAD(&il, ifs, link);
 
 	return 0;

Something better could be done, like checking the ifa_flags for IFF_POINTTOPOINT, but you may have some better idea!

Thanks again

@troglobit
Copy link
Owner

Hi, thanks for filing the report. I have no time to implement and test official support for this. Hopefully someone else has a similar setup and can help out.

@mmaret
Copy link
Contributor Author

mmaret commented Oct 5, 2020

Thanks for having looking at it.

@mmaret
Copy link
Contributor Author

mmaret commented Oct 5, 2020

To have a proper mask detection, I've change openvpn server configuration to have
topology subnet

This is now the recommended behavior for openVPN but not the default one for compatibility purpose.
If it's fine to you, I'll close the Issue

@troglobit
Copy link
Owner

Whatever works for you. If anyone runs into a similar issue, they might find this useful :)

@troglobit
Copy link
Owner

Decided to fix this one after all, neat to have a workaround for this case. Only difference from your approach is to override with a /24 instead of /16.

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