I'm writing a TCP/IP stack on an extremely resource limited embedded device. I would like to know if it is safe to use the source mac address of an ethernet frame to reply to an IPV4 packet.
The normal procedure when you want to reply to the source ip address of an IPV4 packet is to check your ARP cache, and if it's not already populated, do an ARP request to get the MAC address.
I would instead like to use the source mac address of the ethernet frame that the IPV4 packet came in on. (as I will always already have this and thus be able to respond to a packet without waiting for more incoming packets)
Will this strategy ever cause problems?
For example, in a local network where the device is only connected to one router/switch, the reply mac address has to be the one the request came from, so there should never be an issue. However, I've heard packets don't always follow the same route upon reply. Would an end device ever have to reply to a different mac address than a request came from?
I believe routers are required by the standards to emit an ARP request themselves before declaring a destination unreachable, so my thought was that even in a set-up where the end device was connected to two routers (one for incoming packets and one for outgoing) that even if my device replied to the incoming packet router, that it would just forward it to the outgoing router, correcting for my device's deficiency.
Of course, I realize relying on other devices' conformance to the standards to allow my device to not follow the standards is rather hypocritical...