Hi,
I'm making a packet sniffer for IrDA frames called irdadump (inspired by
tcpdump). I'm currently using the "obsolete" SOCK_PACKET interface, but
things are working quite well.
One thing that would be nice is to be able to tell if a frame is outgoing
or incomming. It's easy for ethernet frames (well actually it isn't), but
IrDA frames only use one connection address so its not easy to tell which
direction the frame is going.
The from field in recvfrom(fd, buf, 2048, 0, &from, &fromlen); only tells
the arp protocol identifier (ARPHRD_IRDA) and the name of the device
(irda).
So here are my questions:
1) Is there any way of finding out the direction of such a packet. I know
its coded in skb->pkt_type, but don't know if its possible to get this
(easily) to user-space. Would it be possible to use irda sockets instead
of packet sockets (attaching as a sniffer just like packet sockets), so
that I could return my own special sockaddr_irda which would then
contain the pkt_type field?
2. If I use ETH_P_IRDA instead of ETH_P_ALL in the socket call, I only get
the incomming IrDA frames, even if I have set skb->protocol to
htons(ETH_P_IRDA) for both outgoing and incomming frames. What have I
done wrong? Its easy to filter in user-space, but should be no reason to
receive all frames.
3) Does anybody have some example code on how to use the "new" Linux Socket
Filtering features? I guess SOCK_PACKET will disappear when libpcap and
others have been updated.
Any hints?
-- Dag (using 2.2.1ac5)
--
/ Dag Brattli | The Linux-IrDA Project /
// University of Tromsoe, Norway | Infrared communication for Linux //
/// http://www.cs.uit.no/~dagb | http://www.cs.uit.no/~dagb/irda/ ///
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]