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

PPP Connection type #55

Open
Regela opened this issue Jun 27, 2023 · 4 comments
Open

PPP Connection type #55

Regela opened this issue Jun 27, 2023 · 4 comments

Comments

@Regela
Copy link

Regela commented Jun 27, 2023

Hello! I need to add PPP Connection type to ‎sdbus_async/networkmanager/enums.py
It is a pptp vpn by network-manager-pptp

Type:    Ppp
Name:    ppp0
Address: 10.0.0.11/32
DNS:     10.0.0.10
DNS:     8.8.8.8
Traceback (most recent call last):
  File "/tmp/pycharm_project_872/network_manager_device_info.py", line 110, in <module>
    asyncio.run(list_networkdevice_details_async())
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/tmp/pycharm_project_872/network_manager_device_info.py", line 101, in list_networkdevice_details_async
    connection_id = await get_most_recent_connection_id(dev_name, dev_type)
  File "/tmp/pycharm_project_872/network_manager_device_info.py", line 39, in get_most_recent_connection_id
    if connection.connection_type != getattr(ConnectionType, dev_type):
  File "/usr/lib/python3.10/enum.py", line 437, in __getattr__
    raise AttributeError(name) from None
AttributeError: PPP

Thank you for excellent library!

@igo95862
Copy link
Collaborator

igo95862 commented Jun 27, 2023

Hello,

I think there is a PPPOE device type defined, however, it is probably the wrong name:

Can you try renaming it to PPP = "ppp"?

@Regela
Copy link
Author

Regela commented Jun 27, 2023

No, PPOE and PPP it is a different things. I add PPP = "ppp" to ConnectionType enum and it solved my problem. Please, add it in repo )

@igo95862
Copy link
Collaborator

igo95862 commented Nov 25, 2023

Hmmm...

Looking at the NetworkManager source code it looks like the PPP device connection setting type should be "pppoe"?

https://github.com/NetworkManager/NetworkManager/blob/02371a18b0bd1f30ae9d093646d49048d4944dc9/src/core/devices/nm-device-ppp.c#L327C25-L327C25

The NM_SETTING_PPP_SETTING_NAME seems to be almost unused anywhere in the source code.

@igo95862
Copy link
Collaborator

Ok I think I get it.

So the Device D-Bus interface returns the 23 which in the DeviceType enum has a name PPP.

However, the PPP Device requires the Connection Settings type field set to "pppoe" so the correct value should be PPP = "pppoe".

However, the ConnectionType enum should probably be a map named REQUIRED_CONNECTION_SETTING_TYPE and it won't cover all device types as it seems that certain device types can support multiple connection settings.

For example, VETH:

https://github.com/NetworkManager/NetworkManager/blob/02371a18b0bd1f30ae9d093646d49048d4944dc9/src/core/devices/nm-device-veth.c#L196

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

2 participants