ping(8): Fix pr_iph() to use ntohs() for ip_off field
The ip_off (flags + fragment offset) is a 16-bit field, so we should use
ntohs() instead of ntohl() to read it.
See also: https://reviews.freebsd.org/D38479
Makefile.inc1: Fix build-all/install-all/buildportschroot log directory
The log directory was ${GENLOGDIR} which hardcoded the "/usr/obj"
top-level directory. If user defines a custom MAKEOBJDIRPREFIX, the
GENLOGDIR would become wrong. Fix the issue by replacing GENLOGDIR with
DESTDIRBASE. In addition, remove the unnecessary 'mkdir ${GENLOGDIR}'.
While there, change the 'ldconfig' command in chroot to be
'/bin/sh -c "rcrestart ldconfig"', aligning with the one used in
nrelease/Makefile.
virtio: Fix cpu_lfence() wrong placement in virtqueue_dequeue()
The cpu_lfence() should be placed just after reading the 'used->idx',
before the 'vq_used_cons_idx' equality check and 'used->ring[]' access.
This is the correct use pattern of lfence.
More importantly, this fix an infinite loop in virtqueue_poll() that
happened when GCC 12.5 inlined the whole virtqueue_dequeue(). GCC
thought 'vq->vq_ring.used->idx' wouldn't change during the loop, so
hoisted the 'if (vq->vq_used_cons_idx == vq->vq_ring.used->idx)' into
its own loop and thus an infinite loop.
Maybe it's better to use atomic ops to read the 'vq_ring.used->idx' and
'vq_ring.used->flags' fields, which are updated by the host side. Need
to investigate this later.
ping(8): Fix pr_iph() to use ntohs() for ip_off field
The ip_off (flags + fragment offset) is a 16-bit field, so we should use
ntohs() instead of ntohl() to read it.
See also: https://reviews.freebsd.org/D38479
installer(8): Auto fill default router in fn_assign_ip()
Add field change callbacks for "interface_ip" and "interface_netmask"
fields to auto fill/update the default router according to the IP and
netmask.
In addition, set the default netmask to "255.255.255.0".
Fix bug #3382
Bug: https://bugs.dragonflybsd.org/issues/3382
Reported-by: Nelson H. F. Beebe
installer(8): Fix hostname FQDN handling in fn_assign_ip()
Append domain to create FQDN only when the domain is not empty, similar
to the logic in fn_assign_hostname_domain().
installer(8): Avoid prompting for hostname and domain twice
During the manual IP configuration, the installer prompted for the
hostname and domain. Later, the main configuration menu prompted for
them again.
Retrieve the hostname and domain from rc_conf/resolv_conf variables, and
pre-populate the form fields to avoid the duplicate prompts.
In addition, pre-populate the DNS server field from resolv_conf vars.
Fix bug #3383.
Bug: https://bugs.dragonflybsd.org/issues/3383
Reported-by: Nelson H. F. Beebe
installer(8): Implement form field change callback mechanism
Implement a callback mechanism for form field change. This allows the
backend to dynamically update the dependent form fields when user
modifies one field.
The whole interaction flow is:
1. Set the callback function for a form field;
2. The frontend presents the form;
3. User fills the field and changes focus;
4. The frontend sends the FIELD_CHANGED message and waits for the reply;
5. The backend handles the message, triggers the callback, and replies
the FIELD_CHANGED_ACK message with the full dataset;
6. The frontend applies the dataset to present the updated form.
For example, when user fills the interface IP address, the callback will
auto fill the default router / gateway address.
TODO: The following low-priority features are missing:
[4 lines not shown]
installer(8): Refactor vars handling to avoid writing duplicates
config_vars_write() appends the in-memory vars to the target config
file. fn_assign_hostname_domain() fn_assign_ip() previously both read
the 'resolv.conf' and then write the updated vars, resulting duplicate
items being written to 'resolv.conf'.
Refactor the vars handling to start with empty 'rc_conf' and
'resolv_conf' vars, adjust the above configure functions to add/set
variables, and only write the config files once at the end.
installer(8): Improve config_vars_read() to support CONFIG_TYPE_RESOLV
The config_vars_read() function previously only supported CONFIG_TYPE_SH
and ignored CONFIG_TYPE_RESOLV that's supported by config_vars_write().
Add the CONFIG_TYPE_RESOLV file support to config_vars_read(). This
change is required in later commits that improve/simplify the
installation flow.
installer(8): Use pgrep(1) to check frontend/backend processes
Use 'pgrep -x' to correctly match the frontend/backend processes. This
is simpler than the original ps+grep method and fixes the partial match
problem. For example, the old grep would incorrectly match the tail(1)
process that was checking the `dfuibe_installer_debug.log` or
`dfuife_curses_debug.log` debug logs.
installer(8): Remove unused and unfinished fn_select_services()
This configuration function is intended for enable/disable services.
However, it's unfinished (doesn't update rc.conf) and unused (i.e.,
commented out in the form). Even if we could fix them, it still needs
to start/stop the changed services and to distinguish whether it's
configuring the LiveCD environment or the target installed system.
On the other hand, it's simple and effective to just edit rc.conf (after
booting into the newly installed system) to achieve the purpose. So
simply remove this function to clean up the installer mess a bit.
Discussed-with: swildner
installer(8): Auto fill default router in fn_assign_ip()
Add field change callbacks for "interface_ip" and "interface_netmask"
fields to auto fill/update the default router according to the IP and
netmask.
In addition, set the default netmask to "255.255.255.0".
Fix bug #3382
Bug: https://bugs.dragonflybsd.org/issues/3382
Reported-by: Nelson H. F. Beebe
installer(8): Implement form field change callback mechanism
Implement a callback mechanism for form field change. This allows the
backend to dynamically update the dependent form fields when user
modifies one field.
The whole interaction flow is:
1. Set the callback function for a form field;
2. The frontend presents the form;
3. User fills the field and changes focus;
4. The frontend sends the FIELD_CHANGED message and waits for the reply;
5. The backend handles the message, triggers the callback, and replies
the FIELD_CHANGED_ACK message with the full dataset;
6. The frontend applies the dataset to present the updated form.
For example, when user fills the interface IP address, the callback will
auto fill the default router / gateway address.
TODO: The following low-priority features are missing:
[4 lines not shown]
installer(8): Refactor vars handling to avoid writing duplicates
config_vars_write() appends the in-memory vars to the target config
file. fn_assign_hostname_domain() fn_assign_ip() previously both read
the 'resolv.conf' and then write the updated vars, resulting duplicate
items being written to 'resolv.conf'.
Refactor the vars handling to start with empty 'rc_conf' and
'resolv_conf' vars, adjust the above configure functions to add/set
variables, and only write the config files once at the end.
installer(8): Fix hostname FQDN handling in fn_assign_ip()
Append domain to create FQDN only when the domain is not empty, similar
to the logic in fn_assign_hostname_domain().
installer(8): Avoid prompting for hostname and domain twice
During the manual IP configuration, the installer prompted for the
hostname and domain. Later, the main configuration menu prompted for
them again.
Retrieve the hostname and domain from rc_conf/resolv_conf variables, and
pre-populate the form fields to avoid the duplicate prompts.
In addition, pre-populate the DNS server field from resolv_conf vars.
Fix bug #3383.
Bug: https://bugs.dragonflybsd.org/issues/3383
Reported-by: Nelson H. F. Beebe
installer(8): Improve config_vars_read() to support CONFIG_TYPE_RESOLV
The config_vars_read() function previously only supported CONFIG_TYPE_SH
and ignored CONFIG_TYPE_RESOLV that's supported by config_vars_write().
Add the CONFIG_TYPE_RESOLV file support to config_vars_read(). This
change is required in later commits that improve/simplify the
installation flow.
kernel/rman: Fix error return in sysctl_rman().
Matt changed the error handling in 869748ea0626d3966a0b0e1a8223de70ef05
but forgot to return 'error' from now on.
This fixes devinfo -r (show hardware resource information).
installer(8): Use pgrep(1) to check frontend/backend processes
Use 'pgrep -x' to correctly match the frontend/backend processes. This
is simpler than the original ps+grep method and fixes the partial match
problem. For example, the old grep would incorrectly match the tail(1)
process that was checking the `dfuibe_installer_debug.log` or
`dfuife_curses_debug.log` debug logs.