I have searched on the web for the past few days. Every article or reference on the web is suggesting to go for IPTables and netfilter. I am aware of such tools and in fact used them to achieve the goal.
But I am searching for a simple or minimalistic steps to follow the goal which is shown in the attached figure from inside the Linux kernel as a separate module.
Please note that I'm new to kernel module development and still in the learning phase. So, I'm sorry if the question is to naïve or obvious.
Edited
Ok, so we can get the Ethernet frame using Netfilter hooks (Though we cannot explicitly mention which eth interface from). Since this question was put on hold and requested to narrow it down, I would like to know how can we do the following in a kernel module:
- Get a list of available Ethernet interfaces
- Select an Interface
- Send/inject an IP Packet to it
I have done this from the userspace so I am looking for answers that are related to kernel space and not any userspace alternatives.