+
+# Provides backward compatibility for old option names in the global section.
+translate_option() {
+ local section="$1"
+ local old_option="$2"
+ local new_option="$3"
+ local _value
+ config_get _value "$section" "$old_option"
+ [ -z "$_value" ] && return
+ cfg_append "${new_option//_/-} $_value"
+}
+
+translate_bool() {
+ local section="$1"
+ local old_option="$2"
+ local new_option="$3"
+ local _bool
+ local _value
+ config_get_bool _bool "$section" "$old_option" 0
+ [ "$_bool" -eq 0 ] && return
+ cfg_append "${new_option//_/-} true"
+}
+
+# Adds a new interface section for setting default interface options.
+add_default_option() {
+ local option="$1"
+ local value="$2"
+ cfg_append "default ${option//_/-} $value"
+}
+
+# Global 'hello_interval' and 'wired_hello_interval' options are ignored,
+# because they have no direct equivalent: you should use
+# interface-specific settings.
+parse_old_global_options() {
+ local section="$1"
+ translate_bool "$section" 'carrier_sense' 'link_detect'
+ translate_bool "$section" 'random_router_id' 'random_id'
+ translate_option "$section" 'multicast_address' 'protocol_group'
+ translate_option "$section" 'port' 'protocol_port'
+ translate_option "$section" 'local_server' 'local_port'
+ translate_option "$section" 'smoothing_half_time' 'smoothing_half_life'
+ translate_option "$section" 'duplication_priority' 'allow_duplicates'
+ # These two global options are turned into default interface options.
+ local _bool
+ config_get_bool _bool "$section" 'assume_wireless' 0
+ [ "$_bool" -eq 1 ] && add_default_option "wired" "false"
+ config_get_bool _bool "$section" 'no_split_horizon' 0
+ [ "$_bool" -eq 1 ] && add_default_option "split_horizon" "false"
+}
+