On 8/31/05, Jiangbo Li <jiangbo@xxxxxxxxx> wrote: > > Don't blame me if this question is too simple. I am new to Linux kernel. > > 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. > > Any suggestion is appreciated. > I think you want to know this !!!! struct ifreq macif; struct net_device *dev; unsigned char * mac_ptr; if ((dev = __dev_get_by_name("eth0")) == NULL) return -ENODEV; memcpy(macif.ifr_hwaddr.sa_data, dev->dev_addr, MAX_ADDR_LEN); mac_ptr = macif.ifr_hwaddr.sa_data; // MAC Address Please include necessary header files, I don't remember the names !!!! -- Fawad Lateef - : 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