最近又发现在了一个设置SCO 网卡混杂模式的方法,并且可以抓到数据。但是实现起来也有问题,如下:
int Set_Promisc(char *inte *** ce, int sock )
{
struct ifreq ifr;
printf("strnlen(inte *** ce)+1 : %d\n",strlen(inte *** ce)+1);
strncpy(ifr.ifr_name, inte *** ce,strlen(inte *** ce)+1);
printf("ifr.ifr_name : %s\n",ifr.ifr_name);
if((ioctl(sock, SIOCGIFFLAGS, &ifr) == -1))
{
/*Could not retrieve flags for the inte *** ce*/
perror("Could not retrive flags for the inte *** ce");
exit(0);
}
printf("The inte *** ce is ::: %s\n", inte *** ce);
printf("Retrieved flags from inte *** ce successfully\n");
ifr.ifr_flags |= IFF_LINK0;
if (ioctl (sock, SIOCSIFFLAGS, &ifr) == -1 )
{
/*Could not set the flags>
你发错地方了。
会员注册
会员登录
个人空间
发表评论