mirror of
https://github.com/wangyu-/udp2raw.git
synced 2025-01-19 14:29:34 +08:00
7.11 commit
This commit is contained in:
parent
ab2f1bfa93
commit
efd8d7378b
9
main.cpp
9
main.cpp
@ -682,11 +682,20 @@ int on_raw_recv()
|
|||||||
|
|
||||||
size = recvfrom(raw_recv_fd, buf, buf_len, 0 ,&saddr , &saddr_size);
|
size = recvfrom(raw_recv_fd, buf, buf_len, 0 ,&saddr , &saddr_size);
|
||||||
|
|
||||||
|
if(buf[13]!=8||buf[14]!=0)
|
||||||
|
{
|
||||||
|
printf("not an ipv4 packet!\n");
|
||||||
|
fflush(stdout);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
char *ip_data=buf+14;
|
char *ip_data=buf+14;
|
||||||
|
|
||||||
struct iphdr *iph = (struct iphdr *) (ip_data);
|
struct iphdr *iph = (struct iphdr *) (ip_data);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!(iph->ihl > 0 && iph->ihl < (MTU)/4)) {
|
if (!(iph->ihl > 0 && iph->ihl < (MTU)/4)) {
|
||||||
printf("iph ihl error");
|
printf("iph ihl error");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user