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 762324 - OS X has PKTINFO support but is missing the ioctl to get the network device index
OS X has PKTINFO support but is missing the ioctl to get the network device i...
Status: RESOLVED FIXED
Product: gssdp
Classification: Other
Component: General
unspecified
Other Mac OS
: Normal normal
: ---
Assigned To: GUPnP Maintainers
GUPnP Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-02-19 13:52 UTC by Florian Zwoch
Modified: 2019-02-22 09:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use if_nametoindex if available (1.68 KB, patch)
2016-02-19 16:12 UTC, Jens Georg
committed Details | Review
gssdp-client: Fix preprocessor syntax (780 bytes, patch)
2016-04-03 11:54 UTC, Philip Withnall
committed Details | Review
Do not use PKTINFO on OS X (825 bytes, patch)
2016-04-24 20:18 UTC, Jens Georg
committed Details | Review

Description Florian Zwoch 2016-02-19 13:52:37 UTC
OS X has PKTINFO support but is missing the ioctl to get the network device index.

This causing the device index to not be set all. Ultimately leading to all packets that are received on the socket to be dropped.

See gssdp-client.c:1811

if (!((msg_ifindex == client->priv->device.index ||
    msg_ifindex == LOOPBACK_IFINDEX) &&
    (g_inet_address_equal (gssdp_pktinfo_message_get_local_addr (msg),
    client->priv->device.host_addr))))
        goto out;


In my particular case the values that are being checked were a follows:

msg_ifindex = 4
client->priv->device.index = -1
gssdp_pktinfo_message_get_local_addr (msg) = "0.0.0.0"
client->priv->device.host_addr = "10.122.101.122"

I'm not sure if the "0.0.0.0" address from the message is a result of the above issue or if I'm facing yet a complete different one..
Comment 1 Jens Georg 2016-02-19 16:12:41 UTC
Created attachment 321669 [details] [review]
Use if_nametoindex if available

Signed-off-by: Jens Georg <mail@jensge.org>
Comment 2 Jens Georg 2016-02-19 16:14:07 UTC
That should fix the interface index lookup. I have no idea why the address is ANY, but with any g_inet_address_equal will fail.
Comment 3 Jens Georg 2016-02-19 16:37:20 UTC
ah. Oh. I think I mixed up addresses.
Comment 4 Jens Georg 2016-02-19 17:00:42 UTC
can you dump gssdp_pktinfo_message_get_pkt_addr as well, please?
Comment 5 Jens Georg 2016-02-19 17:40:55 UTC
The issue is that on linux we need this to differentiate between several adresses on the same interface index. I have no idea if OS X has the same concept.
Comment 6 Florian Zwoch 2016-02-22 09:02:39 UTC
I had some trouble getting autoconf etc to work. But I got it working in the end. I had to compile with -Wno-error as the -Wcast-align on the sock addresses would bail on me.

With the patch the index is now correctly set to 4 for my test case. So this one is working well!

gssdp_pktinfo_message_get_pkt_addr(msg) results in "239.255.255.250" or "10.122.101.122". I guess depending on whether this is a broadcast message or a direct discovery reply from a peer.

replacing gssdp_pktinfo_message_get_local_addr() with gssdp_pktinfo_message_get_pkt_addr() kind of seemed to work for me.. but the the device I was looking for was already on. I can imagine that if I would listen before the device is on it would miss the broadcast "alive" message. Then again you probably know the protocol workings better than I do..
Comment 7 Jens Georg 2016-04-02 21:14:51 UTC
Comment on attachment 321669 [details] [review]
Use if_nametoindex if available

Attachment 321669 [details] pushed as 8bdb91c - Use if_nametoindex if available
Comment 8 Philip Withnall 2016-04-03 11:54:55 UTC
Created attachment 325259 [details] [review]
gssdp-client: Fix preprocessor syntax
Comment 9 Jens Georg 2016-04-04 06:58:11 UTC
Review of attachment 325259 [details] [review]:

Er interesting, how did that happen? Thanks.
Comment 10 Philip Withnall 2016-04-04 07:33:08 UTC
Comment on attachment 325259 [details] [review]
gssdp-client: Fix preprocessor syntax

Attachment 325259 [details] pushed as c2678ad - gssdp-client: Fix preprocessor syntax
Comment 11 Florian Zwoch 2016-04-23 10:03:40 UTC
Is there a follow up on the issue discussed in the comments #3-#6? Let me know is you need more info on the matter and I can be of any help.
Comment 12 Jens Georg 2016-04-23 12:33:48 UTC
There is currently no nice solution unfortunately. I suspect I just have to make OS X a non-pktinfo OS for now.
Comment 13 Florian Zwoch 2016-04-23 13:04:22 UTC
Would be fine with me. Still a better solution than a non-functional one.
Comment 14 Jens Georg 2016-04-24 20:18:35 UTC
Created attachment 326643 [details] [review]
Do not use PKTINFO on OS X

Signed-off-by: Jens Georg <mail@jensge.org>
Comment 15 Jens Georg 2016-04-25 21:15:05 UTC
Attachment 326643 [details] pushed as 3a0ddc6 - Do not use PKTINFO on OS X