linux下安装sendip

操作系统kylin

下载sendip-2.5.tar.gz

解压在/home/sendip-2.5/目录下

执行make命令

出现错误:

cc1: warnings being treated as errors

ipv4.c: In function 'do_opt':

ipv4.c:212: warning: pointer targets inpassing argument 1 of 'sprintf' differ in signedness

ipv4.c:213: warning: pointer targets inpassing argument 1 of 'compact_string' differ in signedness

ipv4.c:240: warning: pointer targets inpassing argument 5 of 'addoption' differ in signedness

ipv4.c:355: warning: pointer targets inpassing argument 5 of 'addoption' differ in signedness

ipv4.c:380: warning: pointer targets inpassing argument 5 of 'addoption' differ in signedness

ipv4.c:402: warning: pointer targets inpassing argument 5 of 'addoption' differ in signedness

make: *** [ipv4.so] Error 1

提示上述warning被作为错误

我们打开ipv4.c文件,找到各行,如212行:sprintf(data,"0x%s",arg);

发现参数data在前面(207行)声明为u_int8_t *类型,而sprintf的参数一般为(char *)而得到data的变量arg也是char *类型的,于是我们在212行将参数data显示转换为char *类型:sprintf((char *)data,"0x%s",arg);

再次make发现212行warning消失,于是其213几行和同样处理。

在240、355、380、402行方法'addoption'的data的参数是char *类型,但我们发现386行的addoption方法第5个参数为u_int8_t *类型,于是我们将上面几行的data显示转换为u_int8_t *类型,如240行:addoption(0,0,7,len+2,(u_int8_t *)data,pack);

再次make发现ipv4.c中的warning已经消失,但是出现tcp.c文件中的若干warning:

cc1: warnings being treated as errors

tcp.c: In function 'do_opt':

tcp.c:207: warning: pointer targets inpassing argument 1 of 'sprintf' differ in signedness

tcp.c:208: warning: pointer targets inpassing argument 1 of 'compact_string' differ in signedness

tcp.c:239: warning: pointer targets inassignment differ in signedness

tcp.c:241: warning: pointer targets inpassing argument 1 of 'strchr' differ in signedness

tcp.c:241: warning: pointer targets inassignment differ in signedness

tcp.c:249: warning: pointer targets inassignment differ in signedness

tcp.c:252: warning: pointer targets inassignment differ in signedness

tcp.c:262: warning: pointer targets inassignment differ in signedness

tcp.c:264: warning: pointer targets inassignment differ in signedness

tcp.c:266: warning: pointer targets in assignmentdiffer in signedness

tcp.c:270: warning: pointer targets inassignment differ in signedness

make: *** [tcp.so] Error 1

我们以类似的方法找到各行,进行格式修改:

207行:sprintf((char*)data,"0x%s",arg);

208行:len =compact_string((char *)data);

239行:next=(unsigned char*)arg;

241行:next=(unsigned char*)strchr((char *)next,',');

249行:next=(unsigned char*)arg;

252行:next=(unsigned char*)strchr(arg, ':');

262行:arg=(char *)next;

264行:next=(unsigned char*)strchr(arg, ',');

266行:next=(unsigned char*)arg-1; /* Finito - next points to \0 */

270行:arg=(char *)next;

重新make通过

make install通过

安装完成

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值