003 File Manager
Current Path:
/usr/src/contrib/wpa/wpa_supplicant
usr
/
src
/
contrib
/
wpa
/
wpa_supplicant
/
📁
..
📄
Android.mk
(36.85 KB)
📄
ChangeLog
(127.25 KB)
📄
README
(39.17 KB)
📄
README-DPP
(5.25 KB)
📄
README-HS20
(21.84 KB)
📄
README-P2P
(32.99 KB)
📄
README-WPS
(15.87 KB)
📄
README-Windows.txt
(12.11 KB)
📄
android.config
(19.49 KB)
📄
ap.c
(43.64 KB)
📄
ap.h
(4.4 KB)
📄
autoscan.c
(3.48 KB)
📄
autoscan.h
(1.36 KB)
📄
autoscan_exponential.c
(2.01 KB)
📄
autoscan_periodic.c
(1.6 KB)
📄
bgscan.c
(2.41 KB)
📄
bgscan.h
(2.07 KB)
📄
bgscan_learn.c
(14.42 KB)
📄
bgscan_simple.c
(8 KB)
📁
binder
📄
blacklist.c
(3.38 KB)
📄
blacklist.h
(660 B)
📄
bss.c
(35.64 KB)
📄
bss.h
(5.76 KB)
📄
config.c
(119.47 KB)
📄
config.h
(50.22 KB)
📄
config_file.c
(42.45 KB)
📄
config_none.c
(1.25 KB)
📄
config_ssid.h
(26.9 KB)
📄
ctrl_iface.c
(274.91 KB)
📄
ctrl_iface.h
(5.29 KB)
📄
ctrl_iface_named_pipe.c
(19.62 KB)
📄
ctrl_iface_udp.c
(19.95 KB)
📄
ctrl_iface_unix.c
(34.52 KB)
📁
dbus
📄
defconfig
(21.75 KB)
📄
dpp_supplicant.c
(64.3 KB)
📄
dpp_supplicant.h
(1.28 KB)
📄
driver_i.h
(28.83 KB)
📄
eap_proxy_dummy.mak
(0 B)
📄
eap_proxy_dummy.mk
(0 B)
📄
eap_register.c
(5.24 KB)
📄
eap_testing.txt
(14.43 KB)
📄
eapol_test.c
(39.52 KB)
📄
eapol_test.py
(4.39 KB)
📄
events.c
(135.05 KB)
📁
examples
📄
gas_query.c
(24.23 KB)
📄
gas_query.h
(1.46 KB)
📄
hs20_supplicant.c
(33.17 KB)
📄
hs20_supplicant.h
(2.18 KB)
📄
ibss_rsn.c
(23.31 KB)
📄
ibss_rsn.h
(1.7 KB)
📄
interworking.c
(81.56 KB)
📄
interworking.h
(1.33 KB)
📄
libwpa_test.c
(611 B)
📄
main.c
(10.22 KB)
📄
main_none.c
(844 B)
📄
mbo.c
(14.95 KB)
📄
mesh.c
(18.88 KB)
📄
mesh.h
(1.39 KB)
📄
mesh_mpm.c
(36.44 KB)
📄
mesh_mpm.h
(1.45 KB)
📄
mesh_rsn.c
(20.72 KB)
📄
mesh_rsn.h
(1.43 KB)
📄
nfc_pw_token.c
(1.71 KB)
📄
nmake.mak
(6.58 KB)
📄
notify.c
(20.83 KB)
📄
notify.h
(7.2 KB)
📄
offchannel.c
(16.1 KB)
📄
offchannel.h
(1.37 KB)
📄
op_classes.c
(9.3 KB)
📄
p2p_supplicant.c
(270.45 KB)
📄
p2p_supplicant.h
(12.84 KB)
📄
p2p_supplicant_sd.c
(30.81 KB)
📄
preauth_test.c
(8.56 KB)
📄
rrm.c
(41.04 KB)
📄
scan.c
(80.03 KB)
📄
scan.h
(2.76 KB)
📄
sme.c
(74.45 KB)
📄
sme.h
(3.68 KB)
📁
systemd
📄
todo.txt
(4.43 KB)
📁
utils
📁
vs2005
📄
wifi_display.c
(10.42 KB)
📄
wifi_display.h
(904 B)
📄
wmm_ac.c
(23.61 KB)
📄
wmm_ac.h
(4.84 KB)
📄
wnm_sta.c
(50.52 KB)
📄
wnm_sta.h
(2.47 KB)
📄
wpa_cli.c
(121.3 KB)
📄
wpa_passphrase.c
(1.45 KB)
📄
wpa_priv.c
(29.97 KB)
📄
wpa_supplicant.c
(205.7 KB)
📄
wpa_supplicant.conf
(74.93 KB)
📄
wpa_supplicant_conf.mk
(1.25 KB)
📄
wpa_supplicant_conf.sh
(458 B)
📄
wpa_supplicant_i.h
(46.08 KB)
📄
wpa_supplicant_template.conf
(136 B)
📄
wpas_glue.c
(33.62 KB)
📄
wpas_glue.h
(888 B)
📄
wpas_kay.c
(9.92 KB)
📄
wpas_kay.h
(1.13 KB)
📄
wpas_module_tests.c
(2.51 KB)
📄
wps_supplicant.c
(79.22 KB)
📄
wps_supplicant.h
(5.08 KB)
Editing: main.c
/* * WPA Supplicant / main() function for UNIX like OSes and MinGW * Copyright (c) 2003-2013, Jouni Malinen <j@w1.fi> * * This software may be distributed under the terms of the BSD license. * See README for more details. */ #include "includes.h" #ifdef __linux__ #include <fcntl.h> #endif /* __linux__ */ #include "common.h" #include "fst/fst.h" #include "wpa_supplicant_i.h" #include "driver_i.h" #include "p2p_supplicant.h" static void usage(void) { int i; printf("%s\n\n%s\n" "usage:\n" " wpa_supplicant [-BddhKLqq" #ifdef CONFIG_DEBUG_SYSLOG "s" #endif /* CONFIG_DEBUG_SYSLOG */ "t" #ifdef CONFIG_CTRL_IFACE_DBUS_NEW "u" #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */ "vW] [-P<pid file>] " "[-g<global ctrl>] \\\n" " [-G<group>] \\\n" " -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] " "[-p<driver_param>] \\\n" " [-b<br_ifname>] [-e<entropy file>]" #ifdef CONFIG_DEBUG_FILE " [-f<debug file>]" #endif /* CONFIG_DEBUG_FILE */ " \\\n" " [-o<override driver>] [-O<override ctrl>] \\\n" " [-N -i<ifname> -c<conf> [-C<ctrl>] " "[-D<driver>] \\\n" #ifdef CONFIG_P2P " [-m<P2P Device config file>] \\\n" #endif /* CONFIG_P2P */ " [-p<driver_param>] [-b<br_ifname>] [-I<config file>] " "...]\n" "\n" "drivers:\n", wpa_supplicant_version, wpa_supplicant_license); for (i = 0; wpa_drivers[i]; i++) { printf(" %s = %s\n", wpa_drivers[i]->name, wpa_drivers[i]->desc); } #ifndef CONFIG_NO_STDOUT_DEBUG printf("options:\n" " -b = optional bridge interface name\n" " -B = run daemon in the background\n" " -c = Configuration file\n" " -C = ctrl_interface parameter (only used if -c is not)\n" " -d = increase debugging verbosity (-dd even more)\n" " -D = driver name (can be multiple drivers: nl80211,wext)\n" " -e = entropy file\n" #ifdef CONFIG_DEBUG_FILE " -f = log output to debug file instead of stdout\n" #endif /* CONFIG_DEBUG_FILE */ " -g = global ctrl_interface\n" " -G = global ctrl_interface group\n" " -h = show this help text\n" " -i = interface name\n" " -I = additional configuration file\n" " -K = include keys (passwords, etc.) in debug output\n" " -L = show license (BSD)\n" #ifdef CONFIG_P2P " -m = Configuration file for the P2P Device interface\n" #endif /* CONFIG_P2P */ #ifdef CONFIG_MATCH_IFACE " -M = start describing new matching interface\n" #endif /* CONFIG_MATCH_IFACE */ " -N = start describing new interface\n" " -o = override driver parameter for new interfaces\n" " -O = override ctrl_interface parameter for new interfaces\n" " -p = driver parameters\n" " -P = PID file\n" " -q = decrease debugging verbosity (-qq even less)\n" #ifdef CONFIG_DEBUG_SYSLOG " -s = log output to syslog instead of stdout\n" #endif /* CONFIG_DEBUG_SYSLOG */ " -t = include timestamp in debug messages\n" #ifdef CONFIG_DEBUG_LINUX_TRACING " -T = record to Linux tracing in addition to logging\n" " (records all messages regardless of debug verbosity)\n" #endif /* CONFIG_DEBUG_LINUX_TRACING */ #ifdef CONFIG_CTRL_IFACE_DBUS_NEW " -u = enable DBus control interface\n" #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */ " -v = show version\n" " -W = wait for a control interface monitor before starting\n"); printf("example:\n" " wpa_supplicant -D%s -iwlan0 -c/etc/wpa_supplicant.conf\n", wpa_drivers[0] ? wpa_drivers[0]->name : "nl80211"); #endif /* CONFIG_NO_STDOUT_DEBUG */ } static void license(void) { #ifndef CONFIG_NO_STDOUT_DEBUG printf("%s\n\n%s%s%s%s%s\n", wpa_supplicant_version, wpa_supplicant_full_license1, wpa_supplicant_full_license2, wpa_supplicant_full_license3, wpa_supplicant_full_license4, wpa_supplicant_full_license5); #endif /* CONFIG_NO_STDOUT_DEBUG */ } static void wpa_supplicant_fd_workaround(int start) { #ifdef __linux__ static int fd[3] = { -1, -1, -1 }; int i; /* When started from pcmcia-cs scripts, wpa_supplicant might start with * fd 0, 1, and 2 closed. This will cause some issues because many * places in wpa_supplicant are still printing out to stdout. As a * workaround, make sure that fd's 0, 1, and 2 are not used for other * sockets. */ if (start) { for (i = 0; i < 3; i++) { fd[i] = open("/dev/null", O_RDWR); if (fd[i] > 2) { close(fd[i]); fd[i] = -1; break; } } } else { for (i = 0; i < 3; i++) { if (fd[i] >= 0) { close(fd[i]); fd[i] = -1; } } } #endif /* __linux__ */ } #ifdef CONFIG_MATCH_IFACE static int wpa_supplicant_init_match(struct wpa_global *global) { /* * The assumption is that the first driver is the primary driver and * will handle the arrival / departure of interfaces. */ if (wpa_drivers[0]->global_init && !global->drv_priv[0]) { global->drv_priv[0] = wpa_drivers[0]->global_init(global); if (!global->drv_priv[0]) { wpa_printf(MSG_ERROR, "Failed to initialize driver '%s'", wpa_drivers[0]->name); return -1; } } return 0; } #endif /* CONFIG_MATCH_IFACE */ int main(int argc, char *argv[]) { int c, i; struct wpa_interface *ifaces, *iface; int iface_count, exitcode = -1; struct wpa_params params; struct wpa_global *global; if (os_program_init()) return -1; os_memset(¶ms, 0, sizeof(params)); params.wpa_debug_level = MSG_INFO; iface = ifaces = os_zalloc(sizeof(struct wpa_interface)); if (ifaces == NULL) return -1; iface_count = 1; wpa_supplicant_fd_workaround(1); #ifdef CONFIG_DRIVER_NDIS void driver_ndis_init_ops(void); driver_ndis_init_ops(); #endif /* CONFIG_DRIVER_NDIS */ for (;;) { c = getopt(argc, argv, "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuvW"); if (c < 0) break; switch (c) { case 'b': iface->bridge_ifname = optarg; break; case 'B': params.daemonize++; break; case 'c': iface->confname = optarg; break; case 'C': iface->ctrl_interface = optarg; break; case 'D': iface->driver = optarg; break; case 'd': #ifdef CONFIG_NO_STDOUT_DEBUG printf("Debugging disabled with " "CONFIG_NO_STDOUT_DEBUG=y build time " "option.\n"); goto out; #else /* CONFIG_NO_STDOUT_DEBUG */ params.wpa_debug_level--; break; #endif /* CONFIG_NO_STDOUT_DEBUG */ case 'e': params.entropy_file = optarg; break; #ifdef CONFIG_DEBUG_FILE case 'f': params.wpa_debug_file_path = optarg; break; #endif /* CONFIG_DEBUG_FILE */ case 'g': params.ctrl_interface = optarg; break; case 'G': params.ctrl_interface_group = optarg; break; case 'h': usage(); exitcode = 0; goto out; case 'i': iface->ifname = optarg; break; case 'I': iface->confanother = optarg; break; case 'K': params.wpa_debug_show_keys++; break; case 'L': license(); exitcode = 0; goto out; #ifdef CONFIG_P2P case 'm': params.conf_p2p_dev = optarg; break; #endif /* CONFIG_P2P */ case 'o': params.override_driver = optarg; break; case 'O': params.override_ctrl_interface = optarg; break; case 'p': iface->driver_param = optarg; break; case 'P': os_free(params.pid_file); params.pid_file = os_rel2abs_path(optarg); break; case 'q': params.wpa_debug_level++; break; #ifdef CONFIG_DEBUG_SYSLOG case 's': params.wpa_debug_syslog++; break; #endif /* CONFIG_DEBUG_SYSLOG */ #ifdef CONFIG_DEBUG_LINUX_TRACING case 'T': params.wpa_debug_tracing++; break; #endif /* CONFIG_DEBUG_LINUX_TRACING */ case 't': params.wpa_debug_timestamp++; break; #ifdef CONFIG_CTRL_IFACE_DBUS_NEW case 'u': params.dbus_ctrl_interface = 1; break; #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */ case 'v': printf("%s\n", wpa_supplicant_version); exitcode = 0; goto out; case 'W': params.wait_for_monitor++; break; #ifdef CONFIG_MATCH_IFACE case 'M': params.match_iface_count++; iface = os_realloc_array(params.match_ifaces, params.match_iface_count, sizeof(struct wpa_interface)); if (!iface) goto out; params.match_ifaces = iface; iface = ¶ms.match_ifaces[params.match_iface_count - 1]; os_memset(iface, 0, sizeof(*iface)); break; #endif /* CONFIG_MATCH_IFACE */ case 'N': iface_count++; iface = os_realloc_array(ifaces, iface_count, sizeof(struct wpa_interface)); if (iface == NULL) goto out; ifaces = iface; iface = &ifaces[iface_count - 1]; os_memset(iface, 0, sizeof(*iface)); break; default: usage(); exitcode = 0; goto out; } } exitcode = 0; global = wpa_supplicant_init(¶ms); if (global == NULL) { wpa_printf(MSG_ERROR, "Failed to initialize wpa_supplicant"); exitcode = -1; goto out; } else { wpa_printf(MSG_INFO, "Successfully initialized " "wpa_supplicant"); } if (fst_global_init()) { wpa_printf(MSG_ERROR, "Failed to initialize FST"); exitcode = -1; goto out; } #if defined(CONFIG_FST) && defined(CONFIG_CTRL_IFACE) if (!fst_global_add_ctrl(fst_ctrl_cli)) wpa_printf(MSG_WARNING, "Failed to add CLI FST ctrl"); #endif for (i = 0; exitcode == 0 && i < iface_count; i++) { struct wpa_supplicant *wpa_s; if ((ifaces[i].confname == NULL && ifaces[i].ctrl_interface == NULL) || ifaces[i].ifname == NULL) { if (iface_count == 1 && (params.ctrl_interface || #ifdef CONFIG_MATCH_IFACE params.match_iface_count || #endif /* CONFIG_MATCH_IFACE */ params.dbus_ctrl_interface)) break; usage(); exitcode = -1; break; } wpa_s = wpa_supplicant_add_iface(global, &ifaces[i], NULL); if (wpa_s == NULL) { exitcode = -1; break; } } #ifdef CONFIG_MATCH_IFACE if (exitcode == 0) exitcode = wpa_supplicant_init_match(global); #endif /* CONFIG_MATCH_IFACE */ if (exitcode == 0) exitcode = wpa_supplicant_run(global); wpa_supplicant_deinit(global); fst_global_deinit(); out: wpa_supplicant_fd_workaround(0); os_free(ifaces); #ifdef CONFIG_MATCH_IFACE os_free(params.match_ifaces); #endif /* CONFIG_MATCH_IFACE */ os_free(params.pid_file); os_program_deinit(); return exitcode; }
Upload File
Create Folder