Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Support loopback adapter with external adapters
17-10-2014, 03:51 PM
Post: #21
RE: Support loopback adapter with external adapters
(16-10-2014 02:51 PM)simoncn Wrote:  The patch is attached. I have confirmed that it works OK on Mac, Windows and Linux. Note that the new setsockopt IP_MULTICAST_IF call is made on all platforms, even though it is only required on Mac. This keeps the code simpler and more consistent across platforms.

I've committed the changes now. I ended up making one change - OsNetworkSocketSetMulticastIf() does nothing on Linux since an old Debian bug suggested that not all Linux versions will support our current implementation. (A more portable implementation would require that we passed a ip_mreq to setsockopt. This would require a change in the signature of OsNetworkSocketSetMulticastIf() however and I wasn't sure whether that was justified when we don't rely on this option being set on Linux.)
Find all posts by this user
17-10-2014, 04:34 PM (This post was last modified: 17-10-2014 05:01 PM by simoncn.)
Post: #22
RE: Support loopback adapter with external adapters
(17-10-2014 03:51 PM)simonc Wrote:  I've committed the changes now. I ended up making one change - OsNetworkSocketSetMulticastIf() does nothing on Linux since an old Debian bug suggested that not all Linux versions will support our current implementation. (A more portable implementation would require that we passed a ip_mreq to setsockopt. This would require a change in the signature of OsNetworkSocketSetMulticastIf() however and I wasn't sure whether that was justified when we don't rely on this option being set on Linux.)

I've just looked at this and I don't think there's an issue.

The old Linux kernel supported in_addr only, which is what my patch was passing.

The new Linux kernel supports either mreq or in_addr. Passing in_addr is therefore compatible with both old Linux kernels and new Linux kernels.

The code change that was made is shown here. There was also a change to documentation.
Find all posts by this user
17-10-2014, 06:13 PM
Post: #23
RE: Support loopback adapter with external adapters
(17-10-2014 04:34 PM)simoncn Wrote:  I've just looked at this and I don't think there's an issue.

Oops, you're right. I started looking into this because TestDviDiscovery was failing on Linux PowerPC. Disabling OsNetworkSocketSetMulticastIf() hid this issue. I'll need to look into this more before re-enabling the sockopt for Linux.

If MinimServer has is deployed to big endian platforms that don't use Linux, it'd be interesting to hear whether they work.
Find all posts by this user
17-10-2014, 08:01 PM
Post: #24
RE: Support loopback adapter with external adapters
(17-10-2014 06:13 PM)simonc Wrote:  Oops, you're right. I started looking into this because TestDviDiscovery was failing on Linux PowerPC. Disabling OsNetworkSocketSetMulticastIf() hid this issue. I'll need to look into this more before re-enabling the sockopt for Linux.

I'm concerned about this because MinimServer supports Linux PowerPC and my new release won't work on Linux PowerPC if the new loopback adapter support isn't working there.

Unfortunately, I can't test or debug this myself because I don't have a Linux PowerPC machine (or any other big-endian platform).

I've looked through the code to see if I can spot any endianness issues on big-endian platforms that might cause this problem but I haven't found anything that looks suspicious.

At what point in TestDviDiscovery.cpp is the failure occurring?

Quote:If MinimServer has is deployed to big endian platforms that don't use Linux, it'd be interesting to hear whether they work.

MinimServer isn't deployed to any big-endian platforms that don't use Linux.
Find all posts by this user
18-10-2014, 07:16 PM
Post: #25
RE: Support loopback adapter with external adapters
(17-10-2014 01:14 PM)simonc Wrote:  Later: The following turned out to be wrong...
One of the other users of SocketUdp - MdnsPlatform - is sending multicast messages so I'll update it too.

I didn't see this change in the commits on Github.
Find all posts by this user
20-10-2014, 09:45 AM
Post: #26
RE: Support loopback adapter with external adapters
(18-10-2014 07:16 PM)simoncn Wrote:  
(17-10-2014 01:14 PM)simonc Wrote:  Later: The following turned out to be wrong...
One of the other users of SocketUdp - MdnsPlatform - is sending multicast messages so I'll update it too.

I didn't see this change in the commits on Github.

The changes turned out to be inappropriate.

I realised after posting my original message that MdnsPlatform was correct as-is. I thought that deleting my earlier statement might be confusing so edited it instead to explain that the change wasn't required. Clearly that didn't result in as clear a message as I'd hoped for Sad
Find all posts by this user
20-10-2014, 09:48 AM
Post: #27
RE: Support loopback adapter with external adapters
(17-10-2014 08:01 PM)simoncn Wrote:  
(17-10-2014 06:13 PM)simonc Wrote:  Oops, you're right. I started looking into this because TestDviDiscovery was failing on Linux PowerPC. Disabling OsNetworkSocketSetMulticastIf() hid this issue. I'll need to look into this more before re-enabling the sockopt for Linux.

I'm concerned about this because MinimServer supports Linux PowerPC and my new release won't work on Linux PowerPC if the new loopback adapter support isn't working there.

Are any changes required to make things work on Linux for you? I thought the point of setting IP_MULTICAST_IF was to allow us to remove the code that disabled loopback for Mac. i.e. Linux already did what you needed; only Mac absolutely required that updates were applied.

If this isn't correct, can you explain what goes wrong when running on loopback on Linux please? All our tests seem to cope on loopback okay.
Find all posts by this user
20-10-2014, 10:21 AM
Post: #28
RE: Support loopback adapter with external adapters
(20-10-2014 09:48 AM)simonc Wrote:  Are any changes required to make things work on Linux for you? I thought the point of setting IP_MULTICAST_IF was to allow us to remove the code that disabled loopback for Mac. i.e. Linux already did what you needed; only Mac absolutely required that updates were applied.

If this isn't correct, can you explain what goes wrong when running on loopback on Linux please? All our tests seem to cope on loopback okay.

I didn't see any problems with the new loopback support on Linux, but I haven't been able to test this on Linux PPC. Given that the ohNet tests are failing on Linux PPC for some reason when the IP_MULTICAST_IF call is being made, I am concerned that the new loopback support might not be working on Linux PPC, which would cause problems for MinimServer.

I am happy to help debug and/or fix the Linux PPC test failure issue with the IP_MULTICAST_IF call enabled if you can provide any information about where the failure is occurring during test execution.
Find all posts by this user
20-10-2014, 10:26 AM
Post: #29
RE: Support loopback adapter with external adapters
(20-10-2014 10:21 AM)simoncn Wrote:  I didn't see any problems with the new loopback support on Linux, but I haven't been able to test this on Linux PPC. Given that the ohNet tests are failing on Linux PPC for some reason when the IP_MULTICAST_IF call is being made, I am concerned that the new loopback support might not be working on Linux PPC, which would cause problems for MinimServer.

I am happy to help debug and/or fix the Linux PPC test failure issue with the IP_MULTICAST_IF call enabled if you can provide any information about where the failure is occurring during test execution.

There currently is no loopback support for Linux PPC. I'm not sure whether this is an issue. To the best of my knowledge, device stack clients have always been able to operate on Linux (and on Windows). The only problems I was aware of were on Mac - where a small bit of #if 0'd code prevented loopback ever being returned as an available adapter.

All the changes you suggested are available on Mac now. The changes are disabled on Linux; I hope this won't matter.

I'd hope the current code is usable by you on all platforms. If this isn't the case, can you explain what part of running on loopback doesn't work for you?
Find all posts by this user
20-10-2014, 10:33 AM
Post: #30
RE: Support loopback adapter with external adapters
(20-10-2014 10:26 AM)simonc Wrote:  There currently is no loopback support for Linux PPC. I'm not sure whether this is an issue. To the best of my knowledge, device stack clients have always been able to operate on Linux (and on Windows). The only problems I was aware of were on Mac - where a small bit of #if 0'd code prevented loopback ever being returned as an available adapter.

Can you clarify why there is no loopback support on Linux PPC? Is this a limitation of Linux PPC or a limitation of ohNet? This issue will prevent the new release of MinimServer from running on Linux PPC because the new release depends on loopback support being available.
Find all posts by this user


Forum Jump: