Closed CzzzzzHyq closed 6 years ago
查找你的toolchain使用的头文件"netinet/tcp.h"的路径,编辑打开,查找struct tcphdr的check、doff需要定义什么宏才能启用,使用gcc的-D参数定义所需的宏进行编译。
struct tcphdr { be16 source; be16 dest; be32 seq; be32 ack_seq;
__u16 res1:4,
doff:4,
fin:1,
syn:1,
rst:1,
psh:1,
ack:1,
urg:1,
ece:1,
cwr:1;
__u16 doff:4,
res1:4,
cwr:1,
ece:1,
urg:1,
ack:1,
psh:1,
rst:1,
syn:1,
fin:1;
__be16 window;
__sum16 check;
__be16 urg_ptr;
} tcp.h下有这个tcphdr结构体的定义,那应该怎么开启? 直接-D __u16 这样吗?
请把tcp.h的内容完整上传
/*
struct tcphdr { be16 source; be16 dest; be32 seq; be32 ack_seq;
__u16 res1:4,
doff:4,
fin:1,
syn:1,
rst:1,
psh:1,
ack:1,
urg:1,
ece:1,
cwr:1;
__u16 doff:4,
res1:4,
cwr:1,
ece:1,
urg:1,
ack:1,
psh:1,
rst:1,
syn:1,
fin:1;
__be16 window;
__sum16 check;
__be16 urg_ptr;
} attribute((packed, aligned(2)));
/*
enum { TCP_FLAG_CWR = constant_cpu_to_be32(0x00800000), TCP_FLAG_ECE = __constant_cpu_to_be32(0x00400000), TCP_FLAG_URG = constant_cpu_to_be32(0x00200000), TCP_FLAG_ACK = constant_cpu_to_be32(0x00100000), TCP_FLAG_PSH = __constant_cpu_to_be32(0x00080000), TCP_FLAG_RST = constant_cpu_to_be32(0x00040000), TCP_FLAG_SYN = constant_cpu_to_be32(0x00020000), TCP_FLAG_FIN = __constant_cpu_to_be32(0x00010000), TCP_RESERVED_BITS = constant_cpu_to_be32(0x0F000000), TCP_DATA_OFFSET = __constant_cpu_to_be32(0xF0000000) };
/*
/ TCP socket options /
struct tcp_repair_opt { __u32 opt_code; __u32 opt_val; };
enum { TCP_NO_QUEUE, TCP_RECV_QUEUE, TCP_SEND_QUEUE, TCP_QUEUES_NR, };
/ for TCP_INFO socket option /
enum tcp_ca_state { TCP_CA_Open = 0,
TCP_CA_Disorder = 1,
TCP_CA_CWR = 2,
TCP_CA_Recovery = 3,
TCP_CA_Loss = 4
};
struct tcp_info { u8 tcpi_state; u8 tcpi_ca_state; u8 tcpi_retransmits; u8 tcpi_probes; u8 tcpi_backoff; __u8 tcpi_options; u8 tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
__u32 tcpi_rto;
__u32 tcpi_ato;
__u32 tcpi_snd_mss;
__u32 tcpi_rcv_mss;
__u32 tcpi_unacked;
__u32 tcpi_sacked;
__u32 tcpi_lost;
__u32 tcpi_retrans;
__u32 tcpi_fackets;
/* Times. */
__u32 tcpi_last_data_sent;
__u32 tcpi_last_ack_sent; /* Not remembered, sorry. */
__u32 tcpi_last_data_recv;
__u32 tcpi_last_ack_recv;
/* Metrics. */
__u32 tcpi_pmtu;
__u32 tcpi_rcv_ssthresh;
__u32 tcpi_rtt;
__u32 tcpi_rttvar;
__u32 tcpi_snd_ssthresh;
__u32 tcpi_snd_cwnd;
__u32 tcpi_advmss;
__u32 tcpi_reordering;
__u32 tcpi_rcv_rtt;
__u32 tcpi_rcv_space;
__u32 tcpi_total_retrans;
__u64 tcpi_pacing_rate;
__u64 tcpi_max_pacing_rate;
__u64 tcpi_bytes_acked; /* RFC4898 tcpEStatsAppHCThruOctetsAcked */
__u64 tcpi_bytes_received; /* RFC4898 tcpEStatsAppHCThruOctetsReceived */
__u32 tcpi_segs_out; /* RFC4898 tcpEStatsPerfSegsOut */
__u32 tcpi_segs_in; /* RFC4898 tcpEStatsPerfSegsIn */
};
/ for TCP_MD5SIG socket option /
struct tcp_md5sig { struct kernel_sockaddr_storage tcpm_addr; / address associated / u16 tcpm_pad1; / zero / u16 tcpm_keylen; / key length / u32 tcpm_pad2; / zero / __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; / key (binary) / };
麻烦大佬了
你的toolchain是哪里下载的,提供一下下载地址吧,我看看。
staging_dir/toolchain-mips_24kc_gcc-5.4.0_musl-1.1.16/include/netinet/tcp.h的77行:
#ifdef _GNU_SOURCE
用以下命令编译程序(记得替换TOOLCHAIN_GCC为你toolchain的gcc):
TOOLCHAIN_GCC -D_GNU_SOURCE main.c -o CCDGUTNetCrackerR
已成功!谢谢大佬!
按大佬说的,加了参数,-D_GNU_SOURCE,编译的确是通过了,但是编译出来的东西不正常,运行/usr/sbin/CCDGUTNetCrackerR br-lan daemon,没办法以守护进程运行。 出现提示: Random string: FpouCwDtHD Delete firewall rule. Add firewall rule. 然后本来正常的网络,直接没网了。这咋办
main.c: In function 'tcp_checksum': main.c:326:12: error: 'struct tcphdr' has no member named 'check' tcphdrp->check = 0; ^ main.c:341:12: error: 'struct tcphdr' has no member named 'check' tcphdrp->check = (unsigned short) sum; ^ main.c: In function 'package_processor': main.c:505:51: error: 'struct tcphdr' has no member named 'doff' tcp_header_length = tcp_header->doff << 2u;
大佬,这是什么情况?求解