aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/eapol_test.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-08-20 20:13:33 (GMT)
committerJouni Malinen <j@w1.fi>2015-08-20 20:13:33 (GMT)
commit3b3677b3bc44d2c0173c369f57af605ecd19b8c5 (patch)
tree6b701c6b7e8b2fe04fd9e7dd5d254f3bfffb25b7 /wpa_supplicant/eapol_test.c
parent4c3ae1c0d1a51fa4144c34f2332f43071a42ba36 (diff)
downloadhostap-3b3677b3bc44d2c0173c369f57af605ecd19b8c5.zip
hostap-3b3677b3bc44d2c0173c369f57af605ecd19b8c5.tar.gz
hostap-3b3677b3bc44d2c0173c369f57af605ecd19b8c5.tar.bz2
eapol_test: Allow interface name to be specified
The new -i<ifname> command line argument can be used to specify the name of the interface to use. This is mainly to allow unique control interface names to be defined without having to use multiple directories. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant/eapol_test.c')
-rw-r--r--wpa_supplicant/eapol_test.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/wpa_supplicant/eapol_test.c b/wpa_supplicant/eapol_test.c
index bde7508..efb069d 100644
--- a/wpa_supplicant/eapol_test.c
+++ b/wpa_supplicant/eapol_test.c
@@ -911,7 +911,7 @@ ieee802_1x_receive_auth(struct radius_msg *msg, struct radius_msg *req,
static void wpa_init_conf(struct eapol_test_data *e,
struct wpa_supplicant *wpa_s, const char *authsrv,
int port, const char *secret,
- const char *cli_addr)
+ const char *cli_addr, const char *ifname)
{
struct hostapd_radius_server *as;
int res;
@@ -919,7 +919,7 @@ static void wpa_init_conf(struct eapol_test_data *e,
wpa_s->bssid[5] = 1;
os_memcpy(wpa_s->own_addr, e->own_addr, ETH_ALEN);
e->own_ip_addr.s_addr = htonl((127 << 24) | 1);
- os_strlcpy(wpa_s->ifname, "test", sizeof(wpa_s->ifname));
+ os_strlcpy(wpa_s->ifname, ifname, sizeof(wpa_s->ifname));
e->radius_conf = os_zalloc(sizeof(struct hostapd_radius_servers));
assert(e->radius_conf != NULL);
@@ -1161,7 +1161,7 @@ static void usage(void)
" [-M<client MAC address>] [-o<server cert file] \\\n"
" [-N<attr spec>] [-R<PC/SC reader>] "
"[-P<PC/SC PIN>] \\\n"
- " [-A<client IP>]\n"
+ " [-A<client IP>] [-i<ifname>]\n"
"eapol_test scard\n"
"eapol_test sim <PIN> <num triplets> [debug]\n"
"\n");
@@ -1216,6 +1216,7 @@ int main(int argc, char *argv[])
int timeout = 30;
char *pos;
struct extra_radius_attr *p = NULL, *p1;
+ const char *ifname = "test";
if (os_program_init())
return -1;
@@ -1231,7 +1232,7 @@ int main(int argc, char *argv[])
wpa_debug_show_keys = 1;
for (;;) {
- c = getopt(argc, argv, "a:A:c:C:eM:nN:o:p:P:r:R:s:St:W");
+ c = getopt(argc, argv, "a:A:c:C:ei:M:nN:o:p:P:r:R:s:St:W");
if (c < 0)
break;
switch (c) {
@@ -1250,6 +1251,9 @@ int main(int argc, char *argv[])
case 'e':
eapol_test.req_eap_key_name = 1;
break;
+ case 'i':
+ ifname = optarg;
+ break;
case 'M':
if (hwaddr_aton(optarg, eapol_test.own_addr)) {
usage();
@@ -1374,7 +1378,7 @@ int main(int argc, char *argv[])
}
wpa_init_conf(&eapol_test, &wpa_s, as_addr, as_port, as_secret,
- cli_addr);
+ cli_addr, ifname);
wpa_s.ctrl_iface = wpa_supplicant_ctrl_iface_init(&wpa_s);
if (wpa_s.ctrl_iface == NULL) {
printf("Failed to initialize control interface '%s'.\n"