Send connman mailing list submissions to connman@lists.01.org To subscribe or unsubscribe via the World Wide Web, visit https://lists.01.org/mailman/listinfo/connman or, via email, send a message with subject or body 'help' to connman-requ...@lists.01.org
You can reach the person managing the list at connman-ow...@lists.01.org When replying, please edit your Subject line so it is more specific than "Re: Contents of connman digest..." Today's Topics: 1. [PATCH] dhcp: Add support for setting DHCP Vendor Class ID (Option 60) (Andreas Smas) 2. [PATCH] service: Always call ipconfig notifier (Patrik Flykt) ---------------------------------------------------------------------- Message: 1 Date: Thu, 12 Jan 2017 11:03:15 +0100 From: Andreas Smas <andr...@lonelycoder.com> To: connman@lists.01.org Subject: [PATCH] dhcp: Add support for setting DHCP Vendor Class ID (Option 60) Message-ID: <1484215395-28371-1-git-send-email-andr...@lonelycoder.com> This adds a new global config option "VendorClassID" which, when configured as a string, is passed on to DHCP requests as option 60 --- doc/connman.conf.5.in | 5 +++++ gdhcp/client.c | 5 +++-- gdhcp/gdhcp.h | 1 + src/dhcp.c | 6 ++++++ src/main.c | 15 +++++++++++++++ 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/doc/connman.conf.5.in b/doc/connman.conf.5.in index db9e558..9b28aad 100644 --- a/doc/connman.conf.5.in +++ b/doc/connman.conf.5.in @@ -131,6 +131,11 @@ Default value is false. Automatically enable Anycast 6to4 if possible. This is not recommended, as the use of 6to4 will generally lead to a severe degradation of connection quality. See RFC6343. Default value is false (as recommended by RFC6343 section 4.1). +.TP +.BI VendorClassID= string +Set DHCP option 60 (Vendor Class ID) to the given string. This option can +be used by DHCP servers to identify specific clients without having to +rely on MAC address ranges, etc .SH "EXAMPLE" The following example configuration disables hostname updates and enables ethernet tethering. diff --git a/gdhcp/client.c b/gdhcp/client.c index af1b953..e2eac10 100644 --- a/gdhcp/client.c +++ b/gdhcp/client.c @@ -3115,13 +3115,14 @@ GDHCPClientError g_dhcp_client_set_id(GDHCPClient *dhcp_client) return G_DHCP_CLIENT_ERROR_NONE; } -/* Now only support send hostname */ +/* Now only support send hostname and vendor class ID */ GDHCPClientError g_dhcp_client_set_send(GDHCPClient *dhcp_client, unsigned char option_code, const char *option_value) { uint8_t *binary_option; - if (option_code == G_DHCP_HOST_NAME && option_value) { + if ((option_code == G_DHCP_HOST_NAME || + option_code == G_DHCP_VENDOR_CLASS_ID) && option_value) { binary_option = alloc_dhcp_string_option(option_code, option_value); if (!binary_option) diff --git a/gdhcp/gdhcp.h b/gdhcp/gdhcp.h index 3dcb7a5..eaf6a74 100644 --- a/gdhcp/gdhcp.h +++ b/gdhcp/gdhcp.h @@ -79,6 +79,7 @@ typedef enum { #define G_DHCP_HOST_NAME 0x0c #define G_DHCP_MTU 0x1a #define G_DHCP_NTP_SERVER 0x2a +#define G_DHCP_VENDOR_CLASS_ID 0x3c #define G_DHCP_CLIENT_ID 0x3d #define G_DHCPV6_CLIENTID 1 diff --git a/src/dhcp.c b/src/dhcp.c index 4d23581..54fb64e 100644 --- a/src/dhcp.c +++ b/src/dhcp.c @@ -536,6 +536,7 @@ static int dhcp_initialize(struct connman_dhcp *dhcp) GDHCPClient *dhcp_client; GDHCPClientError error; int index; + const char *vendor_class_id; DBG("dhcp %p", dhcp); @@ -579,6 +580,11 @@ static int dhcp_initialize(struct connman_dhcp *dhcp) g_dhcp_client_set_request(dhcp_client, G_DHCP_ROUTER); g_dhcp_client_set_request(dhcp_client, G_DHCP_SUBNET); + vendor_class_id = connman_option_get_string("VendorClassID"); + if (vendor_class_id) + g_dhcp_client_set_send(dhcp_client, G_DHCP_VENDOR_CLASS_ID, + vendor_class_id); + g_dhcp_client_register_event(dhcp_client, G_DHCP_CLIENT_EVENT_LEASE_AVAILABLE, lease_available_cb, dhcp); diff --git a/src/main.c b/src/main.c index 462ac15..915c17e 100644 --- a/src/main.c +++ b/src/main.c @@ -77,6 +77,7 @@ static struct { char **tethering_technologies; bool persistent_tethering_mode; bool enable_6to4; + char *vendor_class_id; } connman_settings = { .bg_scan = true, .pref_timeservers = NULL, @@ -92,6 +93,7 @@ static struct { .tethering_technologies = NULL, .persistent_tethering_mode = false, .enable_6to4 = false, + .vendor_class_id = NULL, }; #define CONF_BG_SCAN "BackgroundScanning" @@ -108,6 +110,7 @@ static struct { #define CONF_TETHERING_TECHNOLOGIES "TetheringTechnologies" #define CONF_PERSISTENT_TETHERING_MODE "PersistentTetheringMode" #define CONF_ENABLE_6TO4 "Enable6to4" +#define CONF_VENDOR_CLASS_ID "VendorClassID" static const char *supported_options[] = { CONF_BG_SCAN, @@ -124,6 +127,7 @@ static const char *supported_options[] = { CONF_TETHERING_TECHNOLOGIES, CONF_PERSISTENT_TETHERING_MODE, CONF_ENABLE_6TO4, + CONF_VENDOR_CLASS_ID, NULL }; @@ -246,6 +250,7 @@ static void parse_config(GKeyFile *config) char **interfaces; char **str_list; char **tethering; + char *vendor_class_id; gsize len; int timeout; @@ -382,6 +387,13 @@ static void parse_config(GKeyFile *config) connman_settings.enable_6to4 = boolean; g_clear_error(&error); + + vendor_class_id = __connman_config_get_string(config, "General", + CONF_VENDOR_CLASS_ID, &error); + if (!error) + connman_settings.vendor_class_id = vendor_class_id; + + g_clear_error(&error); } static int config_init(const char *file) @@ -532,6 +544,9 @@ static GOptionEntry options[] = { const char *connman_option_get_string(const char *key) { + if (g_str_equal(key, CONF_VENDOR_CLASS_ID)) + return connman_settings.vendor_class_id; + if (g_strcmp0(key, "wifi") == 0) { if (!option_wifi) return "nl80211,wext"; -- 2.7.4 ------------------------------ Message: 2 Date: Thu, 12 Jan 2017 12:52:47 +0200 From: Patrik Flykt <patrik.fl...@linux.intel.com> To: connman@lists.01.org Subject: [PATCH] service: Always call ipconfig notifier Message-ID: <20170112105247.9273-1-patrik.fl...@linux.intel.com> Always call the ipconfig notifier whether the code is waiting to announce the service for the first time with ServicesChanged signal or not. --- This is a fix in for the comment to "[PATCH v3] service: Update nameservers and timeservers with address change". Any part of ipconfig may have changed, not only the address. src/service.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/service.c b/src/service.c index 1ce8b8af..84803500 100644 --- a/src/service.c +++ b/src/service.c @@ -1960,11 +1960,13 @@ static void settings_changed(struct connman_service *service, { enum connman_ipconfig_type type; + type = __connman_ipconfig_get_config_type(ipconfig); + + __connman_notifier_ipconfig_changed(service, ipconfig); + if (!allow_property_changed(service)) return; - type = __connman_ipconfig_get_config_type(ipconfig); - if (type == CONNMAN_IPCONFIG_TYPE_IPV4) connman_dbus_property_changed_dict(service->path, CONNMAN_SERVICE_INTERFACE, "IPv4", @@ -1973,8 +1975,6 @@ static void settings_changed(struct connman_service *service, connman_dbus_property_changed_dict(service->path, CONNMAN_SERVICE_INTERFACE, "IPv6", append_ipv6, service); - - __connman_notifier_ipconfig_changed(service, ipconfig); } static void ipv4_configuration_changed(struct connman_service *service) -- 2.11.0 ------------------------------ Subject: Digest Footer _______________________________________________ connman mailing list connman@lists.01.org https://lists.01.org/mailman/listinfo/connman ------------------------------ End of connman Digest, Vol 15, Issue 13 ***************************************