diff options
author | Jaehyun Kim <jeik01.kim@samsung.com> | 2024-09-09 06:34:26 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@review> | 2024-09-09 06:34:26 +0000 |
commit | 2ad72ed85e56b32031c09ab5993f1be33a9deac4 (patch) | |
tree | 2daf408d0b147c268e14069fd982b82ff5c4487f | |
parent | de98d8ed48cad1733d14177d6a1579049c8a402f (diff) | |
parent | e455cd7a52367f9189c79e81dcaf1766da2badc0 (diff) | |
download | connman-2ad72ed85e56b32031c09ab5993f1be33a9deac4.tar.gz connman-2ad72ed85e56b32031c09ab5993f1be33a9deac4.tar.bz2 connman-2ad72ed85e56b32031c09ab5993f1be33a9deac4.zip |
Merge "Add support for VSIE from DHCP Ack packet" into tizenaccepted/tizen/unified/x/20240910.014319accepted/tizen/unified/dev/20240910.111621accepted/tizen/unified/20240909.154243accepted/tizen_unified_dev
-rwxr-xr-x | gdhcp/common.c | 3 | ||||
-rwxr-xr-x | gdhcp/gdhcp.h | 3 | ||||
-rwxr-xr-x | src/connman.h | 1 | ||||
-rw-r--r-- | src/dhcp.c | 12 | ||||
-rwxr-xr-x | src/ipconfig.c | 16 |
5 files changed, 35 insertions, 0 deletions
diff --git a/gdhcp/common.c b/gdhcp/common.c index c8916aa8..47ee2fc3 100755 --- a/gdhcp/common.c +++ b/gdhcp/common.c @@ -49,6 +49,9 @@ static const DHCPOption client_options[] = { { OPTION_STRING, 0x0f }, /* domain-name */ { OPTION_U16, 0x1a }, /* mtu */ { OPTION_IP | OPTION_LIST, 0x2a }, /* ntp-servers */ +#if defined TIZEN_EXT + { OPTION_STRING, 0x2b }, /* vendor specific element information */ +#endif { OPTION_U32, 0x33 }, /* dhcp-lease-time */ /* Options below will not be exposed to user */ { OPTION_IP, 0x32 }, /* requested-ip */ diff --git a/gdhcp/gdhcp.h b/gdhcp/gdhcp.h index 041ae81b..534ca61d 100755 --- a/gdhcp/gdhcp.h +++ b/gdhcp/gdhcp.h @@ -79,6 +79,9 @@ typedef enum { #define G_DHCP_HOST_NAME 0x0c #define G_DHCP_MTU 0x1a #define G_DHCP_NTP_SERVER 0x2a +#if defined TIZEN_EXT +#define G_DHCP_VENDOR_SPECIFIC_IE 0x2b +#endif #define G_DHCP_VENDOR_CLASS_ID 0x3c #define G_DHCP_CLIENT_ID 0x3d diff --git a/src/connman.h b/src/connman.h index e6e16d11..1b325f50 100755 --- a/src/connman.h +++ b/src/connman.h @@ -400,6 +400,7 @@ void __connman_ipconfig_set_gateway(struct connman_ipconfig *ipconfig, const cha #if defined TIZEN_EXT void __connman_ipconfig_set_dhcp_lease_duration(struct connman_ipconfig *ipconfig, int dhcp_lease_duration); +void __connman_ipconfig_set_dhcp_vsie(struct connman_ipconfig *ipconfig, char *dhcp_vsie); #endif unsigned char __connman_ipconfig_get_prefixlen(struct connman_ipconfig *ipconfig); @@ -184,6 +184,9 @@ static void dhcp_invalidate(struct connman_dhcp *dhcp, bool callback) __connman_ipconfig_set_local(dhcp->ipconfig, NULL); __connman_ipconfig_set_broadcast(dhcp->ipconfig, NULL); __connman_ipconfig_set_gateway(dhcp->ipconfig, NULL); +#if defined TIZEN_EXT + __connman_ipconfig_set_dhcp_vsie(dhcp->ipconfig, NULL); +#endif __connman_ipconfig_set_prefixlen(dhcp->ipconfig, 0); if (dhcp->callback && callback) @@ -428,6 +431,12 @@ static bool apply_lease_available_on_network(GDHCPClient *dhcp_client, if (option) __connman_service_set_hostname(service, option->data); +#if defined TIZEN_EXT + option = g_dhcp_client_get_option(dhcp_client, G_DHCP_VENDOR_SPECIFIC_IE); + if (option) + __connman_ipconfig_set_dhcp_vsie(dhcp->ipconfig, option->data); +#endif + option = g_dhcp_client_get_option(dhcp_client, G_DHCP_NTP_SERVER); ns_entries = g_list_length(option); timeservers = g_try_new0(char *, ns_entries + 1); @@ -724,6 +733,9 @@ static int dhcp_initialize(struct connman_dhcp *dhcp) g_dhcp_client_set_request(dhcp_client, G_DHCP_DNS_SERVER); g_dhcp_client_set_request(dhcp_client, G_DHCP_DOMAIN_NAME); g_dhcp_client_set_request(dhcp_client, G_DHCP_NTP_SERVER); +#if defined TIZEN_EXT + g_dhcp_client_set_request(dhcp_client, G_DHCP_VENDOR_SPECIFIC_IE); +#endif g_dhcp_client_set_request(dhcp_client, 252); g_dhcp_client_set_request(dhcp_client, G_DHCP_MTU); } diff --git a/src/ipconfig.c b/src/ipconfig.c index 9765ca14..90722bc0 100755 --- a/src/ipconfig.c +++ b/src/ipconfig.c @@ -53,6 +53,7 @@ struct connman_ipconfig { struct connman_ipaddress *system; #if defined TIZEN_EXT + char *dhcp_vsie; int dhcp_lease_duration; #endif @@ -1181,6 +1182,14 @@ void __connman_ipconfig_set_gateway(struct connman_ipconfig *ipconfig, } #if defined TIZEN_EXT +void __connman_ipconfig_set_dhcp_vsie(struct connman_ipconfig *ipconfig, char *dhcp_vsie) +{ + DBG(""); + + g_free(ipconfig->dhcp_vsie); + ipconfig->dhcp_vsie = g_strdup(dhcp_vsie); +} + void __connman_ipconfig_set_dhcp_lease_duration(struct connman_ipconfig *ipconfig, int dhcp_lease_duration) { @@ -1390,6 +1399,9 @@ void __connman_ipconfig_unref_debug(struct connman_ipconfig *ipconfig, connman_ipaddress_free(ipconfig->system); connman_ipaddress_free(ipconfig->address); +#if defined TIZEN_EXT + g_free(ipconfig->dhcp_vsie); +#endif g_free(ipconfig->last_dhcp_address); g_strfreev(ipconfig->last_dhcpv6_prefixes); g_free(ipconfig); @@ -2018,6 +2030,10 @@ void __connman_ipconfig_append_ipv4(struct connman_ipconfig *ipconfig, } connman_dbus_dict_append_basic(iter, "DHCPLeaseDuration", DBUS_TYPE_INT32, &ipconfig->dhcp_lease_duration); + + if (ipconfig->dhcp_vsie) + connman_dbus_dict_append_basic(iter, "DHCPVsie", + DBUS_TYPE_STRING, &ipconfig->dhcp_vsie); } #endif } |