Add support for VSIE from DHCP Ack packet 99/316899/1
authorJaehyun Kim <jeik01.kim@samsung.com>
Fri, 30 Aug 2024 08:08:20 +0000 (17:08 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Fri, 30 Aug 2024 08:08:20 +0000 (17:08 +0900)
Change-Id: I3c5ff2fd98ef20b7deaf897f8f2741cc52ac9317
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
gdhcp/common.c
gdhcp/gdhcp.h
src/connman.h
src/dhcp.c
src/ipconfig.c

index c8916aa..47ee2fc 100755 (executable)
@@ -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 */
index 041ae81..534ca61 100755 (executable)
@@ -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
 
index e6e16d1..1b325f5 100755 (executable)
@@ -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);
index 5ad1efb..b79cad3 100644 (file)
@@ -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);
@@ -717,6 +726,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);
        }
index 9765ca1..90722bc 100755 (executable)
@@ -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
 }