Skip to content

Commit

Permalink
fixup! gnrc_sock_udp: accept response from any address if remote is m…
Browse files Browse the repository at this point in the history
…ulticast
  • Loading branch information
benpicco committed Nov 7, 2022
1 parent 2e65f26 commit b59b116
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions sys/include/net/sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ extern "C" {
* @anchor net_sock_flags
* @{
*/
#define SOCK_FLAGS_REUSE_EP (0x0001) /**< allow to reuse end point on bind */
#define SOCK_FLAGS_BIND_REMOTE (0x0002) /**< restrict responses to remote address */
#define SOCK_FLAGS_REUSE_EP (0x0001) /**< allow to reuse end point on bind */
#define SOCK_FLAGS_CONNECT_REMOTE (0x0002) /**< restrict responses to remote address */
/** @} */

/**
Expand Down
4 changes: 2 additions & 2 deletions sys/net/gnrc/sock/udp/gnrc_sock_udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ int sock_udp_create(sock_udp_t *sock, const sock_udp_ep_t *local,
/* only accept responses from the set remote */
if (!(ipv6_addr_is_multicast((ipv6_addr_t *)&remote->addr) ||
ipv6_addr_is_unspecified((ipv6_addr_t *)&remote->addr))) {
flags |= SOCK_FLAGS_BIND_REMOTE;
flags |= SOCK_FLAGS_CONNECT_REMOTE;
}
}
if (local != NULL) {
Expand Down Expand Up @@ -208,7 +208,7 @@ ssize_t sock_udp_recv_aux(sock_udp_t *sock, void *data, size_t max_len,

static bool _remote_mismatch(const sock_udp_t *sock, const udp_hdr_t *hdr, const sock_ip_ep_t *remote)
{
if ((sock->flags & SOCK_FLAGS_BIND_REMOTE) == 0) {
if ((sock->flags & SOCK_FLAGS_CONNECT_REMOTE) == 0) {
return false;
}

Expand Down

0 comments on commit b59b116

Please sign in to comment.