snooda / net-speeder

net-speeder 在高延迟不稳定链路上优化单线程下载速度

Home Page:http://www.snooda.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

我想问个问题,在路由器上应该怎样搭建它?

lslqtz opened this issue · comments

我试图在一个OpenWrt上运行它,但是libnet使我受挫。
libnet.h:87:2: error: #error "byte order has not been specified, you'll"
#error "byte order has not been specified, you'll"
^
libnet.h:88:1: error: expected identifier or ‘(’ before string constant
"need to #define either LIBNET_LIL_ENDIAN or LIBNET_BIG_ENDIAN. See the"
^
1.c: In function ‘got_packet’:
1.c:41:2: error: unknown type name ‘libnet_t’
libnet_t *libnet_handler = (libnet_t *)args;
^
1.c:41:30: error: ‘libnet_t’ undeclared (first use in this function)
libnet_t *libnet_handler = (libnet_t *)args;
^
1.c:41:30: note: each undeclared identifier is reported only once for each function it appears in
1.c:41:40: error: expected expression before ‘)’ token
libnet_t *libnet_handler = (libnet_t *)args;
^
1.c:46:7: error: dereferencing pointer to incomplete type
if(ip->ip_ttl != SPECIAL_TTL) {
^
1.c:47:5: error: dereferencing pointer to incomplete type
ip->ip_ttl = SPECIAL_TTL;
^
1.c:48:87: error: dereferencing pointer to incomplete type
int len_written = libnet_adv_write_raw_ipv4(libnet_handler, (u_int8_t )ip, ntohs(ip->ip_len));
^
1.c:50:58: error: dereferencing pointer to incomplete type
printf("packet len:[%d] actual write:[%d]\n", ntohs(ip->ip_len), len_written);
^
1.c: At top level:
1.c:59:1: error: unknown type name ‘libnet_t’
libnet_t
start_libnet(char *dev) {
^
1.c: In function ‘start_libnet’:
1.c:61:2: error: unknown type name ‘libnet_t’
libnet_t *libnet_handler = libnet_init(LIBNET_RAW4_ADV, dev, errbuf);
^
1.c:61:41: error: ‘LIBNET_RAW4_ADV’ undeclared (first use in this function)
libnet_t *libnet_handler = libnet_init(LIBNET_RAW4_ADV, dev, errbuf);
^
1.c: In function ‘main’:
1.c:106:2: error: unknown type name ‘libnet_t’
libnet_t *libnet_handler = start_libnet(dev);

报错信息大概是这样的。。大概哪些地方需要修改以适应低版本的libnet呢

commented

"byte order has not been specified"提示你字节序没有指定 (小端还是大端)
我记得没错的话OpenWrt的路由器大部分都是小端的

你可以考虑交叉编译 先静态编译运行库 然后编译net-speeder的时候链接那些静态库
再生成一个静态的net-speeder

路由器大部分是ARM架构的 所以你还得指定诸如--host=arm-linux之类的参数

具体没试过 你可以去试试看 :-D

直接在交叉编译环境编译libnet失败了,交叉环境默认似乎没有libnet。
是的,我指定了交叉编译的参数,但还是不行。。
小端是指的啥意思呢

commented

libnet: http://packetfactory.openwall.net/projects/libnet
libcap: http://www.tcpdump.org/
据我所知都可以静态编译 然后编译net_speed.c的时候手动指定库位置

小端就是Little-Endian 具体自己谷歌吧

谢谢!