[PATCH 9/9] gdhcp: Set domain-search names

Peter Meerwald pmeerw at pmeerw.net
Fri Sep 13 03:35:54 PDT 2013


> > diff --git a/src/dhcp.c b/src/dhcp.c
> > index c300357..27c7bef 100644
> > --- a/src/dhcp.c
> > +++ b/src/dhcp.c
> > @@ -301,7 +301,8 @@ static void lease_available_cb(GDHCPClient *dhcp_client, gpointer user_data)
> >  	const char *c_address, *c_gateway;
> >  	char *domainname = NULL, *hostname = NULL;
> >  	char **nameservers, **timeservers, *pac = NULL;
> > -	int ns_entries;
> > +	char **searchdomains = NULL;
> > +	int ns_entries, ds_entries;
> >  	struct connman_ipconfig *ipconfig;
> >  	struct connman_service *service;
> >  	unsigned char prefixlen, c_prefixlen;
> > @@ -376,6 +377,15 @@ static void lease_available_cb(GDHCPClient *dhcp_client, gpointer user_data)
> >  	if (option)
> >  		domainname = g_strdup(option->data);
> >  
> > +	option = g_dhcp_client_get_option(dhcp_client, G_DHCP_DOMAIN_SEARCH);
> > +	ds_entries = g_list_length(option);
> > +	searchdomains = g_try_new0(char *, ds_entries + 1);
> > +	if (searchdomains) {
> > +		for (i = 0, list = option; list; list = list->next, i++)
> > +			searchdomains[i] = g_strdup(list->data);
> > +		searchdomains[ds_entries] = NULL;
> > +	}

> 'searchdomains' is set, but not used?

yes, this is meant as an RFC and to see if this work in generally 
acceptable (and it was not clear to me when/where to actually set it :)

thanks, regards, p.

-- 

Peter Meerwald
+43-664-2444418 (mobile)



More information about the connman mailing list