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

fetch DHCP leases from networkd #420

Open
bhoopesh369 opened this issue Jun 25, 2024 · 3 comments
Open

fetch DHCP leases from networkd #420

bhoopesh369 opened this issue Jun 25, 2024 · 3 comments

Comments

@bhoopesh369
Copy link
Contributor

bhoopesh369 commented Jun 25, 2024

See xPU sZTP provisioning block

today we pass lease file via cmdline arguments like this: --dhcp-lease-file /var/lib/dhclient/dhclient.leases.

for detecting this automatically using Network manger : #418
but if detection through Network Manager doesn't work, we can then look through networkd same as the above

can we detect that info automatically from networkd over dbus?

@bhoopesh369
Copy link
Contributor Author

It seems we can't get the lease info via dbus for systemd-networkd. Dbus does not expose the info.
So the only way to to parse all the lease files present in the /run/systemd/netif/leases folder.

WDYT? @glimchb

@bhoopesh369
Copy link
Contributor Author

The maximum info we can get via dbus is:

array [
      dict entry(
         string "OperationalState"
         variant             string "routable"
      )
      dict entry(
         string "CarrierState"
         variant             string "carrier"
      )
      dict entry(
         string "AddressState"
         variant             string "routable"
      )
      dict entry(
         string "IPv4AddressState"
         variant             string "routable"
      )
      dict entry(
         string "IPv6AddressState"
         variant             string "degraded"
      )
      dict entry(
         string "OnlineState"
         variant             string "online"
      )
      dict entry(
         string "AdministrativeState"
         variant             string "configured"
      )
      dict entry(
         string "BitRates"
         variant             struct {
               uint64 18446744073709551615
               uint64 18446744073709551615
            }
      )
   ]

@glimchb
Copy link
Member

glimchb commented Oct 3, 2024

It seems we can't get the lease info via dbus for systemd-networkd. Dbus does not expose the info. So the only way to to parse all the lease files present in the /run/systemd/netif/leases folder.

WDYT? @glimchb

copy paste please an example of this folder

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