Promisc mode Problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux