ipaddr = inet_select_addr(dev, 0 , 0) seems work for me. Thanks a lot, Jiangbo On 9/1/05, Henrik Nordstrom <hno@xxxxxxxxxxxxxxx> wrote: > On Tue, 30 Aug 2005, Jiangbo Li wrote: > > > I am dealing with the Netfilter PreRouting hook. I want to write > > current IP address into the packet. But I can not find a way to get > > the IP address of the incoming device. > > See the ipt_MASQUERATE.c for one example how to get the IP from a device. > Not sure if this is applicable in your case however.. (MASQUERADE gets the > preferred source IP from the routing related to the outgoing device). > > Regards > Henrik > - : send the line "unsubscribe linux-net" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html