[PATCH 2/7] Port wpa supplicant to RTEMS.
Sichen Zhao
1473996754 at qq.com
Wed Aug 16 16:10:08 UTC 2017
Add wpa_supplicant lib support
and shell command support in RTEMS.
---
builder.py | 1 +
freebsd/contrib/wpa/src/utils/os_unix.c | 10 +-
freebsd/contrib/wpa/wpa_supplicant/config.h | 4 +-
freebsd/contrib/wpa/wpa_supplicant/main.c | 15 ++
libbsd.py | 285 ++++++++++++++++++++++++
libbsd_waf.py | 114 +++++++++-
rtemsbsd/include/bsp/nexus-devices.h | 2 +
rtemsbsd/include/machine/rtems-bsd-commands.h | 2 +
rtemsbsd/include/rtems/netcmds-config.h | 2 +
rtemsbsd/rtems/rtems-bsd-shell-wpa_supplicant.c | 36 +++
10 files changed, 465 insertions(+), 6 deletions(-)
create mode 100644 rtemsbsd/rtems/rtems-bsd-shell-wpa_supplicant.c
diff --git a/builder.py b/builder.py
index b62f79d..b155fea 100755
--- a/builder.py
+++ b/builder.py
@@ -174,6 +174,7 @@ def includes():
return ['-Irtemsbsd/include',
'-Ifreebsd/sys',
'-Ifreebsd/sys/contrib/pf',
+ '-Ifreebsd/crypto',
'-Ifreebsd/sys/net',
'-Ifreebsd/include',
'-Ifreebsd/lib',
diff --git a/freebsd/contrib/wpa/src/utils/os_unix.c b/freebsd/contrib/wpa/src/utils/os_unix.c
index a3abce4..ac700db 100644
--- a/freebsd/contrib/wpa/src/utils/os_unix.c
+++ b/freebsd/contrib/wpa/src/utils/os_unix.c
@@ -25,6 +25,10 @@
#include <mach/mach_time.h>
#endif /* __MACH__ */
+#ifdef __rtems__
+#include <unistd.h>
+#endif /* __rtems__ */
+
#include "os.h"
#include "common.h"
@@ -225,7 +229,7 @@ static int os_daemon(int nochdir, int noclose)
int os_daemonize(const char *pid_file)
{
-#if defined(__uClinux__) || defined(__sun__)
+#if defined(__uClinux__) || defined(__sun__) || defined(__rtems__)
return -1;
#else /* defined(__uClinux__) || defined(__sun__) */
#ifdef __FreeBSD__
@@ -282,6 +286,9 @@ int os_get_random(unsigned char *buf, size_t len)
if (TEST_FAIL())
return -1;
+#ifdef __rtems__
+ return getentropy(buf, len);
+#else /* __rtems__ */
f = fopen("/dev/urandom", "rb");
if (f == NULL) {
printf("Could not open /dev/urandom.\n");
@@ -292,6 +299,7 @@ int os_get_random(unsigned char *buf, size_t len)
fclose(f);
return rc != len ? -1 : 0;
+#endif /* __rtems__ */
}
diff --git a/freebsd/contrib/wpa/wpa_supplicant/config.h b/freebsd/contrib/wpa/wpa_supplicant/config.h
index 627f38b..425e55a 100644
--- a/freebsd/contrib/wpa/wpa_supplicant/config.h
+++ b/freebsd/contrib/wpa/wpa_supplicant/config.h
@@ -44,7 +44,9 @@
#include "wps/wps.h"
#include "common/ieee802_11_defs.h"
#include "common/ieee802_11_common.h"
-
+#ifdef __rtems__
+#include <machine/rtems-bsd-commands.h>
+#endif /* __rtems__ */
struct wpa_cred {
/**
diff --git a/freebsd/contrib/wpa/wpa_supplicant/main.c b/freebsd/contrib/wpa/wpa_supplicant/main.c
index 0e86b93..7347951 100644
--- a/freebsd/contrib/wpa/wpa_supplicant/main.c
+++ b/freebsd/contrib/wpa/wpa_supplicant/main.c
@@ -154,6 +154,21 @@ static void wpa_supplicant_fd_workaround(int start)
#endif /* __linux__ */
}
+#ifdef __rtems__
+#include <rtems/libio.h>
+
+static int
+main(int argc, char **argv);
+
+int rtems_bsd_command_wpa_supplicant(int argc, char **argv)
+{
+ int exit_code;
+
+ exit_code = rtems_bsd_program_call_main("wpa_supplicant", main, argc, argv);
+
+ return exit_code;
+}
+#endif /* __rtems__ */
int main(int argc, char *argv[])
{
diff --git a/libbsd.py b/libbsd.py
index b2f3977..ea469d3 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -3958,6 +3958,290 @@ def usr_sbin_tcpdump(mm):
return mod
#
+# /usr/sbin/wpa_supplicant
+#
+def usr_sbin_wpa_supplicant(mm):
+ mod = builder.Module('usr_sbin_wpa_supplicant')
+ mod.addUserSpaceHeaderFiles(
+ [
+ 'contrib/wpa/wpa_supplicant/ap.h',
+ 'contrib/wpa/wpa_supplicant/blacklist.h',
+ 'contrib/wpa/wpa_supplicant/bss.h',
+ 'contrib/wpa/wpa_supplicant/config.h',
+ 'contrib/wpa/wpa_supplicant/config_ssid.h',
+ 'contrib/wpa/wpa_supplicant/ctrl_iface.h',
+ 'contrib/wpa/wpa_supplicant/driver_i.h',
+ 'contrib/wpa/wpa_supplicant/gas_query.h',
+ 'contrib/wpa/wpa_supplicant/hs20_supplicant.h',
+ 'contrib/wpa/wpa_supplicant/interworking.h',
+ 'contrib/wpa/wpa_supplicant/mesh.h',
+ 'contrib/wpa/wpa_supplicant/mesh_mpm.h',
+ 'contrib/wpa/wpa_supplicant/mesh_rsn.h',
+ 'contrib/wpa/wpa_supplicant/notify.h',
+ 'contrib/wpa/wpa_supplicant/offchannel.h',
+ 'contrib/wpa/wpa_supplicant/scan.h',
+ 'contrib/wpa/wpa_supplicant/autoscan.h',
+ 'contrib/wpa/wpa_supplicant/wmm_ac.h',
+ 'contrib/wpa/wpa_supplicant/wnm_sta.h',
+ 'contrib/wpa/wpa_supplicant/wpas_glue.h',
+ 'contrib/wpa/wpa_supplicant/wpas_kay.h',
+ 'contrib/wpa/wpa_supplicant/wpa_supplicant_i.h',
+ 'contrib/wpa/wpa_supplicant/wps_supplicant.h',
+ 'contrib/wpa/wpa_supplicant/ibss_rsn.h',
+ 'contrib/wpa/wpa_supplicant/p2p_supplicant.h',
+ 'contrib/wpa/wpa_supplicant/wifi_display.h',
+ 'contrib/wpa/wpa_supplicant/sme.h',
+ 'contrib/wpa/wpa_supplicant/bgscan.h',
+ 'contrib/wpa/wpa_supplicant/dbus/dbus_common.h',
+ 'contrib/wpa/wpa_supplicant/dbus/dbus_old.h',
+ 'contrib/wpa/wpa_supplicant/dbus/dbus_new.h',
+ 'contrib/wpa/src/ap/ap_config.h',
+ 'contrib/wpa/src/ap/ap_drv_ops.h',
+ 'contrib/wpa/src/ap/hs20.h',
+ 'contrib/wpa/src/ap/hostapd.h',
+ 'contrib/wpa/src/ap/ieee802_11.h',
+ 'contrib/wpa/src/ap/ieee802_11_auth.h',
+ 'contrib/wpa/src/ap/p2p_hostapd.h',
+ 'contrib/wpa/src/ap/sta_info.h',
+ 'contrib/wpa/src/utils/includes.h',
+ 'contrib/wpa/src/utils/base64.h',
+ 'contrib/wpa/src/utils/build_config.h',
+ 'contrib/wpa/src/utils/common.h',
+ 'contrib/wpa/src/utils/eloop.h',
+ 'contrib/wpa/src/utils/ip_addr.h',
+ 'contrib/wpa/src/utils/list.h',
+ 'contrib/wpa/src/utils/os.h',
+ 'contrib/wpa/src/utils/platform.h',
+ 'contrib/wpa/src/utils/uuid.h',
+ 'contrib/wpa/src/utils/wpa_debug.h',
+ 'contrib/wpa/src/utils/wpabuf.h',
+ 'contrib/wpa/src/utils/trace.h',
+ 'contrib/wpa/src/utils/pcsc_funcs.h',
+ 'contrib/wpa/src/utils/ext_password.h',
+ 'contrib/wpa/src/utils/state_machine.h',
+ 'contrib/wpa/src/common/gas.h',
+ 'contrib/wpa/src/common/hw_features_common.h',
+ 'contrib/wpa/src/common/ieee802_11_common.h',
+ 'contrib/wpa/src/common/ieee802_11_defs.h',
+ 'contrib/wpa/src/common/wpa_common.h',
+ 'contrib/wpa/src/common/defs.h',
+ 'contrib/wpa/src/common/qca-vendor.h',
+ 'contrib/wpa/src/common/eapol_common.h',
+ 'contrib/wpa/src/common/sae.h',
+ 'contrib/wpa/src/common/wpa_ctrl.h',
+ 'contrib/wpa/src/common/version.h',
+ 'contrib/wpa/src/drivers/driver.h',
+ 'contrib/wpa/src/drivers/driver_ndis.h',
+ 'contrib/wpa/src/drivers/driver_nl80211.h',
+ 'contrib/wpa/src/drivers/linux_defines.h',
+ 'contrib/wpa/src/wps/http.h',
+ 'contrib/wpa/src/wps/http_client.h',
+ 'contrib/wpa/src/wps/http_server.h',
+ 'contrib/wpa/src/wps/httpread.h',
+ 'contrib/wpa/src/wps/wps.h',
+ 'contrib/wpa/src/wps/wps_i.h',
+ 'contrib/wpa/src/wps/wps_defs.h',
+ 'contrib/wpa/src/wps/upnp_xml.h',
+ 'contrib/wpa/src/wps/wps_attr_parse.h',
+ 'contrib/wpa/src/wps/wps_dev_attr.h',
+ 'contrib/wpa/src/wps/wps_er.h',
+ 'contrib/wpa/src/wps/wps_upnp.h',
+ 'contrib/wpa/src/wps/wps_upnp_i.h',
+ 'contrib/wpa/src/l2_packet/l2_packet.h',
+ 'contrib/wpa/src/rsn_supp/peerkey.h',
+ 'contrib/wpa/src/rsn_supp/pmksa_cache.h',
+ 'contrib/wpa/src/rsn_supp/preauth.h',
+ 'contrib/wpa/src/rsn_supp/wpa.h',
+ 'contrib/wpa/src/rsn_supp/wpa_i.h',
+ 'contrib/wpa/src/rsn_supp/wpa_ie.h',
+ 'contrib/wpa/src/p2p/p2p.h',
+ 'contrib/wpa/src/fst/fst.h',
+ 'contrib/wpa/src/fst/fst_ctrl_iface.h',
+ 'contrib/wpa/src/fst/fst_ctrl_aux.h',
+ 'contrib/wpa/src/crypto/md5.h',
+ 'contrib/wpa/src/crypto/sha256.h',
+ 'contrib/wpa/src/crypto/sha384.h',
+ 'contrib/wpa/src/crypto/aes_wrap.h',
+ 'contrib/wpa/src/crypto/crypto.h',
+ 'contrib/wpa/src/crypto/random.h',
+ 'contrib/wpa/src/crypto/dh_group5.h',
+ 'contrib/wpa/src/crypto/sha1.h',
+ 'contrib/wpa/src/crypto/tls.h',
+ 'contrib/wpa/src/crypto/ms_funcs.h',
+ 'contrib/wpa/src/crypto/aes.h',
+ 'contrib/wpa/src/crypto/sha256_i.h',
+ 'contrib/wpa/src/eapol_supp/eapol_supp_sm.h',
+ 'contrib/wpa/src/eap_peer/eap_config.h',
+ 'contrib/wpa/src/eap_peer/eap.h',
+ 'contrib/wpa/src/eap_peer/eap_i.h',
+ 'contrib/wpa/src/eap_peer/eap_methods.h',
+ 'contrib/wpa/src/eap_peer/eap_proxy.h',
+ 'contrib/wpa/src/eap_peer/mschapv2.h',
+ 'contrib/wpa/src/eap_peer/tncc.h',
+ 'contrib/wpa/src/eap_peer/eap_tls_common.h',
+ 'contrib/wpa/src/eap_common/eap_defs.h',
+ 'contrib/wpa/src/eap_common/eap_wsc_common.h',
+ 'contrib/wpa/src/eap_common/eap_peap_common.h',
+ 'contrib/wpa/src/eap_common/eap_psk_common.h',
+ 'contrib/wpa/src/eap_common/eap_tlv_common.h',
+ 'contrib/wpa/src/eap_common/eap_common.h',
+ 'contrib/wpa/src/eap_common/chap.h',
+ 'contrib/wpa/src/eap_common/eap_ttls.h',
+ 'contrib/wpa/src/eap_server/eap_methods.h',
+ 'contrib/wpa/src/eapol_supp/eapol_supp_sm.h',
+ 'contrib/wpa/src/tls/tlsv1_client.h',
+ 'contrib/wpa/src/tls/tlsv1_cred.h',
+ 'contrib/wpa/src/tls/tlsv1_server.h',
+ 'usr.sbin/wpa/wpa_supplicant/Packet32.h',
+ 'usr.sbin/wpa/wpa_supplicant/ntddndis.h',
+ ]
+ )
+ mod.addUserSpaceSourceFiles(
+ [
+ 'contrib/wpa/wpa_supplicant/blacklist.c',
+ 'contrib/wpa/wpa_supplicant/bss.c',
+ 'contrib/wpa/wpa_supplicant/config.c',
+ 'contrib/wpa/wpa_supplicant/config_file.c',
+ 'contrib/wpa/wpa_supplicant/ctrl_iface.c',
+ 'contrib/wpa/wpa_supplicant/ctrl_iface_unix.c',
+ 'contrib/wpa/wpa_supplicant/eap_register.c',
+ 'contrib/wpa/wpa_supplicant/events.c',
+ 'contrib/wpa/wpa_supplicant/gas_query.c',
+ 'contrib/wpa/wpa_supplicant/hs20_supplicant.c',
+ 'contrib/wpa/wpa_supplicant/interworking.c',
+ 'contrib/wpa/wpa_supplicant/main.c',
+ 'contrib/wpa/wpa_supplicant/notify.c',
+ 'contrib/wpa/wpa_supplicant/offchannel.c',
+ 'contrib/wpa/wpa_supplicant/scan.c',
+ 'contrib/wpa/wpa_supplicant/wmm_ac.c',
+ 'contrib/wpa/wpa_supplicant/wpa_supplicant.c',
+ 'contrib/wpa/wpa_supplicant/wpas_glue.c',
+ 'contrib/wpa/wpa_supplicant/wps_supplicant.c',
+ 'contrib/wpa/src/ap/ap_drv_ops.c',
+ 'contrib/wpa/src/ap/hs20.c',
+ 'contrib/wpa/src/ap/ieee802_11_shared.c',
+ 'contrib/wpa/src/utils/base64.c',
+ 'contrib/wpa/src/utils/common.c',
+ 'contrib/wpa/src/utils/eloop.c',
+ 'contrib/wpa/src/utils/os_unix.c',
+ 'contrib/wpa/src/utils/uuid.c',
+ 'contrib/wpa/src/utils/wpa_debug.c',
+ 'contrib/wpa/src/utils/wpabuf.c',
+ 'contrib/wpa/src/common/gas.c',
+ 'contrib/wpa/src/common/hw_features_common.c',
+ 'contrib/wpa/src/common/ieee802_11_common.c',
+ 'contrib/wpa/src/common/wpa_common.c',
+ 'contrib/wpa/src/drivers/driver_bsd.c',
+ 'contrib/wpa/src/drivers/driver_common.c',
+ 'contrib/wpa/src/drivers/driver_ndis.c',
+ 'contrib/wpa/src/drivers/driver_wired.c',
+ 'contrib/wpa/src/drivers/drivers.c',
+ 'contrib/wpa/src/wps/http_client.c',
+ 'contrib/wpa/src/wps/http_server.c',
+ 'contrib/wpa/src/wps/httpread.c',
+ 'contrib/wpa/src/wps/upnp_xml.c',
+ 'contrib/wpa/src/wps/wps.c',
+ 'contrib/wpa/src/wps/wps_attr_build.c',
+ 'contrib/wpa/src/wps/wps_attr_parse.c',
+ 'contrib/wpa/src/wps/wps_attr_process.c',
+ 'contrib/wpa/src/wps/wps_common.c',
+ 'contrib/wpa/src/wps/wps_dev_attr.c',
+ 'contrib/wpa/src/wps/wps_enrollee.c',
+ 'contrib/wpa/src/wps/wps_registrar.c',
+ 'contrib/wpa/src/wps/wps_upnp.c',
+ 'contrib/wpa/src/wps/wps_upnp_ap.c',
+ 'contrib/wpa/src/wps/wps_upnp_event.c',
+ 'contrib/wpa/src/wps/wps_upnp_ssdp.c',
+ 'contrib/wpa/src/wps/wps_upnp_web.c',
+ 'contrib/wpa/src/l2_packet/l2_packet_freebsd.c',
+ 'contrib/wpa/src/rsn_supp/peerkey.c',
+ 'contrib/wpa/src/rsn_supp/pmksa_cache.c',
+ 'contrib/wpa/src/rsn_supp/preauth.c',
+ 'contrib/wpa/src/rsn_supp/wpa.c',
+ 'contrib/wpa/src/rsn_supp/wpa_ft.c',
+ 'contrib/wpa/src/rsn_supp/wpa_ie.c',
+ 'contrib/wpa/src/eapol_supp/eapol_supp_sm.c',
+ 'contrib/wpa/src/eap_peer/eap.c',
+ 'contrib/wpa/src/eap_peer/eap_methods.c',
+ 'contrib/wpa/src/eap_peer/eap_mschapv2.c',
+ 'contrib/wpa/src/eap_peer/mschapv2.c',
+ 'contrib/wpa/src/eap_peer/eap_md5.c',
+ 'contrib/wpa/src/eap_peer/eap_tls.c',
+ 'contrib/wpa/src/eap_peer/eap_peap.c',
+ 'contrib/wpa/src/eap_peer/eap_ttls.c',
+ 'contrib/wpa/src/eap_peer/eap_gtc.c',
+ 'contrib/wpa/src/eap_peer/eap_otp.c',
+ 'contrib/wpa/src/eap_peer/eap_leap.c',
+ 'contrib/wpa/src/eap_peer/eap_psk.c',
+ 'contrib/wpa/src/eap_peer/eap_tls_common.c',
+ 'contrib/wpa/src/eap_common/eap_common.c',
+ 'contrib/wpa/src/eap_common/eap_peap_common.c',
+ 'contrib/wpa/src/eap_common/eap_psk_common.c',
+ 'contrib/wpa/src/eap_common/chap.c',
+ 'contrib/wpa/src/crypto/crypto_openssl.c',
+ 'contrib/wpa/src/crypto/random.c',
+ 'contrib/wpa/src/crypto/aes-omac1.c',
+ 'contrib/wpa/src/crypto/sha256-prf.c',
+ 'contrib/wpa/src/crypto/sha256-internal.c',
+ 'contrib/wpa/src/crypto/sha1.c',
+ 'contrib/wpa/src/crypto/sha1-prf.c',
+ 'contrib/wpa/src/crypto/aes-unwrap.c',
+ 'contrib/wpa/src/crypto/rc4.c',
+ 'contrib/wpa/src/crypto/sha1-pbkdf2.c',
+ 'contrib/wpa/src/crypto/tls_internal.c',
+ 'contrib/wpa/src/crypto/ms_funcs.c',
+ 'contrib/wpa/src/crypto/aes-eax.c',
+ 'contrib/wpa/src/crypto/aes-ctr.c',
+ 'contrib/wpa/src/crypto/aes-encblock.c',
+ 'usr.sbin/wpa/wpa_supplicant/Packet32.c',
+ ],
+ mm.generator['source'](['-D__FreeBSD__=1',
+ '-DCONFIG_BACKEND_FILE=1',
+ '-DCONFIG_DEBUG_SYSLOG=1',
+ '-DCONFIG_DRIVER_BSD=1',
+ '-DCONFIG_DRIVER_NDIS=1',
+ '-DCONFIG_DRIVER_WIRED=1',
+ '-DCONFIG_GAS=1',
+ '-DCONFIG_HS20=1',
+ '-DCONFIG_IEEE80211R=1',
+ '-DCONFIG_INTERWORKING=1',
+ '-DCONFIG_PEERKEY=1',
+ '-DCONFIG_PRIVSEP=1',
+ '-DCONFIG_SMARTCARD=1',
+ '-DCONFIG_TERMINATE_ONLASTIF=1',
+ '-DCONFIG_TLS=openssl',
+ '-DCONFIG_WPS=1',
+ '-DCONFIG_WPS2=1',
+ '-DCONFIG_WPS_UPNP=1',
+ '-DPKCS12_FUNCS=1',
+ '-DCONFIG_SHA256=1',
+ '-DCONFIG_CTRL_IFACE=1',
+ '-DCONFIG_CTRL_IFACE_UNIX=1',
+ '-DIEEE8021X_EAPOL=1',
+ '-DEAP_MD5=1',
+ '-DEAP_GTC=1',
+ '-DEAP_LEAP=1',
+ '-DEAP_MSCHAPv2=1',
+ '-DEAP_OTP=1',
+ '-DEAP_PEAP=1',
+ '-DEAP_PSK=1',
+ '-DEAP_TLS=1',
+ '-DEAP_TTLS=1'],
+ ['freebsd/contrib/wpa/src',
+ 'freebsd/contrib/wpa/src/utils',
+ 'freebsd/contrib/wpa/src/eap_peer',
+ 'freebsd/usr.sbin/wpa/wpa_supplicant',
+ 'freebsd/crypto/openssl/crypto'])
+ )
+ mod.addRTEMSSourceFiles(
+ [
+ 'rtems/rtems-bsd-shell-wpa_supplicant.c',
+ ],
+ mm.generator['source']()
+ )
+ return mod
+
+#
# in_chksum Module
#
def in_cksum(mm):
@@ -4236,6 +4520,7 @@ def sources(mm):
mm.addModule(contrib_expat(mm))
mm.addModule(contrib_libpcap(mm))
mm.addModule(usr_sbin_tcpdump(mm))
+ mm.addModule(usr_sbin_wpa_supplicant(mm))
mm.addModule(crypto_openssl(mm))
mm.addModule(tests(mm))
diff --git a/libbsd_waf.py b/libbsd_waf.py
index 64c8af4..329a62a 100644
--- a/libbsd_waf.py
+++ b/libbsd_waf.py
@@ -64,6 +64,7 @@ def build(bld):
includes += ["rtemsbsd/include"]
includes += ["freebsd/sys"]
includes += ["freebsd/sys/contrib/pf"]
+ includes += ["freebsd/crypto"]
includes += ["freebsd/sys/net"]
includes += ["freebsd/include"]
includes += ["freebsd/lib"]
@@ -1404,7 +1405,111 @@ def build(bld):
source = objs07_source)
libbsd_use += ["objs07"]
- objs08_source = ['freebsd/contrib/tcpdump/addrtoname.c',
+ objs08_source = ['freebsd/contrib/wpa/src/ap/ap_drv_ops.c',
+ 'freebsd/contrib/wpa/src/ap/hs20.c',
+ 'freebsd/contrib/wpa/src/ap/ieee802_11_shared.c',
+ 'freebsd/contrib/wpa/src/common/gas.c',
+ 'freebsd/contrib/wpa/src/common/hw_features_common.c',
+ 'freebsd/contrib/wpa/src/common/ieee802_11_common.c',
+ 'freebsd/contrib/wpa/src/common/wpa_common.c',
+ 'freebsd/contrib/wpa/src/crypto/aes-ctr.c',
+ 'freebsd/contrib/wpa/src/crypto/aes-eax.c',
+ 'freebsd/contrib/wpa/src/crypto/aes-encblock.c',
+ 'freebsd/contrib/wpa/src/crypto/aes-omac1.c',
+ 'freebsd/contrib/wpa/src/crypto/aes-unwrap.c',
+ 'freebsd/contrib/wpa/src/crypto/crypto_openssl.c',
+ 'freebsd/contrib/wpa/src/crypto/ms_funcs.c',
+ 'freebsd/contrib/wpa/src/crypto/random.c',
+ 'freebsd/contrib/wpa/src/crypto/rc4.c',
+ 'freebsd/contrib/wpa/src/crypto/sha1-pbkdf2.c',
+ 'freebsd/contrib/wpa/src/crypto/sha1-prf.c',
+ 'freebsd/contrib/wpa/src/crypto/sha1.c',
+ 'freebsd/contrib/wpa/src/crypto/sha256-internal.c',
+ 'freebsd/contrib/wpa/src/crypto/sha256-prf.c',
+ 'freebsd/contrib/wpa/src/crypto/tls_internal.c',
+ 'freebsd/contrib/wpa/src/drivers/driver_bsd.c',
+ 'freebsd/contrib/wpa/src/drivers/driver_common.c',
+ 'freebsd/contrib/wpa/src/drivers/driver_ndis.c',
+ 'freebsd/contrib/wpa/src/drivers/driver_wired.c',
+ 'freebsd/contrib/wpa/src/drivers/drivers.c',
+ 'freebsd/contrib/wpa/src/eap_common/chap.c',
+ 'freebsd/contrib/wpa/src/eap_common/eap_common.c',
+ 'freebsd/contrib/wpa/src/eap_common/eap_peap_common.c',
+ 'freebsd/contrib/wpa/src/eap_common/eap_psk_common.c',
+ 'freebsd/contrib/wpa/src/eap_peer/eap.c',
+ 'freebsd/contrib/wpa/src/eap_peer/eap_gtc.c',
+ 'freebsd/contrib/wpa/src/eap_peer/eap_leap.c',
+ 'freebsd/contrib/wpa/src/eap_peer/eap_md5.c',
+ 'freebsd/contrib/wpa/src/eap_peer/eap_methods.c',
+ 'freebsd/contrib/wpa/src/eap_peer/eap_mschapv2.c',
+ 'freebsd/contrib/wpa/src/eap_peer/eap_otp.c',
+ 'freebsd/contrib/wpa/src/eap_peer/eap_peap.c',
+ 'freebsd/contrib/wpa/src/eap_peer/eap_psk.c',
+ 'freebsd/contrib/wpa/src/eap_peer/eap_tls.c',
+ 'freebsd/contrib/wpa/src/eap_peer/eap_tls_common.c',
+ 'freebsd/contrib/wpa/src/eap_peer/eap_ttls.c',
+ 'freebsd/contrib/wpa/src/eap_peer/mschapv2.c',
+ 'freebsd/contrib/wpa/src/eapol_supp/eapol_supp_sm.c',
+ 'freebsd/contrib/wpa/src/l2_packet/l2_packet_freebsd.c',
+ 'freebsd/contrib/wpa/src/rsn_supp/peerkey.c',
+ 'freebsd/contrib/wpa/src/rsn_supp/pmksa_cache.c',
+ 'freebsd/contrib/wpa/src/rsn_supp/preauth.c',
+ 'freebsd/contrib/wpa/src/rsn_supp/wpa.c',
+ 'freebsd/contrib/wpa/src/rsn_supp/wpa_ft.c',
+ 'freebsd/contrib/wpa/src/rsn_supp/wpa_ie.c',
+ 'freebsd/contrib/wpa/src/utils/base64.c',
+ 'freebsd/contrib/wpa/src/utils/common.c',
+ 'freebsd/contrib/wpa/src/utils/eloop.c',
+ 'freebsd/contrib/wpa/src/utils/os_unix.c',
+ 'freebsd/contrib/wpa/src/utils/uuid.c',
+ 'freebsd/contrib/wpa/src/utils/wpa_debug.c',
+ 'freebsd/contrib/wpa/src/utils/wpabuf.c',
+ 'freebsd/contrib/wpa/src/wps/http_client.c',
+ 'freebsd/contrib/wpa/src/wps/http_server.c',
+ 'freebsd/contrib/wpa/src/wps/httpread.c',
+ 'freebsd/contrib/wpa/src/wps/upnp_xml.c',
+ 'freebsd/contrib/wpa/src/wps/wps.c',
+ 'freebsd/contrib/wpa/src/wps/wps_attr_build.c',
+ 'freebsd/contrib/wpa/src/wps/wps_attr_parse.c',
+ 'freebsd/contrib/wpa/src/wps/wps_attr_process.c',
+ 'freebsd/contrib/wpa/src/wps/wps_common.c',
+ 'freebsd/contrib/wpa/src/wps/wps_dev_attr.c',
+ 'freebsd/contrib/wpa/src/wps/wps_enrollee.c',
+ 'freebsd/contrib/wpa/src/wps/wps_registrar.c',
+ 'freebsd/contrib/wpa/src/wps/wps_upnp.c',
+ 'freebsd/contrib/wpa/src/wps/wps_upnp_ap.c',
+ 'freebsd/contrib/wpa/src/wps/wps_upnp_event.c',
+ 'freebsd/contrib/wpa/src/wps/wps_upnp_ssdp.c',
+ 'freebsd/contrib/wpa/src/wps/wps_upnp_web.c',
+ 'freebsd/contrib/wpa/wpa_supplicant/blacklist.c',
+ 'freebsd/contrib/wpa/wpa_supplicant/bss.c',
+ 'freebsd/contrib/wpa/wpa_supplicant/config.c',
+ 'freebsd/contrib/wpa/wpa_supplicant/config_file.c',
+ 'freebsd/contrib/wpa/wpa_supplicant/ctrl_iface.c',
+ 'freebsd/contrib/wpa/wpa_supplicant/ctrl_iface_unix.c',
+ 'freebsd/contrib/wpa/wpa_supplicant/eap_register.c',
+ 'freebsd/contrib/wpa/wpa_supplicant/events.c',
+ 'freebsd/contrib/wpa/wpa_supplicant/gas_query.c',
+ 'freebsd/contrib/wpa/wpa_supplicant/hs20_supplicant.c',
+ 'freebsd/contrib/wpa/wpa_supplicant/interworking.c',
+ 'freebsd/contrib/wpa/wpa_supplicant/main.c',
+ 'freebsd/contrib/wpa/wpa_supplicant/notify.c',
+ 'freebsd/contrib/wpa/wpa_supplicant/offchannel.c',
+ 'freebsd/contrib/wpa/wpa_supplicant/scan.c',
+ 'freebsd/contrib/wpa/wpa_supplicant/wmm_ac.c',
+ 'freebsd/contrib/wpa/wpa_supplicant/wpa_supplicant.c',
+ 'freebsd/contrib/wpa/wpa_supplicant/wpas_glue.c',
+ 'freebsd/contrib/wpa/wpa_supplicant/wps_supplicant.c',
+ 'freebsd/usr.sbin/wpa/wpa_supplicant/Packet32.c']
+ bld.objects(target = "objs08",
+ features = "c",
+ cflags = cflags,
+ includes = ['freebsd/contrib/wpa/src', 'freebsd/contrib/wpa/src/eap_peer', 'freebsd/contrib/wpa/src/utils', 'freebsd/crypto/openssl/crypto', 'freebsd/usr.sbin/wpa/wpa_supplicant'] + includes,
+ defines = defines + ['CONFIG_BACKEND_FILE=1', 'CONFIG_CTRL_IFACE=1', 'CONFIG_CTRL_IFACE_UNIX=1', 'CONFIG_DEBUG_SYSLOG=1', 'CONFIG_DRIVER_BSD=1', 'CONFIG_DRIVER_NDIS=1', 'CONFIG_DRIVER_WIRED=1', 'CONFIG_GAS=1', 'CONFIG_HS20=1', 'CONFIG_IEEE80211R=1', 'CONFIG_INTERWORKING=1', 'CONFIG_PEERKEY=1', 'CONFIG_PRIVSEP=1', 'CONFIG_SHA256=1', 'CONFIG_SMARTCARD=1', 'CONFIG_TERMINATE_ONLASTIF=1', 'CONFIG_TLS=openssl', 'CONFIG_WPS2=1', 'CONFIG_WPS=1', 'CONFIG_WPS_UPNP=1', 'EAP_GTC=1', 'EAP_LEAP=1', 'EAP_MD5=1', 'EAP_MSCHAPv2=1', 'EAP_OTP=1', 'EAP_PEAP=1', 'EAP_PSK=1', 'EAP_TLS=1', 'EAP_TTLS=1', 'IEEE8021X_EAPOL=1', 'PKCS12_FUNCS=1', '__FreeBSD__=1'],
+ source = objs08_source)
+ libbsd_use += ["objs08"]
+
+ objs09_source = ['freebsd/contrib/tcpdump/addrtoname.c',
'freebsd/contrib/tcpdump/af.c',
'freebsd/contrib/tcpdump/bpf_dump.c',
'freebsd/contrib/tcpdump/checksum.c',
@@ -1547,13 +1652,13 @@ def build(bld):
'freebsd/contrib/tcpdump/smbutil.c',
'freebsd/contrib/tcpdump/tcpdump.c',
'freebsd/contrib/tcpdump/util.c']
- bld.objects(target = "objs08",
+ bld.objects(target = "objs09",
features = "c",
cflags = cflags,
includes = ['freebsd/contrib/tcpdump', 'freebsd/usr.sbin/tcpdump/tcpdump'] + includes,
defines = defines + ['HAVE_CONFIG_H=1', 'HAVE_NET_PFVAR_H=1', 'INET6', '_U_=__attribute__((unused))', '__FreeBSD__=1'],
- source = objs08_source)
- libbsd_use += ["objs08"]
+ source = objs09_source)
+ libbsd_use += ["objs09"]
source = ['freebsd/sys/arm/lpc/if_lpe.c',
'freebsd/sys/arm/lpc/lpc_pwr.c',
@@ -2181,6 +2286,7 @@ def build(bld):
'rtemsbsd/rtems/rtems-bsd-shell-tcpdump.c',
'rtemsbsd/rtems/rtems-bsd-shell-vmstat.c',
'rtemsbsd/rtems/rtems-bsd-shell-wlanstats.c',
+ 'rtemsbsd/rtems/rtems-bsd-shell-wpa_supplicant.c',
'rtemsbsd/rtems/rtems-bsd-syscall-api.c',
'rtemsbsd/rtems/rtems-kernel-assert.c',
'rtemsbsd/rtems/rtems-kernel-autoconf.c',
diff --git a/rtemsbsd/include/bsp/nexus-devices.h b/rtemsbsd/include/bsp/nexus-devices.h
index 65c183c..baa7ec8 100644
--- a/rtemsbsd/include/bsp/nexus-devices.h
+++ b/rtemsbsd/include/bsp/nexus-devices.h
@@ -61,6 +61,8 @@ SYSINIT_MODULE_REFERENCE(wlan_ratectl_none);
SYSINIT_MODULE_REFERENCE(wlan_sta);
SYSINIT_MODULE_REFERENCE(wlan_amrr);
SYSINIT_MODULE_REFERENCE(wlan_wep);
+SYSINIT_MODULE_REFERENCE(wlan_tkip);
+SYSINIT_MODULE_REFERENCE(wlan_ccmp);
SYSINIT_REFERENCE(rtwn_rtl8188eufw);
RTEMS_BSD_DRIVER_USB;
diff --git a/rtemsbsd/include/machine/rtems-bsd-commands.h b/rtemsbsd/include/machine/rtems-bsd-commands.h
index 9e9ed1c..03a09bc 100644
--- a/rtemsbsd/include/machine/rtems-bsd-commands.h
+++ b/rtemsbsd/include/machine/rtems-bsd-commands.h
@@ -62,6 +62,8 @@ int rtems_bsd_command_route(int argc, char **argv);
int rtems_bsd_command_dhcpcd(int argc, char **argv);
+int rtems_bsd_command_wpa_supplicant(int argc, char **argv);
+
int rtems_bsd_command_tcpdump(int argc, char **argv);
int rtems_bsd_command_sysctl(int argc, char **argv);
diff --git a/rtemsbsd/include/rtems/netcmds-config.h b/rtemsbsd/include/rtems/netcmds-config.h
index 515b265..046c859 100644
--- a/rtemsbsd/include/rtems/netcmds-config.h
+++ b/rtemsbsd/include/rtems/netcmds-config.h
@@ -39,6 +39,8 @@ extern rtems_shell_cmd_t rtems_shell_HOSTNAME_Command;
extern rtems_shell_cmd_t rtems_shell_TCPDUMP_Command;
+extern rtems_shell_cmd_t rtems_shell_WPA_SUPPLICANT_Command;
+
extern rtems_shell_cmd_t rtems_shell_SYSCTL_Command;
extern rtems_shell_cmd_t rtems_shell_VMSTAT_Command;
diff --git a/rtemsbsd/rtems/rtems-bsd-shell-wpa_supplicant.c b/rtemsbsd/rtems/rtems-bsd-shell-wpa_supplicant.c
new file mode 100644
index 0000000..32ebb86
--- /dev/null
+++ b/rtemsbsd/rtems/rtems-bsd-shell-wpa_supplicant.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2017 Sichen Zhao. All rights reserved.
+ *
+ * <zsc19940506 at gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <rtems/netcmds-config.h>
+#include <machine/rtems-bsd-commands.h>
+
+rtems_shell_cmd_t rtems_shell_WPA_SUPPLICANT_Command = {
+ .name = "wpa_supplicant",
+ .usage = "wpa_supplicant [args]",
+ .topic = "net",
+ .command = rtems_bsd_command_wpa_supplicant
+};
--
2.7.4
More information about the devel
mailing list