Re: SOCK_PACKET

spyro papademetriou (spyro@isr.umd.edu)
Wed, 10 Mar 1999 14:58:07 -0500


hey all sorry that should have read %x in my printing of rbuff[i]

Spyro Papademetriou wrote:
>
> i am trying to parse the src mac and src ip of an incoming ethernet
> frame.
> i seem to be able to parse the mac frame. however i am getting sets of
> "ffffff"'s when i shouldn't. also i seem to be unable to extract the src
> ip.
>
> below is the code and a sample output. i am using SOCK_PACKET.
> any help or suggestions would be very helpful.
>
> this is the code that prints out the mac address it should be:
> 00:60:97:19:B4:C9
> ---------------
> .
> .
> .
> socket(PF_INET,SOCK_PACKET,htons(ETH_P_ALL));
>
> recvfrom(fd0,rbuff,ETH_LEN,0,&saddr,&fromlen);
>
> for(i=0;i<20;i++)
> printf("%x.",rbuff[i]);
>
> ----------------
> this is the output
>
> 0.60.ffffff97.19.ffffffb4.ffffffc9.0.10.54.3c.20.10.8.0.45.0.0.28.ffffffdb.ffffff9f
>
> ---------------
>
> also, how do i extract the ip portion ?
>
> thanks
> spyro
> -
> To unsubscribe from this list: send the line "unsubscribe linux-net" in
> the body of a message to majordomo@vger.rutgers.edu
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.rutgers.edu