mirror of
https://github.com/M66B/NetGuard.git
synced 2025-01-02 21:34:12 +00:00
Native fixed UDP broadcast
This commit is contained in:
parent
ec77f7403e
commit
f5564607a1
1 changed files with 10 additions and 1 deletions
|
@ -934,6 +934,16 @@ jboolean handle_udp(const struct arguments *args, const uint8_t *buffer, uint16_
|
|||
return 0;
|
||||
}
|
||||
else {
|
||||
// Check for broacast
|
||||
uint32_t broadcast = INADDR_BROADCAST;
|
||||
if (memcmp(&iphdr->saddr, &broadcast, sizeof(broadcast)) == 0) {
|
||||
log_android(ANDROID_LOG_WARN, "UDP broadcast");
|
||||
int on = 1;
|
||||
if (setsockopt(u->socket, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on)))
|
||||
log_android(ANDROID_LOG_ERROR, "UDP setsockopt error %d: %s",
|
||||
errno, strerror(errno));
|
||||
}
|
||||
|
||||
protect_socket(args, u->socket);
|
||||
|
||||
if (last == NULL)
|
||||
|
@ -943,7 +953,6 @@ jboolean handle_udp(const struct arguments *args, const uint8_t *buffer, uint16_
|
|||
|
||||
cur = u;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
char source[40];
|
||||
|
|
Loading…
Reference in a new issue