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
>
>
>
>
>
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]