diff options
| author | Dirk Engling <erdgeist@erdgeist.org> | 2026-11-03 14:03:35 +0100 |
|---|---|---|
| committer | Dirk Engling <erdgeist@erdgeist.org> | 2026-11-03 14:03:35 +0100 |
| commit | 33b5f6790db4e91ebd2370a97405e13932c4759c (patch) | |
| tree | 47647fb35f4d697e437ca351d9aee56425b2a03b /src | |
| parent | 44228839178f0354a4e065f6ef33c0c79b0236f1 (diff) | |
Bind mcast socket to its group rather than the wildcard
Diffstat (limited to 'src')
| -rw-r--r-- | src/ot_socket.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/src/ot_socket.c b/src/ot_socket.c index 79bb01a..b6a1803 100644 --- a/src/ot_socket.c +++ b/src/ot_socket.c | |||
| @@ -263,15 +263,9 @@ static int socket_v4_bind(const ot_ip6 ip, uint16_t port) { | |||
| 263 | 263 | ||
| 264 | int socket_mcast_join(const ot_ip6 group, const ot_ip6 interface, uint16_t port) { | 264 | int socket_mcast_join(const ot_ip6 group, const ot_ip6 interface, uint16_t port) { |
| 265 | struct ip_mreq mreq; | 265 | struct ip_mreq mreq; |
| 266 | ot_ip6 any; | ||
| 267 | int s; | 266 | int s; |
| 268 | 267 | ||
| 269 | /* The group is what is listened to, so the socket takes the wildcard and | 268 | if ((s = socket_v4_bind(group, port)) == -1) |
| 270 | the join names the interface to receive it on */ | ||
| 271 | memcpy(any, ip_v4mapped_prefix, sizeof(ip_v4mapped_prefix)); | ||
| 272 | memset(any + sizeof(ip_v4mapped_prefix), 0, 4); | ||
| 273 | |||
| 274 | if ((s = socket_v4_bind(any, port)) == -1) | ||
| 275 | return -1; | 269 | return -1; |
| 276 | 270 | ||
| 277 | memset(&mreq, 0, sizeof(mreq)); | 271 | memset(&mreq, 0, sizeof(mreq)); |
