Hello.
I need to build esp32-based transparent WiFi bridge like that:
Copper ETH <-> ESP32 AP <-> ESP32 STA <-> Copper ETH
So, first part Copper ETH <-> ESP32 AP works well (based on "eth2ap" example)
Second part ESP32 STA <-> Copper ETH (based on the same "eth2ap" example, but modified to STA) has a problem.
AP can send to WiFi packets with any source MAC
But STA can send only packets with the exactly same source MAC, as it was assigned in esp_wifi_set_mac()
When i try to send packet with other source MAC - looks like it just skipped by driver. Anyway, i can't recieve such packets on the other side.
Of course, i can encapsulate all ETH frames from copper into other frames with correct source MAC address (something like EoIP-tunnel by Mikrotik).
Also i can use something like raw 802.11 packets.
But what is the most correct way to do this with WiFi standart?
Maybe i can disable MAC source control in STA mode or something else?
STA Mode: Sending packets with other MAC source
Re: STA Mode: Sending packets with other MAC source
So, nobody knows ?
Re: STA Mode: Sending packets with other MAC source
Hi,
I have the same problem, in STA mode can send only packets with the exactly same source MAC, as it was assigned in esp_wifi_set_mac().
With other source MAC I can´t send packets
I have the same problem, in STA mode can send only packets with the exactly same source MAC, as it was assigned in esp_wifi_set_mac().
With other source MAC I can´t send packets
Re: STA Mode: Sending packets with other MAC source
I think it's some part of WiFi standart (STA cannot be any other device because of security reasons).
So, my solution - incapsulation of all ethernet frame into other ethernet frames with correct STA mac source.
Of cource MTU will be 14 bytes less than original (because of additional "fake" ETH header)
So, my solution - incapsulation of all ethernet frame into other ethernet frames with correct STA mac source.
Of cource MTU will be 14 bytes less than original (because of additional "fake" ETH header)
-
- Posts: 1708
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: STA Mode: Sending packets with other MAC source
I imagine this is not possible. After all, you must first connect to a WiFi network (AP) using some MAC address. Later changing the MAC address while maintaining the existing WiFi connection... probably not going to happen.
Proper tunneling of the ethernet packets looks like the best option.
Re: STA Mode: Sending packets with other MAC source
And how can I do that? I'm looking in forums but so far I can't find anything, it's so frustrating.
Re: STA Mode: Sending packets with other MAC source
You just need to add another "fake" ethernet header to all your packets before sending from STA.
-MAC Destination addres (it can be just copied from original packet - first 6 bytes)
-MAC Source address - it must be the same MAC that was assigned to STA, not original MAC Source address from original packet (6 bytes)
-Ethernet type (it can be any value, which is not common used, for example 0x7FFF - 2 bytes)
So, you will send 14 bytes + size of original packet.
On the other side (AP) just remove first 14 bytes - and it's done. You received original packet from STA with any MAC Source address.
It's just simple tunneling (ethernet frames inside other ethernet frames).
-MAC Destination addres (it can be just copied from original packet - first 6 bytes)
-MAC Source address - it must be the same MAC that was assigned to STA, not original MAC Source address from original packet (6 bytes)
-Ethernet type (it can be any value, which is not common used, for example 0x7FFF - 2 bytes)
So, you will send 14 bytes + size of original packet.
On the other side (AP) just remove first 14 bytes - and it's done. You received original packet from STA with any MAC Source address.
It's just simple tunneling (ethernet frames inside other ethernet frames).
Who is online
Users browsing this forum: Baidu [Spider] and 110 guests