I'm writing a C program on Linux machine that needs convert data from UART port to ETH and send it to the ETH port. In order to do so, I build a UDP packet with a given payload (in a SKB from UART) and send it to another machine (win7) on a given destination IP via the ETH port.
I do the following all on Linux machine:
- "Learn" the other machine (win7) MAC address, from receive packets.
- Allocate a new SKB and copy all the given UART SKB data to the new SKB
- Build ETH, IP and UDP headers with correct data
- Send the UDP packet that I built to the network by 'netif_rx(MsgSkb);' command.
Now, when I write in the ETH header the local port MAC address, I get an error on the Linux machine:
net_ratelimit: 167 callbacks suppressed
br0: received packet on mb_radio with own address as source address
br0: received packet on mb_radio with own address as source address
br0: received packet on mb_radio with own address as source address
br0: received packet on mb_radio with own address as source address
When I write in the ETH header a junk MAC address as 00:01:02:03:04:05
, all works OK.
In both the cases, I checked and verified in the destination machine (win7) with a sniffer (Wireshark) that all the packet that I send from the Linux machine are received OK with the MAC address that I wrote.
How can I write the packet to leave the Linux machine with the correct MAC address?
Thank ahead for your help and advice, -yaron.