opiproject / sztp

Secure Zero Touch Provisioning (sZTP) in OPI
Apache License 2.0
20 stars 14 forks source link

single file vs folder for dhcp leases #421

Open bhoopesh369 opened 3 months ago

bhoopesh369 commented 3 months ago

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

The below is the flow needed in the runCommandDaemon (code) :

for reference: https://github.com/opiproject/sztp/pull/403, https://github.com/opiproject/sztp/issues/396, https://github.com/opiproject/sztp/issues/418

glimchb commented 3 months ago

when I look at Ubuntu, when using Network Manager, I see a separate file per interface and not all interfaces in the same file...

See example:

root@bf2:~# ls -l /var/lib/NetworkManager/dhclient-*
-rw-r--r-- 1 root root 6981 Jun 19 20:31 /var/lib/NetworkManager/dhclient-aa93b667-6aac-3804-91e9-4958e07fdb2f-oob_net0.lease
-rw-r--r-- 1 root root 2514 Jun  7 18:52 /var/lib/NetworkManager/dhclient-oob_net0.conf

So instead of single file , maybe we should pass a folder to scan ? or check if argument is file or folder ourselves... or only accept folders...

Also what will be files we are looking for in that folder?