yellowman / nsh

OpenBSD networking configuration shell
http://www.nmedia.net/nsh/
Other
177 stars 27 forks source link

no autoconf4 does not work properly when there is a /var/db/dhclient.leases.ifX #163

Closed smytht closed 1 month ago

smytht commented 1 month ago

if one has an interface em0 on their nsh controlled machine

and if at some stage there was a dhclient.leases.em0 file created in /var/db (i.e. if there was dhclient running on that interface in the past )

and there is a static interface configured on the interface (via hostnme.em0) in /etc/

entering the interface em0 in config mode, show run will not show the static ip but instead show autoconf4

typing no autoconf4 will remove the flag from the interface, but the config on the interface on em0 will still remain with autoconf4 set

i.e. no matter how many times you type " no autoconf4" on em0 ... it will not be unset in the nsh interface em0 config, and you will not be able to save or store a static ip config on em0 using nsh interactively. (even manual edits of /etc/nshrc) will not deliver a static ip configuration.

workaround remove /var/db/dhclinet.leases.em0 file and nsh behaves as normal

######## Proposed resolution (s) 1) if an interface in nshrc has a static ip configuration that should take precedence over /var/db/dhclient.leases.ifname file presence 2) no autoconf4 should delete that file in /var/db/dhclient.leases.ifname (and no autoconf6 / no autoconfprivacy should remove similar files if any) 3) integration scripts should / could analyse if flags vs file presence in /var/db/dhclient.leases.ifname. 4) make sure detection of dhcp , 4 or 6 or slaac control of an interface is subservient to a static ip config on that interface... i.e. dhclient dhcpleased should not prevent the configuration of a static ip on that interface being captured in config 5) consider exposing detection of dhcp slaacd or v4 or v6 autoconf and that "preferred addresses" or previous addresses is somehow conveyed to the user
6) somehow warn a user about the presence of /var/db/dhclient.leases.if name

7) do we need to update logic to take account of dhcpleased and dhcplease6d ?

smytht commented 1 month ago

Stsp commit does resolve this issue ... closing it out

smytht commented 1 month ago

tested and autodonf4 and no autoconf4 works as expected ...