python-sdbus-networkmanager
python-sdbus-networkmanager copied to clipboard
PPP Connection type
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!
Hello,
I think there is a PPPOE device type defined, however, it is probably the wrong name:
https://github.com/python-sdbus/python-sdbus-networkmanager/blob/f1fcc1dbef467e9dc0cbdf25eff51d065020ffcc/sdbus_async/networkmanager/enums.py#L550
Can you try renaming it to PPP = "ppp"?
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 )
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.
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