aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/config.c
diff options
context:
space:
mode:
authorMikael Kanstrup <mikael.kanstrup@sonymobile.com>2015-03-14 23:37:06 (GMT)
committerJouni Malinen <j@w1.fi>2015-03-15 18:57:16 (GMT)
commit5c6c315fba6563fd41361073b5f4181a9894d2d5 (patch)
tree90fc33fd72f241ad1a39a30754673178200d65c7 /wpa_supplicant/config.c
parent74fa78b2815b1b8926172a3593e38901685e9f9e (diff)
downloadhostap-5c6c315fba6563fd41361073b5f4181a9894d2d5.zip
hostap-5c6c315fba6563fd41361073b5f4181a9894d2d5.tar.gz
hostap-5c6c315fba6563fd41361073b5f4181a9894d2d5.tar.bz2
Add IPv4 support function for "get" control interface command
Add support to retrieve IPv4 config variables with the "get" control interface command. This allows the ip_addr_* parameters for P2P+NFC IP address assignment to be fetched from the GO. Signed-off-by: Mikael Kanstrup <mikael.kanstrup@sonymobile.com>
Diffstat (limited to 'wpa_supplicant/config.c')
-rw-r--r--wpa_supplicant/config.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index 8e6cd20..a01a910 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -4052,6 +4052,31 @@ static int wpa_config_get_str(const char *name, struct wpa_config *config,
}
+#ifdef CONFIG_P2P
+static int wpa_config_get_ipv4(const char *name, struct wpa_config *config,
+ long offset, char *buf, size_t buflen,
+ int pretty_print)
+{
+ void *val = ((u8 *) config) + (long) offset;
+ int res;
+ char addr[INET_ADDRSTRLEN];
+
+ if (!val || !inet_ntop(AF_INET, val, addr, sizeof(addr)))
+ return -1;
+
+ if (pretty_print)
+ res = os_snprintf(buf, buflen, "%s=%s\n", name, addr);
+ else
+ res = os_snprintf(buf, buflen, "%s", addr);
+
+ if (os_snprintf_error(buflen, res))
+ res = -1;
+
+ return res;
+}
+#endif /* CONFIG_P2P */
+
+
#ifdef OFFSET
#undef OFFSET
#endif /* OFFSET */
@@ -4067,7 +4092,8 @@ static int wpa_config_get_str(const char *name, struct wpa_config *config,
#define STR(f) _STR(f), NULL, NULL
#define STR_RANGE(f, min, max) _STR(f), (void *) min, (void *) max
#define BIN(f) #f, wpa_global_config_parse_bin, NULL, OFFSET(f), NULL, NULL
-#define IPV4(f) #f, wpa_global_config_parse_ipv4, NULL, OFFSET(f), NULL, NULL
+#define IPV4(f) #f, wpa_global_config_parse_ipv4, wpa_config_get_ipv4, \
+ OFFSET(f), NULL, NULL
static const struct global_parse_data global_fields[] = {
#ifdef CONFIG_CTRL_IFACE