Promisc mode Problem

From: Jose Diaz
Date: Mon Feb 09 2004 - 18:59:38 EST


As I can capture all the packages in promiscuous way
except the packages that send since an interafce of
own network?

I put you the fragment of code with the one that
capture packages in promiscuous way:

char *in_iface="eth0";

sock=socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));

if(sock < 0)
{
perror("socket");
exit(0);
}

//Mode Promisc interface

index = set_promisc_iface(in_iface);
mtu = get_mtu_iface(sock, in_iface);

frame=(char *)malloc(mtu);

if(!frame)
exit(0);

s_ll.sll_family=AF_PACKET;
s_ll.sll_protocol=htons(ETH_P_ALL);
s_ll.sll_ifindex=index;

len=sizeof(struct sockaddr_ll);

//Bind Link Layer

if(bind(sock, (struct sockaddr *)&s_ll, len)<0)
{
perror("bind");
exit(0);
}

FD_ZERO(&sockets);
FD_SET(sock,&sockets);

for(;;)
{
select(sock+1,&sockets,0x00,0x00,0x00);

if(FD_ISSET(sock,&sockets))
{

len_paq=recvfrom(sock, frame , mtu, 0, (struct
sockaddr *)&s_ll, &len);

....etc
}

}





___________________________________________________
Yahoo! Messenger - Nueva versión GRATIS
Super Webcam, voz, caritas animadas, y más...
http://messenger.yahoo.es
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html