[Beowulf] How to judge whether an ip address is local or not

Robert G. Brown rgb at phy.duke.edu
Thu Aug 18 12:10:36 PDT 2005


Zhang Hui writes:

> 	Sorry for the confusion i have brought.
> 	I intended to find a method to judge whether the destination ip
> address of a packet received is one of the ip addresses the receiving
> machine has.And this packet is intercepted by my netfilter prog(LKM,in
> "kernel state" of course) at the NF_IP_PRE_ROUTING point.Originally I
> judge the pkt_type of the skb packet,but i'm not sure when and where the
> skb->pkt_type is changed since being received by the NIC.Maybe no change
> happens since the skb is constructed at the sending machine?
> 	And, i have known how a bad subject has twisted your brain, thx a lot^^.

I'll bet you have!  Start messing with packets that far down the TCP
stack and you'll end up like Don Becker!  You have been warned...;-)

I myself stop way uphill around the "tcp socket" level, where all the
kernel automagic is safely hidden.  I've never messed with code that
deep.  However, e.g. tcpdump does, nmap (IIRC) does, and somewhere there
should be some raw low-level ethernet calls you can use to snoop packets
as well.  tcpdump in particular probably does "exactly" what you need
except for the matching part, which is trivial.

     rgb
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://www.beowulf.org/pipermail/beowulf/attachments/20050818/af413d6f/attachment.sig>


More information about the Beowulf mailing list