smiljanic997
smiljanic997

Reputation: 91

Forwarding traffic from ethernet to wlan

Requirement is to have eth0 to wlan0 forwarding, so that eth0-connected device has Internet connection.

I have enabled the forwarding, did the nat and iptables setup and ping from eth0 to Internet through wlan0 is working. What does not work is curl or iperf or any other TCP traffic. All of these commands work as expected if they are run directly through wlan0, not going through eth0 first.

Looking at packet captures, the following is observed: Wireshark capture

To me, this seemed like there are missing bytes on the wlan0 side, exactly 14 bytes.

I have been looking into skb->len and skb->data fields inside of wlan driver transmit function. If I look at the skb->data and print skb->len number of bytes, I see exactly the same as Wireshark sees on the wlan0, but if I try to print even more, 14 more than skb->len, I can see the whole packet. Meaning, data is there, only skb->len is wrong.

After this, I tried to manually increase skb->len for 14 bytes for the TCP case and this fixed things. curl and iperf are working.

The issue I'm having now is that the download speed with iperf3 test is super low, at least 4 times lower than the same test on wlan0 interface, without forwarding. Wireshark captures show large number of retransmissions, lost packets and similar: Wireshark capture after fix

Since this is the case, I suppose that my fix is wrong.

I'm looking for other places where the issue could occur, but it's hard to believe that there is an issue deep inside of the kernel. I am also excluding EMAC driver as a place of the issue since, if I configure forwarding to mobile connection(rmnet_data), everything works fine.

I'm questioning my understanding of the issue and would appreciate new insights.

Upvotes: 1

Views: 55

Answers (0)

Related Questions