首页 新闻 赞助 找找看

libnet 问题

0
悬赏园豆:10 [已解决问题] 解决于 2016-05-27 18:58
 1 #include <sys/socket.h>
 2 #include <netinet/in.h>
 3 #include <arpa/inet.h>
 4 #include <libnet.h>
 5 #include <unistd.h>
 6 #include <stdio.h>
 7 #include <string.h>
 8 #include <sys/errno.h>
 9 #include <stdlib.h>
10 
11 #define ETH    "enp0s25"
12 
13 void err_sys(const char *msg)
14 {
15     printf("%s:%s\n" ,msg, strerror(errno));
16     exit(0);
17 }
18 int main(int argc, char*argv)
19 {
20     libnet_t * lib;
21     char err_buf[50];
22 
23     if((lib = libnet_init(LIBNET_LINK, "enp0s25", err_buf)) == NULL)
24     {
25         printf("libnet_init error : %s\n", err_buf);
26         exit(0);
27     }
28 
29     return 0;
30 }

莫小川的主页 莫小川 | 初学一级 | 园豆:94
提问于:2016-05-26 23:09
< >
分享
最佳答案
0

用户权限问题,CAP_NET_RAW需要的权限较大,root肯定可以,不是root的话,配置较复杂,可查CAP_NET_RAW的关键词

收获园豆:10
2012 | 高人七级 |园豆:21228 | 2016-05-27 08:22

感谢, 确实解决问题了

莫小川 | 园豆:94 (初学一级) | 2016-05-27 18:57
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册