I have a problem which I can't solve even after googling and reading through the available and relevant information that I can find. I hope someone out there who is a linux kernel networking expert can help me with my problem.

Here's the situation:

Suppose I want to manually reroute a packet inside the kernel to an IP address which I do not have an entry of in arp and nd table, what can I do to obtain the MAC address of that particular IP address without pinging the IP address from the user space?

My method of doing that is by using __neigh_lookup for IPv4 and ndisc_get_neigh for IPv6. However, both of these MAC address lookup APIs will not obtain the MAC address if the MAC address entry is not available in the arp or nd cache even if neigh_create is called inside both of the APIs if the entry is not available.

Please advise me on how to fix this problem. I need to fix this urgently. Thank you. Your kindness and help are very very much appreciated.