From: Jouni Malinen Date: Thu, 20 Aug 2015 20:13:33 +0000 (+0300) Subject: eapol_test: Allow interface name to be specified X-Git-Tag: hostap_2_5~130 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b3677b3bc44d2c0173c369f57af605ecd19b8c5;p=thirdparty%2Fhostap.git eapol_test: Allow interface name to be specified The new -i 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 --- diff --git a/wpa_supplicant/eapol_test.c b/wpa_supplicant/eapol_test.c index bde7508b7..efb069d75 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] [-o] [-R] " "[-P] \\\n" - " [-A]\n" + " [-A] [-i]\n" "eapol_test scard\n" "eapol_test sim [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"