i have tried to listen to the raw packets by using the following program 
 .on running it just keeps on waiting  for any packet to come even when
 there is traffic .
 i am running the program as a root.
  
 the program:
 ---------------------------------------------------------------------------------
> #include<sys/types.h>
> #include<sys/socket.h>
> #include<net/if_packet.h>
> #include<linux/if_ether.h>
> #include<netinet/in.h>
> #include<unistd.h>
> #include<stdlib.h>
> #include<stdio.h>
> main()
> {
>   int addlen;
>   struct datagram {
>   struct iphdr *ip;
>   char data[100];
>   };
>   struct datagram ipdgram;
>   int cont,create_socket,new_socket,addrlen;
>    int bufsize = 1024;
>    char *buffer = malloc(bufsize);
> 
>    struct sockaddr_in address;
>    printf("\x1B[2J");//clear screen
>    if ((create_socket = socket(PF_PACKET,SOCK_RAW,ETH_P_ALL)) > 0)
>      printf("The socket was created\n");
>    while(1)
>    {
>    read(create_socket,(struct datagram*)&ipdgram,sizeof(ipdgram));
>    //printf("%s",ipdgram.data);
>    }
>    printf("%s",ipdgram.data);
>    close(create_socket);
> }
> 
> ---------------------------------------------------------------------------------
> on running ::
> ---------------------------------------------------------------------------------
> 
> the socket is created
> 
> 
> 
> 
> ---------------------------------------------------------------------------------
> and like this it keeps on waiting
> 
>  
> 
> 
> 


-----------------------------------------------------------------------
LIH is all for free speech.  But it was created for a purpose - to help
people discuss issues about installing and running Linux.  If your
messages are counterproductive to this purpose, your privileges to
submit messages can and will be revoked.

Reply via email to