Hi,
I am writing a simple application using the bsd socket api. I have 2
issues on which I could get no clarity even after obscene amounts of
googling. Here they are:
1. I capture TCP/IP,UDP/IP & ICMP/IP packets by making a RAW socket and
specifying the protocol as IPPROTO_TCP , IPPROTO_UDP & IPPROTO_ICMP
respectively.
In a similar way, how can I capture ARP packets? Do I have to make a
different type of socket for this?
btw...exactly which layer of the OSI model are we working on in case of
the above-mentioned sockets. I did find something to do with specifying
ETH_P_ARP as the protocol and PF_PACKET as the 1st parameter in
socket()...but I could harly understand it.
2. Is there a cleaner way in which I can make just 1 socket and capture
packets of all types on it and then open up the headers to recognize
what type of a packet it actually was?
Any help will be greatly appreciated.
Thanks in advance,
Siddharth Jain
|