mirror of
https://github.com/hufrea/byedpi.git
synced 2024-12-22 14:25:44 +00:00
usleep to nanosleep
This commit is contained in:
parent
901548ba0e
commit
5c6d706cea
2
Makefile
2
Makefile
@ -1,6 +1,6 @@
|
|||||||
TARGET = ciadpi
|
TARGET = ciadpi
|
||||||
CC ?= gcc
|
CC ?= gcc
|
||||||
CFLAGS += -std=c99 -O2
|
CFLAGS += -std=c99 -O2 -D_XOPEN_SOURCE=500
|
||||||
SOURCES = packets.c main.c conev.c proxy.c desync.c
|
SOURCES = packets.c main.c conev.c proxy.c desync.c
|
||||||
|
|
||||||
all:
|
all:
|
||||||
|
8
desync.c
8
desync.c
@ -1,5 +1,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <sys/time.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <netinet/tcp.h>
|
#include <netinet/tcp.h>
|
||||||
@ -57,7 +60,10 @@ int fake_attack(int sfd, char *buffer, ssize_t n, int cnt, int pos)
|
|||||||
perror("sendfile");
|
perror("sendfile");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
usleep(params.sfdelay);
|
struct timespec delay = {
|
||||||
|
.tv_nsec = params.sfdelay * 1000
|
||||||
|
};
|
||||||
|
nanosleep(&delay, 0);
|
||||||
memcpy(p, buffer, pos);
|
memcpy(p, buffer, pos);
|
||||||
|
|
||||||
if (setsockopt(sfd, IPPROTO_IP, IP_TTL,
|
if (setsockopt(sfd, IPPROTO_IP, IP_TTL,
|
||||||
|
2
main.c
2
main.c
@ -341,7 +341,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
case 'w': //
|
case 'w': //
|
||||||
params.sfdelay = strtoul(optarg, &end, 0);
|
params.sfdelay = strtoul(optarg, &end, 0);
|
||||||
if (optarg == end || *end)
|
if (optarg == end || params.sfdelay > 1000000 || *end)
|
||||||
invalid = 1;
|
invalid = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user