On Thu, Aug 9, 2012 at 8:05 AM, Jukka Rissanen <jukka.rissa...@linux.intel.com> wrote: > The DisableDHCPHostnameOption in system config file can be used > to ignore the received DHCP hostname option (12). > --- > src/main.c | 13 +++++++++++++ > src/main.conf | 6 ++++++ > 2 files changed, 19 insertions(+) > > diff --git a/src/main.c b/src/main.c > index 1e4809f..70c73ef 100644 > --- a/src/main.c > +++ b/src/main.c > @@ -67,6 +67,7 @@ static struct { > unsigned int timeout_inputreq; > unsigned int timeout_browserlaunch; > char **blacklisted_interfaces; > + connman_bool_t disable_dhcp_hostname_option; > } connman_settings = { > .bg_scan = TRUE, > .pref_timeservers = NULL, > @@ -76,6 +77,7 @@ static struct { > .timeout_inputreq = DEFAULT_INPUT_REQUEST_TIMEOUT, > .timeout_browserlaunch = DEFAULT_BROWSER_LAUNCH_TIMEOUT, > .blacklisted_interfaces = NULL, > + .disable_dhcp_hostname_option = FALSE, > }; > > static GKeyFile *load_config(const char *file) > @@ -243,6 +245,14 @@ static void parse_config(GKeyFile *config) > g_strdupv(default_blacklist); > > g_clear_error(&error); > + > + boolean = g_key_file_get_boolean(config, "General", > + "DisableDHCPHostnameOption", > + &error); > + if (error == NULL) > + connman_settings.disable_dhcp_hostname_option = boolean; > + > + g_clear_error(&error); > } > > static int config_init(const char *file) > @@ -403,6 +413,9 @@ connman_bool_t connman_setting_get_bool(const char *key) > if (g_str_equal(key, "BackgroundScanning") == TRUE) > return connman_settings.bg_scan; > > + if (g_str_equal(key, "DisableDHCPHostnameOption") == TRUE) > + return connman_settings.disable_dhcp_hostname_option; > + > return FALSE; > } > > diff --git a/src/main.conf b/src/main.conf > index 95fc7d4..a6d7b62 100644 > --- a/src/main.conf > +++ b/src/main.conf > @@ -58,3 +58,9 @@ > # match any of the list entries. Default value is > # vmnet,vboxnet,virbr. > # NetworkInterfaceBlacklist = vmnet,vboxnet,virbr > + > +# Disable setting of system hostname from DHCP option (12) > +# By default the system hostname is changed if we receive > +# the host name option in DHCP response. The default > +# value is false.
Shouldn't we have default true? This way misbehaved routers don't screw us Lucas De Marchi _______________________________________________ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman