summaryrefslogtreecommitdiffstats
path: root/src/hci
diff options
context:
space:
mode:
authorMichael Brown2013-11-19 16:34:58 +0100
committerMichael Brown2013-12-05 13:43:28 +0100
commiteaa86156484d72f50825fec3e313a732f258fd31 (patch)
tree9e2b04c4e3cee6c27b78a3449bf36ce23b0ae895 /src/hci
parent[settings] Force settings into alphabetical order within sections (diff)
downloadipxe-eaa86156484d72f50825fec3e313a732f258fd31.tar.gz
ipxe-eaa86156484d72f50825fec3e313a732f258fd31.tar.xz
ipxe-eaa86156484d72f50825fec3e313a732f258fd31.zip
[settings] Allow for multiple definitions of each predefined setting
Allow for multiple setting definitions with the same name but different scopes and tags. For example, allow for a "filename" setting with default scope and tag value 67 (for DHCPv4) and a corresponding "filename" setting with IPv6 scope and tag value 59 (for DHCPv6). Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/hci')
-rw-r--r--src/hci/tui/settings_ui.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/hci/tui/settings_ui.c b/src/hci/tui/settings_ui.c
index 8fe13ad8..87afc9ba 100644
--- a/src/hci/tui/settings_ui.c
+++ b/src/hci/tui/settings_ui.c
@@ -119,6 +119,7 @@ static unsigned int select_setting_row ( struct setting_widget *widget,
unsigned int index ) {
struct settings *settings;
struct setting *setting;
+ struct setting *previous = NULL;
unsigned int count = 0;
/* Initialise structure */
@@ -146,11 +147,18 @@ static unsigned int select_setting_row ( struct setting_widget *widget,
/* Include any applicable settings */
for_each_table_entry ( setting, SETTINGS ) {
+
+ /* Skip inapplicable settings */
if ( ! setting_applies ( widget->settings, setting ) )
continue;
- if ( count++ == index ) {
- /* Read current setting value and origin */
+ /* Skip duplicate settings */
+ if ( previous && ( setting_cmp ( setting, previous ) == 0 ) )
+ continue;
+ previous = setting;
+
+ /* Read current setting value and origin */
+ if ( count++ == index ) {
fetchf_setting ( widget->settings, setting,
&widget->row.origin,
&widget->row.setting,