-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
Extends multicast options #291
Conversation
f98cd18
to
3de255f
Compare
Codecov Report
@@ Coverage Diff @@
## master #291 +/- ##
==========================================
+ Coverage 63.70% 63.88% +0.17%
==========================================
Files 76 76
Lines 5756 5875 +119
==========================================
+ Hits 3667 3753 +86
- Misses 1701 1725 +24
- Partials 388 397 +9
Continue to review full report at Codecov.
|
6f9870f
to
b4a61b8
Compare
The changes look fine... |
There is a problem with overall platforms. For example, if you have multiple IP addresses on the interface, some listeners will have incorrect source IP addresses. |
fdcfba2
to
9029ff7
Compare
I just tested the current version of the branch with my multicast test-code and it worked fine (after fixing the reference to the WithMulticastInterface function in my code). I will later test it in a network-namespace to make sure the interface selection works fine (which has to be done in the absence of a default-route to prevent Linux from faking things ^^) |
I get the following error on a system without a default route: I am calling I am not sure the code should call "connect()" for multicast targets, but I am still looking for the place in the code where it happens. |
I traced the origin of the error, its happening in the problem at this point is that the API tries to build an UDP "connection", which will fail for a multicast address in the absence of a default route. The default route is not necessary for sending, but something in the setup go wrong. We need a socket which has NOT set the remote address so that the socket API doesn't call "connect()" in sock_posix.go:150 |
Okay, I got the issue resolved with the help of a new option I call WithMulticastTarget(), which allows you to overwrite the destination of a WriteMulticast() call... this way you can open the socket without the multicast IP (e.g. ":5634" instead of "224.0.1.187:5683") but still can specify the destination of the Multicast. How do you want to get the additions (a bit of code in net/connUDP.go and net/options.go)? |
I can also provide the scripts I use to setup my network namespaces for testing... |
You can use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SonarCloud complains about some smell again, otherwise I see nothing else.
I have (in my local repository) added an option to allow a client to send Multicast to several addresses by selecting a target for each multicast simultaneously. |
Can we see if you add #293 to this change set before merging it to master? Multicast support for the server is not that useful if the client side doesn't work correctly... |
c8a9a46
to
4bafdac
Compare
Please, could you explain your use case? Because as I said: If you want to discover clients you need to use In the handler of responses, you will have the client which you can store somewhere for eg: |
I am using Discovery/Hello-Messages in terms of networking protocols, not specifically coap. I am working for a German Fraunhofer Institute (Fraunhofer FKIE in Wachtberg) and we are doing work on decentral radio networks, so protocols with "Hello/Beacon messages" are pretty common. Messages which already contain information for the receivers and don't need any answer. I am not sure if the COAP discovery mechanism is that useful for this purpose. Originally all of this stuff was done in custom binary messages but I like the idea of having COAP in between and being able to use its semantics without having to reinvent the wheel. My current project is a lightweight decentralized data store which use broad/multicasted Hash-values to communicate its current state (so that the "steady state" is low-traffic). Similar to the HNCP Homenet protocol (see RFC 7788) but useful for pure low/medium datarate radio networks, not for ethernet/wifi. |
Just as an additional explanation, in slow radio networks "media access" is often more important than "data rate"... when using a server discovery via multicast (and redo it from time to time because of limited radio range) and then use unicast to get the data, you square the number of packets involved in the process, which can be really bad. |
Ok, Now I understand :), So I added address as an argument in |
Just pulled your commit, changed a few lines in my code and it seems to work fine. Network Namespaces are just fun for testing code... |
hmm... just a thought... did anyone already test the code with IPv6 linklocal addresses and multicast? Edit: just tested it, linklocal IPv6 multicast works fine. |
- Add option to send multicast to an unspecified interface Co-authored-by: Henning Rogge <hrogge@gmail.com>
1f4c560
to
6ad7efe
Compare
Kudos, SonarCloud Quality Gate passed! |
Co-authored-by: Jozef Kralik jojo.lwin@gmail.com