mirror of
https://github.com/hufrea/byedpi.git
synced 2024-12-22 06:15:14 +00:00
check mapped IPv4
This commit is contained in:
parent
3be8b82084
commit
a35039e6d7
18
desync.c
18
desync.c
@ -183,11 +183,15 @@ int desync(int sfd, char *buffer,
|
||||
int desync_udp(int fd, char *buffer,
|
||||
ssize_t n, struct sockaddr_in6 *dst)
|
||||
{
|
||||
char is_mv4 = 1;
|
||||
|
||||
if (dst->sin6_family == AF_INET6) {
|
||||
static char *pat = "\0\0\0\0\0\0\0\0\0\0\xff\xff";
|
||||
is_mv4 = !memcmp(&dst->sin6_addr, pat, 12);
|
||||
}
|
||||
if (params.desync_udp & DESYNC_UDP_FAKE) {
|
||||
if (setttl(fd, params.ttl, AF_INET) < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (setttl(fd, params.ttl, AF_INET6) < 0) {
|
||||
if (setttl(fd, params.ttl,
|
||||
is_mv4 ? AF_INET : dst->sin6_family) < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (sendto(fd, fake_udp.data, fake_udp.size,
|
||||
@ -195,10 +199,8 @@ int desync_udp(int fd, char *buffer,
|
||||
perror("sendto");
|
||||
return -1;
|
||||
}
|
||||
if (setttl(fd, params.def_ttl, AF_INET) < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (setttl(fd, params.def_ttl, AF_INET6) < 0) {
|
||||
if (setttl(fd, params.def_ttl,
|
||||
is_mv4 ? AF_INET : dst->sin6_family) < 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user