GNOME Bugzilla – Bug 762324
OS X has PKTINFO support but is missing the ioctl to get the network device index
Last modified: 2019-02-22 09:29:44 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..
Created attachment 321669 [details] [review] Use if_nametoindex if available Signed-off-by: Jens Georg <mail@jensge.org>
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.
ah. Oh. I think I mixed up addresses.
can you dump gssdp_pktinfo_message_get_pkt_addr as well, please?
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.
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 on attachment 321669 [details] [review] Use if_nametoindex if available Attachment 321669 [details] pushed as 8bdb91c - Use if_nametoindex if available
Created attachment 325259 [details] [review] gssdp-client: Fix preprocessor syntax
Review of attachment 325259 [details] [review]: Er interesting, how did that happen? Thanks.
Comment on attachment 325259 [details] [review] gssdp-client: Fix preprocessor syntax Attachment 325259 [details] pushed as c2678ad - gssdp-client: Fix preprocessor syntax
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.
There is currently no nice solution unfortunately. I suspect I just have to make OS X a non-pktinfo OS for now.
Would be fine with me. Still a better solution than a non-functional one.
Created attachment 326643 [details] [review] Do not use PKTINFO on OS X Signed-off-by: Jens Georg <mail@jensge.org>
Attachment 326643 [details] pushed as 3a0ddc6 - Do not use PKTINFO on OS X