After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 656406 - Wrong use of inet_netof leeds to dropped ssdp packages
Wrong use of inet_netof leeds to dropped ssdp packages
Status: RESOLVED FIXED
Product: gssdp
Classification: Other
Component: General
unspecified
Other All
: Normal major
: ---
Assigned To: GUPnP Maintainers
GUPnP Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-08-12 14:54 UTC by SDG
Modified: 2019-02-22 09:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Drop use of inet_netof (14.70 KB, patch)
2012-12-13 23:02 UTC, Jens Georg
committed Details | Review

Description SDG 2011-08-12 14:54:27 UTC
In gssd-client.c Func socket_source_cb (GSSDPSocketSource *socket_source, GSSDPClient *client) Line 900 is inet_netof used to determine the origin of the ssdp-packages. This will NOT work if you have two Users from e.g. 192.168.1.2 and 192.168.2.2 (netmask (255.255.0.0) cause inet_netof do NOT use the current netmask to determine the network part of these IPs. It only looks on the first octet (192).

For IPv4 (ip1 & netmask) == (ip2 & netmask) should be evaluated. IPv6 ma be different.
Comment 1 Ross Burton 2011-08-15 05:54:39 UTC
Aaah, so this is why GUPnP doesn't work correctly in the office.

Note that in recent GSSDP releases this code has been changed a lot, but the relevant check is still there at line 948.
Comment 2 Ross Burton 2011-08-15 05:55:09 UTC
I guess as this isn't as easy as it appears, this check should be implemented in GSocketAddress.
Comment 3 SDG 2011-08-15 14:41:57 UTC
Maybe GInetSocketAddress, but You have already the network part of "our_addr" (see get_host_ip(...)). 

So, one should also store the ifa_netmask in privat->netmask (near line 1200 and 1209). 

Then we have to check (in socket_source_cb) without respect to IPv6:

if ((addr.sin_addr & client->privat->netmask) != (our_addr.s_addr & client->privat->netmask))
    goto out;

The recv_network and our_network vars can be dropped. For me, that seems better than the existing code.
Comment 4 Jens Georg 2012-12-13 23:02:51 UTC
Created attachment 231526 [details] [review]
Drop use of inet_netof

This is just wrong in times of CIDR.

Much appreciated if someone with a setup like that could test it.
Comment 5 Jens Georg 2013-02-09 15:07:23 UTC
Attachment 231526 [details] pushed as 48f5d5b - Drop use of inet_netof
Comment 6 Jens Georg 2013-02-20 12:20:13 UTC
Commited with slight merge issue fixes