Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using wlan0 as network interface doesn't work #540

Open
langmo opened this issue Mar 23, 2023 · 0 comments
Open

Using wlan0 as network interface doesn't work #540

langmo opened this issue Mar 23, 2023 · 0 comments

Comments

@langmo
Copy link

langmo commented Mar 23, 2023

I try to connect a Raspberry via iWLAN to my PLC using p-net. When using eth0, everything works fine, but when using wlan0 p-net won't establish a connection. I debugged the problem and found that p-net is indirectly calling ethtool to determine the connection type, which only supports cable based connections.
Specifically, the call stack is

  • pnal_eth_get_status
  • pf_pdport_update_eth_status
  • bg_worker_task

In pnal_eth_get_status (pnal.c), we finally hafe the condition

if(ioctl(control_socket, SIOCETHTOOL, &ifr) >= 0)
{..}

which evaluates to false when ifr.ifr_name is "wlan0" and causes the problem.

When I (just out of curiousity) hard-coded the following else-statement

if(ioctl(control_socket, SIOCETHTOOL, &ifr) >= 0)
{..}
else
{
  status->is_autonegotiation_enabled = true;
  status->is_autonegotiation_supported = true;
  status->operational_mau_type = PNAL_ETH_MAU_COPPER_100BaseTX_FULL_DUPLEX;
  status->autonegotiation_advertised_capabilities = PNAL_ETH_AUTONEG_CAP_UNKNOWN;
  ret = 0;
}

p-net runs without problems and I can establish the connection to the PLC via iWLAN. Using PNAL_ETH_MAU_RADIO instead however not works, since this results in p-net believing my network speed is too low. Specifically, in pf_cmdev.c,

if(pf_cmdev_check_pvdev(net) == 0)
{..}

evaluates to false.

Is there a way to add iWLAN support to p-net? From the outside, the problem seems to only/mainly be the call to ethtool which doesn't support WLAN network interfaces (and maybe pf_cmdev_check_pvdev ranking PNAL_ETH_MAU_RADIO to be slower than PNAL_ETH_MAU_COPPER_100BaseTX_FULL_DUPLEX)? Or do you know a way to trick ethtool to believe that wlan0 is cable based?

Thanks a lot!
Moritz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant