├── 64 └── profiles │ └── 001_welled.mk ├── .gitignore ├── .rpmmacros ├── Android.mk ├── CHANGELOG ├── Config.in ├── DEBIAN ├── control └── substvars ├── Dockerfile ├── Doxyfile ├── INSTALL.md ├── LICENSE.txt ├── Makefile ├── README.md ├── VIB ├── index.xml └── vendor-index.xml ├── android ├── init.step-startup.rc ├── init.welled-x86.rc ├── init.welled-x86_64.rc ├── init.wpa_supplicant.rc └── wpa_supplicant.conf ├── contrib └── welled.spec ├── dist └── tmp ├── doc ├── dhcp ├── dhcp-wlan ├── firewall ├── firewall-wlan ├── logo.png ├── mac80211-hwsim ├── network ├── network-wlan ├── welled.conf ├── welled_banner.png ├── welled_symbol.png ├── welled_symbol_orig.png ├── welled_symbol_small.png └── wireless ├── etc ├── init.d │ └── wmasterd └── vmware │ ├── firewall │ └── wmasterd.xml │ └── secpolicy │ └── tardisks │ └── wmasterd ├── man ├── gelled-ctrl.8 ├── gelled-ctrl.8.gz ├── gelled-ctrl.in ├── gelled.8 ├── gelled.8.gz ├── gelled.in ├── welled.8 ├── welled.8.gz ├── welled.in ├── wmasterd.8 ├── wmasterd.8.gz └── wmasterd.in ├── metadata ├── bulletins │ └── wmasterd.xml ├── descriptor.tmp ├── vendor-index.xml ├── vibs │ ├── wmasterd-2.3.0-1551304196.xml │ └── wmasterd.xml └── vmware.tmp ├── patches ├── 3.10 │ ├── 0001-mac80211_hwsim-disables-hwsim0-device.patch │ ├── 0002-mac80211_hwsim-adds-ATTR_FREQ-to-netlink-messages-an.patch │ └── 0003-mac80211_hwsim-updated-to-allow-any-MAC-address.patch ├── 3.18 │ ├── 0001-mac80211_hwsim-disables-hwsim0-device.patch │ ├── 0002-mac80211_hwsim-adds-ATTR_FREQ-to-netlink-messages-a.patch │ └── 0003-mac80211_hwsim-updated-to-allow-any-MAC-address.patch ├── 4.0.0-kali1-amd64 │ ├── 0001-mac80211_hwsim-check-ATTR_FREQ-for-netlink-packets.patch │ ├── 0002-mac80211_hwsim-disables-hwsim0-device.patch │ ├── 0003-mac80211_hwsim-allows-use-of-any-MAC-address-with-ne.patch │ └── 0004-mac80211_hwsim-adds-param-string-perm_addr.patch ├── 4.18.0-kali2-amd64 │ ├── 0001-disables-hwsim0-device.patch │ └── 0002-adds-param-string-perm.patch ├── 4.18.16-200.fc28.x86_64 │ ├── 0001-disables-hwsim0-device.patch │ └── 0002-adds-param-string-perm.patch ├── 4.19.0-kali1-amd64 │ ├── 0001-disables-hwsim0-interface.patch │ └── 0002-adds-param-string-perm_addr.patch ├── 4.2.6-301.fc23.x86_64 │ ├── 0001-mac80211_hwsim-check-ATTR_FREQ-for-netlink-packets.patch │ ├── 0002-mac80211_hwsim-disables-hwsim0-device.patch │ └── 0003-mac80211_hwsim-adds-param-string-perm_addr ├── 4.3.3-300.fc23.x86_64 │ ├── 0001-mac80211_hwsim-check-ATTR_FREQ-for-netlink-packets.patch │ ├── 0002-mac80211_hwsim-disables-hwsim0-device.patch │ └── 0003-mac80211_hwsim-adds-param-string-perm_addr ├── 4.9.0-kali3-amd64 │ ├── 0001-disables-hwsim0-device.patch │ └── 0002-adds-param-string-perm_addr.patch ├── 4.9.0-kali4-amd64 │ ├── 0001-disables-hwsim0-device.patch │ └── 0002-adds-param-string-perm_addr.patch ├── android-build-config-changes-2016-06-22 │ ├── 0001-boardconfig-mk-add-driver.patch │ └── 0002-system-etc-wifi-conf.patch ├── android-libhardware-2016-06-17 │ └── 0001-libhardware-adds-wifi-device.patch ├── android-net-wifi-2016-06-22 │ └── 0001-net-wifi-add-driver-to-build.patch ├── android-wext-driver-2016-06-22 │ └── 0001-wext-driver-load-welled.patch ├── compat-wireless-2014-05-22 │ ├── 0001-mac80211_hwsim-disables-hwsim0-device.patch │ └── 0002-mac80211_hwsim-adds-param-string-perm_addr.patch ├── compat-wireless-2015-03-09 │ ├── 0001-mac80211_hwsim-disables-hwsim0-device.patch │ ├── 0002-mac80211_hwsim-checks-ATTR_FREQ-for-netlink-messages.patch │ └── 0003-mac80211_hwsim-adds-param-string-perm_addr.patch ├── compat-wireless-2015-10-26 │ ├── 0001-mac80211_hwsim-disables-hwsim0-device.patch │ ├── 0002-mac80211_hwsim-checks-ATTR_FREQ-for-netlink-messages.patch │ └── 0003-mac80211_hwsim-adds-param-string-perm_addr ├── compat-wireless-2015-12-03 │ ├── 0001-mac80211_hwsim-disables-hwsim0-device.patch │ └── 0002-mac80211_hwsim-adds-param-string-perm_addr ├── compat-wireless-2016-01-10 │ ├── 0001-mac80211_hwsim-disables-hwsim0-device │ └── 0002-mac80211_hwsim-adds-param-string-perm_addr ├── mac80211_hwsim.c-compat-wireless-2014-05-22 ├── mac80211_hwsim.c-linux-source-3.19.0 ├── mac80211_hwsim.c-linux-source-4.0 └── mac80211_hwsim.c-linux-source-4.3.0-rc7 ├── pix └── gps.png ├── scripts ├── gelled.path ├── gelled.service ├── init-welled-debian ├── init-welled-openwrt ├── init-welled-rhel ├── init-welled-vyos ├── install-wmasterd-esx.sh ├── welled.path └── welled.service ├── sig.pkcs7 ├── src ├── Makefile ├── gelled-ctrl.c ├── gelled-gui.c ├── gelled.c ├── ieee80211.h ├── nodes.c ├── nodes.h ├── vmci_sockets.h ├── welled.c ├── welled.h ├── windows_error.c ├── windows_error.h ├── wmasterd.c └── wmasterd.h ├── update_release.sh ├── vmw.mk └── vmware_guest ├── config-default ├── profiles ├── 000-Generic.mk └── 001_welled.mk └── target.mk /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode/ 2 | bin/ 3 | *.o 4 | html/ 5 | latex/ 6 | .*swp 7 | dist/* 8 | -------------------------------------------------------------------------------- /.rpmmacros: -------------------------------------------------------------------------------- 1 | %_topdir %(echo PATH) 2 | %_tmppath %{_topdir}/tmp 3 | -------------------------------------------------------------------------------- /64/profiles/001_welled.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2018 Carnegie Mellon University. All Rights Reserved. 2 | # 3 | # NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING 4 | # INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON 5 | # UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | # AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR 7 | # PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF 8 | # THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF 9 | # ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT 10 | # INFRINGEMENT. 11 | # 12 | # Released under a GNU GPL 2.0-style license, please see license.txt or 13 | # contact permission@sei.cmu.edu for full terms. 14 | # 15 | # [DISTRIBUTION STATEMENT A] This material has been approved for public 16 | # release and unlimited distribution. Please see Copyright notice for 17 | # non-US Government use and distribution. Carnegie Mellon® and CERT® are 18 | # registered in the U.S. Patent and Trademark Office by Carnegie Mellon 19 | # University. 20 | # 21 | # This Software includes and/or makes use of the following Third-Party 22 | # Software subject to its own license: 23 | # 1. wmediumd (https://github.com/bcopeland/wmediumd) 24 | # Copyright 2011 cozybit Inc.. 25 | # 2. mac80211_hwsim (https://github.com/torvalds/linux/blob/master/drivers/net/wireless/mac80211_hwsim.c) 26 | # Copyright 2008 Jouni Malinen 27 | # Copyright (c) 2011, Javier Lopez 28 | # 29 | # DM17-0952 30 | 31 | define Profile/welled 32 | NAME:=welled 33 | KCONFIG:=CONFIG_VMDK_IMAGES=y CONFIG_TARGET_IMAGES_PAD=y \ 34 | CONFIG_TARGET_KERNEL_PARTSIZE=1024 CONFIG_TARGET_ROOTFS_PARTSIZE=4096 35 | PACKAGES:=kmod-acpi-button kmod-button-hotplug kmod-vmw_vmci kmod-vsock \ 36 | kmod-vmw_vsock_vmci_transport kmod-fs-isofs kmod-scsi-cdrom kmod-3c59x \ 37 | kmod-e100 kmod-e1000 kmod-natsemi kmod-ne2k-pci \ 38 | kmod-pcnet32 kmod-8139too kmod-r8169 kmod-sis900 kmod-tg3 \ 39 | kmod-via-rhine kmod-via-velocity kmod-mac80211-hwsim libnl welled \ 40 | tcpdump iperf hostapd luci-ssl strace valgrind glib2 wireless-tools 41 | endef 42 | 43 | define Profile/welled/Description 44 | Profile for welled and dependencies 45 | endef 46 | $(eval $(call Profile,welled)) 47 | -------------------------------------------------------------------------------- /Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2018 Carnegie Mellon University. All Rights Reserved. 2 | # 3 | # NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING 4 | # INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON 5 | # UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | # AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR 7 | # PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF 8 | # THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF 9 | # ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT 10 | # INFRINGEMENT. 11 | # 12 | # Released under a GNU GPL 2.0-style license, please see license.txt or 13 | # contact permission@sei.cmu.edu for full terms. 14 | # 15 | # [DISTRIBUTION STATEMENT A] This material has been approved for public 16 | # release and unlimited distribution. Please see Copyright notice for 17 | # non-US Government use and distribution. Carnegie Mellon® and CERT® are 18 | # registered in the U.S. Patent and Trademark Office by Carnegie Mellon 19 | # University. 20 | # 21 | # This Software includes and/or makes use of the following Third-Party 22 | # Software subject to its own license: 23 | # 1. wmediumd (https://github.com/bcopeland/wmediumd) 24 | # Copyright 2011 cozybit Inc.. 25 | # 2. mac80211_hwsim (https://github.com/torvalds/linux/blob/master/drivers/net/wireless/mac80211_hwsim.c) 26 | # Copyright 2008 Jouni Malinen 27 | # Copyright (c) 2011, Javier Lopez 28 | # 29 | # DM17-0952 30 | 31 | LOCAL_PATH:= $(call my-dir) 32 | 33 | include $(CLEAR_VARS) 34 | LOCAL_MODULE_TAGS := eng debug 35 | LOCAL_MODULE := welled 36 | welled_version := 2.4.5 37 | VERSION_STR := $(welled_version) 38 | LOCAL_SRC_FILES := \ 39 | src/welled.c \ 40 | src/nodes.c 41 | LOCAL_C_INCLUDES := external/libnl/include/ 42 | LOCAL_LDLIBS := -lnl 43 | LOCAL_CFLAGS := -DVERSION_STR=\"$(VERSION_STR)\" -D_ANDROID 44 | include $(BUILD_EXECUTABLE) 45 | 46 | include $(CLEAR_VARS) 47 | LOCAL_MODULE_TAGS := eng debug 48 | LOCAL_MODULE := gelled-ctrl 49 | welled_version := 2.2.1 50 | VERSION_STR := $(welled_version) 51 | LOCAL_SRC_FILES := src/gelled-ctrl.c 52 | LOCAL_CFLAGS := -DVERSION_STR=\"$(VERSION_STR)\" -D_ANDROID 53 | include $(BUILD_EXECUTABLE) 54 | 55 | include $(CLEAR_VARS) 56 | LOCAL_MODULE := init.welled.rc 57 | LOCAL_MODULE_CLASS := ETC 58 | LOCAL_SRC_FILES := android/init.welled-$(TARGET_ARCH).rc 59 | LOCAL_MODULE_TAGS := eng 60 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) 61 | include $(BUILD_PREBUILT) 62 | 63 | include $(CLEAR_VARS) 64 | LOCAL_MODULE := wpa_supplicant.conf 65 | LOCAL_MODULE_CLASS := ETC 66 | LOCAL_SRC_FILES := android/$(LOCAL_MODULE) 67 | LOCAL_MODULE_TAGS := eng 68 | LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/wifi/ 69 | include $(BUILD_PREBUILT) 70 | 71 | include $(CLEAR_VARS) 72 | LOCAL_MODULE := welled_prep 73 | LOCAL_MODULE_CLASS := ETC 74 | LOCAL_SRC_FILES := android/$(LOCAL_MODULE) 75 | LOCAL_MODULE_TAGS := eng 76 | LOCAL_MODULE_PATH := $(TARGET_OUT)/bin/ 77 | include $(BUILD_PREBUILT) 78 | 79 | # begin extra packages 80 | include $(CLEAR_VARS) 81 | LOCAL_MODULE := bc24da93.0 82 | LOCAL_MODULE_CLASS := ETC 83 | LOCAL_SRC_FILES := android/certs/$(LOCAL_MODULE) 84 | LOCAL_MODULE_TAGS := eng 85 | LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/security/cacerts/ 86 | include $(BUILD_PREBUILT) 87 | 88 | include $(CLEAR_VARS) 89 | LOCAL_MODULE := exercise_prep 90 | LOCAL_MODULE_CLASS := ETC 91 | LOCAL_SRC_FILES := android/$(LOCAL_MODULE) 92 | LOCAL_MODULE_TAGS := eng 93 | LOCAL_MODULE_PATH := $(TARGET_OUT)/bin/ 94 | include $(BUILD_PREBUILT) 95 | 96 | include $(CLEAR_VARS) 97 | LOCAL_MODULE := step-startup.sh 98 | LOCAL_MODULE_CLASS := ETC 99 | LOCAL_SRC_FILES := android/$(LOCAL_MODULE) 100 | LOCAL_MODULE_TAGS := eng 101 | LOCAL_MODULE_PATH := $(TARGET_OUT)/bin/ 102 | include $(BUILD_PREBUILT) 103 | 104 | include $(CLEAR_VARS) 105 | LOCAL_MODULE := init.step-startup.rc 106 | LOCAL_MODULE_CLASS := ETC 107 | LOCAL_SRC_FILES := android/$(LOCAL_MODULE) 108 | LOCAL_MODULE_TAGS := eng 109 | include $(BUILD_PREBUILT) 110 | 111 | # for m -j12 iso 112 | iso_img: welled 113 | 114 | # for m welled and mm 115 | welled: welled-binaries welled-depends welled-files init-rc-update 116 | 117 | welled-binaries: 118 | test -d external/welled/dist/$(TARGET_PRODUCT)/ || mkdir external/welled/dist/$(TARGET_PRODUCT)/ 119 | cp $(TARGET_OUT)/bin/welled external/welled/dist/$(TARGET_PRODUCT)/ 120 | cp $(TARGET_OUT)/bin/gelled-ctrl external/welled/dist/$(TARGET_PRODUCT)/ 121 | cp $(TARGET_OUT)/bin/welled_prep external/welled/dist/$(TARGET_PRODUCT)/ 122 | 123 | welled-depends: 124 | cp out/target/product/$(TARGET_ARCH)/obj/kernel/drivers/misc/vmw_vmci/vmw_vmci.ko external/welled/dist/$(TARGET_PRODUCT)/ 125 | cp out/target/product/$(TARGET_ARCH)/obj/kernel/net/vmw_vsock/vsock.ko external/welled/dist/$(TARGET_PRODUCT)/ 126 | cp out/target/product/$(TARGET_ARCH)/obj/kernel/net/vmw_vsock/vmw_vsock_virtio_transport_common.ko external/welled/dist/$(TARGET_PRODUCT)/ 127 | cp out/target/product/$(TARGET_ARCH)/obj/kernel/net/vmw_vsock/vmw_vsock_virtio_transport.ko external/welled/dist/$(TARGET_PRODUCT)/ 128 | cp out/target/product/$(TARGET_ARCH)/obj/kernel/net/vmw_vsock/vmw_vsock_vmci_transport.ko external/welled/dist/$(TARGET_PRODUCT)/ 129 | 130 | welled-files: 131 | cp $(TARGET_ROOT_OUT)/init.welled.rc external/welled/dist/$(TARGET_PRODUCT)/init.welled-$(TARGET_ARCH).rc 132 | 133 | init-rc-update: 134 | echo "import /init.welled.rc" >> $(TARGET_ROOT_OUT)/init.rc 135 | 136 | -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- 1 | 2.4.5 - wmasterd: -p option send NMEA PASHR sentence 2 | 2.4.4 - wmasterd: fixes bug copying follow from update 3 | 2.4.3 - gelled-ctrl: updates to wmasterd, gelled, and gelled-ctrl to rename 4 | climb to pitch 5 | 2.4.2 - wmasterd: fixes bug in following nodes 6 | 2.4.1 - wmasterd: update_node_location logs to syslog 7 | 2.4.0 - welled: Uses syslog for both wmasterd and welled 8 | 2.3.3 - wmasterd: The esxi init script sleeps after signaling for new data 9 | from the process to prevent reading of stale data. 10 | 2.3.2 - welled: Removes genl cache. 11 | 2.3.1 - wmasterd: Performs better checking on null name and null room from 12 | update struct version 1. 13 | 2.3.0 - wmasterd: Accepts update struct with climb. Removes UDP from all 14 | applications since it has never been used. Pulls guestinfo.isolationTag 15 | from the VMX file. 16 | 2.2.2 - wmasterd: Parses VMX files on Windows for room ID and Display Name 17 | 2.2.1 - wmasterd: Bug fix links memcpy to glibc 2.2.5 again. 18 | 2.2.0 - wmasterd: Handles old and new guestinfo variable storage methods 19 | within the vmx file. Old method was storing themn inside of the annotations 20 | field but the new message sets them on their own lines. 21 | 2.1.3 - wmasterd: Bug fix resulting in performance improvement by resetting 22 | timeval structure used by the select() call. 23 | -------------------------------------------------------------------------------- /Config.in: -------------------------------------------------------------------------------- 1 | # Copyright 2018 Carnegie Mellon University. All Rights Reserved. 2 | # 3 | # NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING 4 | # INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON 5 | # UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | # AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR 7 | # PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF 8 | # THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF 9 | # ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT 10 | # INFRINGEMENT. 11 | # 12 | # Released under a GNU GPL 2.0-style license, please see license.txt or 13 | # contact permission@sei.cmu.edu for full terms. 14 | # 15 | # [DISTRIBUTION STATEMENT A] This material has been approved for public 16 | # release and unlimited distribution. Please see Copyright notice for 17 | # non-US Government use and distribution. Carnegie Mellon® and CERT® are 18 | # registered in the U.S. Patent and Trademark Office by Carnegie Mellon 19 | # University. 20 | # 21 | # This Software includes and/or makes use of the following Third-Party 22 | # Software subject to its own license: 23 | # 1. wmediumd (https://github.com/bcopeland/wmediumd) 24 | # Copyright 2011 cozybit Inc.. 25 | # 2. mac80211_hwsim (https://github.com/torvalds/linux/blob/master/drivers/net/wireless/mac80211_hwsim.c) 26 | # Copyright 2008 Jouni Malinen 27 | # Copyright (c) 2011, Javier Lopez 28 | # 29 | # DM17-0952 30 | 31 | menu "Configuration" 32 | depends on PACKAGE_libnl && PACKAGE_kmod-mac80211-hwsim 33 | 34 | config BR2_PACKAGE_WELLED 35 | tristate "welled - wireless emulation link layer exchange daemon" 36 | default m if CONFIG_DEVEL 37 | help 38 | welled is used to emulate wireless radios across multiple VMs 39 | 40 | endmenu 41 | ~ 42 | 43 | -------------------------------------------------------------------------------- /DEBIAN/control: -------------------------------------------------------------------------------- 1 | Package: welled 2 | Version: 2.2.1 3 | Source: welled 4 | Priority: optional 5 | Maintainer: Adam Welle 6 | Build-Depends: 7 | Standards-Version: 3.9.8 8 | Homepage: http://www.cert.org 9 | Architecture: all 10 | Depends: 11 | Description: wireless emulation link layer exchange daemon 12 | -------------------------------------------------------------------------------- /DEBIAN/substvars: -------------------------------------------------------------------------------- 1 | # Copyright 2018 Carnegie Mellon University. All Rights Reserved. 2 | # 3 | # NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING 4 | # INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON 5 | # UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | # AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR 7 | # PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF 8 | # THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF 9 | # ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT 10 | # INFRINGEMENT. 11 | # 12 | # Released under a GNU GPL 2.0-style license, please see license.txt or 13 | # contact permission@sei.cmu.edu for full terms. 14 | # 15 | # [DISTRIBUTION STATEMENT A] This material has been approved for public 16 | # release and unlimited distribution. Please see Copyright notice for 17 | # non-US Government use and distribution. Carnegie Mellon® and CERT® are 18 | # registered in the U.S. Patent and Trademark Office by Carnegie Mellon 19 | # University. 20 | # 21 | # This Software includes and/or makes use of the following Third-Party 22 | # Software subject to its own license: 23 | # 1. wmediumd (https://github.com/bcopeland/wmediumd) 24 | # Copyright 2011 cozybit Inc.. 25 | # 2. mac80211_hwsim (https://github.com/torvalds/linux/blob/master/drivers/net/wireless/mac80211_hwsim.c) 26 | # Copyright 2008 Jouni Malinen 27 | # Copyright (c) 2011, Javier Lopez 28 | # 29 | # DM17-0952 30 | 31 | shlibs:Depends=libc6 (>= 2.15), libcurl3 (>= 7.16.2), libglib2.0-0 (>= 2.12.0), libnl-3-200 (>= 3.2.7), libnl-genl-3-200 (>= 3.2.7), libpng12-0 (>= 1.2.13-4) 32 | shlibs:Depends=libc6 (>= 2.15), libcurl3 (>= 7.16.2), libglib2.0-0 (>= 2.12.0), libnl-3-200 (>= 3.2.7), libnl-genl-3-200 (>= 3.2.7), libpng12-0 (>= 1.2.13-4) 33 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | COPY . /app 4 | WORKDIR /app/src 5 | 6 | RUN apt-get update && \ 7 | apt-get install -y libcurl4-openssl-dev && \ 8 | apt-get install -y libnl-3-dev libnl-genl-3-dev libnl-route-3-dev pkg-config && \ 9 | apt-get install -y libpng-dev libglib2.0-dev 10 | 11 | RUN make x86_64-Linux 12 | WORKDIR /app/dist/x86_64-Linux -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2018 Carnegie Mellon University. All Rights Reserved. 2 | # 3 | # NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING 4 | # INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON 5 | # UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | # AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR 7 | # PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF 8 | # THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF 9 | # ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT 10 | # INFRINGEMENT. 11 | # 12 | # Released under a GNU GPL 2.0-style license, please see license.txt or 13 | # contact permission@sei.cmu.edu for full terms. 14 | # 15 | # [DISTRIBUTION STATEMENT A] This material has been approved for public 16 | # release and unlimited distribution. Please see Copyright notice for 17 | # non-US Government use and distribution. Carnegie Mellon® and CERT® are 18 | # registered in the U.S. Patent and Trademark Office by Carnegie Mellon 19 | # University. 20 | # 21 | # This Software includes and/or makes use of the following Third-Party 22 | # Software subject to its own license: 23 | # 1. wmediumd (https://github.com/bcopeland/wmediumd) 24 | # Copyright 2011 cozybit Inc.. 25 | # 2. mac80211_hwsim (https://github.com/torvalds/linux/blob/master/drivers/net/wireless/mac80211_hwsim.c) 26 | # Copyright 2008 Jouni Malinen 27 | # Copyright (c) 2011, Javier Lopez 28 | # 29 | # DM17-0952 30 | 31 | ############################################## 32 | # OpenWrt Makefile for welled program 33 | # 34 | # 35 | # Most of the variables used here are defined in 36 | # the include directives below. We just need to 37 | # specify a basic description of the package, 38 | # where to build our program, where to find 39 | # the source files, and where to install the 40 | # compiled program on the router. 41 | # 42 | # Be very careful of spacing in this file. 43 | # Indents should be tabs, not spaces, and 44 | # there should be no trailing whitespace in 45 | # lines that are not commented. 46 | # 47 | ############################################## 48 | 49 | include $(TOPDIR)/rules.mk 50 | 51 | # Name and release number of this package 52 | PKG_NAME:=welled 53 | PKG_RELEASE:=2.4.5 54 | 55 | # This specifies the directory where we're going to build the program. 56 | # The root build directory, $(BUILD_DIR), is by default the build_mipsel 57 | # directory in your OpenWrt SDK directory 58 | PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) 59 | 60 | include $(INCLUDE_DIR)/package.mk 61 | 62 | # Specify package information for this program. 63 | # The variables defined here should be self explanatory. 64 | # Package description I had to change from DESCRIPTION. 65 | # DEPENDS had to be added as well. 66 | define Package/welled 67 | SECTION:=utils 68 | CATEGORY:=Utilities 69 | TITLE:=welled -- Wireless Emulation Link Layer Exchange Daemon 70 | Package/PKG_NAME/description:=\ 71 | Wireless Emulation \\\ 72 | Link Layer Exchange \\\ 73 | Daemon \\\ 74 | This program is the link layer \\\ 75 | exchange daemon for wireless emulation. 76 | DEPENDS:=+libnl +glib2 +hostapd +kmod-mac80211-hwsim 77 | MAINTAINER:=Adam Welle 78 | endef 79 | 80 | # Specify what needs to be done to prepare for building the package. 81 | # In our case, we need to copy the source files to the build directory. 82 | # This is NOT the default. The default uses the PKG_SOURCE_URL and the 83 | # PKG_SOURCE which is not defined here to download the source from the web. 84 | # In order to just build a simple program that we have just written, it is 85 | # much easier to do it this way. 86 | define Build/Prepare 87 | mkdir -p $(PKG_BUILD_DIR) 88 | $(CP) ./src/*c $(PKG_BUILD_DIR)/ 89 | $(CP) ./src/*h $(PKG_BUILD_DIR)/ 90 | $(CP) ./src/Makefile $(PKG_BUILD_DIR)/ 91 | endef 92 | 93 | # We do not need to define Build/Configure or Build/Compile directives 94 | # The defaults are appropriate for compiling a simple program such as this one 95 | 96 | define Build/Compile 97 | CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CPPFLAGS) " \ 98 | LDFLAGS="$(EXTRA_LDFLAGS) " \ 99 | $(MAKE) -C $(PKG_BUILD_DIR) \ 100 | $(TARGET_CONFIGURE_OPTS) \ 101 | CROSS="$(TARGET_CROSS)" \ 102 | CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CPPFLAGS) " \ 103 | ARCH="$(ARCH)" \ 104 | openwrt; 105 | endef 106 | 107 | # Specify where and how to install the program. We will copy multiple files to 108 | # the router. The $(1) variable represents the root directory on the router 109 | # running OpenWrt. The $(INSTALL_DIR) variable contains a command to prepare 110 | # the install directory if it does not already exist. Likewise $(INSTALL_BIN) 111 | # contains the command to copy the binary file from its current location (in our 112 | # case the build directory) to the install directory. $(INSTALL_DATA) will copy 113 | # files with permissions 644, while $(INSTALL_BIN) uses 755. 114 | 115 | define Package/welled/install 116 | $(INSTALL_DIR) $(1)/bin/ 117 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/welled $(1)/bin/ 118 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/gelled-ctrl $(1)/bin/ 119 | $(INSTALL_DIR) $(1)/etc/init.d/ 120 | $(INSTALL_BIN) ./scripts/init-welled-openwrt $(1)/etc/init.d/welled 121 | $(INSTALL_DIR) $(1)/etc/config/ 122 | $(INSTALL_DATA) ./doc/wireless $(1)/etc/config/wireless-example 123 | $(INSTALL_DATA) ./doc/network $(1)/etc/config/network-example 124 | $(INSTALL_DATA) ./doc/dhcp $(1)/etc/config/dhcp-example 125 | $(INSTALL_DATA) ./doc/firewall $(1)/etc/config/firewall-example 126 | $(INSTALL_DATA) ./doc/welled.conf $(1)/etc/welled.conf-example 127 | #$(INSTALL_DIR) $(1)/etc/modules.d/ 128 | #$(INSTALL_DATA) ./doc/mac80211-hwsim $(1)/etc/modules.d/ 129 | endef 130 | 131 | # Configure the package after install 132 | #define Package/welled/postinst 133 | #endef 134 | 135 | # Clean up prior to package removal 136 | define Package/welled/prerm 137 | #!/bin/sh 138 | if [ -z "$${IPKG_INSTROOT}" ]; then 139 | echo "Removing rc.d symlink for welled" 140 | /etc/init.d/welled disable 141 | fi 142 | exit 0 143 | 144 | exit 0 145 | endef 146 | 147 | # This line executes the necessary commands to compile our program. 148 | # The above define directives specify all the information needed, but this 149 | # line calls BuildPackage which in turn actually uses this information to 150 | # build a package. 151 | $(eval $(call BuildPackage,welled)) 152 | 153 | -------------------------------------------------------------------------------- /VIB/index.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Carnegie Mellon University 4 | CMU 5 | vendor-index.xml 6 | 7 | 8 | 9 | VMware ESX 10 | http://www.vmware.com/depotmanagement/esx 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /VIB/vendor-index.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | embeddedEsx 4 | 5.* 5 | 6 | metadata.zip 7 | default 8 | 9 | 10 | embeddedEsx 11 | 6.* 12 | 13 | metadata.zip 14 | default 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /android/init.step-startup.rc: -------------------------------------------------------------------------------- 1 | # required modules 2 | 3 | on property:vold.post_fs_data_done=1 4 | start step-startup 5 | 6 | # services 7 | on property:step-startup.start=daemon 8 | setprop step-startup.start none 9 | start step-startup 10 | 11 | on property:step-startup.stop=daemon 12 | setprop step-startup.stop none 13 | stop step-startup 14 | 15 | service step-startup /system/bin/step-startup.sh 16 | oneshot 17 | disabled 18 | -------------------------------------------------------------------------------- /android/init.welled-x86.rc: -------------------------------------------------------------------------------- 1 | # required modules 2 | on boot 3 | insmod /lib/modules/4.9.31-android-x86/kernel/net/vmw_vsock/vsock.ko 4 | insmod /lib/modules/4.9.31-android-x86/kernel/net/vmw_vsock/vmw_vsock_vmci_transport.ko 5 | insmod /lib/modules/4.9.31-android-x86/kernel/net/wireless/cfg80211.ko 6 | insmod /lib/modules/4.9.31-android-x86/kernel/net/mac80211/mac80211.ko 7 | insmod /lib/modules/4.9.31-android-x86/kernel/drivers/net/wireless/mac80211_hwsim.ko radios=1 8 | 9 | on property:vold.post_fs_data_done=1 10 | copy /system/etc/wifi/wpa_supplicant.conf /data/misc/wifi/wpa_supplicant.conf 11 | chown wifi wifi /data/misc/wifi/wpa_supplicant.conf 12 | 13 | # services 14 | on property:welled.start=daemon 15 | setprop welled.start none 16 | start welled_prep 17 | start welled 18 | 19 | on property:welled.stop=daemon 20 | setprop welled.stop none 21 | stop welled 22 | 23 | service welled /system/bin/welled 24 | class main 25 | seclabel u:r:su:s0 26 | 27 | service welled_prep /system/bin/welled_prep 28 | oneshot 29 | disabled 30 | 31 | 32 | -------------------------------------------------------------------------------- /android/init.welled-x86_64.rc: -------------------------------------------------------------------------------- 1 | # required modules 2 | on boot 3 | insmod /lib/modules/4.9.31-android-x86_64/kernel/net/vmw_vsock/vsock.ko 4 | insmod /lib/modules/4.9.31-android-x86_64/kernel/net/vmw_vsock/vmw_vsock_vmci_transport.ko 5 | insmod /lib/modules/4.9.31-android-x86_64/kernel/net/wireless/cfg80211.ko 6 | insmod /lib/modules/4.9.31-android-x86_64/kernel/net/mac80211/mac80211.ko 7 | insmod /lib/modules/4.9.31-android-x86_64/kernel/drivers/net/wireless/mac80211_hwsim.ko radios=1 8 | 9 | on property:vold.post_fs_data_done=1 10 | copy /system/etc/wifi/wpa_supplicant.conf /data/misc/wifi/wpa_supplicant.conf 11 | chown wifi wifi /data/misc/wifi/wpa_supplicant.conf 12 | 13 | # services 14 | on property:welled.start=daemon 15 | setprop welled.start none 16 | start welled_prep 17 | start welled 18 | 19 | on property:welled.stop=daemon 20 | setprop welled.stop none 21 | stop welled 22 | 23 | service welled /system/bin/welled 24 | class main 25 | seclabel u:r:su:s0 26 | 27 | service welled_prep /system/bin/welled_prep 28 | oneshot 29 | disabled 30 | 31 | 32 | -------------------------------------------------------------------------------- /android/init.wpa_supplicant.rc: -------------------------------------------------------------------------------- 1 | # required modules 2 | on boot 3 | insmod /lib/modules/4.9.31-android-x86/kernel/net/wireless/cfg80211.ko 4 | insmod /lib/modules/4.9.31-android-x86/kernel/net/mac80211/mac80211.ko 5 | insmod /lib/modules/4.9.31-android-x86/kernel/drivers/net/wireless/mac80211_hwsim.ko radios=1a 6 | 7 | # common socket dirs 8 | mkdir /system/etc/wifi 0770 wifi wifi 9 | chmod 0770 /system/etc/wifi 10 | chmod 0660 /system/etc/wifi/wpa_supplicant.conf 11 | chown wifi wifi /system/etc/wifi/wpa_supplicant.conf 12 | 13 | # android socket dirs 14 | mkdir /data/misc/wifi 0770 wifi wifi 15 | mkdir /data/misc/wifi/sockets 0770 wifi wifi 16 | chmod 0770 /data/misc/wifi 17 | chmod 0660 /data/misc/wifi/wpa_supplicant.conf 18 | chown wifi wifi /data/misc/wifi 19 | chown wifi wifi /data/misc/wifi/wpa_supplicant.conf 20 | 21 | # unix socket dirs 22 | mkdir /data/system/wpa_supplicant 0771 wifi wifi 23 | chmod 0771 /data/system/wpa_supplicant 24 | chown wifi wifi /data/system/wpa_supplicant 25 | 26 | # service 27 | service wpa_supplicant /system/bin/wpa_supplicant \ 28 | -iwlan0 -Dnl80211 \ 29 | -c/system/etc/wifi/wpa_supplicant.conf 30 | class main 31 | seclabel u:r:su:s0 32 | -------------------------------------------------------------------------------- /android/wpa_supplicant.conf: -------------------------------------------------------------------------------- 1 | ctrl_interface=wlan0 GROUP=wifi 2 | update_config=1 3 | ap_scan=1 4 | network={ 5 | ssid="OpenWrt" 6 | psk="P@ssw0rd!" 7 | } 8 | -------------------------------------------------------------------------------- /contrib/welled.spec: -------------------------------------------------------------------------------- 1 | # Copyright 2018 Carnegie Mellon University. All Rights Reserved. 2 | # 3 | # NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING 4 | # INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON 5 | # UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | # AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR 7 | # PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF 8 | # THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF 9 | # ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT 10 | # INFRINGEMENT. 11 | # 12 | # Released under a GNU GPL 2.0-style license, please see license.txt or 13 | # contact permission@sei.cmu.edu for full terms. 14 | # 15 | # [DISTRIBUTION STATEMENT A] This material has been approved for public 16 | # release and unlimited distribution. Please see Copyright notice for 17 | # non-US Government use and distribution. Carnegie Mellon® and CERT® are 18 | # registered in the U.S. Patent and Trademark Office by Carnegie Mellon 19 | # University. 20 | # 21 | # This Software includes and/or makes use of the following Third-Party 22 | # Software subject to its own license: 23 | # 1. wmediumd (https://github.com/bcopeland/wmediumd) 24 | # Copyright 2011 cozybit Inc.. 25 | # 2. mac80211_hwsim (https://github.com/torvalds/linux/blob/master/drivers/net/wireless/mac80211_hwsim.c) 26 | # Copyright 2008 Jouni Malinen 27 | # Copyright (c) 2011, Javier Lopez 28 | # 29 | # DM17-0952 30 | 31 | Name: welled 32 | Version: 2.2.1 33 | Release: 1%{?dist} 34 | Summary: wireless emulation 35 | 36 | Group: Applications/Emulators 37 | License: GPLv2 38 | URL: http://www.cert.org 39 | SOURCE0 : %{name}-%{version}.tar.gz 40 | 41 | #Requires: 42 | 43 | %description 44 | wireless emulation link layer exchange daemon 45 | 46 | %global debug_package %{nil} 47 | 48 | %prep 49 | %autosetup 50 | #%setup -q 51 | 52 | 53 | %build 54 | 55 | 56 | %install 57 | mkdir -p %{buildroot}/bin/ 58 | mkdir -p %{buildroot}/etc/ 59 | mkdir -p %{buildroot}/lib/systemd/system/ 60 | mkdir -p %{buildroot}/usr/local/share/man/man8/ 61 | install -m 755 bin/welled %{buildroot}/bin/ 62 | install -m 755 bin/gelled %{buildroot}/bin/ 63 | install -m 755 bin/gelled-ctrl %{buildroot}/bin/ 64 | install -m 755 lib/systemd/system/welled.path %{buildroot}/lib/systemd/system/ 65 | install -m 755 lib/systemd/system/welled.service %{buildroot}/lib/systemd/system/ 66 | install -m 755 lib/systemd/system/gelled.service %{buildroot}/lib/systemd/system/ 67 | install -m 644 etc/welled.conf %{buildroot}/etc/ 68 | install -m 444 usr/local/share/man/man8/welled.8.gz %{buildroot}/usr/local/share/man/man8/ 69 | install -m 444 usr/local/share/man/man8/gelled.8.gz %{buildroot}/usr/local/share/man/man8/ 70 | install -m 444 usr/local/share/man/man8/gelled-ctrl.8.gz %{buildroot}/usr/local/share/man/man8/ 71 | 72 | %files 73 | %config /etc/welled.conf 74 | /bin/welled 75 | /bin/gelled 76 | /bin/gelled-ctrl 77 | /lib/systemd/system/gelled.service 78 | /lib/systemd/system/welled.path 79 | /lib/systemd/system/welled.service 80 | %doc %attr(0444,root,root) /usr/local/share/man/man8/welled.8.gz 81 | %doc %attr(0444,root,root) /usr/local/share/man/man8/gelled.8.gz 82 | %doc %attr(0444,root,root) /usr/local/share/man/man8/gelled-ctrl.8.gz 83 | 84 | %clean 85 | rm -rf %{buildroot} 86 | 87 | %changelog 88 | 89 | -------------------------------------------------------------------------------- /dist/tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cmu-sei/welled/fff448c5deeb52808b30c5390f6d8bb10f2a43b6/dist/tmp -------------------------------------------------------------------------------- /doc/dhcp: -------------------------------------------------------------------------------- 1 | 2 | config dnsmasq 3 | option domainneeded '1' 4 | option boguspriv '1' 5 | option filterwin2k '0' 6 | option localise_queries '1' 7 | option rebind_protection '1' 8 | option rebind_localhost '1' 9 | option local '/lan/' 10 | option domain 'lan' 11 | option expandhosts '1' 12 | option nonegcache '0' 13 | option authoritative '1' 14 | option readethers '1' 15 | option leasefile '/tmp/dhcp.leases' 16 | option resolvfile '/tmp/resolv.conf.auto' 17 | option localservice '1' 18 | 19 | config dhcp 'lan' 20 | option start '100' 21 | option leasetime '12h' 22 | option interface 'xwlan' 23 | option limit '150' 24 | option dhcpv6 'server' 25 | option ra 'server' 26 | option ra_management '1' 27 | 28 | config dhcp 'wan' 29 | option ignore '1' 30 | option interface 'wan' 31 | 32 | config odhcpd 'odhcpd' 33 | option maindhcp '0' 34 | option leasefile '/tmp/hosts/odhcpd' 35 | option leasetrigger '/usr/sbin/odhcpd-update' 36 | 37 | config dhcp 'wlan' 38 | option start '100' 39 | option leasetime '12h' 40 | option interface 'wlan' 41 | option limit '50' 42 | -------------------------------------------------------------------------------- /doc/dhcp-wlan: -------------------------------------------------------------------------------- 1 | 2 | config dhcp 'wlan' 3 | option start '100' 4 | option leasetime '12h' 5 | option interface 'wlan' 6 | option limit '50' 7 | 8 | -------------------------------------------------------------------------------- /doc/firewall: -------------------------------------------------------------------------------- 1 | config defaults 2 | option syn_flood 1 3 | option input ACCEPT 4 | option output ACCEPT 5 | option forward REJECT 6 | 7 | config zone 8 | option name lan 9 | option network 'lan' 10 | option input ACCEPT 11 | option output ACCEPT 12 | option forward ACCEPT 13 | 14 | config zone 15 | option name wan 16 | option input REJECT 17 | option output ACCEPT 18 | option forward REJECT 19 | option masq 1 20 | option mtu_fix 1 21 | option network 'wan wan6' 22 | 23 | config forwarding 24 | option src lan 25 | option dest wan 26 | 27 | config rule 28 | option name Allow-DHCP-Renew 29 | option src wan 30 | option proto udp 31 | option dest_port 68 32 | option target ACCEPT 33 | option family ipv4 34 | 35 | config rule 36 | option name Allow-Ping 37 | option src wan 38 | option proto icmp 39 | option icmp_type echo-request 40 | option family ipv4 41 | option target ACCEPT 42 | 43 | config rule 44 | option name Allow-IGMP 45 | option src wan 46 | option proto igmp 47 | option family ipv4 48 | option target ACCEPT 49 | 50 | config rule 51 | option name Allow-DHCPv6 52 | option src wan 53 | option proto udp 54 | option src_iP fc00::/6 55 | option dest_ip fc00::/6 56 | option dest_port 546 57 | option family ipv6 58 | option targeT ACCEPT 59 | 60 | config rule 61 | option name Allow-MLD 62 | option src wan 63 | option proto icmp 64 | option src_ip fe80::/10 65 | list icmp_type '130/0' 66 | list icmp_type '131/0' 67 | list icmp_type '132/0' 68 | list icmp_type '143/0' 69 | option family ipv6 70 | option target ACCEPT 71 | 72 | config rule 73 | option name Allow-ICMPv6-Input 74 | option src wan 75 | option proto icmp 76 | list icmp_type echo-request 77 | list icmp_type echo-reply 78 | list icmp_type destination-unreachable 79 | list icmp_type packet-too-big 80 | list icmp_type time-exceeded 81 | list icmp_type bad-header 82 | list icmp_type unknown-header-type 83 | list icmp_type router-solicitation 84 | list icmp_type neighbour-solicitation 85 | list icmp_type router-advertisement 86 | list icmp_type neighbour-advertisement 87 | option limit 1000/sec 88 | option family ipv6 89 | option target ACCEPT 90 | 91 | config rule 92 | option name Allow-ICMPv6-Forward 93 | option src wan 94 | option dest * 95 | option proto icmp 96 | list icmp_type echo-request 97 | list icmp_type echo-reply 98 | list icmp_type destination-unreachable 99 | list icmp_type packet-too-big 100 | list icmp_type time-exceeded 101 | list icmp_type bad-header 102 | list icmp_type unknown-header-type 103 | option limit 1000/sec 104 | option family ipv6 105 | option target ACCEPT 106 | 107 | config include 108 | option path /etc/firewall.user 109 | 110 | config rule 111 | option src wan 112 | option dest lan 113 | option proto esp 114 | option target ACCEPT 115 | 116 | config rule 117 | option src wan 118 | option dest lan 119 | option dest_port 500 120 | option proto udp 121 | option target ACCEPT 122 | 123 | config zone 124 | option name wlan 125 | option input ACCEPT 126 | option output ACCEPT 127 | option network wlan 128 | option forward ACCEPT 129 | 130 | config forwarding 131 | option dest lan 132 | option src wlan 133 | 134 | config forwarding 135 | option dest wan 136 | option src wlan 137 | 138 | config forwarding 139 | option dest wlan 140 | option src lan 141 | -------------------------------------------------------------------------------- /doc/firewall-wlan: -------------------------------------------------------------------------------- 1 | 2 | config zone 3 | option name wlan 4 | option input ACCEPT 5 | option output ACCEPT 6 | option network wlan 7 | option forward ACCEPT 8 | 9 | config forwarding 10 | option dest lan 11 | option src wlan 12 | 13 | config forwarding 14 | option dest wan 15 | option src wlan 16 | 17 | config forwarding 18 | option dest wlan 19 | option src lan 20 | 21 | -------------------------------------------------------------------------------- /doc/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cmu-sei/welled/fff448c5deeb52808b30c5390f6d8bb10f2a43b6/doc/logo.png -------------------------------------------------------------------------------- /doc/mac80211-hwsim: -------------------------------------------------------------------------------- 1 | mac80211_hwsim radios=1 use_hwsim_mon=0 perm_addr=00:0c:41:00:00:00 2 | -------------------------------------------------------------------------------- /doc/network: -------------------------------------------------------------------------------- 1 | 2 | config interface 'loopback' 3 | option ifname 'lo' 4 | option proto 'static' 5 | option ipaddr '127.0.0.1' 6 | option netmask '255.0.0.0' 7 | 8 | config interface 'lan' 9 | option proto 'static' 10 | option ipaddr '10.10.10.1' 11 | option netmask '255.255.255.0' 12 | option ifname 'eth0' 13 | 14 | config interface 'wlan' 15 | option _orig_ifname 'radio0.network1' 16 | option _orig_bridge 'false' 17 | option proto 'static' 18 | option ipaddr '192.168.1.1' 19 | option netmask '255.255.255.0' 20 | 21 | config interface 'wan' 22 | option ifname 'eth1' 23 | option proto 'dhcp' 24 | 25 | -------------------------------------------------------------------------------- /doc/network-wlan: -------------------------------------------------------------------------------- 1 | 2 | config interface 'wlan' 3 | option _orig_ifname 'radio0.network1' 4 | option _orig_bridge 'false' 5 | option proto 'static' 6 | option ipaddr '192.168.1.1' 7 | option netmask '255.255.255.0' 8 | 9 | -------------------------------------------------------------------------------- /doc/welled.conf: -------------------------------------------------------------------------------- 1 | [gelled] 2 | protocol=vmci 3 | #name=test-client 4 | #follow=test-master 5 | 6 | -------------------------------------------------------------------------------- /doc/welled_banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cmu-sei/welled/fff448c5deeb52808b30c5390f6d8bb10f2a43b6/doc/welled_banner.png -------------------------------------------------------------------------------- /doc/welled_symbol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cmu-sei/welled/fff448c5deeb52808b30c5390f6d8bb10f2a43b6/doc/welled_symbol.png -------------------------------------------------------------------------------- /doc/welled_symbol_orig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cmu-sei/welled/fff448c5deeb52808b30c5390f6d8bb10f2a43b6/doc/welled_symbol_orig.png -------------------------------------------------------------------------------- /doc/welled_symbol_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cmu-sei/welled/fff448c5deeb52808b30c5390f6d8bb10f2a43b6/doc/welled_symbol_small.png -------------------------------------------------------------------------------- /doc/wireless: -------------------------------------------------------------------------------- 1 | 2 | config wifi-device 'radio0' 3 | option type 'mac80211' 4 | option path 'virtual/mac80211_hwsim/hwsim0' 5 | option txpower '20' 6 | option channel '11' 7 | option hwmode '11g' 8 | option country '00' 9 | 10 | config wifi-iface 11 | option device 'radio0' 12 | option mode 'ap' 13 | option encryption 'psk2' 14 | option key 'tartans@1' 15 | option macaddr '00:0c:41:00:00:00' 16 | option ssid 'OpenWrt' 17 | option network 'wlan' 18 | -------------------------------------------------------------------------------- /etc/init.d/wmasterd: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (c) 2015 Carnegie Mellon University 4 | # 5 | # Author: Adam Welle 6 | # 7 | # wmasterd: 8 | # Start and stop the wmasterd daemon 9 | # 10 | # chkconfig: on 90 90 11 | # description: wireless emulation master daemon 12 | 13 | WMASTERD=/usr/lib/vmware/wmasterd/bin/wmasterd 14 | WMASTERD_TAG=wmasterd 15 | 16 | case "$1" in 17 | start) 18 | if [ -z "$(pidof -xs "${WMASTERD}")" ]; then 19 | /sbin/watchdog.sh -d -s "${WMASTERD_TAG}" "${WMASTERD} -d -c /wmasterd_nodes -D 5" 20 | echo "wmasterd started" 21 | else 22 | echo "wmasterd already running" 23 | fi 24 | ;; 25 | stop) 26 | if [ -n "$(pidof -xs "${WMASTERD}")" ]; then 27 | /sbin/watchdog.sh -k "${WMASTERD_TAG}" 28 | pkill -9 "${WMASTERD_TAG}" 29 | else 30 | echo "wmasterd is not running" 31 | fi 32 | ;; 33 | status) 34 | if [ -n "$(pidof -xs "${WMASTERD}")" ]; then 35 | echo "wmasterd is running as $(pidof -xs "${WMASTERD}")" 36 | kill -usr1 $(pidof -xs "${WMASTERD}") 37 | cat /tmp/wmasterd.status 2>/dev/null 38 | rm /tmp/wmasterd.status 2>/dev/null 39 | exit 0 40 | else 41 | echo "wmasterd is not running" 42 | exit 3 43 | fi 44 | ;; 45 | restart) 46 | $0 stop 47 | while [ -n "$(pidof -xs "${WMASTERD}")" ]; do 48 | sleep 1 49 | done 50 | $0 start 51 | ;; 52 | reload) 53 | $0 restart 54 | ;; 55 | enable) 56 | chkconfig wmasterd on 57 | ;; 58 | disable) 59 | chkconfig wmasterd off 60 | ;; 61 | *) 62 | echo "Usage: wmasterd {start|stop|status|reload|restart|enable|disable" 63 | exit 1 64 | ;; 65 | esac 66 | -------------------------------------------------------------------------------- /etc/vmware/firewall/wmasterd.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | wmasterd 4 | 5 | inbound 6 | udp 7 | dst 8 | 2018 9 | 10 | 11 | outbound 12 | udp 13 | dst 14 | 2018 15 | 16 | true 17 | false 18 | 19 | 20 | -------------------------------------------------------------------------------- /etc/vmware/secpolicy/tardisks/wmasterd: -------------------------------------------------------------------------------- 1 | -E unlabeled superDom 2 | -------------------------------------------------------------------------------- /man/gelled-ctrl.8: -------------------------------------------------------------------------------- 1 | .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4. 2 | .TH GELLED-CTRL "8" "November 2017" "gelled-ctrl version 2.2.2" "System Administration Utilities" 3 | .SH NAME 4 | gelled-ctrl \- control gps emulation 5 | .SH SYNOPSIS 6 | .B gelled-ctrl 7 | [\fI\,-hVv\/\fR] [\fI\,-u -i\/\fR] [\fI\,-x|-y|-k|-d\/\fR] [\fI\,-f\/\fR] [\fI\,-n \/\fR] [\fI\,-r\/\fR] 8 | .SH DESCRIPTION 9 | gelled\-ctrl \- control program for GPS emulation 10 | .SH OPTIONS 11 | .TP 12 | \fB\-h\fR, \fB\-\-help\fR 13 | print this help and exit 14 | .TP 15 | \fB\-V\fR, \fB\-\-version\fR 16 | print version and exit 17 | .TP 18 | \fB\-v\fR, \fB\-\-verbose\fR 19 | verbose output 20 | .TP 21 | \fB\-u\fR, \fB\-\-udp\fR 22 | use udp to this wmasterd ip address 23 | .TP 24 | \fB\-y\fR, \fB\-\-latitude\fR 25 | new latitude in decimal degrees 26 | .TP 27 | \fB\-x\fR, \fB\-\-longitude\fR 28 | new longitude in decimal degrees 29 | .TP 30 | \fB\-a\fR, \fB\-\-altitude\fR 31 | new altitude in meters 32 | .TP 33 | \fB\-k\fR, \fB\-\-knots\fR 34 | new velocity in knots 35 | .TP 36 | \fB\-d\fR, \fB\-\-degrees\fR 37 | new heading in degrees 38 | .TP 39 | \fB\-i\fR, \fB\-\-interface\fR 40 | use local ip for udp send 41 | .TP 42 | \fB\-f\fR, \fB\-\-follow\fR 43 | follow gps feed of this vm ip/name 44 | .TP 45 | \fB\-n\fR, \fB\-\-name\fR 46 | name for this this machine 47 | .TP 48 | \fB\-r\fR, \fB\-\-room\fR 49 | room id for this client 50 | .SH AVAILABILITY 51 | The latest version of this distribution is available on-line from: 52 | https://github.com/cmu-sei/welle-d 53 | .SH FILES 54 | .TP 55 | /bin/gelled-ctrl 56 | Executable 57 | .SH AUTHOR 58 | .TP 59 | Adam Welle 60 | .SH "REPORTING BUGS" 61 | Report bugs to 62 | .SH COPYRIGHT 63 | Copyright \(co 2017 Carnegie Mellon University 64 | .PP 65 | License GPLv2: GNU GPL version 2 66 | .br 67 | This is free software; you are free to change and redistribute it. 68 | There is NO WARRANTY, to the extent permitted by law. 69 | .SH "SEE ALSO" 70 | .PP 71 | \fBwmasterd\fR(8), 72 | \fBwelled\fR(8) 73 | \fBgelled\fR(8) 74 | -------------------------------------------------------------------------------- /man/gelled-ctrl.8.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cmu-sei/welled/fff448c5deeb52808b30c5390f6d8bb10f2a43b6/man/gelled-ctrl.8.gz -------------------------------------------------------------------------------- /man/gelled-ctrl.in: -------------------------------------------------------------------------------- 1 | [files] 2 | .TP 3 | /bin/gelled-ctrl 4 | Executable 5 | 6 | [see also] 7 | .PP 8 | \fBwmasterd\fR(8), 9 | \fBwelled\fR(8) 10 | \fBgelled\fR(8) 11 | 12 | [availability] 13 | The latest version of this distribution is available on-line from: 14 | https://github.com/cmu-sei/welle-d 15 | 16 | [author] 17 | .TP 18 | Adam Welle 19 | 20 | -------------------------------------------------------------------------------- /man/gelled.8: -------------------------------------------------------------------------------- 1 | .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4. 2 | .TH GELLED "8" "November 2017" "gelled version 2.2.2" "System Administration Utilities" 3 | .SH NAME 4 | gelled \- emulate GPS data stream 5 | .SH SYNOPSIS 6 | .B gelled 7 | [\fI\,-hVv\/\fR] [\fI\,-u -i\/\fR] [\fI\,-d\/\fR] [\fI\,-m\/\fR] [\fI\,-s|-l\/\fR] 8 | .SH DESCRIPTION 9 | gelled \- gelled, GPS emulation link layer exchange daemon 10 | .SH OPTIONS 11 | .TP 12 | \fB\-h\fR, \fB\-\-help\fR 13 | print this help and exit 14 | .TP 15 | \fB\-V\fR, \fB\-\-version\fR 16 | print version and exit 17 | .TP 18 | \fB\-v\fR, \fB\-\-verbose\fR 19 | verbose output 20 | .TP 21 | \fB\-u\fR, \fB\-\-udp\fR 22 | use udp to this wmasterd ip address 23 | .TP 24 | \fB\-l\fR, \fB\-\-land\fR 25 | gps should only travel on land 26 | .TP 27 | \fB\-s\fR, \fB\-\-sea\fR 28 | gps should only travel on water 29 | .TP 30 | \fB\-d\fR, \fB\-\-device\fR 31 | use this device as GPS 32 | .TP 33 | \fB\-m\fR, \fB\-\-mapserver\fR 34 | use this server for map tiles 35 | .TP 36 | \fB\-i\fR, \fB\-\-interface\fR 37 | use local ip for udp send 38 | .SH AVAILABILITY 39 | The latest version of this distribution is available on-line from: 40 | https://github.com/cmu-sei/welle-d 41 | .SH FILES 42 | .TP 43 | /bin/gelled 44 | Executable 45 | .TP 46 | /etc/init.d/gelled 47 | SysVinit Script 48 | .TP 49 | /lib/systemd/system/gelled.path 50 | systemd unit file 51 | .TP 52 | /lib/systemd/system/gelled.service 53 | systemd unit file 54 | .SH AUTHOR 55 | Adam Welle 56 | .SH "REPORTING BUGS" 57 | Report bugs to 58 | .SH COPYRIGHT 59 | Copyright \(co 2016 Carnegie Mellon University 60 | .PP 61 | License GPLv2: GNU GPL version 2 62 | .br 63 | This is free software; you are free to change and redistribute it. 64 | There is NO WARRANTY, to the extent permitted by law. 65 | .SH "SEE ALSO" 66 | .PP 67 | \fBwmasterd\fR(8), 68 | \fBgelled\fR(8), 69 | \fBgelled-ctrl\fR(8) 70 | -------------------------------------------------------------------------------- /man/gelled.8.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cmu-sei/welled/fff448c5deeb52808b30c5390f6d8bb10f2a43b6/man/gelled.8.gz -------------------------------------------------------------------------------- /man/gelled.in: -------------------------------------------------------------------------------- 1 | [files] 2 | .TP 3 | /bin/gelled 4 | Executable 5 | .TP 6 | /etc/init.d/gelled 7 | SysVinit Script 8 | .TP 9 | /lib/systemd/system/gelled.path 10 | systemd unit file 11 | .TP 12 | /lib/systemd/system/gelled.service 13 | systemd unit file 14 | 15 | [see also] 16 | .PP 17 | \fBwmasterd\fR(8), 18 | \fBgelled\fR(8), 19 | \fBgelled-ctrl\fR(8) 20 | 21 | [availability] 22 | The latest version of this distribution is available on-line from: 23 | https://github.com/cmu-sei/welle-d 24 | 25 | [author] 26 | Adam Welle 27 | 28 | -------------------------------------------------------------------------------- /man/welled.8: -------------------------------------------------------------------------------- 1 | .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4. 2 | .TH WELLED "8" "November 2017" "welled version 2.2.2" "System Administration Utilities" 3 | .SH NAME 4 | welled \- emulate wireless networks 5 | .SH SYNOPSIS 6 | .B welled 7 | [\fI\,-hVav\/\fR] [\fI\,-s\/\fR] 8 | .SH DESCRIPTION 9 | welled \- wireless emulation link layer exchange daemon 10 | .SH OPTIONS 11 | .TP 12 | \fB\-h\fR, \fB\-\-help\fR 13 | print this help and exit 14 | .HP 15 | \fB\-V\fR, \fB\-\-version\fR print version and exit 16 | .TP 17 | \fB\-a\fR, \fB\-\-any\fR 18 | allow any mac address (patched driver) 19 | .HP 20 | \fB\-v\fR, \fB\-\-verbose\fR verbose output 21 | .TP 22 | \fB\-s\fR, \fB\-\-server\fR 23 | use udp to this wmasterd ip address 24 | .SH AVAILABILITY 25 | The latest version of this distribution is available on-line from: 26 | https://github.com/cmu-sei/welle-d 27 | .SH FILES 28 | .TP 29 | /bin/welled 30 | Executable 31 | .TP 32 | /etc/init.d/welled 33 | SysVinit Script 34 | .TP 35 | /lib/systemd/system/welled.path 36 | systemd unit file 37 | .TP 38 | /lib/systemd/system/welled.service 39 | systemd unit file 40 | .SH AUTHOR 41 | .TP 42 | Adam Welle 43 | .SH "REPORTING BUGS" 44 | Report bugs to 45 | .SH COPYRIGHT 46 | Copyright \(co 2015 Carnegie Mellon University 47 | .PP 48 | License GPLv2: GNU GPL version 2 49 | .br 50 | This is free software; you are free to change and redistribute it. 51 | There is NO WARRANTY, to the extent permitted by law. 52 | .SH "SEE ALSO" 53 | .PP 54 | \fBwmasterd\fR(8), 55 | \fBgelled\fR(8), 56 | \fBgelled-ctrl\fR(8), 57 | \fBmodprobe\fR(8), 58 | \fBlsmod\fR(8), 59 | \fBmodinfo\fR(8), 60 | \fBinsmod\fR(8), 61 | \fBrmmod\fR(8), 62 | \fBwpa_supplicant\fR(8), 63 | \fBhostapd\fR(8) 64 | -------------------------------------------------------------------------------- /man/welled.8.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cmu-sei/welled/fff448c5deeb52808b30c5390f6d8bb10f2a43b6/man/welled.8.gz -------------------------------------------------------------------------------- /man/welled.in: -------------------------------------------------------------------------------- 1 | [files] 2 | .TP 3 | /bin/welled 4 | Executable 5 | .TP 6 | /etc/init.d/welled 7 | SysVinit Script 8 | .TP 9 | /lib/systemd/system/welled.path 10 | systemd unit file 11 | .TP 12 | /lib/systemd/system/welled.service 13 | systemd unit file 14 | 15 | [see also] 16 | .PP 17 | \fBwmasterd\fR(8), 18 | \fBgelled\fR(8), 19 | \fBgelled-ctrl\fR(8), 20 | \fBmodprobe\fR(8), 21 | \fBlsmod\fR(8), 22 | \fBmodinfo\fR(8), 23 | \fBinsmod\fR(8), 24 | \fBrmmod\fR(8), 25 | \fBwpa_supplicant\fR(8), 26 | \fBhostapd\fR(8) 27 | 28 | [availability] 29 | The latest version of this distribution is available on-line from: 30 | https://github.com/cmu-sei/welle-d 31 | 32 | [author] 33 | .TP 34 | Adam Welle 35 | 36 | -------------------------------------------------------------------------------- /man/wmasterd.8: -------------------------------------------------------------------------------- 1 | .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4. 2 | .TH WMASTERD "8" "November 2017" "wmasterd version 2.2.2" "System Administration Utilities" 3 | .SH NAME 4 | wmasterd \- wireless master daemon 5 | .SH SYNOPSIS 6 | .B wmasterd 7 | [\fI\,-hVvur\/\fR] 8 | .SH DESCRIPTION 9 | This is a test 10 | .PP 11 | wmasterd \- wireless master daemon 12 | .SH OPTIONS 13 | .TP 14 | \fB\-h\fR, \fB\-\-help\fR 15 | print this help and exit 16 | .TP 17 | \fB\-V\fR, \fB\-\-version\fR 18 | print version and exit 19 | .TP 20 | \fB\-v\fR, \fB\-\-verbose\fR 21 | verbose output 22 | .TP 23 | \fB\-u\fR, \fB\-\-udp\fR 24 | use udp instead of vmci 25 | .TP 26 | \fB\-r\fR, \fB\-\-no\-room\-check\fR 27 | do not check room id 28 | .TP 29 | \fB\-d\fR, \fB\-\-distance\fR 30 | prepend distance to frames 31 | .TP 32 | \fB\-c\fR, \fB\-\-cache\fR 33 | file to save location data 34 | .SH AVAILABILITY 35 | The latest version of this distribution is available on-line from: 36 | https://github.com/cmu-sei/welle-d 37 | .SH FILES 38 | .TP 39 | /bin/wmasterd 40 | Executable 41 | .TP 42 | /etc/init.d/wmasterd 43 | SysVinit Script 44 | .SH AUTHOR 45 | .TP 46 | Adam Welle 47 | .SH "REPORTING BUGS" 48 | Report bugs to 49 | .SH COPYRIGHT 50 | Copyright \(co 2015 Carnegie Mellon University 51 | .PP 52 | License GPLv2: GNU GPL version 2 53 | .br 54 | This is free software; you are free to change and redistribute it. 55 | There is NO WARRANTY, to the extent permitted by law. 56 | .SH "SEE ALSO" 57 | .PP 58 | \fBwelled\fR(8), 59 | \fBgelled\fR(8), 60 | \fBgelled-ctrl\fR(8) 61 | -------------------------------------------------------------------------------- /man/wmasterd.8.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cmu-sei/welled/fff448c5deeb52808b30c5390f6d8bb10f2a43b6/man/wmasterd.8.gz -------------------------------------------------------------------------------- /man/wmasterd.in: -------------------------------------------------------------------------------- 1 | [files] 2 | .TP 3 | /bin/wmasterd 4 | Executable 5 | .TP 6 | /etc/init.d/wmasterd 7 | SysVinit Script 8 | 9 | [description] 10 | This is a test 11 | 12 | [see also] 13 | .PP 14 | \fBwelled\fR(8), 15 | \fBgelled\fR(8), 16 | \fBgelled-ctrl\fR(8) 17 | 18 | [availability] 19 | The latest version of this distribution is available on-line from: 20 | https://github.com/cmu-sei/welle-d 21 | 22 | [author] 23 | .TP 24 | Adam Welle 25 | 26 | -------------------------------------------------------------------------------- /metadata/bulletins/wmasterd.xml: -------------------------------------------------------------------------------- 1 | 2 | wmasterd-VERSION 3 | Carnegie Mellon University 4 | wmasterd for ESX 5 | general 6 | enhancement 7 | Important 8 | extension 9 | wmasterd Utility 10 | http://github.com/cmu-sei/welled 11 | arwelle@cert.org 12 | 2019-01-23T00:00:00.000000+00:00 13 | 14 | 15 | 16 | 17 | 18 | CMU_bootbank_wmasterd_VERSION 19 | 20 | 21 | -------------------------------------------------------------------------------- /metadata/descriptor.tmp: -------------------------------------------------------------------------------- 1 | 2 | bootbank 3 | wmasterd 4 | VERSION 5 | CMU 6 | wmasterd: Wireless Master Daemon for mac80211_hwsim 7 | Uses vSockets to relay mac80211_hwsim frames between guests 8 | RELEASEDATE 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | module 21 | 22 | 23 | false 24 | 25 | 26 | usr/lib/vmware/wmasterd/bin/wmasterd 27 | etc/init.d/wmasterd 28 | etc/vmware/firewall/wmasterd.xml 29 | 30 | community 31 | true 32 | true 33 | false 34 | true 35 | false 36 | 37 | 38 | SHA256 39 | SHA1 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /metadata/vendor-index.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | embeddedEsx 4 | 5.* 5 | 6 | metadata.zip 7 | default 8 | 9 | 10 | embeddedEsx 11 | 6.* 12 | 13 | metadata.zip 14 | default 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /metadata/vibs/wmasterd-2.3.0-1551304196.xml: -------------------------------------------------------------------------------- 1 | 2 | bootbank 3 | wmasterd 4 | 2.3.0 5 | CMU 6 | wmasterd: Wireless Master Daemon for mac80211_hwsim 7 | Uses vSockets to relay mac80211_hwsim frames between guests 8 | 2019-02-27T21:49:56.000000+00:00 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | module 21 | 22 | vib20/wmasterd/CMU_bootbank_wmasterd_2.3.0.vib 23 | 39210 24 | f6d8361b81e2fe890d889fbf310e9c8d41256442c5e2bc65811349a0a4f80b80 25 | 26 | false 27 | 28 | 29 | usr/lib/vmware/wmasterd/bin/wmasterd 30 | etc/init.d/wmasterd 31 | etc/vmware/firewall/wmasterd.xml 32 | 33 | community 34 | true 35 | true 36 | false 37 | true 38 | false 39 | 40 | 41 | SHA256 42 | SHA1 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /metadata/vibs/wmasterd.xml: -------------------------------------------------------------------------------- 1 | 2 | bootbank 3 | wmasterd 4 | VERSION 5 | CMU 6 | wmasterd: Wireless Master Daemon for mac80211_hwsim 7 | Uses vSockets to relay mac80211_hwsim frames between guests 8 | RELEASEDATE 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | module 21 | 22 | vib20/wmasterd/CMU_bootbank_wmasterd_VERSION.vib 23 | VIBSIZE 24 | VIBSHA256 25 | 26 | false 27 | 28 | 29 | usr/lib/vmware/wmasterd/bin/wmasterd 30 | etc/init.d/wmasterd 31 | etc/vmware/firewall/wmasterd.xml 32 | 33 | community 34 | true 35 | true 36 | false 37 | true 38 | false 39 | 40 | 41 | SHA256 42 | SHA1 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /metadata/vmware.tmp: -------------------------------------------------------------------------------- 1 | 2 | 3.0 3 | 2019-01-23T00:00:00.000000 4 | 5 | wmasterd-VERSION 6 | Carnegie Mellon University 7 | wmasterd for ESX 8 | general 9 | enhancement 10 | Important 11 | extension 12 | wmasterd Utility 13 | http://github.com/cmu-sei/welled 14 | arwelle@cert.org 15 | 2019-01-23T00:00:00.000000+00:00 16 | 17 | 18 | 19 | 20 | 21 | 22 | 1.4.5 23 | CMU_bootbank_wmasterd_VERSION 24 | wmasterd 25 | VERSION 26 | CMU 27 | bootbank 28 | wmasterd: Wireless Master Daemon for mac80211_hwsim 29 | 30 | false 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | false 44 | false 45 | 46 | 47 | module 48 | 49 | 50 | 51 | vib20/wmasterd/CMU_bootbank_wmasterd_VERSION.vib 52 | VIBSIZE 53 | 54 | sha-256 55 | VIBSHA256 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /patches/3.10/0001-mac80211_hwsim-disables-hwsim0-device.patch: -------------------------------------------------------------------------------- 1 | From 1af10bbf3fe7d8a7bd4c979d70311d296a5b76fe Mon Sep 17 00:00:00 2001 2 | From: Adam Welle 3 | Date: Tue, 3 Nov 2015 15:42:39 -0500 4 | Subject: [PATCH 1/3] mac80211_hwsim: disables hwsim0 device 5 | 6 | --- 7 | drivers/net/wireless/mac80211_hwsim.c | 39 ++++++++++++++++++++++++----------- 8 | 1 file changed, 27 insertions(+), 12 deletions(-) 9 | 10 | diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c 11 | index cb34c78..0e9cc78 100644 12 | --- a/drivers/net/wireless/mac80211_hwsim.c 13 | +++ b/drivers/net/wireless/mac80211_hwsim.c 14 | @@ -57,6 +57,10 @@ static bool rctbl = false; 15 | module_param(rctbl, bool, 0444); 16 | MODULE_PARM_DESC(rctbl, "Handle rate control table"); 17 | 18 | +static bool use_hwsim_mon = true; 19 | +module_param(use_hwsim_mon, bool, 0444); 20 | +MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 21 | + 22 | /** 23 | * enum hwsim_regtest - the type of regulatory tests we offer 24 | * 25 | @@ -459,6 +463,9 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, 26 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_skb); 27 | struct ieee80211_rate *txrate = ieee80211_get_tx_rate(hw, info); 28 | 29 | + if (!use_hwsim_mon) 30 | + return; 31 | + 32 | if (!netif_running(hwsim_mon)) 33 | return; 34 | 35 | @@ -503,6 +510,9 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan, 36 | u16 flags; 37 | struct ieee80211_hdr *hdr11; 38 | 39 | + if (!use_hwsim_mon) 40 | + return; 41 | + 42 | if (!netif_running(hwsim_mon)) 43 | return; 44 | 45 | @@ -2524,22 +2534,24 @@ static int __init init_mac80211_hwsim(void) 46 | list_add_tail(&data->list, &hwsim_radios); 47 | } 48 | 49 | - hwsim_mon = alloc_netdev(0, "hwsim%d", hwsim_mon_setup); 50 | - if (hwsim_mon == NULL) 51 | - goto failed; 52 | + if (use_hwsim_mon) { 53 | + hwsim_mon = alloc_netdev(0, "hwsim%d", hwsim_mon_setup); 54 | + if (hwsim_mon == NULL) 55 | + goto failed; 56 | 57 | - rtnl_lock(); 58 | + rtnl_lock(); 59 | 60 | - err = dev_alloc_name(hwsim_mon, hwsim_mon->name); 61 | - if (err < 0) 62 | - goto failed_mon; 63 | + err = dev_alloc_name(hwsim_mon, hwsim_mon->name); 64 | + if (err < 0) 65 | + goto failed_mon; 66 | 67 | 68 | - err = register_netdevice(hwsim_mon); 69 | - if (err < 0) 70 | - goto failed_mon; 71 | + err = register_netdevice(hwsim_mon); 72 | + if (err < 0) 73 | + goto failed_mon; 74 | 75 | - rtnl_unlock(); 76 | + rtnl_unlock(); 77 | + } 78 | 79 | err = hwsim_init_netlink(); 80 | if (err < 0) 81 | @@ -2576,7 +2588,10 @@ static void __exit exit_mac80211_hwsim(void) 82 | hwsim_exit_netlink(); 83 | 84 | mac80211_hwsim_free(); 85 | - unregister_netdev(hwsim_mon); 86 | + 87 | + if (hwsim_mon) 88 | + unregister_netdev(hwsim_mon); 89 | + 90 | platform_driver_unregister(&mac80211_hwsim_driver); 91 | } 92 | module_exit(exit_mac80211_hwsim); 93 | -- 94 | 2.1.4 95 | 96 | -------------------------------------------------------------------------------- /patches/3.10/0002-mac80211_hwsim-adds-ATTR_FREQ-to-netlink-messages-an.patch: -------------------------------------------------------------------------------- 1 | From 2b12d3e52eef333fa79c48f0cbb30849eaec9dd9 Mon Sep 17 00:00:00 2001 2 | From: Adam Welle 3 | Date: Tue, 3 Nov 2015 15:50:29 -0500 4 | Subject: [PATCH 2/3] mac80211_hwsim: adds ATTR_FREQ to netlink messages and 5 | checks on receive 6 | 7 | This updates mac80211_hwsim.c and mac80211_hwsim.h to include the 8 | HWSIM_ATTR_FREQ value. 9 | --- 10 | drivers/net/wireless/mac80211_hwsim.c | 14 ++++++++++++++ 11 | drivers/net/wireless/mac80211_hwsim.h | 1 + 12 | 2 files changed, 15 insertions(+) 13 | 14 | diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c 15 | index 0e9cc78..362e38e 100644 16 | --- a/drivers/net/wireless/mac80211_hwsim.c 17 | +++ b/drivers/net/wireless/mac80211_hwsim.c 18 | @@ -411,6 +411,7 @@ static struct nla_policy hwsim_genl_policy[HWSIM_ATTR_MAX + 1] = { 19 | .len = IEEE80211_TX_MAX_RATES*sizeof( 20 | struct hwsim_tx_rate)}, 21 | [HWSIM_ATTR_COOKIE] = { .type = NLA_U64 }, 22 | + [HWSIM_ATTR_FREQ] = { .type = NLA_U32 }, 23 | }; 24 | 25 | static netdev_tx_t hwsim_mon_xmit(struct sk_buff *skb, 26 | @@ -661,6 +662,9 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw, 27 | if (nla_put_u32(skb, HWSIM_ATTR_FLAGS, hwsim_flags)) 28 | goto nla_put_failure; 29 | 30 | + if (nla_put_u32(skb, HWSIM_ATTR_FREQ, data->channel->center_freq)) 31 | + goto nla_put_failure; 32 | + 33 | /* We get the tx control (rate and retries) info*/ 34 | 35 | for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { 36 | @@ -2050,6 +2054,16 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2, 37 | 38 | /*A frame is received from user space*/ 39 | memset(&rx_status, 0, sizeof(rx_status)); 40 | + 41 | + /* Check ATTR_FREQ if it exists, and throw away off-channel packets */ 42 | + if (info->attrs[HWSIM_ATTR_FREQ]) { 43 | + rx_status.freq = nla_get_u32(info->attrs[HWSIM_ATTR_FREQ]); 44 | + if (rx_status.freq != data2->channel->center_freq) 45 | + goto out; 46 | + } else { 47 | + rx_status.freq = data2->channel->center_freq; 48 | + } 49 | + 50 | rx_status.freq = data2->channel->center_freq; 51 | rx_status.band = data2->channel->band; 52 | rx_status.rate_idx = nla_get_u32(info->attrs[HWSIM_ATTR_RX_RATE]); 53 | diff --git a/drivers/net/wireless/mac80211_hwsim.h b/drivers/net/wireless/mac80211_hwsim.h 54 | index afaad5a..95ac959 100644 55 | --- a/drivers/net/wireless/mac80211_hwsim.h 56 | +++ b/drivers/net/wireless/mac80211_hwsim.h 57 | @@ -108,6 +108,7 @@ enum { 58 | HWSIM_ATTR_SIGNAL, 59 | HWSIM_ATTR_TX_INFO, 60 | HWSIM_ATTR_COOKIE, 61 | + HWSIM_ATTR_FREQ, 62 | __HWSIM_ATTR_MAX, 63 | }; 64 | #define HWSIM_ATTR_MAX (__HWSIM_ATTR_MAX - 1) 65 | -- 66 | 2.1.4 67 | 68 | -------------------------------------------------------------------------------- /patches/3.10/0003-mac80211_hwsim-updated-to-allow-any-MAC-address.patch: -------------------------------------------------------------------------------- 1 | From 49ecf9eb9f645e4fc3f306b1d30aa3ba7c023cee Mon Sep 17 00:00:00 2001 2 | From: Adam Welle 3 | Date: Tue, 3 Nov 2015 16:03:44 -0500 4 | Subject: [PATCH 3/3] mac80211_hwsim: updated to allow any MAC address 5 | 6 | get_hwsim_data_ref_from_add() updated to use mac80211_hwsim_addr_match() 7 | mac80211_hwsim_addr_match() updated 8 | --- 9 | drivers/net/wireless/mac80211_hwsim.c | 16 ++++++++-------- 10 | 1 file changed, 8 insertions(+), 8 deletions(-) 11 | 12 | diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c 13 | index 362e38e..268f0c4 100644 14 | --- a/drivers/net/wireless/mac80211_hwsim.c 15 | +++ b/drivers/net/wireless/mac80211_hwsim.c 16 | @@ -594,13 +594,15 @@ static void mac80211_hwsim_addr_iter(void *data, u8 *mac, 17 | static bool mac80211_hwsim_addr_match(struct mac80211_hwsim_data *data, 18 | const u8 *addr) 19 | { 20 | - struct mac80211_hwsim_addr_match_data md; 21 | + struct mac80211_hwsim_addr_match_data md = { 22 | + .ret = false, 23 | + }; 24 | 25 | - if (memcmp(addr, data->hw->wiphy->perm_addr, ETH_ALEN) == 0) 26 | + if (data->scanning && memcmp(addr, data->scan_addr, ETH_ALEN) == 0) 27 | return true; 28 | 29 | - md.ret = false; 30 | - md.addr = addr; 31 | + memcpy(md.addr, addr, ETH_ALEN); 32 | + 33 | ieee80211_iterate_active_interfaces_atomic(data->hw, 34 | IEEE80211_IFACE_ITER_NORMAL, 35 | mac80211_hwsim_addr_iter, 36 | @@ -642,8 +644,7 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw, 37 | goto nla_put_failure; 38 | } 39 | 40 | - if (nla_put(skb, HWSIM_ATTR_ADDR_TRANSMITTER, 41 | - sizeof(struct mac_address), data->addresses[1].addr)) 42 | + if (nla_put(skb, HWSIM_ATTR_ADDR_TRANSMITTER, ETH_ALEN, hdr->addr2)) 43 | goto nla_put_failure; 44 | 45 | /* We get the skb->data */ 46 | @@ -1912,8 +1913,7 @@ static struct mac80211_hwsim_data *get_hwsim_data_ref_from_addr( 47 | 48 | spin_lock_bh(&hwsim_radio_lock); 49 | list_for_each_entry(data, &hwsim_radios, list) { 50 | - if (memcmp(data->addresses[1].addr, addr, 51 | - sizeof(struct mac_address)) == 0) { 52 | + if (mac80211_hwsim_addr_match(data, addr)) { 53 | _found = true; 54 | break; 55 | } 56 | -- 57 | 2.1.4 58 | 59 | -------------------------------------------------------------------------------- /patches/3.18/0001-mac80211_hwsim-disables-hwsim0-device.patch: -------------------------------------------------------------------------------- 1 | From 2a7fad719eaab9bd96256b6d17af040aa73496e9 Mon Sep 17 00:00:00 2001 2 | From: Adam Welle 3 | Date: Tue, 3 Nov 2015 15:42:36 -0500 4 | Subject: [PATCH 1/3] mac80211_hwsim: disables hwsim0 device 5 | 6 | --- 7 | drivers/net/wireless/mac80211_hwsim.c | 49 +++++++++++++++++++++++------------ 8 | 1 file changed, 32 insertions(+), 17 deletions(-) 9 | 10 | diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c 11 | index c9ad4cf..15ba0a2 100644 12 | --- a/drivers/net/wireless/mac80211_hwsim.c 13 | +++ b/drivers/net/wireless/mac80211_hwsim.c 14 | @@ -61,6 +61,10 @@ static bool support_p2p_device = true; 15 | module_param(support_p2p_device, bool, 0444); 16 | MODULE_PARM_DESC(support_p2p_device, "Support P2P-Device interface type"); 17 | 18 | +static bool use_hwsim_mon = true; 19 | +module_param(use_hwsim_mon, bool, 0444); 20 | +MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 21 | + 22 | /** 23 | * enum hwsim_regtest - the type of regulatory tests we offer 24 | * 25 | @@ -708,6 +712,9 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, 26 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_skb); 27 | struct ieee80211_rate *txrate = ieee80211_get_tx_rate(hw, info); 28 | 29 | + if (!use_hwsim_mon) 30 | + return; 31 | + 32 | if (!netif_running(hwsim_mon)) 33 | return; 34 | 35 | @@ -752,6 +759,9 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan, 36 | u16 flags; 37 | struct ieee80211_hdr *hdr11; 38 | 39 | + if (!use_hwsim_mon) 40 | + return; 41 | + 42 | if (!netif_running(hwsim_mon)) 43 | return; 44 | 45 | @@ -2683,26 +2693,28 @@ static int __init init_mac80211_hwsim(void) 46 | goto out_free_radios; 47 | } 48 | 49 | - hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN, 50 | - hwsim_mon_setup); 51 | - if (hwsim_mon == NULL) { 52 | - err = -ENOMEM; 53 | - goto out_free_radios; 54 | - } 55 | + if (use_hwsim_mon) { 56 | + hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN, 57 | + hwsim_mon_setup); 58 | + if (hwsim_mon == NULL) { 59 | + err = -ENOMEM; 60 | + goto out_free_radios; 61 | + } 62 | 63 | - rtnl_lock(); 64 | - err = dev_alloc_name(hwsim_mon, hwsim_mon->name); 65 | - if (err < 0) { 66 | - rtnl_unlock(); 67 | - goto out_free_radios; 68 | - } 69 | + rtnl_lock(); 70 | + err = dev_alloc_name(hwsim_mon, hwsim_mon->name); 71 | + if (err < 0) { 72 | + rtnl_unlock(); 73 | + goto out_free_radios; 74 | + } 75 | 76 | - err = register_netdevice(hwsim_mon); 77 | - if (err < 0) { 78 | + err = register_netdevice(hwsim_mon); 79 | + if (err < 0) { 80 | + rtnl_unlock(); 81 | + goto out_free_mon; 82 | + } 83 | rtnl_unlock(); 84 | - goto out_free_mon; 85 | } 86 | - rtnl_unlock(); 87 | 88 | err = hwsim_init_netlink(); 89 | if (err < 0) 90 | @@ -2727,7 +2739,10 @@ static void __exit exit_mac80211_hwsim(void) 91 | hwsim_exit_netlink(); 92 | 93 | mac80211_hwsim_free(); 94 | - unregister_netdev(hwsim_mon); 95 | + 96 | + if (hwsim_mon) 97 | + unregister_netdev(hwsim_mon); 98 | + 99 | platform_driver_unregister(&mac80211_hwsim_driver); 100 | } 101 | module_exit(exit_mac80211_hwsim); 102 | -- 103 | 2.1.4 104 | 105 | -------------------------------------------------------------------------------- /patches/3.18/0002-mac80211_hwsim-adds-ATTR_FREQ-to-netlink-messages-a.patch: -------------------------------------------------------------------------------- 1 | From 6407133c18c34c97c53f0013ebeade9754b8917f Mon Sep 17 00:00:00 2001 2 | From: Adam Welle 3 | Date: Tue, 3 Nov 2015 15:50:19 -0500 4 | Subject: [PATCH 2/3] mac80211_hwsim: adds ATTR_FREQ to netlink messages and 5 | checks on receive 6 | 7 | This updates mac80211_hwsim.c and mac80211_hwsim.h to include the 8 | HWSIM_ATTR_FREQ value. 9 | --- 10 | drivers/net/wireless/mac80211_hwsim.c | 14 ++++++++++++++ 11 | drivers/net/wireless/mac80211_hwsim.h | 1 + 12 | 2 files changed, 15 insertions(+) 13 | 14 | diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c 15 | index 15ba0a2..7ca40da 100644 16 | --- a/drivers/net/wireless/mac80211_hwsim.c 17 | +++ b/drivers/net/wireless/mac80211_hwsim.c 18 | @@ -500,6 +500,7 @@ static const struct nla_policy hwsim_genl_policy[HWSIM_ATTR_MAX + 1] = { 19 | [HWSIM_ATTR_REG_CUSTOM_REG] = { .type = NLA_U32 }, 20 | [HWSIM_ATTR_REG_STRICT_REG] = { .type = NLA_FLAG }, 21 | [HWSIM_ATTR_SUPPORT_P2P_DEVICE] = { .type = NLA_FLAG }, 22 | + [HWSIM_ATTR_FREQ] = { .type = NLA_U32 }, 23 | }; 24 | 25 | static void mac80211_hwsim_tx_frame(struct ieee80211_hw *hw, 26 | @@ -906,6 +907,9 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw, 27 | if (nla_put_u32(skb, HWSIM_ATTR_FLAGS, hwsim_flags)) 28 | goto nla_put_failure; 29 | 30 | + if (nla_put_u32(skb, HWSIM_ATTR_FREQ, data->channel->center_freq)) 31 | + goto nla_put_failure; 32 | + 33 | /* We get the tx control (rate and retries) info*/ 34 | 35 | for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { 36 | @@ -2392,6 +2396,16 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2, 37 | 38 | /* A frame is received from user space */ 39 | memset(&rx_status, 0, sizeof(rx_status)); 40 | + 41 | + /* Check ATTR_FREQ if it exists, and throw away off-channel packets */ 42 | + if (info->attrs[HWSIM_ATTR_FREQ]) { 43 | + rx_status.freq = nla_get_u32(info->attrs[HWSIM_ATTR_FREQ]); 44 | + if (rx_status.freq != data2->channel->center_freq) 45 | + goto out; 46 | + } else { 47 | + rx_status.freq = data2->channel->center_freq; 48 | + } 49 | + 50 | rx_status.freq = data2->channel->center_freq; 51 | rx_status.band = data2->channel->band; 52 | rx_status.rate_idx = nla_get_u32(info->attrs[HWSIM_ATTR_RX_RATE]); 53 | diff --git a/drivers/net/wireless/mac80211_hwsim.h b/drivers/net/wireless/mac80211_hwsim.h 54 | index c9d0315..251a95c 100644 55 | --- a/drivers/net/wireless/mac80211_hwsim.h 56 | +++ b/drivers/net/wireless/mac80211_hwsim.h 57 | @@ -132,6 +132,7 @@ enum { 58 | HWSIM_ATTR_REG_STRICT_REG, 59 | HWSIM_ATTR_SUPPORT_P2P_DEVICE, 60 | HWSIM_ATTR_USE_CHANCTX, 61 | + HWSIM_ATTR_FREQ, 62 | __HWSIM_ATTR_MAX, 63 | }; 64 | #define HWSIM_ATTR_MAX (__HWSIM_ATTR_MAX - 1) 65 | -- 66 | 2.1.4 67 | 68 | -------------------------------------------------------------------------------- /patches/3.18/0003-mac80211_hwsim-updated-to-allow-any-MAC-address.patch: -------------------------------------------------------------------------------- 1 | From b0f73fc9e7edafae49ba41e4816343c8a0e43bf9 Mon Sep 17 00:00:00 2001 2 | From: Adam Welle 3 | Date: Tue, 3 Nov 2015 16:04:02 -0500 4 | Subject: [PATCH 3/3] mac80211_hwsim: updated to allow any MAC address 5 | 6 | get_hwsim_data_ref_from_add() updated to use mac80211_hwsim_addr_match() 7 | mac80211_hwsim_addr_match() updated 8 | --- 9 | drivers/net/wireless/mac80211_hwsim.c | 8 +++++--- 10 | 1 file changed, 5 insertions(+), 3 deletions(-) 11 | 12 | diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c 13 | index 7ca40da..ea2e52d 100644 14 | --- a/drivers/net/wireless/mac80211_hwsim.c 15 | +++ b/drivers/net/wireless/mac80211_hwsim.c 16 | @@ -818,6 +818,9 @@ static bool mac80211_hwsim_addr_match(struct mac80211_hwsim_data *data, 17 | .ret = false, 18 | }; 19 | 20 | + if (data->scanning && memcmp(addr, data->scan_addr, ETH_ALEN) == 0) 21 | + return true; 22 | + 23 | memcpy(md.addr, addr, ETH_ALEN); 24 | 25 | ieee80211_iterate_active_interfaces_atomic(data->hw, 26 | @@ -887,8 +890,7 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw, 27 | goto nla_put_failure; 28 | } 29 | 30 | - if (nla_put(skb, HWSIM_ATTR_ADDR_TRANSMITTER, 31 | - ETH_ALEN, data->addresses[1].addr)) 32 | + if (nla_put(skb, HWSIM_ATTR_ADDR_TRANSMITTER, ETH_ALEN, hdr->addr2)) 33 | goto nla_put_failure; 34 | 35 | /* We get the skb->data */ 36 | @@ -2257,7 +2259,7 @@ static struct mac80211_hwsim_data *get_hwsim_data_ref_from_addr(const u8 *addr) 37 | 38 | spin_lock_bh(&hwsim_radio_lock); 39 | list_for_each_entry(data, &hwsim_radios, list) { 40 | - if (memcmp(data->addresses[1].addr, addr, ETH_ALEN) == 0) { 41 | + if (mac80211_hwsim_addr_match(data, addr)) { 42 | _found = true; 43 | break; 44 | } 45 | -- 46 | 2.1.4 47 | 48 | -------------------------------------------------------------------------------- /patches/4.0.0-kali1-amd64/0001-mac80211_hwsim-check-ATTR_FREQ-for-netlink-packets.patch: -------------------------------------------------------------------------------- 1 | --- a/drivers/net/wireless/mac80211_hwsim.c 2 | +++ b/drivers/net/wireless/mac80211_hwsim.c 3 | @@ -2749,10 +2749,16 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2, 4 | 5 | /* A frame is received from user space */ 6 | memset(&rx_status, 0, sizeof(rx_status)); 7 | - /* TODO: Check ATTR_FREQ if it exists, and maybe throw away off-channel 8 | - * packets? 9 | - */ 10 | - rx_status.freq = data2->channel->center_freq; 11 | + 12 | + /* Check ATTR_FREQ if it exists, and throw away off-channel packets */ 13 | + if (info->attrs[HWSIM_ATTR_FREQ]) { 14 | + rx_status.freq = nla_get_u32(info->attrs[HWSIM_ATTR_FREQ]); 15 | + if (rx_status.freq != data2->channel->center_freq) 16 | + goto out; 17 | + } else { 18 | + rx_status.freq = data2->channel->center_freq; 19 | + } 20 | + 21 | rx_status.band = data2->channel->band; 22 | rx_status.rate_idx = nla_get_u32(info->attrs[HWSIM_ATTR_RX_RATE]); 23 | rx_status.signal = nla_get_u32(info->attrs[HWSIM_ATTR_SIGNAL]); 24 | -------------------------------------------------------------------------------- /patches/4.0.0-kali1-amd64/0002-mac80211_hwsim-disables-hwsim0-device.patch: -------------------------------------------------------------------------------- 1 | --- a/drivers/net/wireless/mac80211_hwsim.c 2 | +++ b/drivers/net/wireless/mac80211_hwsim.c 3 | @@ -61,6 +61,10 @@ static bool support_p2p_device = true; 4 | module_param(support_p2p_device, bool, 0444); 5 | MODULE_PARM_DESC(support_p2p_device, "Support P2P-Device interface type"); 6 | 7 | +static bool use_hwsim_mon = true; 8 | +module_param(use_hwsim_mon, bool, 0444); 9 | +MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 10 | + 11 | /** 12 | * enum hwsim_regtest - the type of regulatory tests we offer 13 | * 14 | @@ -733,6 +737,9 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, 15 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_skb); 16 | struct ieee80211_rate *txrate = ieee80211_get_tx_rate(hw, info); 17 | 18 | + if (!use_hwsim_mon) 19 | + return; 20 | + 21 | if (!netif_running(hwsim_mon)) 22 | return; 23 | 24 | @@ -777,6 +784,9 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan, 25 | u16 flags; 26 | struct ieee80211_hdr *hdr11; 27 | 28 | + if (!use_hwsim_mon) 29 | + return; 30 | + 31 | if (!netif_running(hwsim_mon)) 32 | return; 33 | 34 | @@ -3186,26 +3196,28 @@ static int __init init_mac80211_hwsim(void) 35 | goto out_free_radios; 36 | } 37 | 38 | - hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN, 39 | + if (use_hwsim_mon) { 40 | + hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN, 41 | hwsim_mon_setup); 42 | - if (hwsim_mon == NULL) { 43 | - err = -ENOMEM; 44 | - goto out_free_radios; 45 | - } 46 | + if (hwsim_mon == NULL) { 47 | + err = -ENOMEM; 48 | + goto out_free_radios; 49 | + } 50 | 51 | - rtnl_lock(); 52 | - err = dev_alloc_name(hwsim_mon, hwsim_mon->name); 53 | - if (err < 0) { 54 | - rtnl_unlock(); 55 | - goto out_free_radios; 56 | - } 57 | + rtnl_lock(); 58 | + err = dev_alloc_name(hwsim_mon, hwsim_mon->name); 59 | + if (err < 0) { 60 | + rtnl_unlock(); 61 | + goto out_free_radios; 62 | + } 63 | 64 | - err = register_netdevice(hwsim_mon); 65 | - if (err < 0) { 66 | + err = register_netdevice(hwsim_mon); 67 | + if (err < 0) { 68 | + rtnl_unlock(); 69 | + goto out_free_mon; 70 | + } 71 | rtnl_unlock(); 72 | - goto out_free_mon; 73 | } 74 | - rtnl_unlock(); 75 | 76 | return 0; 77 | 78 | @@ -3226,7 +3238,10 @@ static void __exit exit_mac80211_hwsim(void) 79 | hwsim_exit_netlink(); 80 | 81 | mac80211_hwsim_free(); 82 | - unregister_netdev(hwsim_mon); 83 | + 84 | + if (hwsim_mon) 85 | + unregister_netdev(hwsim_mon); 86 | + 87 | platform_driver_unregister(&mac80211_hwsim_driver); 88 | } 89 | module_exit(exit_mac80211_hwsim); 90 | -------------------------------------------------------------------------------- /patches/4.0.0-kali1-amd64/0003-mac80211_hwsim-allows-use-of-any-MAC-address-with-ne.patch: -------------------------------------------------------------------------------- 1 | --- a/drivers/net/wireless/mac80211_hwsim.c 2 | +++ b/drivers/net/wireless/mac80211_hwsim.c 3 | @@ -916,8 +916,7 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw, 4 | goto nla_put_failure; 5 | } 6 | 7 | - if (nla_put(skb, HWSIM_ATTR_ADDR_TRANSMITTER, 8 | - ETH_ALEN, data->addresses[1].addr)) 9 | + if (nla_put(skb, HWSIM_ATTR_ADDR_TRANSMITTER, ETH_ALEN, hdr->addr2)) 10 | goto nla_put_failure; 11 | 12 | /* We get the skb->data */ 13 | @@ -2621,7 +2620,7 @@ static struct mac80211_hwsim_data *get_hwsim_data_ref_from_addr(const u8 *addr) 14 | 15 | spin_lock_bh(&hwsim_radio_lock); 16 | list_for_each_entry(data, &hwsim_radios, list) { 17 | - if (memcmp(data->addresses[1].addr, addr, ETH_ALEN) == 0) { 18 | + if (mac80211_hwsim_addr_match(data, addr)) { 19 | _found = true; 20 | break; 21 | } 22 | -------------------------------------------------------------------------------- /patches/4.0.0-kali1-amd64/0004-mac80211_hwsim-adds-param-string-perm_addr.patch: -------------------------------------------------------------------------------- 1 | --- a/drivers/net/wireless/mac80211_hwsim.c 2 | +++ b/drivers/net/wireless/mac80211_hwsim.c 3 | @@ -65,6 +65,10 @@ static bool use_hwsim_mon = true; 4 | module_param(use_hwsim_mon, bool, 0444); 5 | MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 6 | 7 | +static char perm_addr[18]; 8 | +module_param_string(perm_addr, perm_addr, 18, 0444); 9 | +MODULE_PARM_DESC(perm_addr, "Permanent hardware address for first radio"); 10 | + 11 | /** 12 | * enum hwsim_regtest - the type of regulatory tests we offer 13 | * 14 | @@ -120,7 +124,7 @@ MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 15 | * 5 - strict regulatory domain settings using the third driver regulatory 16 | * domain request 17 | * 6 and on - should follow the intersection of the 3rd, 4rth and 5th radio 18 | - * regulatory requests. 19 | + * regulatory requests. 20 | */ 21 | enum hwsim_regtest { 22 | HWSIM_REGTEST_DISABLED = 0, 23 | @@ -2237,6 +2241,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, 24 | enum ieee80211_band band; 25 | const struct ieee80211_ops *ops = &mac80211_hwsim_ops; 26 | int idx; 27 | + int perm_addr_len; 28 | + int match; 29 | 30 | if (WARN_ON(param->channels > 1 && !param->use_chanctx)) 31 | return -EINVAL; 32 | @@ -2275,13 +2281,34 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, 33 | skb_queue_head_init(&data->pending); 34 | 35 | SET_IEEE80211_DEV(hw, data->dev); 36 | - memset(addr, 0, ETH_ALEN); 37 | - addr[0] = 0x02; 38 | - addr[3] = idx >> 8; 39 | - addr[4] = idx; 40 | - memcpy(data->addresses[0].addr, addr, ETH_ALEN); 41 | - memcpy(data->addresses[1].addr, addr, ETH_ALEN); 42 | - data->addresses[1].addr[0] |= 0x40; 43 | + 44 | + /* convert perm_addr string to mac address */ 45 | + perm_addr_len = strlen(perm_addr); 46 | + 47 | + if (perm_addr_len == 17) { 48 | + printk(KERN_DEBUG "mac80211_hwsim: perm_addr %s\n", perm_addr); 49 | + memset(addr, 0, ETH_ALEN); 50 | + match = sscanf(perm_addr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", 51 | + &addr[0], &addr[1], &addr[2], 52 | + &addr[3], &addr[4], &addr[5]); 53 | + if (match != 6) { 54 | + printk(KERN_DEBUG "mac80211_hwsim: perm_addr failed\n"); 55 | + goto default_address; 56 | + } 57 | + addr[5] += idx; 58 | + memcpy(data->addresses[0].addr, addr, ETH_ALEN); 59 | + memcpy(data->addresses[1].addr, addr, ETH_ALEN); 60 | + } else { 61 | +default_address: 62 | + printk(KERN_DEBUG "mac80211_hwsim: using default addresses\n"); 63 | + memset(addr, 0, ETH_ALEN); 64 | + addr[0] = 0x02; 65 | + addr[3] = idx >> 8; 66 | + addr[4] = idx; 67 | + memcpy(data->addresses[0].addr, addr, ETH_ALEN); 68 | + memcpy(data->addresses[1].addr, addr, ETH_ALEN); 69 | + data->addresses[1].addr[0] |= 0x40; 70 | + } 71 | hw->wiphy->n_addresses = 2; 72 | hw->wiphy->addresses = data->addresses; 73 | 74 | -- 75 | 2.1.4 76 | 77 | -------------------------------------------------------------------------------- /patches/4.18.0-kali2-amd64/0001-disables-hwsim0-device.patch: -------------------------------------------------------------------------------- 1 | From fc4399a59f0434694963d9a1f84a1b4849f42820 Mon Sep 17 00:00:00 2001 2 | From: root 3 | Date: Thu, 25 Oct 2018 15:40:56 -0400 4 | Subject: [PATCH 1/2] 0001-disables-hwsim0-device.patch 5 | 6 | --- 7 | drivers/net/wireless/mac80211_hwsim.c | 15 ++++++++++++++- 8 | 1 file changed, 14 insertions(+), 1 deletion(-) 9 | 10 | diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c 11 | index 18e819d9..c7c81ca7 100644 12 | --- a/drivers/net/wireless/mac80211_hwsim.c 13 | +++ b/drivers/net/wireless/mac80211_hwsim.c 14 | @@ -62,6 +62,10 @@ static bool support_p2p_device = true; 15 | module_param(support_p2p_device, bool, 0444); 16 | MODULE_PARM_DESC(support_p2p_device, "Support P2P-Device interface type"); 17 | 18 | +static bool use_hwsim_mon = true; 19 | +module_param(use_hwsim_mon, bool, 0444); 20 | +MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 21 | + 22 | /** 23 | * enum hwsim_regtest - the type of regulatory tests we offer 24 | * 25 | @@ -859,6 +863,8 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, 26 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_skb); 27 | struct ieee80211_rate *txrate = ieee80211_get_tx_rate(hw, info); 28 | 29 | + if(!use_hwsim_mon) 30 | + return; 31 | if (WARN_ON(!txrate)) 32 | return; 33 | 34 | @@ -906,6 +912,8 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan, 35 | u16 flags; 36 | struct ieee80211_hdr *hdr11; 37 | 38 | + if(!use_hwsim_mon) 39 | + return; 40 | if (!netif_running(hwsim_mon)) 41 | return; 42 | 43 | @@ -3673,6 +3681,9 @@ static int __init init_mac80211_hwsim(void) 44 | goto out_free_radios; 45 | } 46 | 47 | + if(!use_hwsim_mon) 48 | + return 0; 49 | + 50 | hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN, 51 | hwsim_mon_setup); 52 | if (hwsim_mon == NULL) { 53 | @@ -3722,7 +3733,9 @@ static void __exit exit_mac80211_hwsim(void) 54 | flush_workqueue(hwsim_wq); 55 | 56 | rhashtable_destroy(&hwsim_radios_rht); 57 | - unregister_netdev(hwsim_mon); 58 | + 59 | + if(hwsim_mon) 60 | + unregister_netdev(hwsim_mon); 61 | platform_driver_unregister(&mac80211_hwsim_driver); 62 | unregister_pernet_device(&hwsim_net_ops); 63 | destroy_workqueue(hwsim_wq); 64 | -- 65 | 2.19.1 66 | 67 | -------------------------------------------------------------------------------- /patches/4.18.0-kali2-amd64/0002-adds-param-string-perm.patch: -------------------------------------------------------------------------------- 1 | From 04e6774eca106c4f9035b92c95adcb24a6756e35 Mon Sep 17 00:00:00 2001 2 | From: root 3 | Date: Thu, 25 Oct 2018 16:36:14 -0400 4 | Subject: [PATCH 2/2] adds param string perm 5 | 6 | --- 7 | drivers/net/wireless/mac80211_hwsim.c | 39 +++++++++++++++++++++------ 8 | 1 file changed, 31 insertions(+), 8 deletions(-) 9 | 10 | diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c 11 | index c7c81ca7..4672f937 100644 12 | --- a/drivers/net/wireless/mac80211_hwsim.c 13 | +++ b/drivers/net/wireless/mac80211_hwsim.c 14 | @@ -66,6 +66,10 @@ static bool use_hwsim_mon = true; 15 | module_param(use_hwsim_mon, bool, 0444); 16 | MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 17 | 18 | +static char perm_addr[18]; 19 | +module_param_string(perm_addr, perm_addr, 18, 0444); 20 | +MODULE_PARM_DESC(perm_addr, "Permanent hardware address for first radio"); 21 | + 22 | /** 23 | * enum hwsim_regtest - the type of regulatory tests we offer 24 | * 25 | @@ -2536,6 +2540,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, 26 | const struct ieee80211_ops *ops = &mac80211_hwsim_ops; 27 | struct net *net; 28 | int idx; 29 | + int perm_addr_len; 30 | + int match; 31 | 32 | if (WARN_ON(param->channels > 1 && !param->use_chanctx)) 33 | return -EINVAL; 34 | @@ -2585,14 +2591,31 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, 35 | 36 | SET_IEEE80211_DEV(hw, data->dev); 37 | if (!param->perm_addr) { 38 | - eth_zero_addr(addr); 39 | - addr[0] = 0x02; 40 | - addr[3] = idx >> 8; 41 | - addr[4] = idx; 42 | - memcpy(data->addresses[0].addr, addr, ETH_ALEN); 43 | - /* Why need here second address ? */ 44 | - memcpy(data->addresses[1].addr, addr, ETH_ALEN); 45 | - data->addresses[1].addr[0] |= 0x40; 46 | + 47 | + perm_addr_len = strlen(perm_addr); 48 | + if(perm_addr_len == 17){ 49 | + printk(KERN_DEBUG "mac80211_hwsim: perm_addr %s\n", perm_addr); 50 | + memset(addr, 0, ETH_ALEN); 51 | + match = sscanf(perm_addr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &addr[0], &addr[1], &addr[2], &addr[3], &addr[4], &addr[5]); 52 | + if(match != 6){ 53 | + printk(KERN_DEBUG "mac80211_hwsim: perm_addr failed\n"); 54 | + goto default_address; 55 | + } 56 | + addr[5] += idx; 57 | + memcpy(data->addresses[0].addr, addr, ETH_ALEN); 58 | + memcpy(data->addresses[1].addr, addr, ETH_ALEN); 59 | + }else { 60 | +default_address: 61 | + printk(KERN_DEBUG "mac80211_hwsim: using default addresses\n"); 62 | + memset(addr, 0, ETH_ALEN); 63 | + addr[0] = 0x02; 64 | + addr[3] = idx >> 8; 65 | + addr[4] = idx; 66 | + memcpy(data->addresses[0].addr, addr, ETH_ALEN); 67 | + memcpy(data->addresses[1].addr, addr, ETH_ALEN); 68 | + data->addresses[1].addr[0] |= 0x40; 69 | + } 70 | + 71 | hw->wiphy->n_addresses = 2; 72 | hw->wiphy->addresses = data->addresses; 73 | /* possible address clash is checked at hash table insertion */ 74 | -- 75 | 2.19.1 76 | 77 | -------------------------------------------------------------------------------- /patches/4.18.16-200.fc28.x86_64/0001-disables-hwsim0-device.patch: -------------------------------------------------------------------------------- 1 | From fc4399a59f0434694963d9a1f84a1b4849f42820 Mon Sep 17 00:00:00 2001 2 | From: root 3 | Date: Thu, 25 Oct 2018 15:40:56 -0400 4 | Subject: [PATCH 1/2] 0001-disables-hwsim0-device.patch 5 | 6 | --- 7 | drivers/net/wireless/mac80211_hwsim.c | 15 ++++++++++++++- 8 | 1 file changed, 14 insertions(+), 1 deletion(-) 9 | 10 | diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c 11 | index 18e819d9..c7c81ca7 100644 12 | --- a/drivers/net/wireless/mac80211_hwsim.c 13 | +++ b/drivers/net/wireless/mac80211_hwsim.c 14 | @@ -62,6 +62,10 @@ static bool support_p2p_device = true; 15 | module_param(support_p2p_device, bool, 0444); 16 | MODULE_PARM_DESC(support_p2p_device, "Support P2P-Device interface type"); 17 | 18 | +static bool use_hwsim_mon = true; 19 | +module_param(use_hwsim_mon, bool, 0444); 20 | +MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 21 | + 22 | /** 23 | * enum hwsim_regtest - the type of regulatory tests we offer 24 | * 25 | @@ -859,6 +863,8 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, 26 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_skb); 27 | struct ieee80211_rate *txrate = ieee80211_get_tx_rate(hw, info); 28 | 29 | + if(!use_hwsim_mon) 30 | + return; 31 | if (WARN_ON(!txrate)) 32 | return; 33 | 34 | @@ -906,6 +912,8 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan, 35 | u16 flags; 36 | struct ieee80211_hdr *hdr11; 37 | 38 | + if(!use_hwsim_mon) 39 | + return; 40 | if (!netif_running(hwsim_mon)) 41 | return; 42 | 43 | @@ -3673,6 +3681,9 @@ static int __init init_mac80211_hwsim(void) 44 | goto out_free_radios; 45 | } 46 | 47 | + if(!use_hwsim_mon) 48 | + return 0; 49 | + 50 | hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN, 51 | hwsim_mon_setup); 52 | if (hwsim_mon == NULL) { 53 | @@ -3722,7 +3733,9 @@ static void __exit exit_mac80211_hwsim(void) 54 | flush_workqueue(hwsim_wq); 55 | 56 | rhashtable_destroy(&hwsim_radios_rht); 57 | - unregister_netdev(hwsim_mon); 58 | + 59 | + if(hwsim_mon) 60 | + unregister_netdev(hwsim_mon); 61 | platform_driver_unregister(&mac80211_hwsim_driver); 62 | unregister_pernet_device(&hwsim_net_ops); 63 | destroy_workqueue(hwsim_wq); 64 | -- 65 | 2.19.1 66 | 67 | -------------------------------------------------------------------------------- /patches/4.18.16-200.fc28.x86_64/0002-adds-param-string-perm.patch: -------------------------------------------------------------------------------- 1 | From fc4399a59f0434694963d9a1f84a1b4849f42820 Mon Sep 17 00:00:00 2001 2 | From: root 3 | Date: Thu, 25 Oct 2018 15:40:56 -0400 4 | Subject: [PATCH 1/2] 0001-disables-hwsim0-device.patch 5 | 6 | --- 7 | drivers/net/wireless/mac80211_hwsim.c | 15 ++++++++++++++- 8 | 1 file changed, 14 insertions(+), 1 deletion(-) 9 | 10 | diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c 11 | index 18e819d9..c7c81ca7 100644 12 | --- a/drivers/net/wireless/mac80211_hwsim.c 13 | +++ b/drivers/net/wireless/mac80211_hwsim.c 14 | @@ -62,6 +62,10 @@ static bool support_p2p_device = true; 15 | module_param(support_p2p_device, bool, 0444); 16 | MODULE_PARM_DESC(support_p2p_device, "Support P2P-Device interface type"); 17 | 18 | +static bool use_hwsim_mon = true; 19 | +module_param(use_hwsim_mon, bool, 0444); 20 | +MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 21 | + 22 | /** 23 | * enum hwsim_regtest - the type of regulatory tests we offer 24 | * 25 | @@ -859,6 +863,8 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, 26 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_skb); 27 | struct ieee80211_rate *txrate = ieee80211_get_tx_rate(hw, info); 28 | 29 | + if(!use_hwsim_mon) 30 | + return; 31 | if (WARN_ON(!txrate)) 32 | return; 33 | 34 | @@ -906,6 +912,8 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan, 35 | u16 flags; 36 | struct ieee80211_hdr *hdr11; 37 | 38 | + if(!use_hwsim_mon) 39 | + return; 40 | if (!netif_running(hwsim_mon)) 41 | return; 42 | 43 | @@ -3673,6 +3681,9 @@ static int __init init_mac80211_hwsim(void) 44 | goto out_free_radios; 45 | } 46 | 47 | + if(!use_hwsim_mon) 48 | + return 0; 49 | + 50 | hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN, 51 | hwsim_mon_setup); 52 | if (hwsim_mon == NULL) { 53 | @@ -3722,7 +3733,9 @@ static void __exit exit_mac80211_hwsim(void) 54 | flush_workqueue(hwsim_wq); 55 | 56 | rhashtable_destroy(&hwsim_radios_rht); 57 | - unregister_netdev(hwsim_mon); 58 | + 59 | + if(hwsim_mon) 60 | + unregister_netdev(hwsim_mon); 61 | platform_driver_unregister(&mac80211_hwsim_driver); 62 | unregister_pernet_device(&hwsim_net_ops); 63 | destroy_workqueue(hwsim_wq); 64 | -- 65 | 2.19.1 66 | 67 | -------------------------------------------------------------------------------- /patches/4.19.0-kali1-amd64/0001-disables-hwsim0-interface.patch: -------------------------------------------------------------------------------- 1 | From df87d23e2504467bab99ef0efce8f7eaaabe078e Mon Sep 17 00:00:00 2001 2 | From: Adam Welle 3 | Date: Wed, 27 Feb 2019 13:29:01 -0500 4 | Subject: [PATCH 1/2] disables hwsim0 interface 5 | 6 | --- 7 | drivers/net/wireless/mac80211_hwsim.c | 15 ++++++++++++++- 8 | 1 file changed, 14 insertions(+), 1 deletion(-) 9 | 10 | diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c 11 | index 4ca6592f..2015be46 100644 12 | --- a/drivers/net/wireless/mac80211_hwsim.c 13 | +++ b/drivers/net/wireless/mac80211_hwsim.c 14 | @@ -64,6 +64,10 @@ static bool support_p2p_device = true; 15 | module_param(support_p2p_device, bool, 0444); 16 | MODULE_PARM_DESC(support_p2p_device, "Support P2P-Device interface type"); 17 | 18 | +static bool use_hwsim_mon = true; 19 | +module_param(use_hwsim_mon, bool, 0444); 20 | +MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 21 | + 22 | /** 23 | * enum hwsim_regtest - the type of regulatory tests we offer 24 | * 25 | @@ -860,6 +864,8 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, 26 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_skb); 27 | struct ieee80211_rate *txrate = ieee80211_get_tx_rate(hw, info); 28 | 29 | + if(!use_hwsim_mon) 30 | + return; 31 | if (WARN_ON(!txrate)) 32 | return; 33 | 34 | @@ -907,6 +913,8 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan, 35 | u16 flags; 36 | struct ieee80211_hdr *hdr11; 37 | 38 | + if(!use_hwsim_mon) 39 | + return; 40 | if (!netif_running(hwsim_mon)) 41 | return; 42 | 43 | @@ -3800,6 +3808,9 @@ static int __init init_mac80211_hwsim(void) 44 | goto out_free_radios; 45 | } 46 | 47 | + if(!use_hwsim_mon) 48 | + return 0; 49 | + 50 | hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN, 51 | hwsim_mon_setup); 52 | if (hwsim_mon == NULL) { 53 | @@ -3851,7 +3862,9 @@ static void __exit exit_mac80211_hwsim(void) 54 | flush_workqueue(hwsim_wq); 55 | 56 | rhashtable_destroy(&hwsim_radios_rht); 57 | - unregister_netdev(hwsim_mon); 58 | + 59 | + if(hwsim_mon) 60 | + unregister_netdev(hwsim_mon); 61 | platform_driver_unregister(&mac80211_hwsim_driver); 62 | unregister_pernet_device(&hwsim_net_ops); 63 | destroy_workqueue(hwsim_wq); 64 | -- 65 | 2.19.1 66 | 67 | -------------------------------------------------------------------------------- /patches/4.19.0-kali1-amd64/0002-adds-param-string-perm_addr.patch: -------------------------------------------------------------------------------- 1 | From 4aa165392818feed35afe897859d4494548dbd53 Mon Sep 17 00:00:00 2001 2 | From: Adam Welle 3 | Date: Wed, 27 Feb 2019 14:59:03 -0500 4 | Subject: [PATCH 2/2] adds param string perm_addr 5 | 6 | --- 7 | drivers/net/wireless/mac80211_hwsim.c | 17 ++++++++++++++++- 8 | 1 file changed, 16 insertions(+), 1 deletion(-) 9 | 10 | diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c 11 | index 2015be46..3f2973a5 100644 12 | --- a/drivers/net/wireless/mac80211_hwsim.c 13 | +++ b/drivers/net/wireless/mac80211_hwsim.c 14 | @@ -68,6 +68,10 @@ static bool use_hwsim_mon = true; 15 | module_param(use_hwsim_mon, bool, 0444); 16 | MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 17 | 18 | +static char perm_addr[18]; 19 | +module_param_string(perm_addr, perm_addr, 18, 0444); 20 | +MODULE_PARM_DESC(perm_addr, "Permanent hardware address for first radio"); 21 | + 22 | /** 23 | * enum hwsim_regtest - the type of regulatory tests we offer 24 | * 25 | @@ -3732,7 +3736,18 @@ static int __init init_mac80211_hwsim(void) 26 | 27 | for (i = 0; i < radios; i++) { 28 | struct hwsim_new_radio_params param = { 0 }; 29 | - 30 | + u8 u8_mac[ETH_ALEN]; 31 | + 32 | + eth_zero_addr(u8_mac); 33 | + sscanf(perm_addr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", 34 | + &u8_mac[0], 35 | + &u8_mac[1], 36 | + &u8_mac[2], 37 | + &u8_mac[3], 38 | + &u8_mac[4], 39 | + &u8_mac[5]); 40 | + u8_mac[5] += i; 41 | + param.perm_addr = u8_mac; 42 | param.channels = channels; 43 | 44 | switch (regtest) { 45 | -- 46 | 2.19.1 47 | 48 | -------------------------------------------------------------------------------- /patches/4.2.6-301.fc23.x86_64/0001-mac80211_hwsim-check-ATTR_FREQ-for-netlink-packets.patch: -------------------------------------------------------------------------------- 1 | From 32a357858565c5c16e425f2d8ed740a88a96ed3c Mon Sep 17 00:00:00 2001 2 | From: Adam Welle 3 | Date: Thu, 3 Dec 2015 16:15:02 -0500 4 | Subject: [PATCH] mac80211_hwsim: check ATTR_FREQ for netlink packets 5 | 6 | --- 7 | drivers/net/wireless/mac80211_hwsim.c | 14 ++++++++++---- 8 | 1 file changed, 10 insertions(+), 4 deletions(-) 9 | 10 | diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c 11 | index 99e873d..c129b76 100644 12 | --- a/drivers/net/wireless/mac80211_hwsim.c 13 | +++ b/drivers/net/wireless/mac80211_hwsim.c 14 | @@ -2827,10 +2827,16 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2, 15 | 16 | /* A frame is received from user space */ 17 | memset(&rx_status, 0, sizeof(rx_status)); 18 | - /* TODO: Check ATTR_FREQ if it exists, and maybe throw away off-channel 19 | - * packets? 20 | - */ 21 | - rx_status.freq = data2->channel->center_freq; 22 | + 23 | + /* Check ATTR_FREQ if it exists, and throw away off-channel packets */ 24 | + if (info->attrs[HWSIM_ATTR_FREQ]) { 25 | + rx_status.freq = nla_get_u32(info->attrs[HWSIM_ATTR_FREQ]); 26 | + if (rx_status.freq != data2->channel->center_freq) 27 | + goto out; 28 | + } else { 29 | + rx_status.freq = data2->channel->center_freq; 30 | + } 31 | + 32 | rx_status.band = data2->channel->band; 33 | rx_status.rate_idx = nla_get_u32(info->attrs[HWSIM_ATTR_RX_RATE]); 34 | rx_status.signal = nla_get_u32(info->attrs[HWSIM_ATTR_SIGNAL]); 35 | -- 36 | 2.5.0 37 | 38 | -------------------------------------------------------------------------------- /patches/4.2.6-301.fc23.x86_64/0002-mac80211_hwsim-disables-hwsim0-device.patch: -------------------------------------------------------------------------------- 1 | From f8244e28b7489f9d9f21da3a835843ad7612bf28 Mon Sep 17 00:00:00 2001 2 | From: Adam Welle 3 | Date: Thu, 3 Dec 2015 16:21:38 -0500 4 | Subject: [PATCH] mac80211_hwsim: disables hwsim0 device 5 | 6 | --- 7 | drivers/net/wireless/mac80211_hwsim.c | 47 +++++++++++++++++++++++------------ 8 | 1 file changed, 31 insertions(+), 16 deletions(-) 9 | 10 | diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c 11 | index c129b76..957bf21 100644 12 | --- a/drivers/net/wireless/mac80211_hwsim.c 13 | +++ b/drivers/net/wireless/mac80211_hwsim.c 14 | @@ -61,6 +61,10 @@ static bool support_p2p_device = true; 15 | module_param(support_p2p_device, bool, 0444); 16 | MODULE_PARM_DESC(support_p2p_device, "Support P2P-Device interface type"); 17 | 18 | +static bool use_hwsim_mon = true; 19 | +module_param(use_hwsim_mon, bool, 0444); 20 | +MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 21 | + 22 | /** 23 | * enum hwsim_regtest - the type of regulatory tests we offer 24 | * 25 | @@ -810,6 +814,9 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, 26 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_skb); 27 | struct ieee80211_rate *txrate = ieee80211_get_tx_rate(hw, info); 28 | 29 | + if (!use_hwsim_mon) 30 | + return; 31 | + 32 | if (!netif_running(hwsim_mon)) 33 | return; 34 | 35 | @@ -854,6 +861,9 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan, 36 | u16 flags; 37 | struct ieee80211_hdr *hdr11; 38 | 39 | + if (!use_hwsim_mon) 40 | + return; 41 | + 42 | if (!netif_running(hwsim_mon)) 43 | return; 44 | 45 | @@ -3264,26 +3274,28 @@ static int __init init_mac80211_hwsim(void) 46 | goto out_free_radios; 47 | } 48 | 49 | - hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN, 50 | + if (use_hwsim_mon) { 51 | + hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN, 52 | hwsim_mon_setup); 53 | - if (hwsim_mon == NULL) { 54 | - err = -ENOMEM; 55 | - goto out_free_radios; 56 | - } 57 | + if (hwsim_mon == NULL) { 58 | + err = -ENOMEM; 59 | + goto out_free_radios; 60 | + } 61 | 62 | - rtnl_lock(); 63 | - err = dev_alloc_name(hwsim_mon, hwsim_mon->name); 64 | - if (err < 0) { 65 | - rtnl_unlock(); 66 | - goto out_free_radios; 67 | - } 68 | + rtnl_lock(); 69 | + err = dev_alloc_name(hwsim_mon, hwsim_mon->name); 70 | + if (err < 0) { 71 | + rtnl_unlock(); 72 | + goto out_free_radios; 73 | + } 74 | 75 | - err = register_netdevice(hwsim_mon); 76 | - if (err < 0) { 77 | + err = register_netdevice(hwsim_mon); 78 | + if (err < 0) { 79 | + rtnl_unlock(); 80 | + goto out_free_mon; 81 | + } 82 | rtnl_unlock(); 83 | - goto out_free_mon; 84 | } 85 | - rtnl_unlock(); 86 | 87 | return 0; 88 | 89 | @@ -3304,7 +3316,10 @@ static void __exit exit_mac80211_hwsim(void) 90 | hwsim_exit_netlink(); 91 | 92 | mac80211_hwsim_free(); 93 | - unregister_netdev(hwsim_mon); 94 | + 95 | + if (hwsim_mon) 96 | + unregister_netdev(hwsim_mon); 97 | + 98 | platform_driver_unregister(&mac80211_hwsim_driver); 99 | } 100 | module_exit(exit_mac80211_hwsim); 101 | -- 102 | 2.5.0 103 | 104 | -------------------------------------------------------------------------------- /patches/4.2.6-301.fc23.x86_64/0003-mac80211_hwsim-adds-param-string-perm_addr: -------------------------------------------------------------------------------- 1 | From e5fe869343a5fc785aac294e4328459a4b1da7f0 Mon Sep 17 00:00:00 2001 2 | From: Adam Welle 3 | Date: Thu, 3 Dec 2015 16:27:55 -0500 4 | Subject: [PATCH] mac80211_hwsim: adds param string perm_addr 5 | 6 | --- 7 | drivers/net/wireless/mac80211_hwsim.c | 42 +++++++++++++++++++++++++++++------ 8 | 1 file changed, 35 insertions(+), 7 deletions(-) 9 | 10 | diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c 11 | index 957bf21..a758cc0 100644 12 | --- a/drivers/net/wireless/mac80211_hwsim.c 13 | +++ b/drivers/net/wireless/mac80211_hwsim.c 14 | @@ -65,6 +65,10 @@ static bool use_hwsim_mon = true; 15 | module_param(use_hwsim_mon, bool, 0444); 16 | MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 17 | 18 | +static char perm_addr[18]; 19 | +module_param_string(perm_addr, perm_addr, 18, 0444); 20 | +MODULE_PARM_DESC(perm_addr, "Permanent hardware address for first radio"); 21 | + 22 | /** 23 | * enum hwsim_regtest - the type of regulatory tests we offer 24 | * 25 | @@ -2310,6 +2314,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, 26 | enum ieee80211_band band; 27 | const struct ieee80211_ops *ops = &mac80211_hwsim_ops; 28 | int idx; 29 | + int perm_addr_len; 30 | + int match; 31 | 32 | if (WARN_ON(param->channels > 1 && !param->use_chanctx)) 33 | return -EINVAL; 34 | @@ -2348,13 +2354,35 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, 35 | skb_queue_head_init(&data->pending); 36 | 37 | SET_IEEE80211_DEV(hw, data->dev); 38 | - eth_zero_addr(addr); 39 | - addr[0] = 0x02; 40 | - addr[3] = idx >> 8; 41 | - addr[4] = idx; 42 | - memcpy(data->addresses[0].addr, addr, ETH_ALEN); 43 | - memcpy(data->addresses[1].addr, addr, ETH_ALEN); 44 | - data->addresses[1].addr[0] |= 0x40; 45 | + 46 | + /* convert perm_addr string to mac address */ 47 | + perm_addr_len = strlen(perm_addr); 48 | + 49 | + if (perm_addr_len == 17) { 50 | + printk(KERN_DEBUG "mac80211_hwsim: perm_addr %s\n", perm_addr); 51 | + memset(addr, 0, ETH_ALEN); 52 | + match = sscanf(perm_addr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", 53 | + &addr[0], &addr[1], &addr[2], 54 | + &addr[3], &addr[4], &addr[5]); 55 | + if (match != 6) { 56 | + printk(KERN_DEBUG "mac80211_hwsim: perm_addr failed\n"); 57 | + goto default_address; 58 | + } 59 | + addr[5] += idx; 60 | + memcpy(data->addresses[0].addr, addr, ETH_ALEN); 61 | + memcpy(data->addresses[1].addr, addr, ETH_ALEN); 62 | + } else { 63 | +default_address: 64 | + printk(KERN_DEBUG "mac80211_hwsim: using default addresses\n"); 65 | + memset(addr, 0, ETH_ALEN); 66 | + addr[0] = 0x02; 67 | + addr[3] = idx >> 8; 68 | + addr[4] = idx; 69 | + memcpy(data->addresses[0].addr, addr, ETH_ALEN); 70 | + memcpy(data->addresses[1].addr, addr, ETH_ALEN); 71 | + data->addresses[1].addr[0] |= 0x40; 72 | + } 73 | + 74 | hw->wiphy->n_addresses = 2; 75 | hw->wiphy->addresses = data->addresses; 76 | 77 | -- 78 | 2.5.0 79 | 80 | -------------------------------------------------------------------------------- /patches/4.3.3-300.fc23.x86_64/0001-mac80211_hwsim-check-ATTR_FREQ-for-netlink-packets.patch: -------------------------------------------------------------------------------- 1 | --- a/drivers/net/wireless/mac80211_hwsim.c 2 | +++ b/drivers/net/wireless/mac80211_hwsim.c 3 | @@ -2827,10 +2827,16 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2, 4 | 5 | /* A frame is received from user space */ 6 | memset(&rx_status, 0, sizeof(rx_status)); 7 | - /* TODO: Check ATTR_FREQ if it exists, and maybe throw away off-channel 8 | - * packets? 9 | - */ 10 | - rx_status.freq = data2->channel->center_freq; 11 | + 12 | + /* Check ATTR_FREQ if it exists, and throw away off-channel packets */ 13 | + if (info->attrs[HWSIM_ATTR_FREQ]) { 14 | + rx_status.freq = nla_get_u32(info->attrs[HWSIM_ATTR_FREQ]); 15 | + if (rx_status.freq != data2->channel->center_freq) 16 | + goto out; 17 | + } else { 18 | + rx_status.freq = data2->channel->center_freq; 19 | + } 20 | + 21 | rx_status.band = data2->channel->band; 22 | rx_status.rate_idx = nla_get_u32(info->attrs[HWSIM_ATTR_RX_RATE]); 23 | rx_status.signal = nla_get_u32(info->attrs[HWSIM_ATTR_SIGNAL]); 24 | -------------------------------------------------------------------------------- /patches/4.3.3-300.fc23.x86_64/0002-mac80211_hwsim-disables-hwsim0-device.patch: -------------------------------------------------------------------------------- 1 | --- a/drivers/net/wireless/mac80211_hwsim.c 2 | +++ b/drivers/net/wireless/mac80211_hwsim.c 3 | @@ -61,6 +61,10 @@ static bool support_p2p_device = true; 4 | module_param(support_p2p_device, bool, 0444); 5 | MODULE_PARM_DESC(support_p2p_device, "Support P2P-Device interface type"); 6 | 7 | +static bool use_hwsim_mon = true; 8 | +module_param(use_hwsim_mon, bool, 0444); 9 | +MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 10 | + 11 | /** 12 | * enum hwsim_regtest - the type of regulatory tests we offer 13 | * 14 | @@ -810,6 +814,9 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, 15 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_skb); 16 | struct ieee80211_rate *txrate = ieee80211_get_tx_rate(hw, info); 17 | 18 | + if (!use_hwsim_mon) 19 | + return; 20 | + 21 | if (!netif_running(hwsim_mon)) 22 | return; 23 | 24 | @@ -854,6 +861,9 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan, 25 | u16 flags; 26 | struct ieee80211_hdr *hdr11; 27 | 28 | + if (!use_hwsim_mon) 29 | + return; 30 | + 31 | if (!netif_running(hwsim_mon)) 32 | return; 33 | 34 | @@ -3264,26 +3274,28 @@ static int __init init_mac80211_hwsim(void) 35 | goto out_free_radios; 36 | } 37 | 38 | - hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN, 39 | + if (use_hwsim_mon) { 40 | + hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN, 41 | hwsim_mon_setup); 42 | - if (hwsim_mon == NULL) { 43 | - err = -ENOMEM; 44 | - goto out_free_radios; 45 | - } 46 | + if (hwsim_mon == NULL) { 47 | + err = -ENOMEM; 48 | + goto out_free_radios; 49 | + } 50 | 51 | - rtnl_lock(); 52 | - err = dev_alloc_name(hwsim_mon, hwsim_mon->name); 53 | - if (err < 0) { 54 | - rtnl_unlock(); 55 | - goto out_free_radios; 56 | - } 57 | + rtnl_lock(); 58 | + err = dev_alloc_name(hwsim_mon, hwsim_mon->name); 59 | + if (err < 0) { 60 | + rtnl_unlock(); 61 | + goto out_free_radios; 62 | + } 63 | 64 | - err = register_netdevice(hwsim_mon); 65 | - if (err < 0) { 66 | + err = register_netdevice(hwsim_mon); 67 | + if (err < 0) { 68 | + rtnl_unlock(); 69 | + goto out_free_mon; 70 | + } 71 | rtnl_unlock(); 72 | - goto out_free_mon; 73 | } 74 | - rtnl_unlock(); 75 | 76 | return 0; 77 | 78 | @@ -3304,7 +3316,10 @@ static void __exit exit_mac80211_hwsim(void) 79 | hwsim_exit_netlink(); 80 | 81 | mac80211_hwsim_free(); 82 | - unregister_netdev(hwsim_mon); 83 | + 84 | + if (hwsim_mon) 85 | + unregister_netdev(hwsim_mon); 86 | + 87 | platform_driver_unregister(&mac80211_hwsim_driver); 88 | } 89 | module_exit(exit_mac80211_hwsim); 90 | -------------------------------------------------------------------------------- /patches/4.3.3-300.fc23.x86_64/0003-mac80211_hwsim-adds-param-string-perm_addr: -------------------------------------------------------------------------------- 1 | --- a/drivers/net/wireless/mac80211_hwsim.c 2 | +++ b/drivers/net/wireless/mac80211_hwsim.c 3 | @@ -65,6 +65,10 @@ static bool use_hwsim_mon = true; 4 | module_param(use_hwsim_mon, bool, 0444); 5 | MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 6 | 7 | +static char perm_addr[18]; 8 | +module_param_string(perm_addr, perm_addr, 18, 0444); 9 | +MODULE_PARM_DESC(perm_addr, "Permanent hardware address for first radio"); 10 | + 11 | /** 12 | * enum hwsim_regtest - the type of regulatory tests we offer 13 | * 14 | @@ -2310,6 +2314,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, 15 | enum ieee80211_band band; 16 | const struct ieee80211_ops *ops = &mac80211_hwsim_ops; 17 | int idx; 18 | + int perm_addr_len; 19 | + int match; 20 | 21 | if (WARN_ON(param->channels > 1 && !param->use_chanctx)) 22 | return -EINVAL; 23 | @@ -2348,13 +2354,35 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, 24 | skb_queue_head_init(&data->pending); 25 | 26 | SET_IEEE80211_DEV(hw, data->dev); 27 | - eth_zero_addr(addr); 28 | - addr[0] = 0x02; 29 | - addr[3] = idx >> 8; 30 | - addr[4] = idx; 31 | - memcpy(data->addresses[0].addr, addr, ETH_ALEN); 32 | - memcpy(data->addresses[1].addr, addr, ETH_ALEN); 33 | - data->addresses[1].addr[0] |= 0x40; 34 | + 35 | + /* convert perm_addr string to mac address */ 36 | + perm_addr_len = strlen(perm_addr); 37 | + 38 | + if (perm_addr_len == 17) { 39 | + printk(KERN_DEBUG "mac80211_hwsim: perm_addr %s\n", perm_addr); 40 | + memset(addr, 0, ETH_ALEN); 41 | + match = sscanf(perm_addr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", 42 | + &addr[0], &addr[1], &addr[2], 43 | + &addr[3], &addr[4], &addr[5]); 44 | + if (match != 6) { 45 | + printk(KERN_DEBUG "mac80211_hwsim: perm_addr failed\n"); 46 | + goto default_address; 47 | + } 48 | + addr[5] += idx; 49 | + memcpy(data->addresses[0].addr, addr, ETH_ALEN); 50 | + memcpy(data->addresses[1].addr, addr, ETH_ALEN); 51 | + } else { 52 | +default_address: 53 | + printk(KERN_DEBUG "mac80211_hwsim: using default addresses\n"); 54 | + memset(addr, 0, ETH_ALEN); 55 | + addr[0] = 0x02; 56 | + addr[3] = idx >> 8; 57 | + addr[4] = idx; 58 | + memcpy(data->addresses[0].addr, addr, ETH_ALEN); 59 | + memcpy(data->addresses[1].addr, addr, ETH_ALEN); 60 | + data->addresses[1].addr[0] |= 0x40; 61 | + } 62 | + 63 | hw->wiphy->n_addresses = 2; 64 | hw->wiphy->addresses = data->addresses; 65 | 66 | 67 | -------------------------------------------------------------------------------- /patches/4.9.0-kali3-amd64/0001-disables-hwsim0-device.patch: -------------------------------------------------------------------------------- 1 | From 150b723b52b2f379b0e9f6fe4e8ee33c1a7446bb Mon Sep 17 00:00:00 2001 2 | From: root 3 | Date: Thu, 27 Apr 2017 12:19:28 -0400 4 | Subject: [PATCH 1/2] disables hwsim0 device 5 | 6 | --- 7 | drivers/net/wireless/mac80211_hwsim.c | 18 +++++++++++++++++- 8 | 1 file changed, 17 insertions(+), 1 deletion(-) 9 | 10 | diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c 11 | index d3bad57..574289c 100644 12 | --- a/drivers/net/wireless/mac80211_hwsim.c 13 | +++ b/drivers/net/wireless/mac80211_hwsim.c 14 | @@ -61,6 +61,10 @@ static bool support_p2p_device = true; 15 | module_param(support_p2p_device, bool, 0444); 16 | MODULE_PARM_DESC(support_p2p_device, "Support P2P-Device interface type"); 17 | 18 | +static bool use_hwsim_mon = true; 19 | +module_param(use_hwsim_mon, bool, 0444); 20 | +MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 21 | + 22 | /** 23 | * enum hwsim_regtest - the type of regulatory tests we offer 24 | * 25 | @@ -841,6 +845,9 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, 26 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_skb); 27 | struct ieee80211_rate *txrate = ieee80211_get_tx_rate(hw, info); 28 | 29 | + if (!use_hwsim_mon) 30 | + return; 31 | + 32 | if (WARN_ON(!txrate)) 33 | return; 34 | 35 | @@ -888,6 +895,9 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan, 36 | u16 flags; 37 | struct ieee80211_hdr *hdr11; 38 | 39 | + if (!use_hwsim_mon) 40 | + return; 41 | + 42 | if (!netif_running(hwsim_mon)) 43 | return; 44 | 45 | @@ -3473,6 +3483,9 @@ static int __init init_mac80211_hwsim(void) 46 | goto out_free_radios; 47 | } 48 | 49 | + if (!use_hwsim_mon) 50 | + return 0; 51 | + 52 | hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN, 53 | hwsim_mon_setup); 54 | if (hwsim_mon == NULL) { 55 | @@ -3515,7 +3528,10 @@ static void __exit exit_mac80211_hwsim(void) 56 | hwsim_exit_netlink(); 57 | 58 | mac80211_hwsim_free(); 59 | - unregister_netdev(hwsim_mon); 60 | + 61 | + if (hwsim_mon) 62 | + unregister_netdev(hwsim_mon); 63 | + 64 | platform_driver_unregister(&mac80211_hwsim_driver); 65 | unregister_pernet_device(&hwsim_net_ops); 66 | } 67 | -- 68 | 2.11.0 69 | 70 | -------------------------------------------------------------------------------- /patches/4.9.0-kali3-amd64/0002-adds-param-string-perm_addr.patch: -------------------------------------------------------------------------------- 1 | From f3d8d8d013d48d99314a08ad11cd116c014035bf Mon Sep 17 00:00:00 2001 2 | From: root 3 | Date: Thu, 27 Apr 2017 13:05:10 -0400 4 | Subject: [PATCH 2/2] adds param string perm_addr 5 | 6 | --- 7 | drivers/net/wireless/mac80211_hwsim.c | 42 +++++++++++++++++++++++++++++------ 8 | 1 file changed, 35 insertions(+), 7 deletions(-) 9 | 10 | diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c 11 | index 574289c..48f094c 100644 12 | --- a/drivers/net/wireless/mac80211_hwsim.c 13 | +++ b/drivers/net/wireless/mac80211_hwsim.c 14 | @@ -65,6 +65,10 @@ static bool use_hwsim_mon = true; 15 | module_param(use_hwsim_mon, bool, 0444); 16 | MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 17 | 18 | +static char perm_addr[18]; 19 | +module_param_string(perm_addr, perm_addr, 18, 0444); 20 | +MODULE_PARM_DESC(perm_addr, "Permanent hardware address for first radio"); 21 | + 22 | /** 23 | * enum hwsim_regtest - the type of regulatory tests we offer 24 | * 25 | @@ -2422,6 +2426,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, 26 | const struct ieee80211_ops *ops = &mac80211_hwsim_ops; 27 | struct net *net; 28 | int idx; 29 | + int perm_addr_len; 30 | + int match; 31 | 32 | if (WARN_ON(param->channels > 1 && !param->use_chanctx)) 33 | return -EINVAL; 34 | @@ -2467,13 +2473,35 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, 35 | skb_queue_head_init(&data->pending); 36 | 37 | SET_IEEE80211_DEV(hw, data->dev); 38 | - eth_zero_addr(addr); 39 | - addr[0] = 0x02; 40 | - addr[3] = idx >> 8; 41 | - addr[4] = idx; 42 | - memcpy(data->addresses[0].addr, addr, ETH_ALEN); 43 | - memcpy(data->addresses[1].addr, addr, ETH_ALEN); 44 | - data->addresses[1].addr[0] |= 0x40; 45 | + 46 | + /* convert perm_addr string to mac address */ 47 | + perm_addr_len = strlen(perm_addr); 48 | + 49 | + if (perm_addr_len == 17) { 50 | + printk(KERN_DEBUG "mac80211_hwsim: perm_addr %s\n", perm_addr); 51 | + memset(addr, 0, ETH_ALEN); 52 | + match = sscanf(perm_addr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", 53 | + &addr[0], &addr[1], &addr[2], 54 | + &addr[3], &addr[4], &addr[5]); 55 | + if (match != 6) { 56 | + printk(KERN_DEBUG "mac80211_hwsim: perm_addr failed\n"); 57 | + goto default_address; 58 | + } 59 | + addr[5] += idx; 60 | + memcpy(data->addresses[0].addr, addr, ETH_ALEN); 61 | + memcpy(data->addresses[1].addr, addr, ETH_ALEN); 62 | + } else { 63 | +default_address: 64 | + printk(KERN_DEBUG "mac80211_hwsim: using default addresses\n"); 65 | + memset(addr, 0, ETH_ALEN); 66 | + addr[0] = 0x02; 67 | + addr[3] = idx >> 8; 68 | + addr[4] = idx; 69 | + memcpy(data->addresses[0].addr, addr, ETH_ALEN); 70 | + memcpy(data->addresses[1].addr, addr, ETH_ALEN); 71 | + data->addresses[1].addr[0] |= 0x40; 72 | + } 73 | + 74 | hw->wiphy->n_addresses = 2; 75 | hw->wiphy->addresses = data->addresses; 76 | 77 | -- 78 | 2.11.0 79 | 80 | -------------------------------------------------------------------------------- /patches/4.9.0-kali4-amd64/0001-disables-hwsim0-device.patch: -------------------------------------------------------------------------------- 1 | From 150b723b52b2f379b0e9f6fe4e8ee33c1a7446bb Mon Sep 17 00:00:00 2001 2 | From: root 3 | Date: Thu, 27 Apr 2017 12:19:28 -0400 4 | Subject: [PATCH 1/2] disables hwsim0 device 5 | 6 | --- 7 | drivers/net/wireless/mac80211_hwsim.c | 18 +++++++++++++++++- 8 | 1 file changed, 17 insertions(+), 1 deletion(-) 9 | 10 | diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c 11 | index d3bad57..574289c 100644 12 | --- a/drivers/net/wireless/mac80211_hwsim.c 13 | +++ b/drivers/net/wireless/mac80211_hwsim.c 14 | @@ -61,6 +61,10 @@ static bool support_p2p_device = true; 15 | module_param(support_p2p_device, bool, 0444); 16 | MODULE_PARM_DESC(support_p2p_device, "Support P2P-Device interface type"); 17 | 18 | +static bool use_hwsim_mon = true; 19 | +module_param(use_hwsim_mon, bool, 0444); 20 | +MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 21 | + 22 | /** 23 | * enum hwsim_regtest - the type of regulatory tests we offer 24 | * 25 | @@ -841,6 +845,9 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, 26 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_skb); 27 | struct ieee80211_rate *txrate = ieee80211_get_tx_rate(hw, info); 28 | 29 | + if (!use_hwsim_mon) 30 | + return; 31 | + 32 | if (WARN_ON(!txrate)) 33 | return; 34 | 35 | @@ -888,6 +895,9 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan, 36 | u16 flags; 37 | struct ieee80211_hdr *hdr11; 38 | 39 | + if (!use_hwsim_mon) 40 | + return; 41 | + 42 | if (!netif_running(hwsim_mon)) 43 | return; 44 | 45 | @@ -3473,6 +3483,9 @@ static int __init init_mac80211_hwsim(void) 46 | goto out_free_radios; 47 | } 48 | 49 | + if (!use_hwsim_mon) 50 | + return 0; 51 | + 52 | hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN, 53 | hwsim_mon_setup); 54 | if (hwsim_mon == NULL) { 55 | @@ -3515,7 +3528,10 @@ static void __exit exit_mac80211_hwsim(void) 56 | hwsim_exit_netlink(); 57 | 58 | mac80211_hwsim_free(); 59 | - unregister_netdev(hwsim_mon); 60 | + 61 | + if (hwsim_mon) 62 | + unregister_netdev(hwsim_mon); 63 | + 64 | platform_driver_unregister(&mac80211_hwsim_driver); 65 | unregister_pernet_device(&hwsim_net_ops); 66 | } 67 | -- 68 | 2.11.0 69 | 70 | -------------------------------------------------------------------------------- /patches/4.9.0-kali4-amd64/0002-adds-param-string-perm_addr.patch: -------------------------------------------------------------------------------- 1 | From f3d8d8d013d48d99314a08ad11cd116c014035bf Mon Sep 17 00:00:00 2001 2 | From: root 3 | Date: Thu, 27 Apr 2017 13:05:10 -0400 4 | Subject: [PATCH 2/2] adds param string perm_addr 5 | 6 | --- 7 | drivers/net/wireless/mac80211_hwsim.c | 42 +++++++++++++++++++++++++++++------ 8 | 1 file changed, 35 insertions(+), 7 deletions(-) 9 | 10 | diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c 11 | index 574289c..48f094c 100644 12 | --- a/drivers/net/wireless/mac80211_hwsim.c 13 | +++ b/drivers/net/wireless/mac80211_hwsim.c 14 | @@ -65,6 +65,10 @@ static bool use_hwsim_mon = true; 15 | module_param(use_hwsim_mon, bool, 0444); 16 | MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 17 | 18 | +static char perm_addr[18]; 19 | +module_param_string(perm_addr, perm_addr, 18, 0444); 20 | +MODULE_PARM_DESC(perm_addr, "Permanent hardware address for first radio"); 21 | + 22 | /** 23 | * enum hwsim_regtest - the type of regulatory tests we offer 24 | * 25 | @@ -2422,6 +2426,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, 26 | const struct ieee80211_ops *ops = &mac80211_hwsim_ops; 27 | struct net *net; 28 | int idx; 29 | + int perm_addr_len; 30 | + int match; 31 | 32 | if (WARN_ON(param->channels > 1 && !param->use_chanctx)) 33 | return -EINVAL; 34 | @@ -2467,13 +2473,35 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, 35 | skb_queue_head_init(&data->pending); 36 | 37 | SET_IEEE80211_DEV(hw, data->dev); 38 | - eth_zero_addr(addr); 39 | - addr[0] = 0x02; 40 | - addr[3] = idx >> 8; 41 | - addr[4] = idx; 42 | - memcpy(data->addresses[0].addr, addr, ETH_ALEN); 43 | - memcpy(data->addresses[1].addr, addr, ETH_ALEN); 44 | - data->addresses[1].addr[0] |= 0x40; 45 | + 46 | + /* convert perm_addr string to mac address */ 47 | + perm_addr_len = strlen(perm_addr); 48 | + 49 | + if (perm_addr_len == 17) { 50 | + printk(KERN_DEBUG "mac80211_hwsim: perm_addr %s\n", perm_addr); 51 | + memset(addr, 0, ETH_ALEN); 52 | + match = sscanf(perm_addr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", 53 | + &addr[0], &addr[1], &addr[2], 54 | + &addr[3], &addr[4], &addr[5]); 55 | + if (match != 6) { 56 | + printk(KERN_DEBUG "mac80211_hwsim: perm_addr failed\n"); 57 | + goto default_address; 58 | + } 59 | + addr[5] += idx; 60 | + memcpy(data->addresses[0].addr, addr, ETH_ALEN); 61 | + memcpy(data->addresses[1].addr, addr, ETH_ALEN); 62 | + } else { 63 | +default_address: 64 | + printk(KERN_DEBUG "mac80211_hwsim: using default addresses\n"); 65 | + memset(addr, 0, ETH_ALEN); 66 | + addr[0] = 0x02; 67 | + addr[3] = idx >> 8; 68 | + addr[4] = idx; 69 | + memcpy(data->addresses[0].addr, addr, ETH_ALEN); 70 | + memcpy(data->addresses[1].addr, addr, ETH_ALEN); 71 | + data->addresses[1].addr[0] |= 0x40; 72 | + } 73 | + 74 | hw->wiphy->n_addresses = 2; 75 | hw->wiphy->addresses = data->addresses; 76 | 77 | -- 78 | 2.11.0 79 | 80 | -------------------------------------------------------------------------------- /patches/android-build-config-changes-2016-06-22/0001-boardconfig-mk-add-driver.patch: -------------------------------------------------------------------------------- 1 | --- a/kernel/BoardConfig.mk 2 | +++ b/kernel/BoardConfig.mk 3 | @@ -108,1 +109,1 @@ 4 | 5 | - BOARD_80211_HW_SIM_DRIVER := ATMEL 6 | + BOARD_80211_HW_SIM_DRIVER := WELLED 7 | + WIFI_DRIVER_MODULE_PATH := /etc/welled 8 | + WIFI_DRIVER_MODULE_NAME := wlan0 9 | 10 | 11 | 12 | -- a/init.rc 13 | ++ a/init.rc 14 | @@ -15,1 +16,1 @@ 15 | 16 | + setprop wifi.interface "wlan0" 17 | + setprop wlan.driver.status "ok" 18 | + setprio wifi.firmware /etc/firmware/welled 19 | -------------------------------------------------------------------------------- /patches/android-build-config-changes-2016-06-22/0002-system-etc-wifi-conf.patch: -------------------------------------------------------------------------------- 1 | --- a/kernel/system/etc/wifi/80211_hwsim.conf 2 | +++ b/kernel/system/etc/wifi/80211_hwsim.conf 3 | @@ -10,1 +11,1 @@ 4 | 5 | 6 | + ctrl_interface=wlan0 GROUP=wifi 7 | + update_config=1 8 | + ap_scan=0 9 | + network={ 10 | + key_mgmt=NONE 11 | + } 12 | -------------------------------------------------------------------------------- /patches/android-libhardware-2016-06-17/0001-libhardware-adds-wifi-device.patch: -------------------------------------------------------------------------------- 1 | --- a/hardware/libhardware/source/hardware/hardware.c 2 | +++ b/hardware/libhardware/source/hardware/hardware.c 3 | @@ -214,6 +215,10 @@ 4 | 5 | + typedef struct welled_module { 6 | + hw_module_t common; 7 | + int (*associate_mac)(string mac_address); 8 | + int (*set_device_info)(int device_id, struct welled_info *info); 9 | + } welled_module_t; 10 | + 11 | + struct welled_module HAL_MODULE_INFO_SYM = { 12 | + .common = { 13 | + .tag = HARDWARE_MODULE_TAG, 14 | + .module_api_version = WIFI_MODULE_API_VERSION_0_1, 15 | + .hal_api_version = HARDWARE_HAL_API_VERSION, 16 | + .id = WIFI_HARDWARE_MODULE_ID, 17 | + .name = "Welle-d wifi simulator", 18 | + .author = "Ben Draffin, CERT at SEI", 19 | + .methods = &hal_module_methods, 20 | + }, 21 | + }; 22 | + 23 | + struct welled_hw_device { 24 | + struct hw_device_t common; 25 | + 26 | + uint32_t (*get_supported_devices)(const struct welled_hw_device *dev); 27 | + }; 28 | + typedef struct welled_hw_device welled_hw_device_t; 29 | 30 | 31 | -- a/hardware/libhardware_legacy/wifi/wifi.c 32 | -- b/hardware/libhardware_legacy/wifi/wifi.c 33 | @@ -54,1 +54,1 @@ rmmod() 34 | return 0; 35 | 36 | @@ -75,1 +76,1 @@ insmod() 37 | return 0; 38 | -------------------------------------------------------------------------------- /patches/android-net-wifi-2016-06-22/0001-net-wifi-add-driver-to-build.patch: -------------------------------------------------------------------------------- 1 | --- a/external/net/80211/Android.mk 2 | +++ a/external/net/80211/Android.mk 3 | @@ -43,1 +43,1 @@ 4 | 5 | + 80211_HW_SIM_BUILD := TRUE 6 | -------------------------------------------------------------------------------- /patches/android-wext-driver-2016-06-22/0001-wext-driver-load-welled.patch: -------------------------------------------------------------------------------- 1 | --- a/external/mac80211/driver_wext.c 2 | +++ b/external/mac80211/driver_wext.c 3 | @@ -54,1 +55,1 @@ wpa_driver_priv_driver_cmd() 4 | 5 | + ret = 0; 6 | -------------------------------------------------------------------------------- /patches/compat-wireless-2014-05-22/0001-mac80211_hwsim-disables-hwsim0-device.patch: -------------------------------------------------------------------------------- 1 | --- a/drivers/net/wireless/mac80211_hwsim.c 2 | +++ b/drivers/net/wireless/mac80211_hwsim.c 3 | @@ -61,6 +61,10 @@ static bool support_p2p_device = true; 4 | module_param(support_p2p_device, bool, 0444); 5 | MODULE_PARM_DESC(support_p2p_device, "Support P2P-Device interface type"); 6 | 7 | +static bool use_hwsim_mon = true; 8 | +module_param(use_hwsim_mon, bool, 0444); 9 | +MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 10 | + 11 | /** 12 | * enum hwsim_regtest - the type of regulatory tests we offer 13 | * 14 | @@ -703,6 +707,9 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, 15 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_skb); 16 | struct ieee80211_rate *txrate = ieee80211_get_tx_rate(hw, info); 17 | 18 | + if (!use_hwsim_mon) 19 | + return; 20 | + 21 | if (!netif_running(hwsim_mon)) 22 | return; 23 | 24 | @@ -747,6 +754,9 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan, 25 | u16 flags; 26 | struct ieee80211_hdr *hdr11; 27 | 28 | + if (!use_hwsim_mon) 29 | + return; 30 | + 31 | if (!netif_running(hwsim_mon)) 32 | return; 33 | 34 | @@ -2680,25 +2690,27 @@ static int __init init_mac80211_hwsim(void) 35 | goto out_free_radios; 36 | } 37 | 38 | - hwsim_mon = alloc_netdev(0, "hwsim%d", hwsim_mon_setup); 39 | - if (hwsim_mon == NULL) { 40 | - err = -ENOMEM; 41 | - goto out_free_radios; 42 | - } 43 | + if (use_hwsim_mon) { 44 | + hwsim_mon = alloc_netdev(0, "hwsim%d", hwsim_mon_setup); 45 | + if (hwsim_mon == NULL) { 46 | + err = -ENOMEM; 47 | + goto out_free_radios; 48 | + } 49 | 50 | - rtnl_lock(); 51 | - err = dev_alloc_name(hwsim_mon, hwsim_mon->name); 52 | - if (err < 0) { 53 | - rtnl_unlock(); 54 | - goto out_free_radios; 55 | - } 56 | + rtnl_lock(); 57 | + err = dev_alloc_name(hwsim_mon, hwsim_mon->name); 58 | + if (err < 0) { 59 | + rtnl_unlock(); 60 | + goto out_free_radios; 61 | + } 62 | 63 | - err = register_netdevice(hwsim_mon); 64 | - if (err < 0) { 65 | + err = register_netdevice(hwsim_mon); 66 | + if (err < 0) { 67 | + rtnl_unlock(); 68 | + goto out_free_mon; 69 | + } 70 | rtnl_unlock(); 71 | - goto out_free_mon; 72 | } 73 | - rtnl_unlock(); 74 | 75 | err = hwsim_init_netlink(); 76 | if (err < 0) 77 | @@ -2723,7 +2735,10 @@ static void __exit exit_mac80211_hwsim(void) 78 | hwsim_exit_netlink(); 79 | 80 | mac80211_hwsim_free(); 81 | - unregister_netdev(hwsim_mon); 82 | + 83 | + if (use_hwsim_mon) 84 | + unregister_netdev(hwsim_mon); 85 | + 86 | platform_driver_unregister(&mac80211_hwsim_driver); 87 | } 88 | module_exit(exit_mac80211_hwsim); 89 | -- 90 | 2.5.0 91 | 92 | -------------------------------------------------------------------------------- /patches/compat-wireless-2014-05-22/0002-mac80211_hwsim-adds-param-string-perm_addr.patch: -------------------------------------------------------------------------------- 1 | --- a/drivers/net/wireless/mac80211_hwsim.c 2 | +++ b/drivers/net/wireless/mac80211_hwsim.c 3 | @@ -65,6 +65,10 @@ static bool use_hwsim_mon = true; 4 | module_param(use_hwsim_mon, bool, 0444); 5 | MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 6 | 7 | +static char perm_addr[18]; 8 | +module_param_string(perm_addr, perm_addr, 18, 0444); 9 | +MODULE_PARM_DESC(perm_addr, "Permanent hardware address for first radio"); 10 | + 11 | /** 12 | * enum hwsim_regtest - the type of regulatory tests we offer 13 | * 14 | @@ -1963,6 +1967,8 @@ static int mac80211_hwsim_create_radio(int channels, const char *reg_alpha2, 15 | enum ieee80211_band band; 16 | const struct ieee80211_ops *ops = &mac80211_hwsim_ops; 17 | int idx; 18 | + int perm_addr_len; 19 | + int match; 20 | 21 | if (WARN_ON(channels > 1 && !use_chanctx)) 22 | return -EINVAL; 23 | @@ -2001,13 +2007,34 @@ static int mac80211_hwsim_create_radio(int channels, const char *reg_alpha2, 24 | skb_queue_head_init(&data->pending); 25 | 26 | SET_IEEE80211_DEV(hw, data->dev); 27 | + 28 | + /* convert perm_addr string to mac address */ 29 | + perm_addr_len = strlen(perm_addr); 30 | + 31 | + if (perm_addr_len == 17) { 32 | + printk(KERN_DEBUG "mac80211_hwsim: perm_addr %s\n", perm_addr); 33 | memset(addr, 0, ETH_ALEN); 34 | - addr[0] = 0x02; 35 | - addr[3] = idx >> 8; 36 | - addr[4] = idx; 37 | - memcpy(data->addresses[0].addr, addr, ETH_ALEN); 38 | - memcpy(data->addresses[1].addr, addr, ETH_ALEN); 39 | - data->addresses[1].addr[0] |= 0x40; 40 | + match = sscanf(perm_addr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", 41 | + &addr[0], &addr[1], &addr[2], 42 | + &addr[3], &addr[4], &addr[5]); 43 | + if (match != 6) { 44 | + printk(KERN_DEBUG "mac80211_hwsim: perm_addr failed\n"); 45 | + goto default_address; 46 | + } 47 | + addr[5] += idx; 48 | + memcpy(data->addresses[0].addr, addr, ETH_ALEN); 49 | + memcpy(data->addresses[1].addr, addr, ETH_ALEN); 50 | + } else { 51 | +default_address: 52 | + printk(KERN_DEBUG "mac80211_hwsim: using default addresses\n"); 53 | + memset(addr, 0, ETH_ALEN); 54 | + addr[0] = 0x02; 55 | + addr[3] = idx >> 8; 56 | + addr[4] = idx; 57 | + memcpy(data->addresses[0].addr, addr, ETH_ALEN); 58 | + memcpy(data->addresses[1].addr, addr, ETH_ALEN); 59 | + data->addresses[1].addr[0] |= 0x40; 60 | + } 61 | hw->wiphy->n_addresses = 2; 62 | hw->wiphy->addresses = data->addresses; 63 | 64 | -- 65 | 2.5.0 66 | 67 | -------------------------------------------------------------------------------- /patches/compat-wireless-2015-03-09/0001-mac80211_hwsim-disables-hwsim0-device.patch: -------------------------------------------------------------------------------- 1 | --- a/drivers/net/wireless/mac80211_hwsim.c 2 | +++ b/drivers/net/wireless/mac80211_hwsim.c 3 | @@ -61,6 +61,10 @@ static bool support_p2p_device = true; 4 | module_param(support_p2p_device, bool, 0444); 5 | MODULE_PARM_DESC(support_p2p_device, "Support P2P-Device interface type"); 6 | 7 | +static bool use_hwsim_mon = true; 8 | +module_param(use_hwsim_mon, bool, 0444); 9 | +MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 10 | + 11 | /** 12 | * enum hwsim_regtest - the type of regulatory tests we offer 13 | * 14 | @@ -810,6 +814,9 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, 15 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_skb); 16 | struct ieee80211_rate *txrate = ieee80211_get_tx_rate(hw, info); 17 | 18 | + if (!use_hwsim_mon) 19 | + return; 20 | + 21 | if (!netif_running(hwsim_mon)) 22 | return; 23 | 24 | @@ -854,6 +861,9 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan, 25 | u16 flags; 26 | struct ieee80211_hdr *hdr11; 27 | 28 | + if (!use_hwsim_mon) 29 | + return; 30 | + 31 | if (!netif_running(hwsim_mon)) 32 | return; 33 | 34 | @@ -3261,26 +3271,28 @@ static int __init init_mac80211_hwsim(void) 35 | goto out_free_radios; 36 | } 37 | 38 | - hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN, 39 | - hwsim_mon_setup); 40 | - if (hwsim_mon == NULL) { 41 | - err = -ENOMEM; 42 | - goto out_free_radios; 43 | - } 44 | + if (use_hwsim_mon) { 45 | + hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN, 46 | + hwsim_mon_setup); 47 | + if (hwsim_mon == NULL) { 48 | + err = -ENOMEM; 49 | + goto out_free_radios; 50 | + } 51 | 52 | - rtnl_lock(); 53 | - err = dev_alloc_name(hwsim_mon, hwsim_mon->name); 54 | - if (err < 0) { 55 | - rtnl_unlock(); 56 | - goto out_free_radios; 57 | - } 58 | + rtnl_lock(); 59 | + err = dev_alloc_name(hwsim_mon, hwsim_mon->name); 60 | + if (err < 0) { 61 | + rtnl_unlock(); 62 | + goto out_free_radios; 63 | + } 64 | 65 | - err = register_netdevice(hwsim_mon); 66 | - if (err < 0) { 67 | + err = register_netdevice(hwsim_mon); 68 | + if (err < 0) { 69 | + rtnl_unlock(); 70 | + goto out_free_mon; 71 | + } 72 | rtnl_unlock(); 73 | - goto out_free_mon; 74 | } 75 | - rtnl_unlock(); 76 | 77 | return 0; 78 | 79 | @@ -3301,7 +3313,10 @@ static void __exit exit_mac80211_hwsim(void) 80 | hwsim_exit_netlink(); 81 | 82 | mac80211_hwsim_free(); 83 | - unregister_netdev(hwsim_mon); 84 | + 85 | + if (hwsim_mon) 86 | + unregister_netdev(hwsim_mon); 87 | + 88 | platform_driver_unregister(&mac80211_hwsim_driver); 89 | } 90 | module_exit(exit_mac80211_hwsim); 91 | -- 92 | 2.5.5 93 | 94 | -------------------------------------------------------------------------------- /patches/compat-wireless-2015-03-09/0002-mac80211_hwsim-checks-ATTR_FREQ-for-netlink-messages.patch: -------------------------------------------------------------------------------- 1 | --- a/drivers/net/wireless/mac80211_hwsim.c 2 | +++ b/drivers/net/wireless/mac80211_hwsim.c 3 | @@ -2838,10 +2838,17 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2, 4 | 5 | /* A frame is received from user space */ 6 | memset(&rx_status, 0, sizeof(rx_status)); 7 | - /* TODO: Check ATTR_FREQ if it exists, and maybe throw away off-channel 8 | - * packets? 9 | - */ 10 | - rx_status.freq = data2->channel->center_freq; 11 | + 12 | + /* Check ATTR_FREQ if it exists, and throw away off-channel packets */ 13 | + if (info->attrs[HWSIM_ATTR_FREQ]) { 14 | + rx_status.freq = nla_get_u32(info->attrs[HWSIM_ATTR_FREQ]); 15 | + if (rx_status.freq != data2->channel->center_freq) 16 | + goto out; 17 | + } else { 18 | + rx_status.freq = data2->channel->center_freq; 19 | + } 20 | + 21 | + 22 | rx_status.band = data2->channel->band; 23 | rx_status.rate_idx = nla_get_u32(info->attrs[HWSIM_ATTR_RX_RATE]); 24 | rx_status.signal = nla_get_u32(info->attrs[HWSIM_ATTR_SIGNAL]); 25 | -- 26 | 2.5.5 27 | 28 | -------------------------------------------------------------------------------- /patches/compat-wireless-2015-03-09/0003-mac80211_hwsim-adds-param-string-perm_addr.patch: -------------------------------------------------------------------------------- 1 | --- a/drivers/net/wireless/mac80211_hwsim.c 2 | +++ b/drivers/net/wireless/mac80211_hwsim.c 3 | @@ -65,6 +65,10 @@ static bool use_hwsim_mon = true; 4 | module_param(use_hwsim_mon, bool, 0444); 5 | MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 6 | 7 | +static char perm_addr[18]; 8 | +module_param_string(perm_addr, perm_addr, 18, 0444); 9 | +MODULE_PARM_DESC(perm_addr, "Permanent hardware address for first radio"); 10 | + 11 | /** 12 | * enum hwsim_regtest - the type of regulatory tests we offer 13 | * 14 | @@ -120,7 +124,7 @@ MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 15 | * 5 - strict regulatory domain settings using the third driver regulatory 16 | * domain request 17 | * 6 and on - should follow the intersection of the 3rd, 4rth and 5th radio 18 | - * regulatory requests. 19 | + * regulatory requests. 20 | */ 21 | enum hwsim_regtest { 22 | HWSIM_REGTEST_DISABLED = 0, 23 | @@ -2312,6 +2316,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, 24 | enum ieee80211_band band; 25 | const struct ieee80211_ops *ops = &mac80211_hwsim_ops; 26 | int idx; 27 | + int perm_addr_len; 28 | + int match; 29 | 30 | if (WARN_ON(param->channels > 1 && !param->use_chanctx)) 31 | return -EINVAL; 32 | @@ -2350,13 +2356,36 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, 33 | skb_queue_head_init(&data->pending); 34 | 35 | SET_IEEE80211_DEV(hw, data->dev); 36 | - eth_zero_addr(addr); 37 | - addr[0] = 0x02; 38 | - addr[3] = idx >> 8; 39 | - addr[4] = idx; 40 | - memcpy(data->addresses[0].addr, addr, ETH_ALEN); 41 | - memcpy(data->addresses[1].addr, addr, ETH_ALEN); 42 | - data->addresses[1].addr[0] |= 0x40; 43 | + 44 | + /* convert perm_addr string to mac address */ 45 | + perm_addr_len = strlen(perm_addr); 46 | + 47 | + if (perm_addr_len == 17) { 48 | + printk(KERN_DEBUG "mac80211_hwsim: perm_addr %s\n", perm_addr); 49 | + memset(addr, 0, ETH_ALEN); 50 | + match = sscanf(perm_addr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", 51 | + &addr[0], &addr[1], &addr[2], 52 | + &addr[3], &addr[4], &addr[5]); 53 | + if (match != 6) { 54 | + printk(KERN_DEBUG "mac80211_hwsim: perm_addr failed\n"); 55 | + goto default_address; 56 | + } 57 | + addr[5] += idx; 58 | + memcpy(data->addresses[0].addr, addr, ETH_ALEN); 59 | + memcpy(data->addresses[1].addr, addr, ETH_ALEN); 60 | + } else { 61 | +default_address: 62 | + printk(KERN_DEBUG "mac80211_hwsim: using default addresses\n"); 63 | + memset(addr, 0, ETH_ALEN); 64 | + addr[0] = 0x02; 65 | + addr[3] = idx >> 8; 66 | + addr[4] = idx; 67 | + memcpy(data->addresses[0].addr, addr, ETH_ALEN); 68 | + memcpy(data->addresses[1].addr, addr, ETH_ALEN); 69 | + data->addresses[1].addr[0] |= 0x40; 70 | + } 71 | + 72 | + 73 | hw->wiphy->n_addresses = 2; 74 | hw->wiphy->addresses = data->addresses; 75 | 76 | -- 77 | 2.5.5 78 | 79 | -------------------------------------------------------------------------------- /patches/compat-wireless-2015-10-26/0001-mac80211_hwsim-disables-hwsim0-device.patch: -------------------------------------------------------------------------------- 1 | --- a/drivers/net/wireless/mac80211_hwsim.c 2 | +++ b/drivers/net/wireless/mac80211_hwsim.c 3 | @@ -61,6 +61,10 @@ static bool support_p2p_device = true; 4 | module_param(support_p2p_device, bool, 0444); 5 | MODULE_PARM_DESC(support_p2p_device, "Support P2P-Device interface type"); 6 | 7 | +static bool use_hwsim_mon = true; 8 | +module_param(use_hwsim_mon, bool, 0444); 9 | +MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 10 | + 11 | /** 12 | * enum hwsim_regtest - the type of regulatory tests we offer 13 | * 14 | @@ -810,6 +814,9 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, 15 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_skb); 16 | struct ieee80211_rate *txrate = ieee80211_get_tx_rate(hw, info); 17 | 18 | + if (!use_hwsim_mon) 19 | + return; 20 | + 21 | if (!netif_running(hwsim_mon)) 22 | return; 23 | 24 | @@ -854,6 +861,9 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan, 25 | u16 flags; 26 | struct ieee80211_hdr *hdr11; 27 | 28 | + if (!use_hwsim_mon) 29 | + return; 30 | + 31 | if (!netif_running(hwsim_mon)) 32 | return; 33 | 34 | @@ -3266,26 +3276,28 @@ static int __init init_mac80211_hwsim(void) 35 | goto out_free_radios; 36 | } 37 | 38 | - hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN, 39 | - hwsim_mon_setup); 40 | - if (hwsim_mon == NULL) { 41 | - err = -ENOMEM; 42 | - goto out_free_radios; 43 | - } 44 | + if (use_hwsim_mon) { 45 | + hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN, 46 | + hwsim_mon_setup); 47 | + if (hwsim_mon == NULL) { 48 | + err = -ENOMEM; 49 | + goto out_free_radios; 50 | + } 51 | 52 | - rtnl_lock(); 53 | - err = dev_alloc_name(hwsim_mon, hwsim_mon->name); 54 | - if (err < 0) { 55 | - rtnl_unlock(); 56 | - goto out_free_radios; 57 | - } 58 | + rtnl_lock(); 59 | + err = dev_alloc_name(hwsim_mon, hwsim_mon->name); 60 | + if (err < 0) { 61 | + rtnl_unlock(); 62 | + goto out_free_radios; 63 | + } 64 | 65 | - err = register_netdevice(hwsim_mon); 66 | - if (err < 0) { 67 | + err = register_netdevice(hwsim_mon); 68 | + if (err < 0) { 69 | + rtnl_unlock(); 70 | + goto out_free_mon; 71 | + } 72 | rtnl_unlock(); 73 | - goto out_free_mon; 74 | } 75 | - rtnl_unlock(); 76 | 77 | return 0; 78 | 79 | @@ -3306,7 +3318,10 @@ static void __exit exit_mac80211_hwsim(void) 80 | hwsim_exit_netlink(); 81 | 82 | mac80211_hwsim_free(); 83 | - unregister_netdev(hwsim_mon); 84 | + 85 | + if (hwsim_mon) 86 | + unregister_netdev(hwsim_mon); 87 | + 88 | platform_driver_unregister(&mac80211_hwsim_driver); 89 | } 90 | module_exit(exit_mac80211_hwsim); 91 | -------------------------------------------------------------------------------- /patches/compat-wireless-2015-10-26/0002-mac80211_hwsim-checks-ATTR_FREQ-for-netlink-messages.patch: -------------------------------------------------------------------------------- 1 | --- a/drivers/net/wireless/mac80211_hwsim.c 2 | +++ b/drivers/net/wireless/mac80211_hwsim.c 3 | @@ -2841,10 +2841,16 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2, 4 | 5 | /* A frame is received from user space */ 6 | memset(&rx_status, 0, sizeof(rx_status)); 7 | - /* TODO: Check ATTR_FREQ if it exists, and maybe throw away off-channel 8 | - * packets? 9 | - */ 10 | - rx_status.freq = data2->channel->center_freq; 11 | + 12 | + /* Check ATTR_FREQ if it exists, and throw away off-channel packets */ 13 | + if (info->attrs[HWSIM_ATTR_FREQ]) { 14 | + rx_status.freq = nla_get_u32(info->attrs[HWSIM_ATTR_FREQ]); 15 | + if (rx_status.freq != data2->channel->center_freq) 16 | + goto out; 17 | + } else { 18 | + rx_status.freq = data2->channel->center_freq; 19 | + } 20 | + 21 | rx_status.band = data2->channel->band; 22 | rx_status.rate_idx = nla_get_u32(info->attrs[HWSIM_ATTR_RX_RATE]); 23 | rx_status.signal = nla_get_u32(info->attrs[HWSIM_ATTR_SIGNAL]); 24 | -------------------------------------------------------------------------------- /patches/compat-wireless-2015-10-26/0003-mac80211_hwsim-adds-param-string-perm_addr: -------------------------------------------------------------------------------- 1 | --- a/drivers/net/wireless/mac80211_hwsim.c 2 | +++ b/drivers/net/wireless/mac80211_hwsim.c 3 | @@ -65,6 +65,10 @@ static bool use_hwsim_mon = true; 4 | module_param(use_hwsim_mon, bool, 0444); 5 | MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 6 | 7 | +static char perm_addr[18]; 8 | +module_param_string(perm_addr, perm_addr, 18, 0444); 9 | +MODULE_PARM_DESC(perm_addr, "Permanent hardware address for first radio"); 10 | + 11 | /** 12 | * enum hwsim_regtest - the type of regulatory tests we offer 13 | * 14 | @@ -120,7 +124,7 @@ MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 15 | * 5 - strict regulatory domain settings using the third driver regulatory 16 | * domain request 17 | * 6 and on - should follow the intersection of the 3rd, 4rth and 5th radio 18 | - * regulatory requests. 19 | + * regulatory requests. 20 | */ 21 | enum hwsim_regtest { 22 | HWSIM_REGTEST_DISABLED = 0, 23 | @@ -2309,6 +2313,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, 24 | enum ieee80211_band band; 25 | const struct ieee80211_ops *ops = &mac80211_hwsim_ops; 26 | int idx; 27 | + int perm_addr_len; 28 | + int match; 29 | 30 | if (WARN_ON(param->channels > 1 && !param->use_chanctx)) 31 | return -EINVAL; 32 | @@ -2347,13 +2353,34 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, 33 | skb_queue_head_init(&data->pending); 34 | 35 | SET_IEEE80211_DEV(hw, data->dev); 36 | - eth_zero_addr(addr); 37 | - addr[0] = 0x02; 38 | - addr[3] = idx >> 8; 39 | - addr[4] = idx; 40 | - memcpy(data->addresses[0].addr, addr, ETH_ALEN); 41 | - memcpy(data->addresses[1].addr, addr, ETH_ALEN); 42 | - data->addresses[1].addr[0] |= 0x40; 43 | + 44 | + /* convert perm_addr string to mac address */ 45 | + perm_addr_len = strlen(perm_addr); 46 | + 47 | + if (perm_addr_len == 17) { 48 | + printk(KERN_DEBUG "mac80211_hwsim: perm_addr %s\n", perm_addr); 49 | + memset(addr, 0, ETH_ALEN); 50 | + match = sscanf(perm_addr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", 51 | + &addr[0], &addr[1], &addr[2], 52 | + &addr[3], &addr[4], &addr[5]); 53 | + if (match != 6) { 54 | + printk(KERN_DEBUG "mac80211_hwsim: perm_addr failed\n"); 55 | + goto default_address; 56 | + } 57 | + addr[5] += idx; 58 | + memcpy(data->addresses[0].addr, addr, ETH_ALEN); 59 | + memcpy(data->addresses[1].addr, addr, ETH_ALEN); 60 | + } else { 61 | +default_address: 62 | + printk(KERN_DEBUG "mac80211_hwsim: using default addresses\n"); 63 | + memset(addr, 0, ETH_ALEN); 64 | + addr[0] = 0x02; 65 | + addr[3] = idx >> 8; 66 | + addr[4] = idx; 67 | + memcpy(data->addresses[0].addr, addr, ETH_ALEN); 68 | + memcpy(data->addresses[1].addr, addr, ETH_ALEN); 69 | + data->addresses[1].addr[0] |= 0x40; 70 | + } 71 | hw->wiphy->n_addresses = 2; 72 | hw->wiphy->addresses = data->addresses; 73 | 74 | -- 75 | 2.1.4 76 | 77 | -------------------------------------------------------------------------------- /patches/compat-wireless-2015-12-03/0001-mac80211_hwsim-disables-hwsim0-device.patch: -------------------------------------------------------------------------------- 1 | --- a/drivers/net/wireless/mac80211_hwsim.c 2 | +++ b/drivers/net/wireless/mac80211_hwsim.c 3 | @@ -61,6 +61,10 @@ static bool support_p2p_device = true; 4 | module_param(support_p2p_device, bool, 0444); 5 | MODULE_PARM_DESC(support_p2p_device, "Support P2P-Device interface type"); 6 | 7 | +static bool use_hwsim_mon = true; 8 | +module_param(use_hwsim_mon, bool, 0444); 9 | +MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 10 | + 11 | /** 12 | * enum hwsim_regtest - the type of regulatory tests we offer 13 | * 14 | @@ -814,6 +818,9 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, 15 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_skb); 16 | struct ieee80211_rate *txrate = ieee80211_get_tx_rate(hw, info); 17 | 18 | + if (!use_hwsim_mon) 19 | + return; 20 | + 21 | if (WARN_ON(!txrate)) 22 | return; 23 | 24 | @@ -861,6 +868,9 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan, 25 | u16 flags; 26 | struct ieee80211_hdr *hdr11; 27 | 28 | + if (!use_hwsim_mon) 29 | + return; 30 | + 31 | if (!netif_running(hwsim_mon)) 32 | return; 33 | 34 | @@ -3340,19 +3350,28 @@ static int __init init_mac80211_hwsim(void) 35 | goto out_free_radios; 36 | } 37 | 38 | - rtnl_lock(); 39 | - err = dev_alloc_name(hwsim_mon, hwsim_mon->name); 40 | - if (err < 0) { 41 | - rtnl_unlock(); 42 | - goto out_free_radios; 43 | - } 44 | + if (use_hwsim_mon) { 45 | + hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN, 46 | + hwsim_mon_setup); 47 | + if (hwsim_mon == NULL) { 48 | + err = -ENOMEM; 49 | + goto out_free_radios; 50 | + } 51 | 52 | - err = register_netdevice(hwsim_mon); 53 | - if (err < 0) { 54 | + rtnl_lock(); 55 | + err = dev_alloc_name(hwsim_mon, hwsim_mon->name); 56 | + if (err < 0) { 57 | + rtnl_unlock(); 58 | + goto out_free_radios; 59 | + } 60 | + 61 | + err = register_netdevice(hwsim_mon); 62 | + if (err < 0) { 63 | + rtnl_unlock(); 64 | + goto out_free_mon; 65 | + } 66 | rtnl_unlock(); 67 | - goto out_free_mon; 68 | } 69 | - rtnl_unlock(); 70 | 71 | return 0; 72 | 73 | @@ -3373,7 +3392,10 @@ static void __exit exit_mac80211_hwsim(void) 74 | hwsim_exit_netlink(); 75 | 76 | mac80211_hwsim_free(); 77 | - unregister_netdev(hwsim_mon); 78 | + 79 | + if (hwsim_mon) 80 | + unregister_netdev(hwsim_mon); 81 | + 82 | platform_driver_unregister(&mac80211_hwsim_driver); 83 | } 84 | module_exit(exit_mac80211_hwsim); 85 | -- 86 | 2.5.0 87 | 88 | -------------------------------------------------------------------------------- /patches/compat-wireless-2015-12-03/0002-mac80211_hwsim-adds-param-string-perm_addr: -------------------------------------------------------------------------------- 1 | --- a/drivers/net/wireless/mac80211_hwsim.c 2 | +++ b/drivers/net/wireless/mac80211_hwsim.c 3 | @@ -65,6 +65,10 @@ static bool use_hwsim_mon = true; 4 | module_param(use_hwsim_mon, bool, 0444); 5 | MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 6 | 7 | +static char perm_addr[18]; 8 | +module_param_string(perm_addr, perm_addr, 18, 0444); 9 | +MODULE_PARM_DESC(perm_addr, "Permanent hardware address for first radio"); 10 | + 11 | /** 12 | * enum hwsim_regtest - the type of regulatory tests we offer 13 | * 14 | @@ -120,7 +124,7 @@ MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 15 | * 5 - strict regulatory domain settings using the third driver regulatory 16 | * domain request 17 | * 6 and on - should follow the intersection of the 3rd, 4rth and 5th radio 18 | - * regulatory requests. 19 | + * regulatory requests. 20 | */ 21 | enum hwsim_regtest { 22 | HWSIM_REGTEST_DISABLED = 0, 23 | @@ -2309,6 +2313,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, 24 | enum ieee80211_band band; 25 | const struct ieee80211_ops *ops = &mac80211_hwsim_ops; 26 | int idx; 27 | + int perm_addr_len; 28 | + int match; 29 | 30 | if (WARN_ON(param->channels > 1 && !param->use_chanctx)) 31 | return -EINVAL; 32 | @@ -2347,13 +2353,34 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, 33 | skb_queue_head_init(&data->pending); 34 | 35 | SET_IEEE80211_DEV(hw, data->dev); 36 | - eth_zero_addr(addr); 37 | - addr[0] = 0x02; 38 | - addr[3] = idx >> 8; 39 | - addr[4] = idx; 40 | - memcpy(data->addresses[0].addr, addr, ETH_ALEN); 41 | - memcpy(data->addresses[1].addr, addr, ETH_ALEN); 42 | - data->addresses[1].addr[0] |= 0x40; 43 | + 44 | + /* convert perm_addr string to mac address */ 45 | + perm_addr_len = strlen(perm_addr); 46 | + 47 | + if (perm_addr_len == 17) { 48 | + printk(KERN_DEBUG "mac80211_hwsim: perm_addr %s\n", perm_addr); 49 | + memset(addr, 0, ETH_ALEN); 50 | + match = sscanf(perm_addr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", 51 | + &addr[0], &addr[1], &addr[2], 52 | + &addr[3], &addr[4], &addr[5]); 53 | + if (match != 6) { 54 | + printk(KERN_DEBUG "mac80211_hwsim: perm_addr failed\n"); 55 | + goto default_address; 56 | + } 57 | + addr[5] += idx; 58 | + memcpy(data->addresses[0].addr, addr, ETH_ALEN); 59 | + memcpy(data->addresses[1].addr, addr, ETH_ALEN); 60 | + } else { 61 | +default_address: 62 | + printk(KERN_DEBUG "mac80211_hwsim: using default addresses\n"); 63 | + memset(addr, 0, ETH_ALEN); 64 | + addr[0] = 0x02; 65 | + addr[3] = idx >> 8; 66 | + addr[4] = idx; 67 | + memcpy(data->addresses[0].addr, addr, ETH_ALEN); 68 | + memcpy(data->addresses[1].addr, addr, ETH_ALEN); 69 | + data->addresses[1].addr[0] |= 0x40; 70 | + } 71 | hw->wiphy->n_addresses = 2; 72 | hw->wiphy->addresses = data->addresses; 73 | 74 | -- 75 | 2.1.4 76 | 77 | -------------------------------------------------------------------------------- /patches/compat-wireless-2016-01-10/0001-mac80211_hwsim-disables-hwsim0-device: -------------------------------------------------------------------------------- 1 | --- a/drivers/net/wireless/mac80211_hwsim.c 2 | +++ b/drivers/net/wireless/mac80211_hwsim.c 3 | @@ -61,6 +61,10 @@ static bool support_p2p_device = true; 4 | module_param(support_p2p_device, bool, 0444); 5 | MODULE_PARM_DESC(support_p2p_device, "Support P2P-Device interface type"); 6 | 7 | +static bool use_hwsim_mon = true; 8 | +module_param(use_hwsim_mon, bool, 0444); 9 | +MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 10 | + 11 | /** 12 | * enum hwsim_regtest - the type of regulatory tests we offer 13 | * 14 | @@ -814,6 +818,9 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, 15 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_skb); 16 | struct ieee80211_rate *txrate = ieee80211_get_tx_rate(hw, info); 17 | 18 | + if (!use_hwsim_mon) 19 | + return; 20 | + 21 | if (WARN_ON(!txrate)) 22 | return; 23 | 24 | @@ -861,6 +868,9 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan, 25 | u16 flags; 26 | struct ieee80211_hdr *hdr11; 27 | 28 | + if (!use_hwsim_mon) 29 | + return; 30 | + 31 | if (!netif_running(hwsim_mon)) 32 | return; 33 | 34 | @@ -3343,19 +3353,28 @@ static int __init init_mac80211_hwsim(void) 35 | goto out_free_radios; 36 | } 37 | 38 | - rtnl_lock(); 39 | - err = dev_alloc_name(hwsim_mon, hwsim_mon->name); 40 | - if (err < 0) { 41 | - rtnl_unlock(); 42 | - goto out_free_radios; 43 | - } 44 | + if (use_hwsim_mon) { 45 | + hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN, 46 | + hwsim_mon_setup); 47 | + if (hwsim_mon == NULL) { 48 | + err = -ENOMEM; 49 | + goto out_free_radios; 50 | + } 51 | 52 | - err = register_netdevice(hwsim_mon); 53 | - if (err < 0) { 54 | + rtnl_lock(); 55 | + err = dev_alloc_name(hwsim_mon, hwsim_mon->name); 56 | + if (err < 0) { 57 | + rtnl_unlock(); 58 | + goto out_free_radios; 59 | + } 60 | + 61 | + err = register_netdevice(hwsim_mon); 62 | + if (err < 0) { 63 | + rtnl_unlock(); 64 | + goto out_free_mon; 65 | + } 66 | rtnl_unlock(); 67 | - goto out_free_mon; 68 | } 69 | - rtnl_unlock(); 70 | 71 | return 0; 72 | 73 | @@ -3376,7 +3395,10 @@ static void __exit exit_mac80211_hwsim(void) 74 | hwsim_exit_netlink(); 75 | 76 | mac80211_hwsim_free(); 77 | - unregister_netdev(hwsim_mon); 78 | + 79 | + if (hwsim_mon) 80 | + unregister_netdev(hwsim_mon); 81 | + 82 | platform_driver_unregister(&mac80211_hwsim_driver); 83 | } 84 | module_exit(exit_mac80211_hwsim); 85 | -------------------------------------------------------------------------------- /patches/compat-wireless-2016-01-10/0002-mac80211_hwsim-adds-param-string-perm_addr: -------------------------------------------------------------------------------- 1 | --- a/drivers/net/wireless/mac80211_hwsim.c 2 | +++ b/drivers/net/wireless/mac80211_hwsim.c 3 | @@ -65,6 +65,10 @@ static bool use_hwsim_mon = true; 4 | module_param(use_hwsim_mon, bool, 0444); 5 | MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 6 | 7 | +static char perm_addr[18]; 8 | +module_param_string(perm_addr, perm_addr, 18, 0444); 9 | +MODULE_PARM_DESC(perm_addr, "Permanent hardware address for first radio"); 10 | + 11 | /** 12 | * enum hwsim_regtest - the type of regulatory tests we offer 13 | * 14 | @@ -120,7 +124,7 @@ MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device"); 15 | * 5 - strict regulatory domain settings using the third driver regulatory 16 | * domain request 17 | * 6 and on - should follow the intersection of the 3rd, 4rth and 5th radio 18 | - * regulatory requests. 19 | + * regulatory requests. 20 | */ 21 | enum hwsim_regtest { 22 | HWSIM_REGTEST_DISABLED = 0, 23 | @@ -2357,6 +2361,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, 24 | enum ieee80211_band band; 25 | const struct ieee80211_ops *ops = &mac80211_hwsim_ops; 26 | int idx; 27 | + int perm_addr_len; 28 | + int match; 29 | 30 | if (WARN_ON(param->channels > 1 && !param->use_chanctx)) 31 | return -EINVAL; 32 | @@ -2395,13 +2401,34 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, 33 | skb_queue_head_init(&data->pending); 34 | 35 | SET_IEEE80211_DEV(hw, data->dev); 36 | - eth_zero_addr(addr); 37 | - addr[0] = 0x02; 38 | - addr[3] = idx >> 8; 39 | - addr[4] = idx; 40 | - memcpy(data->addresses[0].addr, addr, ETH_ALEN); 41 | - memcpy(data->addresses[1].addr, addr, ETH_ALEN); 42 | - data->addresses[1].addr[0] |= 0x40; 43 | + 44 | + /* convert perm_addr string to mac address */ 45 | + perm_addr_len = strlen(perm_addr); 46 | + 47 | + if (perm_addr_len == 17) { 48 | + printk(KERN_DEBUG "mac80211_hwsim: perm_addr %s\n", perm_addr); 49 | + memset(addr, 0, ETH_ALEN); 50 | + match = sscanf(perm_addr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", 51 | + &addr[0], &addr[1], &addr[2], 52 | + &addr[3], &addr[4], &addr[5]); 53 | + if (match != 6) { 54 | + printk(KERN_DEBUG "mac80211_hwsim: perm_addr failed\n"); 55 | + goto default_address; 56 | + } 57 | + addr[5] += idx; 58 | + memcpy(data->addresses[0].addr, addr, ETH_ALEN); 59 | + memcpy(data->addresses[1].addr, addr, ETH_ALEN); 60 | + } else { 61 | +default_address: 62 | + printk(KERN_DEBUG "mac80211_hwsim: using default addresses\n"); 63 | + memset(addr, 0, ETH_ALEN); 64 | + addr[0] = 0x02; 65 | + addr[3] = idx >> 8; 66 | + addr[4] = idx; 67 | + memcpy(data->addresses[0].addr, addr, ETH_ALEN); 68 | + memcpy(data->addresses[1].addr, addr, ETH_ALEN); 69 | + data->addresses[1].addr[0] |= 0x40; 70 | + } 71 | hw->wiphy->n_addresses = 2; 72 | hw->wiphy->addresses = data->addresses; 73 | 74 | -------------------------------------------------------------------------------- /pix/gps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cmu-sei/welled/fff448c5deeb52808b30c5390f6d8bb10f2a43b6/pix/gps.png -------------------------------------------------------------------------------- /scripts/gelled.path: -------------------------------------------------------------------------------- 1 | # This file is part of welled 2 | # 3 | # welled is free software; you can redistribute it and/or modify it 4 | # under the terms of the GNU Lesser General Public License as published by 5 | # the Free Software Foundation; either version 2.1 of the License, or 6 | # (at your option) any later version. 7 | 8 | [Unit] 9 | Description=Watch /dev/vsock and /dev/tnt0 and start welled.service 10 | 11 | [Path] 12 | PathExists=/dev/tnt0 13 | PathExists=/dev/vsock 14 | 15 | [Install] 16 | WantedBy=multi-user.target 17 | 18 | -------------------------------------------------------------------------------- /scripts/gelled.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=GPS Emulation Link Layer Exchange Daemon 3 | Before=gpsd.service 4 | 5 | [Service] 6 | ExecStartPre=sleep 1 7 | ExecStart=/bin/gelled -d /dev/tnt0 8 | #ExecStartPost=/bin/gelled-ctrl -y 35 -x 30 -d 0 -k 0 9 | StandardOutput=journal 10 | StandardError=journal 11 | 12 | [Install] 13 | WantedBy=multi-user.target 14 | 15 | -------------------------------------------------------------------------------- /scripts/init-welled-debian: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ### BEGIN INIT INFO 4 | # Provides: welled 5 | # Required-Start: $network $syslog $vmware-tools 6 | # Required-Stop: $network $syslog $vmware-tools 7 | # Default-Start: 2 3 4 5 8 | # Default-Stop: 0 1 6 9 | # Short-Description: Start welled 10 | ### END INIT INFO 11 | 12 | PATH="/sbin:/bin:/usr/sbin:/usr/bin" 13 | 14 | . /lib/lsb/init-functions 15 | 16 | DAEMON=/bin/welled 17 | PIDFILE=/var/run/welled.pid 18 | OPTS=-a 19 | 20 | test -x $DAEMON || exit 5 21 | 22 | case "$1" in 23 | start) 24 | log_daemon_msg "Starting wireless emulation" "welled" 25 | modprobe mac80211_hwsim radios=1 use_hwsim_mon=0 perm_addr=42:00:00:00:01:00 26 | start-stop-daemon --start --oknodo --make-pidfile --pidfile $PIDFILE --background --exec $DAEMON -- $OPTS 27 | log_end_msg $? 28 | /bin/gelled-ctrl -y 35 -x 35 -d 0 -k 0 29 | ;; 30 | stop) 31 | log_daemon_msg "Stopping wireless emulation" "welled" 32 | start-stop-daemon --stop --pidfile $PIDFILE 33 | log_end_msg $? 34 | rm -f $PIDFILE 35 | ;; 36 | force-reload|restart) 37 | $0 stop && sleep 2 && $0 start 38 | ;; 39 | reload) 40 | echo "reload not implemented" 41 | ;; 42 | status) 43 | status_of_proc $DAEMON "welled" 44 | ;; 45 | enable) 46 | /usr/sbin/update-rc.d welled defaults 47 | ;; 48 | disable) 49 | /usr/sbin/update-rc.d welled remove 50 | ;; 51 | *) 52 | echo "Usage: /etc/init.d/welled {start|stop|reload|restart|force-reload|enable|disable}" 53 | exit 1 54 | ;; 55 | esac 56 | 57 | exit 0 58 | 59 | # vim: noet ts=8 60 | -------------------------------------------------------------------------------- /scripts/init-welled-openwrt: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # welled init script 3 | # Copyright (C) 2017 Carnegie Mellon University 4 | 5 | START=91 6 | STOP=92 7 | 8 | NAME=welled 9 | PROG=/bin/welled 10 | 11 | USE_PROCD=1 12 | 13 | start_service() { 14 | procd_open_instance 15 | procd_set_param command "$PROG" 16 | procd_set_param respawn 17 | procd_set_param stdout 1 18 | procd_set_param stderr 1 19 | procd_set_param pidfile /var/run/welled.pid 20 | procd_close_instance 21 | } 22 | 23 | -------------------------------------------------------------------------------- /scripts/init-welled-rhel: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # /etc/rc.d/init.d/welled 4 | # 5 | # 6 | # 7 | # 8 | # 13 | 14 | ### BEGIN INIT INFO 15 | # Provides: welled 16 | # Required-Start: network 17 | # Defalt-Start: 2 3 4 5 18 | # Default-Stop: 0 1 6 19 | # Description: wireless emulation link layer exchange daemon 20 | ### END INIT INFO 21 | 22 | DAEMON=/bin/welled 23 | ARGS=-a 24 | 25 | case "$1" in 26 | start) 27 | if [ -s /var/run/welled.pid ]; then 28 | echo "welled is running" 29 | exit 30 | fi 31 | echo -n "Starting welled services: " 32 | modprobe mac80211_hwsim radios=1 use_hwsim_mon=0 perm_addr=42:00:00:00:01:00 33 | #daemon function 34 | $DAEMON $ARGS & 35 | pidof welled > /var/run/welled.pid 36 | /bin/gelled-ctrl -y 35 -x 35 -d 0 -k 0 37 | ;; 38 | stop) 39 | if [ -s /var/run/welled.pid ]; then 40 | echo -n "Shutting down welled services: " 41 | #killproc function 42 | PID=`cat /var/run/welled.pid` 43 | kill $PID 44 | rm -f /var/run/welled.pid 45 | exit 46 | else 47 | echo "welled not running" 48 | exit 49 | fi 50 | ;; 51 | status) 52 | #status function 53 | if [ -s /var/run/welled.pid ]; then 54 | echo "welled is running" 55 | else 56 | echo "welled not running" 57 | fi 58 | exit 59 | ;; 60 | restart) 61 | $0 stop; $0 start 62 | ;; 63 | reload) 64 | #kill -HUP 65 | $0 stop; $0 start 66 | ;; 67 | probe) 68 | echo "Not implemented" 69 | exit 70 | ;; 71 | enable) 72 | chkconfig welled on 73 | ;; 74 | disable) 75 | chkconfig welled off 76 | ;; 77 | *) 78 | echo "Usage: welled {start|stop|status|reload|restart|enable|disable[|probe]" 79 | exit 1 80 | ;; 81 | esac 82 | -------------------------------------------------------------------------------- /scripts/init-welled-vyos: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ### BEGIN INIT INFO 4 | # Provides: welled 5 | # Required-Start: $network $syslog $vmware-tools 6 | # Required-Stop: $network $syslog $vmware-tools 7 | # Default-Start: 2 3 4 5 8 | # Default-Stop: 0 1 6 9 | # Short-Description: Start welled 10 | ### END INIT INFO 11 | 12 | PATH="/sbin:/bin:/usr/sbin:/usr/bin" 13 | 14 | . /lib/lsb/init-functions 15 | 16 | DAEMON=/bin/welled 17 | PIDFILE=/var/run/welled.pid 18 | OPTS= 19 | 20 | test -x $DAEMON || exit 5 21 | 22 | case "$1" in 23 | start) 24 | log_daemon_msg "Starting wireless emulation" "welled" 25 | #modprobe mac80211_hwsim radios=1 #use_hwsim_mon=0 perm_addr=42:00:00:00:01:00 26 | start-stop-daemon --start --oknodo --make-pidfile --pidfile $PIDFILE --background --exec $DAEMON -- $OPTS 27 | log_end_msg $? 28 | #/bin/gelled-ctrl -y 35 -x 35 -d 0 -k 0 29 | ;; 30 | stop) 31 | log_daemon_msg "Stopping wireless emulation" "welled" 32 | start-stop-daemon --stop --pidfile $PIDFILE 33 | log_end_msg $? 34 | rm -f $PIDFILE 35 | ;; 36 | force-reload|restart) 37 | $0 stop && sleep 2 && $0 start 38 | ;; 39 | reload) 40 | echo "reload not implemented" 41 | ;; 42 | status) 43 | status_of_proc $DAEMON "welled" 44 | ;; 45 | enable) 46 | /usr/sbin/update-rc.d welled defaults 47 | ;; 48 | disable) 49 | /usr/sbin/update-rc.d welled remove 50 | ;; 51 | *) 52 | echo "Usage: /etc/init.d/welled {start|stop|reload|restart|force-reload|enable|disable}" 53 | exit 1 54 | ;; 55 | esac 56 | 57 | exit 0 58 | 59 | # vim: noet ts=8 60 | -------------------------------------------------------------------------------- /scripts/install-wmasterd-esx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cp wmasterd.tgz /bootbank/wmasterd.tgz 4 | tar -xzvf /bootbank/wmasterd.tgz -C / 5 | grep wmasterd.tgz /bootbank/boot.cfg >/dev/null 6 | if [ $? -eq 1 ]; then 7 | echo "Adding wmasterd.tgz to /bootbank/boot.cfg" 8 | sed -i "s/state.tgz/wmasterd.tgz --- state.tgz/" /bootbank/boot.cfg 9 | /etc/init.d/wmasterd enable 10 | esxcli network firewall refresh 11 | fi 12 | /etc/init.d/wmasterd restart 13 | /etc/init.d/wmasterd status 14 | -------------------------------------------------------------------------------- /scripts/welled.path: -------------------------------------------------------------------------------- 1 | # This file is part of welled 2 | # 3 | # welled is free software; you can redistribute it and/or modify it 4 | # under the terms of the GNU Lesser General Public License as published by 5 | # the Free Software Foundation; either version 2.1 of the License, or 6 | # (at your option) any later version. 7 | 8 | [Unit] 9 | Description=Watch /dev/vsock and start welled.service 10 | 11 | [Path] 12 | PathExists=/dev/vsock 13 | 14 | [Install] 15 | WantedBy=multi-user.target 16 | 17 | -------------------------------------------------------------------------------- /scripts/welled.service: -------------------------------------------------------------------------------- 1 | # This file is part of welled 2 | # 3 | # welled is free software; you can redistribute it and/or modify it 4 | # under the terms of the GNU Lesser General Public License as published by 5 | # the Free Software Foundation; either version 2.1 of the License, or 6 | # (at your option) any later version. 7 | 8 | [Unit] 9 | Description=Wireless Emulation Link Layer Exchange Daemon 10 | 11 | [Service] 12 | ExecStartPre=/sbin/modprobe mac80211_hwsim radios=1 use_hwsim_mon=0 perm_addr=42:00:00:00:01:00 13 | ExecStart=/bin/welled -a 14 | #ExecStartPost=/bin/gelled-ctrl -y 35 -x 35 -d 0 -k 0 15 | 16 | [Install] 17 | WantedBy=multi-user.target 18 | 19 | -------------------------------------------------------------------------------- /sig.pkcs7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cmu-sei/welled/fff448c5deeb52808b30c5390f6d8bb10f2a43b6/sig.pkcs7 -------------------------------------------------------------------------------- /src/gelled-ctrl.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Carnegie Mellon University. All Rights Reserved. 3 | * 4 | * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING 5 | * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON 6 | * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 7 | * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR 8 | * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF 9 | * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF 10 | * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT 11 | * INFRINGEMENT. 12 | * 13 | * Released under a GNU GPL 2.0-style license, please see license.txt or 14 | * contact permission@sei.cmu.edu for full terms. 15 | * 16 | * [DISTRIBUTION STATEMENT A] This material has been approved for public 17 | * release and unlimited distribution. Please see Copyright notice for 18 | * non-US Government use and distribution. Carnegie Mellon® and CERT® are 19 | * registered in the U.S. Patent and Trademark Office by Carnegie Mellon 20 | * University. 21 | * 22 | * This Software includes and/or makes use of the following Third-Party 23 | * Software subject to its own license: 24 | * 1. wmediumd (https://github.com/bcopeland/wmediumd) 25 | * Copyright 2011 cozybit Inc.. 26 | * 2. mac80211_hwsim (https://github.com/torvalds/linux/blob/master/drivers/net/wireless/mac80211_hwsim.c) 27 | * Copyright 2008 Jouni Malinen 28 | * Copyright (c) 2011, Javier Lopez 29 | * 30 | * DM17-0952 31 | */ 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #ifdef _WIN32 39 | #include 40 | #ifndef _WIN32_WINNT 41 | #define _WIN32_WINNT 0x0501 /* Windows XP. */ 42 | #endif 43 | #include 44 | #include 45 | #include "vmci_sockets.h" 46 | #define CONFIG_FILE "C:/welled.conf" 47 | WSADATA wsa_data; 48 | #else 49 | #ifndef _ANDROID 50 | #include 51 | #endif 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | #define CONFIG_FILE "/etc/welled.conf" 59 | #endif 60 | 61 | #include "wmasterd.h" 62 | #include "vmci_sockets.h" 63 | 64 | /** Port used to send frames to wmasterd */ 65 | #define SEND_PORT 1111 66 | /** Address used to send frames to wmasterd */ 67 | #define SERVER_CID 2 68 | /** Buffer size for VMCI datagrams */ 69 | #define VMCI_BUFF_LEN 4096 70 | 71 | /** Whether to print verbose output */ 72 | int verbose; 73 | /** Whether to break loop after signal */ 74 | int running; 75 | /** FD for vmci send */ 76 | int sockfd; 77 | /** sockaddr_vm for vmci send */ 78 | struct sockaddr_vm servaddr_vmci; 79 | 80 | /** 81 | * @brief Prints the CLI help 82 | * @param exval - exit code 83 | * @return - void, calls exit() 84 | */ 85 | void show_usage(int exval) 86 | { 87 | /* allow help2man to read this */ 88 | setbuf(stdout, NULL); 89 | 90 | printf("gelled-ctrl - control program for GPS emulation\n\n"); 91 | 92 | printf("Usage: gelled-ctrl [-hVv] [-x|-y|-k|-d|-p] [-f] [-n ]\n\n"); 93 | 94 | printf("Options:\n"); 95 | printf(" -h, --help print this help and exit\n"); 96 | printf(" -V, --version print version and exit\n"); 97 | printf(" -v, --verbose verbose output\n"); 98 | printf(" -y, --latitude new latitude in decimal degrees\n"); 99 | printf(" -x, --longitude new longitude in decimal degrees\n"); 100 | printf(" -a, --altitude new altitude in meters\n"); 101 | printf(" -k, --knots new velocity in knots\n"); 102 | printf(" -d, --degrees new heading in degrees\n"); 103 | printf(" -p, --pitch new pitch angle in degrees\n"); 104 | printf(" -f, --follow follow gps feed of this vm ip/name\n"); 105 | printf(" -n, --name name for this this machine\n"); 106 | 107 | printf("\n"); 108 | printf("Copyright (C) 2021 Carnegie Mellon University\n\n"); 109 | printf("License GPLv2: GNU GPL version 2 \n"); 110 | printf("This is free software; you are free to change and redistribute it.\n"); 111 | printf("There is NO WARRANTY, to the extent permitted by law.\n\n"); 112 | 113 | printf("Report bugs to \n\n"); 114 | 115 | _exit(exval); 116 | } 117 | 118 | /** 119 | * @brief Display a hex dump of the passed buffer 120 | * this function was pulled off the web somehwere... seems to throw a 121 | * segfault when printing some of the netlink error message data 122 | * @param addr - address of buffer 123 | * @param len - size of buffer 124 | * @return void - assumes success 125 | */ 126 | void hex_dump(void *addr, int len) 127 | { 128 | int i; 129 | unsigned char buff[17]; 130 | unsigned char *pc; 131 | 132 | pc = (unsigned char *)addr; 133 | 134 | /* Process every byte in the data. */ 135 | for (i = 0; i < len; i++) { 136 | /* Multiple of 16 means new line (with line offset). */ 137 | if ((i % 16) == 0) { 138 | /* Just don't print ASCII for the zeroth line. */ 139 | if (i != 0) 140 | printf(" %s\n", buff); 141 | /* Output the offset. */ 142 | printf(" %04x ", i); 143 | } 144 | 145 | /* Now the hex code for the specific character. */ 146 | printf(" %02x", pc[i]); 147 | 148 | /* And store a printable ASCII character for later. */ 149 | if ((pc[i] < 0x20) || (pc[i] > 0x7e)) 150 | buff[i % 16] = '.'; 151 | else 152 | buff[i % 16] = pc[i]; 153 | buff[(i % 16) + 1] = '\0'; 154 | } 155 | 156 | /* Pad out last line if not exactly 16 characters. */ 157 | while ((i % 16) != 0) { 158 | printf(" "); 159 | i++; 160 | } 161 | 162 | /* And print the final ASCII bit. */ 163 | printf(" %s\n", buff); 164 | } 165 | 166 | /** 167 | * @brief main function 168 | */ 169 | int main(int argc, char *argv[]) 170 | { 171 | int afVMCI; 172 | int cid; 173 | int ret; 174 | int long_index; 175 | int opt; 176 | char *msg; 177 | int msg_len; 178 | int bytes; 179 | struct update_2 data; 180 | #ifndef ANDROID 181 | GKeyFile* gkf; 182 | gchar *key_value; 183 | #endif 184 | static struct option long_options[] = { 185 | {"help", no_argument, 0, 'h'}, 186 | {"version", no_argument, 0, 'V'}, 187 | {"verbose", no_argument, 0, 'v'}, 188 | {"latitude", required_argument, 0, 'y'}, 189 | {"longitude", required_argument, 0, 'x'}, 190 | {"altitude", required_argument, 0, 'a'}, 191 | {"knots", required_argument, 0, 'k'}, 192 | {"degrees", required_argument, 0, 'd'}, 193 | {"pitch", required_argument, 0, 'p'}, 194 | {"follow", required_argument, 0, 'f'}, 195 | {"name", required_argument, 0, 'n'}, 196 | {0, 0, 0, 0} 197 | }; 198 | 199 | memset(&data, 0, sizeof(struct update_2)); 200 | data.latitude = 9999; 201 | data.longitude = 9999; 202 | data.heading = -1; 203 | data.altitude = -1; 204 | data.velocity = -1; 205 | data.pitch = -1; 206 | 207 | #ifdef ANDROID 208 | goto options; 209 | #else 210 | /* parse config file */ 211 | gkf = g_key_file_new(); 212 | if (!g_key_file_load_from_file( 213 | gkf, CONFIG_FILE, G_KEY_FILE_NONE, NULL)) { 214 | g_print("Could not read config file %s\n", CONFIG_FILE); 215 | 216 | goto options; 217 | } 218 | 219 | key_value = g_key_file_get_string(gkf, "gelled", "name", NULL); 220 | if (key_value) 221 | g_snprintf(data.name, 1024, "%s", key_value); 222 | 223 | key_value = g_key_file_get_string(gkf, "gelled", "follow", NULL); 224 | if (key_value) 225 | g_snprintf(data.follow, FOLLOW_LEN, "%s", key_value); 226 | 227 | if (key_value) 228 | free(key_value); 229 | g_key_file_free(gkf); 230 | #endif 231 | 232 | options: 233 | while ((opt = getopt_long(argc, argv, "hVvy:x:a:k:d:f:n:p:", 234 | long_options, &long_index)) != -1) { 235 | switch (opt) { 236 | case 'h': 237 | show_usage(EXIT_SUCCESS); 238 | break; 239 | case 'V': 240 | /* allow help2man to read this */ 241 | setbuf(stdout, NULL); 242 | printf("gelled-ctrl version %s\n", VERSION_STR); 243 | _exit(EXIT_SUCCESS); 244 | break; 245 | case 'v': 246 | verbose = 1; 247 | break; 248 | case 'y': 249 | data.latitude = strtof(optarg, NULL); 250 | // check bounds 251 | if ((data.latitude < -90) || 252 | (data.latitude > 90)) { 253 | printf("latitude invalid\n"); 254 | _exit(EXIT_FAILURE); 255 | } 256 | break; 257 | case 'x': 258 | data.longitude = strtof(optarg, NULL); 259 | // check bounds 260 | if ((data.longitude < -180) || 261 | (data.longitude > 180)) { 262 | printf("longitude invalid\n"); 263 | _exit(EXIT_FAILURE); 264 | } 265 | break; 266 | case 'a': 267 | data.altitude = strtof(optarg, NULL); 268 | // check bounds between 0 and 85k ft (sr-71) 269 | if ((data.altitude < 0) || 270 | (data.altitude > 25908)) { 271 | printf("altitude invalid\n"); 272 | _exit(EXIT_FAILURE); 273 | } 274 | break; 275 | case 'k': 276 | data.velocity = strtof(optarg, NULL); 277 | // check bounds 278 | break; 279 | case 'd': 280 | data.heading = strtof(optarg, NULL); 281 | // check bounds 282 | break; 283 | case 'p': 284 | data.pitch = strtof(optarg, NULL); 285 | // check bounds 286 | break; 287 | case 'f': 288 | /* sync to another vm's gps feed */ 289 | strncpy(data.follow, optarg, FOLLOW_LEN); 290 | break; 291 | case 'n': 292 | strncpy(data.name, optarg, NAME_LEN); 293 | break; 294 | case ':': 295 | case '?': 296 | printf("Error - No such option: `%c'\n\n", 297 | optopt); 298 | show_usage(EXIT_FAILURE); 299 | break; 300 | } 301 | 302 | } 303 | if (optind < argc) 304 | show_usage(EXIT_FAILURE); 305 | 306 | #ifdef _WIN32 307 | WSAStartup(MAKEWORD(1,1), &wsa_data); 308 | #endif 309 | 310 | afVMCI = VMCISock_GetAFValue(); 311 | cid = VMCISock_GetLocalCID(); 312 | if (verbose) { 313 | printf("CID: %d\n", cid); 314 | printf("af: %d\n", afVMCI); 315 | } 316 | data.cid = cid; 317 | 318 | /* setup vmci client socket */ 319 | sockfd = socket(afVMCI, SOCK_DGRAM, 0); 320 | /* we can initalize this struct because it never changes */ 321 | memset(&servaddr_vmci, 0, sizeof(servaddr_vmci)); 322 | servaddr_vmci.svm_cid = SERVER_CID; 323 | servaddr_vmci.svm_port = SEND_PORT; 324 | servaddr_vmci.svm_family = afVMCI; 325 | if (sockfd < 0) { 326 | perror("socket"); 327 | _exit(EXIT_FAILURE); 328 | } 329 | 330 | msg_len = 7 + sizeof(struct update_2); 331 | msg = (char *)malloc(msg_len); 332 | memset(msg, 0, msg_len); 333 | snprintf(msg, msg_len, "gelled:"); 334 | memcpy(msg + 7, &data, sizeof(struct update_2)); 335 | 336 | // if (verbose) 337 | // hex_dump(msg, msg_len); 338 | 339 | bytes = sendto(sockfd, msg, msg_len, 0, 340 | (struct sockaddr *)&servaddr_vmci, 341 | sizeof(struct sockaddr)); 342 | 343 | if (bytes != msg_len) { 344 | perror("sendto"); 345 | } else { 346 | printf("gelled-ctrl: sent %d bytes to wmasterd\n", bytes); 347 | if (verbose) { 348 | printf("latitude: %f\n", data.latitude); 349 | printf("longitude: %f\n", data.longitude); 350 | printf("altitude: %f\n", data.altitude); 351 | printf("velocity: %f\n", data.velocity); 352 | printf("heading: %f\n", data.heading); 353 | printf("pitch: %f\n", data.pitch); 354 | printf("follow: %s\n", data.follow); 355 | } 356 | } 357 | 358 | free(msg); 359 | 360 | close(sockfd); 361 | 362 | _exit(EXIT_SUCCESS); 363 | } 364 | 365 | -------------------------------------------------------------------------------- /src/ieee80211.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wmediumd, wireless medium simulator for mac80211_hwsim kernel module 3 | * Copyright (c) 2011 cozybit Inc. 4 | * 5 | * Author: Javier Lopez 6 | * Javier Cardona 7 | * 8 | * This program is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU General Public License 10 | * as published by the Free Software Foundation; either version 2 11 | * of the License, or (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 21 | * 02110-1301, USA. 22 | */ 23 | 24 | #ifndef IEEE80211_H_ 25 | #define IEEE80211_H_ 26 | 27 | #define u8 uint8_t 28 | 29 | #define IEEE80211_AVAILABLE_RATES 12 30 | #define IEEE80211_MAX_RATES_PER_TX 5 31 | 32 | #define IEEE80211_FTYPE_MGMT 0x0000 33 | #define IEEE80211_FTYPE_CTL 0x0004 34 | #define IEEE80211_FTYPE_DATA 0x0008 35 | #define IEEE80211_FTYPE_EXT 0x000c 36 | 37 | /* control */ 38 | #define IEEE80211_STYPE_CTL_EXT 0x0060 39 | #define IEEE80211_STYPE_BACK_REQ 0x0080 40 | #define IEEE80211_STYPE_BACK 0x0090 41 | #define IEEE80211_STYPE_PSPOLL 0x00A0 42 | #define IEEE80211_STYPE_RTS 0x00B0 43 | #define IEEE80211_STYPE_CTS 0x00C0 44 | #define IEEE80211_STYPE_ACK 0x00D0 45 | #define IEEE80211_STYPE_CFEND 0x00E0 46 | #define IEEE80211_STYPE_CFENDACK 0x00F0 47 | 48 | /** 49 | * \brief IEEE80211 header 50 | * 51 | * IEEE80211 header fields 52 | */ 53 | /* 54 | struct ieee80211_hdr { 55 | unsigned char frame_control[2]; 56 | unsigned char duration_id[2]; 57 | unsigned char addr1[6]; 58 | unsigned char addr2[6]; 59 | unsigned char addr3[6]; 60 | unsigned char seq_ctrl[2]; 61 | unsigned char addr4[6]; 62 | }; 63 | */ 64 | 65 | struct ieee80211_hdr { 66 | __le16 frame_control; 67 | __le16 duration_id; 68 | u8 addr1[ETH_ALEN]; 69 | u8 addr2[ETH_ALEN]; 70 | u8 addr3[ETH_ALEN]; 71 | __le16 seq_ctrl; 72 | u8 addr4[ETH_ALEN]; 73 | }; 74 | 75 | #endif /* IEEE80211_H_ */ 76 | -------------------------------------------------------------------------------- /src/nodes.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Carnegie Mellon University. All Rights Reserved. 3 | * 4 | * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING 5 | * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON 6 | * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 7 | * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR 8 | * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF 9 | * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF 10 | * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT 11 | * INFRINGEMENT. 12 | * 13 | * Released under a GNU GPL 2.0-style license, please see license.txt or 14 | * contact permission@sei.cmu.edu for full terms. 15 | * 16 | * [DISTRIBUTION STATEMENT A] This material has been approved for public 17 | * release and unlimited distribution. Please see Copyright notice for 18 | * non-US Government use and distribution. Carnegie Mellon® and CERT® are 19 | * registered in the U.S. Patent and Trademark Office by Carnegie Mellon 20 | * University. 21 | * 22 | * This Software includes and/or makes use of the following Third-Party 23 | * Software subject to its own license: 24 | * 1. wmediumd (https://github.com/bcopeland/wmediumd) 25 | * Copyright 2011 cozybit Inc.. 26 | * 2. mac80211_hwsim (https://github.com/torvalds/linux/blob/master/drivers/net/wireless/mac80211_hwsim.c) 27 | * Copyright 2008 Jouni Malinen 28 | * Copyright (c) 2011, Javier Lopez 29 | * 30 | * DM17-0952 31 | */ 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | #include "nodes.h" 46 | 47 | struct device_node *head; 48 | 49 | /** 50 | * @brief Adds a node to the linked list 51 | * @param node - the new device node 52 | * @return void - success always assumed 53 | */ 54 | void add_node(struct device_node *node) 55 | { 56 | struct device_node *curr; 57 | 58 | curr = NULL; 59 | 60 | /* create new node */ 61 | if (head == NULL) { 62 | /* add first node */ 63 | head = node; 64 | } else { 65 | /* traverse to end of list */ 66 | curr = head; 67 | while (curr->next != NULL) 68 | curr = curr->next; 69 | /* add to node to end of list */ 70 | curr->next = node; 71 | } 72 | } 73 | 74 | /** 75 | * @brief Searches the linked list for a given node 76 | * @param name - name of interface we are searching for 77 | * @return returns a pointer to the node 78 | */ 79 | struct device_node *get_node_by_name(char *name) 80 | { 81 | struct device_node *curr; 82 | 83 | curr = head; 84 | 85 | while (curr != NULL) { 86 | if (strcmp(curr->name, name) == 0) 87 | return curr; 88 | 89 | curr = curr->next; 90 | } 91 | 92 | return NULL; 93 | } 94 | 95 | /** 96 | * @brief Searches the linked list for a given node 97 | * @param index - index of interface we are searching for 98 | * @return returns a pointer to the node 99 | */ 100 | struct device_node *get_node_by_index(int index) 101 | { 102 | struct device_node *curr; 103 | 104 | curr = head; 105 | 106 | while (curr != NULL) { 107 | if (curr->index == index) 108 | return curr; 109 | 110 | curr = curr->next; 111 | } 112 | 113 | return NULL; 114 | } 115 | 116 | /** 117 | * @brief Searches the linked list for a given node 118 | * @param pos - position of interface we are searching for 119 | * @return returns a pointer to the node 120 | */ 121 | struct device_node *get_node_by_pos(int pos) 122 | { 123 | struct device_node *curr; 124 | int i; 125 | 126 | curr = head; 127 | i = 0; 128 | 129 | while (curr != NULL) { 130 | if (i == pos) 131 | return curr; 132 | i++; 133 | curr = curr->next; 134 | } 135 | 136 | return NULL; 137 | } 138 | 139 | /** 140 | * @brief Searches the linked list until a monitor mode device is found 141 | * @return true if device is in monitor mode 142 | */ 143 | int monitor_mode(void) 144 | { 145 | struct device_node *curr; 146 | 147 | curr = head; 148 | 149 | while (curr != NULL) { 150 | if (curr->iftype == NL80211_IFTYPE_MONITOR) 151 | return 1; 152 | curr = curr->next; 153 | } 154 | 155 | return 0; 156 | } 157 | 158 | /** 159 | * @brief Lists the nodes in the linked list 160 | * @return void 161 | */ 162 | void list_nodes(void) 163 | { 164 | struct device_node *curr; 165 | int i; 166 | 167 | i = 0; 168 | 169 | curr = head; 170 | 171 | while (curr != NULL) { 172 | printf("N[%d]:name: %s\n", i, curr->name); 173 | printf("N[%d]:index: %d\n", i, curr->index); 174 | if (curr->iftype == 2) 175 | printf("M[%d]:iftype: NL80211_IFTYPE_STATION\n", i); 176 | else if (curr->iftype == 3) 177 | printf("M[%d]:iftype: NL80211_IFTYPE_AP\n", i); 178 | else if (curr->iftype == 8) 179 | printf("M[%d]:iftype: NL80211_IFTYPE_MONITOR\n", i); 180 | else 181 | printf("M[%d]:iftype: %d\n", i, curr->iftype); 182 | printf("N[%d]:address: %02X:%02X:%02X:%02X:%02X:%02X\n", i, 183 | curr->address[0], curr->address[1], 184 | curr->address[2], curr->address[3], 185 | curr->address[4], curr->address[5]); 186 | printf("N[%d]:perm_addr: %02X:%02X:%02X:%02X:%02X:%02X\n", i, 187 | curr->perm_addr[0], curr->perm_addr[1], 188 | curr->perm_addr[2], curr->perm_addr[3], 189 | curr->perm_addr[4], curr->perm_addr[5]); 190 | i++; 191 | curr = curr->next; 192 | } 193 | } 194 | 195 | /** 196 | * @brief Removes a node from the linked list 197 | * @param name - name of interface to be removed 198 | * @return success or failure 199 | */ 200 | int remove_node_by_name(char *name) 201 | { 202 | struct device_node *curr; 203 | struct device_node *prev; 204 | 205 | curr = head; 206 | prev = NULL; 207 | 208 | /* traverse while not null and no match */ 209 | while (curr != NULL && !(strcmp(curr->name, name))) { 210 | prev = curr; 211 | curr = curr->next; 212 | } 213 | 214 | /* exit if we hit the end of the list */ 215 | if (curr == NULL) 216 | return 0; 217 | 218 | /* delete node */ 219 | if (prev == NULL) 220 | head = curr->next; 221 | else 222 | prev->next = curr->next; 223 | 224 | free(curr->name); 225 | free(curr); 226 | 227 | return 1; 228 | } 229 | 230 | /** 231 | * @brief Removes a node from the linked list 232 | * @param index - index of interface to be removed 233 | * @return success or failure 234 | */ 235 | int remove_node_by_index(int index) 236 | { 237 | struct device_node *curr; 238 | struct device_node *prev; 239 | 240 | curr = head; 241 | prev = NULL; 242 | 243 | /* traverse while not null and no match */ 244 | while (curr != NULL && (curr->index != index)) { 245 | prev = curr; 246 | curr = curr->next; 247 | } 248 | 249 | /* exit if we hit the end of the list */ 250 | if (curr == NULL) 251 | return 0; 252 | 253 | /* delete node */ 254 | if (prev == NULL) 255 | head = curr->next; 256 | else 257 | prev->next = curr->next; 258 | 259 | free(curr->name); 260 | free(curr); 261 | 262 | return 1; 263 | } 264 | 265 | /** 266 | * @brief Frees all of the nodes in the linked list 267 | * @return void - assumes success 268 | */ 269 | void free_list(void) 270 | { 271 | struct device_node *temp = NULL; 272 | struct device_node *curr = NULL; 273 | 274 | curr = head; 275 | 276 | while (curr != NULL) { 277 | temp = curr; 278 | curr = curr->next; 279 | free(temp->name); 280 | free(temp); 281 | } 282 | 283 | head = NULL; 284 | } 285 | 286 | -------------------------------------------------------------------------------- /src/nodes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Carnegie Mellon University. All Rights Reserved. 3 | * 4 | * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING 5 | * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON 6 | * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 7 | * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR 8 | * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF 9 | * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF 10 | * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT 11 | * INFRINGEMENT. 12 | * 13 | * Released under a GNU GPL 2.0-style license, please see license.txt or 14 | * contact permission@sei.cmu.edu for full terms. 15 | * 16 | * [DISTRIBUTION STATEMENT A] This material has been approved for public 17 | * release and unlimited distribution. Please see Copyright notice for 18 | * non-US Government use and distribution. Carnegie Mellon® and CERT® are 19 | * registered in the U.S. Patent and Trademark Office by Carnegie Mellon 20 | * University. 21 | * 22 | * This Software includes and/or makes use of the following Third-Party 23 | * Software subject to its own license: 24 | * 1. wmediumd (https://github.com/bcopeland/wmediumd) 25 | * Copyright 2011 cozybit Inc.. 26 | * 2. mac80211_hwsim (https://github.com/torvalds/linux/blob/master/drivers/net/wireless/mac80211_hwsim.c) 27 | * Copyright 2008 Jouni Malinen 28 | * Copyright (c) 2011, Javier Lopez 29 | * 30 | * DM17-0952 31 | */ 32 | 33 | #ifndef NODES_H_ 34 | #define NODES_H_ 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | #define MAX_ADDR_LEN 32 41 | 42 | struct device_node { 43 | char *name; 44 | int index; 45 | int iftype; 46 | unsigned char address[ETH_ALEN]; 47 | unsigned char perm_addr[ETH_ALEN]; 48 | struct device_node *next; 49 | }; 50 | 51 | int monitor_mode(void); 52 | int remove_node_by_name(char *); 53 | int remove_node_by_index(int); 54 | 55 | void add_node(struct device_node *); 56 | void list_nodes(void); 57 | void free_list(void); 58 | 59 | struct device_node *get_node_by_name(char *); 60 | struct device_node *get_node_by_index(int); 61 | struct device_node *get_node_by_pos(int); 62 | 63 | #endif /* NODES_H_ */ 64 | 65 | -------------------------------------------------------------------------------- /src/welled.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Carnegie Mellon University. All Rights Reserved. 3 | * 4 | * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING 5 | * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON 6 | * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 7 | * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR 8 | * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF 9 | * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF 10 | * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT 11 | * INFRINGEMENT. 12 | * 13 | * Released under a GNU GPL 2.0-style license, please see license.txt or 14 | * contact permission@sei.cmu.edu for full terms. 15 | * 16 | * [DISTRIBUTION STATEMENT A] This material has been approved for public 17 | * release and unlimited distribution. Please see Copyright notice for 18 | * non-US Government use and distribution. Carnegie Mellon® and CERT® are 19 | * registered in the U.S. Patent and Trademark Office by Carnegie Mellon 20 | * University. 21 | * 22 | * This Software includes and/or makes use of the following Third-Party 23 | * Software subject to its own license: 24 | * 1. wmediumd (https://github.com/bcopeland/wmediumd) 25 | * Copyright 2011 cozybit Inc.. 26 | * 2. mac80211_hwsim (https://github.com/torvalds/linux/blob/master/drivers/net/wireless/mac80211_hwsim.c) 27 | * Copyright 2008 Jouni Malinen 28 | * Copyright (c) 2011, Javier Lopez 29 | * 30 | * DM17-0952 31 | */ 32 | 33 | #ifdef _OPENWRT 34 | struct ether_addr 35 | { 36 | u_int8_t ether_addr_octet[ETH_ALEN]; 37 | } __attribute__ ((__packed__)); 38 | #else 39 | #include 40 | #endif 41 | 42 | #include "ieee80211.h" 43 | 44 | #ifndef WELLED_H_ 45 | #define WELLED_H_ 46 | 47 | static struct { 48 | struct nl_sock *nls; 49 | int nl80211_id; 50 | } wifi; 51 | 52 | #define BIT(x) (1 << (x)) 53 | 54 | /** 55 | * enum hwsim_tx_control_flags - flags to describe transmission info/status 56 | * 57 | * These flags are used to give the wmediumd extra information in order to 58 | * modify its behavior for each frame 59 | * 60 | * HWSIM_TX_CTL_REQ_TX_STATUS: require TX status callback for this frame. 61 | * HWSIM_TX_CTL_NO_ACK: tell the wmediumd not to wait for an ack 62 | * HWSIM_TX_STAT_ACK: Frame was acknowledged 63 | * 64 | */ 65 | enum hwsim_tx_control_flags { 66 | HWSIM_TX_CTL_REQ_TX_STATUS = BIT(0), 67 | HWSIM_TX_CTL_NO_ACK = BIT(1), 68 | HWSIM_TX_STAT_ACK = BIT(2), 69 | }; 70 | 71 | /** 72 | * enum hwsim_commands - supported hwsim commands 73 | * 74 | * HWSIM_CMD_UNSPEC: unspecified command to catch errors 75 | * 76 | * HWSIM_CMD_REGISTER: request to register and received all broadcasted 77 | * frames by any mac80211_hwsim radio device. 78 | * HWSIM_CMD_FRAME: send/receive a broadcasted frame from/to kernel/user 79 | * space, uses: 80 | * %HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_ADDR_RECEIVER, 81 | * %HWSIM_ATTR_FRAME, %HWSIM_ATTR_FLAGS, %HWSIM_ATTR_RX_RATE, 82 | * %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE, %HWSIM_ATTR_FREQ (optional) 83 | * HWSIM_CMD_TX_INFO_FRAME: Transmission info report from user space to 84 | * kernel, uses: 85 | * %HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_FLAGS, 86 | * %HWSIM_ATTR_TX_INFO, %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE 87 | * HWSIM_CMD_NEW_RADIO: create a new radio with the given parameters, 88 | * returns the radio ID (>= 0) or negative on errors, if successful 89 | * then multicast the result 90 | * HWSIM_CMD_DEL_RADIO: destroy a radio, reply is multicasted 91 | * HWSIM_CMD_GET_RADIO: fetch information about existing radios, uses: 92 | * %HWSIM_ATTR_RADIO_ID 93 | * __HWSIM_CMD_MAX: enum limit 94 | */ 95 | enum { 96 | HWSIM_CMD_UNSPEC, 97 | HWSIM_CMD_REGISTER, 98 | HWSIM_CMD_FRAME, 99 | HWSIM_CMD_TX_INFO_FRAME, 100 | HWSIM_CMD_NEW_RADIO, 101 | HWSIM_CMD_DEL_RADIO, 102 | HWSIM_CMD_GET_RADIO, 103 | __HWSIM_CMD_MAX, 104 | }; 105 | 106 | #define HWSIM_CMD_MAX (_HWSIM_CMD_MAX - 1) 107 | #define HWSIM_CMD_CREATE_RADIO HWSIM_CMD_NEW_RADIO 108 | #define HWSIM_CMD_DESTROY_RADIO HWSIM_CMD_DEL_RADIO 109 | 110 | /** 111 | * enum hwsim_attrs - hwsim netlink attributes 112 | * 113 | * HWSIM_ATTR_UNSPEC: unspecified attribute to catch errors 114 | * 115 | * HWSIM_ATTR_ADDR_RECEIVER: MAC address of the radio device that 116 | * the frame is broadcasted to 117 | * HWSIM_ATTR_ADDR_TRANSMITTER: MAC address of the radio device that 118 | * the frame was broadcasted from 119 | * HWSIM_ATTR_FRAME: Data array 120 | * HWSIM_ATTR_FLAGS: mac80211 transmission flags, used to process 121 | properly the frame at user space 122 | * HWSIM_ATTR_RX_RATE: estimated rx rate index for this frame at user 123 | space 124 | * HWSIM_ATTR_SIGNAL: estimated RX signal for this frame at user 125 | space 126 | * HWSIM_ATTR_TX_INFO: ieee80211_tx_rate array 127 | * HWSIM_ATTR_COOKIE: sk_buff cookie to identify the frame 128 | * HWSIM_ATTR_CHANNELS: u32 attribute used with the %HWSIM_CMD_CREATE_RADIO 129 | * command giving the number of channels supported by the new radio 130 | * HWSIM_ATTR_RADIO_ID: u32 attribute used with %HWSIM_CMD_DESTROY_RADIO 131 | * only to destroy a radio 132 | * HWSIM_ATTR_REG_HINT_ALPHA2: alpha2 for regulatoro driver hint 133 | * (nla string, length 2) 134 | * HWSIM_ATTR_REG_CUSTOM_REG: custom regulatory domain index (u32 attribute) 135 | * HWSIM_ATTR_REG_STRICT_REG: request REGULATORY_STRICT_REG (flag attribute) 136 | * HWSIM_ATTR_SUPPORT_P2P_DEVICE: support P2P Device virtual interface (flag) 137 | * HWSIM_ATTR_USE_CHANCTX: used with the %HWSIM_CMD_CREATE_RADIO 138 | * command to force use of channel contexts even when only a 139 | * single channel is supported 140 | * HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE: used with the %HWSIM_CMD_CREATE_RADIO 141 | * command to force radio removal when process that created the radio dies 142 | * HWSIM_ATTR_RADIO_NAME: Name of radio, e.g. phy666 143 | * HWSIM_ATTR_NO_VIF: Do not create vif (wlanX) when creating radio. 144 | * HWSIM_ATTR_FREQ: Frequency at which packet is transmitted or received. 145 | * __HWSIM_ATTR_MAX: enum limit 146 | */ 147 | 148 | enum { 149 | HWSIM_ATTR_UNSPEC, 150 | HWSIM_ATTR_ADDR_RECEIVER, 151 | HWSIM_ATTR_ADDR_TRANSMITTER, 152 | HWSIM_ATTR_FRAME, 153 | HWSIM_ATTR_FLAGS, 154 | HWSIM_ATTR_RX_RATE, 155 | HWSIM_ATTR_SIGNAL, 156 | HWSIM_ATTR_TX_INFO, 157 | HWSIM_ATTR_COOKIE, 158 | HWSIM_ATTR_CHANNELS, 159 | HWSIM_ATTR_RADIO_ID, 160 | HWSIM_ATTR_REG_HINT_ALPHA2, 161 | HWSIM_ATTR_REG_CUSTOM_REG, 162 | HWSIM_ATTR_REG_STRICT_REG, 163 | HWSIM_ATTR_SUPPORT_P2P_DEVICE, 164 | HWSIM_ATTR_USE_CHANCTX, 165 | HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE, 166 | HWSIM_ATTR_RADIO_NAME, 167 | HWSIM_ATTR_NO_VIF, 168 | HWSIM_ATTR_FREQ, 169 | __HWSIM_ATTR_MAX, 170 | }; 171 | 172 | #define HWSIM_ATTR_MAX (__HWSIM_ATTR_MAX - 1) 173 | 174 | 175 | #define VERSION_NR 1 176 | 177 | #include 178 | 179 | /** 180 | * struct hwsim_tx_rate - rate selection/status 181 | * 182 | * idx: rate index to attempt to send with 183 | * count: number of tries in this rate before going to the next rate 184 | * 185 | * A value of -1 for idx indicates an invalid rate and, if used 186 | * in an array of retry rates, that no more rates should be tried. 187 | * 188 | * When used for transmit status reporting, the driver should 189 | * always report the rate and number of retries used. 190 | * 191 | */ 192 | struct hwsim_tx_rate { 193 | signed char idx; 194 | unsigned char count; 195 | }; 196 | 197 | void show_usage(int); 198 | void hex_dump(void *, int); 199 | void free_mem(void); 200 | void signal_handler(void); 201 | void set_all_rates_invalid(struct hwsim_tx_rate *); 202 | int get_signal_by_rate(int); 203 | void nlh_print(struct nlmsghdr *); 204 | void gnlh_print(struct genlmsghdr *); 205 | void attrs_print(struct nlattr *attrs[]); 206 | static int process_messages_cb(struct nl_msg *, void *); 207 | int init_netlink(void); 208 | int send_register_msg(void); 209 | void recv_from_master(void); 210 | void dellink(struct nlmsghdr *); 211 | void newlink(struct nlmsghdr *); 212 | static int process_nl_route_event(struct nl_msg *, void *); 213 | //void process_event(int); 214 | void *monitor_devices(void *); 215 | void *monitor_hwsim(void *); 216 | static int finish_handler(struct nl_msg *, void *); 217 | static int list_interface_handler(struct nl_msg *, void *); 218 | int nl80211_get_interface(int); 219 | static void generate_ack_frame(uint32_t, struct ether_addr*, struct ether_addr*); 220 | void mac_address_to_string(char *, struct ether_addr *); 221 | void print_debug(int, char *, ...); 222 | 223 | #endif /* WELLED_H_ */ 224 | -------------------------------------------------------------------------------- /src/windows_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Carnegie Mellon University. All Rights Reserved. 3 | * 4 | * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING 5 | * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON 6 | * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 7 | * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR 8 | * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF 9 | * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF 10 | * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT 11 | * INFRINGEMENT. 12 | * 13 | * Released under a GNU GPL 2.0-style license, please see license.txt or 14 | * contact permission@sei.cmu.edu for full terms. 15 | * 16 | * [DISTRIBUTION STATEMENT A] This material has been approved for public 17 | * release and unlimited distribution. Please see Copyright notice for 18 | * non-US Government use and distribution. Carnegie Mellon® and CERT® are 19 | * registered in the U.S. Patent and Trademark Office by Carnegie Mellon 20 | * University. 21 | * 22 | * This Software includes and/or makes use of the following Third-Party 23 | * Software subject to its own license: 24 | * 1. wmediumd (https://github.com/bcopeland/wmediumd) 25 | * Copyright 2011 cozybit Inc.. 26 | * 2. mac80211_hwsim (https://github.com/torvalds/linux/blob/master/drivers/net/wireless/mac80211_hwsim.c) 27 | * Copyright 2008 Jouni Malinen 28 | * Copyright (c) 2011, Javier Lopez 29 | * 30 | * DM17-0952 31 | */ 32 | 33 | void windows_error(char *); 34 | 35 | -------------------------------------------------------------------------------- /src/wmasterd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Carnegie Mellon University. All Rights Reserved. 3 | * 4 | * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING 5 | * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON 6 | * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 7 | * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR 8 | * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF 9 | * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF 10 | * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT 11 | * INFRINGEMENT. 12 | * 13 | * Released under a GNU GPL 2.0-style license, please see license.txt or 14 | * contact permission@sei.cmu.edu for full terms. 15 | * 16 | * [DISTRIBUTION STATEMENT A] This material has been approved for public 17 | * release and unlimited distribution. Please see Copyright notice for 18 | * non-US Government use and distribution. Carnegie Mellon® and CERT® are 19 | * registered in the U.S. Patent and Trademark Office by Carnegie Mellon 20 | * University. 21 | * 22 | * This Software includes and/or makes use of the following Third-Party 23 | * Software subject to its own license: 24 | * 1. wmediumd (https://github.com/bcopeland/wmediumd) 25 | * Copyright 2011 cozybit Inc.. 26 | * 2. mac80211_hwsim (https://github.com/torvalds/linux/blob/master/drivers/net/wireless/mac80211_hwsim.c) 27 | * Copyright 2008 Jouni Malinen 28 | * Copyright (c) 2011, Javier Lopez 29 | * 30 | * DM17-0952 31 | */ 32 | 33 | #ifndef WMASTERD_H_ 34 | 35 | /** Buffer size for NMEA sentences */ 36 | #define NMEA_LEN 100 37 | 38 | #define FOLLOW_LEN 1024 39 | #define NAME_LEN 1024 40 | #define UUID_LEN 37 41 | 42 | #ifdef _WIN32 43 | #define LOG_EMERG 0 /* system is unusable */ 44 | #define LOG_ALERT 1 /* action must be taken immediately */ 45 | #define LOG_CRIT 2 /* critical conditions */ 46 | #define LOG_ERR 3 /* error conditions */ 47 | #define LOG_WARNING 4 /* warning conditions */ 48 | #define LOG_NOTICE 5 /* normal but significant condition */ 49 | #define LOG_INFO 6 /* informational */ 50 | #define LOG_DEBUG 7 /* debug-level messages */ 51 | #endif 52 | 53 | /** 54 | * Structure for tracking welled node locations 55 | * latitude and longitude are stored in degrees decimal 56 | * velocity is in knots 57 | * heading is in degrees 58 | */ 59 | struct location { 60 | char follow[FOLLOW_LEN]; 61 | float latitude; 62 | float longitude; 63 | float altitude; 64 | float velocity; 65 | float heading; 66 | float pitch; 67 | char nmea_zda[NMEA_LEN]; 68 | char nmea_gga[NMEA_LEN]; 69 | char nmea_rmc[NMEA_LEN]; 70 | char nmea_pashr[NMEA_LEN]; 71 | /* 72 | char nmea_gsa[NMEA_LEN]; 73 | char nmea_gbs[NMEA_LEN]; 74 | char nmea_gsv1[NMEA_LEN]; 75 | char nmea_gsv2[NMEA_LEN]; 76 | char nmea_gsv3[NMEA_LEN]; 77 | */ 78 | }; 79 | 80 | struct update { 81 | char follow[FOLLOW_LEN]; 82 | float latitude; 83 | float longitude; 84 | float altitude; 85 | float velocity; 86 | float heading; 87 | int room_id; 88 | char name[1024]; 89 | char address[16]; 90 | unsigned int cid; 91 | }; 92 | 93 | struct update_2 { 94 | char version[8]; 95 | char follow[FOLLOW_LEN]; 96 | float latitude; 97 | float longitude; 98 | float altitude; 99 | float velocity; 100 | float heading; 101 | float pitch; 102 | char room[UUID_LEN]; 103 | char name[NAME_LEN]; 104 | char isolation_tag[UUID_LEN]; 105 | unsigned int cid; 106 | }; 107 | 108 | /** 109 | * \brief Structure for tracking welled nodes 110 | * 111 | * This is the node used to track welled clients in a linked list 112 | * We will retransmit all frames and netlink data to these clients 113 | */ 114 | struct client { 115 | /** CID */ 116 | unsigned int cid; 117 | /** Isolation Tag */ 118 | char isolation_tag[UUID_LEN]; 119 | /** RoomID */ 120 | //int room_id; 121 | /** GUID for Room */ 122 | char room[UUID_LEN]; 123 | /** VM name */ 124 | char name[NAME_LEN]; 125 | /** VM UUID, unused */ 126 | char uuid[UUID_LEN]; 127 | /** epoch time stamp of last access */ 128 | int time; 129 | /** GPS location data */ 130 | struct location loc; 131 | /** Pointer to next node */ 132 | struct client *next; 133 | }; 134 | 135 | void show_usage(int); 136 | void block_signal(void); 137 | void print_node(struct client *); 138 | void unblock_signal(void); 139 | int parse_vmx(char *, unsigned int, char *, char *, char *); 140 | void get_vm_info(unsigned int, char *, char *, char *); 141 | void add_node_vmci(unsigned int, char *, char *, char *); 142 | void clear_inactive_nodes(void); 143 | struct client *search_node_vmci(unsigned int); 144 | struct client *search_node_name(char *); 145 | void list_nodes_vmci(void); 146 | void remove_node_vmci(unsigned int); 147 | void send_to_hosts(char *, int, char *); 148 | void send_to_nodes_vmci(char *, int, struct client *); 149 | void send_gps_to_nodes(void); 150 | void *produce_nmea(void *); 151 | void free_list(void); 152 | void usr1_handler(void); 153 | void signal_handler(void); 154 | void recv_from_welled_vmci(void); 155 | void *recv_from_hosts(void *); 156 | void update_node_location(struct client *, struct update_2 *); 157 | void update_node_info(struct client *, struct update_2 *); 158 | void update_cache_file_info(struct client *); 159 | void update_cache_file_location(struct client *); 160 | void update_followers(struct client *); 161 | int get_distance(struct client *, struct client *); 162 | unsigned int nmea_checksum(char *); 163 | void create_new_sentences(struct client *); 164 | double rad2deg(double); 165 | double deg2rad(double); 166 | void dec_deg_to_dec_min(float, char *, int); 167 | void print_debug(int, char *, ...); 168 | 169 | #endif /* WMASTERD_H_ */ 170 | 171 | -------------------------------------------------------------------------------- /update_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | OLDVERSION=`grep PKG_RELEASE Makefile | cut -f 2 -d =` 4 | OLDMAJ=`echo $OLDVERSION | cut -f 1 -d .` 5 | OLDMIN=`echo $OLDVERSION | cut -f 2 -d .` 6 | OLDREV=`echo $OLDVERSION | cut -f 3 -d .` 7 | 8 | if [ $1 == "major" ]; then 9 | echo major release being incremented 10 | ((OLDMAJ++)) 11 | elif [ $1 == "minor" ]; then 12 | echo minor release being incremented 13 | ((OLDMIN++)) 14 | elif [ $1 == "revision" ]; then 15 | echo revision release being incremented 16 | ((OLDREV++)) 17 | else 18 | echo "usage: $0 [major|minor|revision]" 19 | fi 20 | 21 | NEWVERSION=$OLDMAJ.$OLDMIN.$OLDREV 22 | echo $NEWVERSION 23 | 24 | for FILE in Makefile Android.mk Doxyfile src/Makefile; do 25 | sed -i "s/$OLDVERSION/$NEWVERSION/g" $FILE 26 | done 27 | 28 | -------------------------------------------------------------------------------- /vmw.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2018 Carnegie Mellon University. All Rights Reserved. 2 | # 3 | # NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING 4 | # INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON 5 | # UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | # AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR 7 | # PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF 8 | # THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF 9 | # ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT 10 | # INFRINGEMENT. 11 | # 12 | # Released under a GNU GPL 2.0-style license, please see license.txt or 13 | # contact permission@sei.cmu.edu for full terms. 14 | # 15 | # [DISTRIBUTION STATEMENT A] This material has been approved for public 16 | # release and unlimited distribution. Please see Copyright notice for 17 | # non-US Government use and distribution. Carnegie Mellon® and CERT® are 18 | # registered in the U.S. Patent and Trademark Office by Carnegie Mellon 19 | # University. 20 | # 21 | # This Software includes and/or makes use of the following Third-Party 22 | # Software subject to its own license: 23 | # 1. wmediumd (https://github.com/bcopeland/wmediumd) 24 | # Copyright 2011 cozybit Inc.. 25 | # 2. mac80211_hwsim (https://github.com/torvalds/linux/blob/master/drivers/net/wireless/mac80211_hwsim.c) 26 | # Copyright 2008 Jouni Malinen 27 | # Copyright (c) 2011, Javier Lopez 28 | # 29 | # DM17-0952 30 | 31 | #under Device Drivers, Misc devices on Linux 32 | define KernelPackage/vmw_vmci 33 | SUBMENU:=$(VIRTUAL_MENU) 34 | TITLE:=VMCI 35 | DEPENDS:=@(TARGET_x86_64||TARGET_x86_vmware_guest) 36 | KCONFIG:=CONFIG_VMWARE_VMCI=m 37 | FILES:=$(LINUX_DIR)/drivers/misc/vmw_vmci/vmw_vmci.ko 38 | AUTOLOAD:=$(call AutoLoad,51,vmw_vmci) 39 | endef 40 | 41 | define KernelPackage/vmw_vmci/description 42 | VMCI driver 43 | endef 44 | 45 | $(eval $(call KernelPackage,vmw_vmci)) 46 | 47 | #under Networking Support, Networking Options on Linux 48 | define KernelPackage/vsock 49 | SUBMENU:=$(VIRTUAL_MENU) 50 | TITLE:=VSOCK 51 | DEPENDS:=@(TARGET_x86_64||TARGET_x86_vmware_guest) 52 | KCONFIG:=CONFIG_VSOCKETS=m 53 | FILES:=$(LINUX_DIR)/net/vmw_vsock/vsock.ko 54 | AUTOLOAD:=$(call AutoLoad,52,vsock) 55 | endef 56 | 57 | define KernelPackage/vmw_vsock/description 58 | VMWare VSOCK 59 | endef 60 | 61 | $(eval $(call KernelPackage,vsock)) 62 | 63 | #under Networking Support, Networking Options on Linux 64 | define KernelPackage/vmw_vsock_vmci_transport 65 | SUBMENU:=$(VIRTUAL_MENU) 66 | TITLE:=VSOCK VMCI Transport 67 | DEPENDS:=@(TARGET_x86_64||TARGET_x86_vmware_guest) +kmod-vmw_vmci +kmod-vsock 68 | KCONFIG:=CONFIG_VMWARE_VMCI_VSOCKETS=m 69 | FILES:=$(LINUX_DIR)/net/vmw_vsock/vmw_vsock_vmci_transport.ko 70 | AUTOLOAD:=$(call AutoLoad,53,vmw_vsock_vmci_transport) 71 | endef 72 | 73 | define KernelPackage/vmw_vsock_vmci_transport/description 74 | VMWare VSOCK transport driver 75 | endef 76 | 77 | $(eval $(call KernelPackage,vmw_vsock_vmci_transport)) 78 | 79 | -------------------------------------------------------------------------------- /vmware_guest/profiles/000-Generic.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2018 Carnegie Mellon University. All Rights Reserved. 2 | # 3 | # NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING 4 | # INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON 5 | # UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | # AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR 7 | # PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF 8 | # THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF 9 | # ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT 10 | # INFRINGEMENT. 11 | # 12 | # Released under a GNU GPL 2.0-style license, please see license.txt or 13 | # contact permission@sei.cmu.edu for full terms. 14 | # 15 | # [DISTRIBUTION STATEMENT A] This material has been approved for public 16 | # release and unlimited distribution. Please see Copyright notice for 17 | # non-US Government use and distribution. Carnegie Mellon® and CERT® are 18 | # registered in the U.S. Patent and Trademark Office by Carnegie Mellon 19 | # University. 20 | # 21 | # This Software includes and/or makes use of the following Third-Party 22 | # Software subject to its own license: 23 | # 1. wmediumd (https://github.com/bcopeland/wmediumd) 24 | # Copyright 2011 cozybit Inc.. 25 | # 2. mac80211_hwsim (https://github.com/torvalds/linux/blob/master/drivers/net/wireless/mac80211_hwsim.c) 26 | # Copyright 2008 Jouni Malinen 27 | # Copyright (c) 2011, Javier Lopez 28 | # 29 | # DM17-0952 30 | 31 | define Profile/Generic 32 | NAME:=Generic 33 | PACKAGES:=kmod-3c59x kmod-e100 kmod-e1000 kmod-natsemi kmod-ne2k-pci \ 34 | kmod-pcnet32 kmod-8139too kmod-r8169 kmod-sis900 kmod-tg3 \ 35 | kmod-via-rhine kmod-via-velocity 36 | endef 37 | 38 | define Profile/Generic/Description 39 | Generic Profile 40 | endef 41 | $(eval $(call Profile,Generic)) 42 | -------------------------------------------------------------------------------- /vmware_guest/profiles/001_welled.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2018 Carnegie Mellon University. All Rights Reserved. 2 | # 3 | # NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING 4 | # INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON 5 | # UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | # AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR 7 | # PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF 8 | # THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF 9 | # ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT 10 | # INFRINGEMENT. 11 | # 12 | # Released under a GNU GPL 2.0-style license, please see license.txt or 13 | # contact permission@sei.cmu.edu for full terms. 14 | # 15 | # [DISTRIBUTION STATEMENT A] This material has been approved for public 16 | # release and unlimited distribution. Please see Copyright notice for 17 | # non-US Government use and distribution. Carnegie Mellon® and CERT® are 18 | # registered in the U.S. Patent and Trademark Office by Carnegie Mellon 19 | # University. 20 | # 21 | # This Software includes and/or makes use of the following Third-Party 22 | # Software subject to its own license: 23 | # 1. wmediumd (https://github.com/bcopeland/wmediumd) 24 | # Copyright 2011 cozybit Inc.. 25 | # 2. mac80211_hwsim (https://github.com/torvalds/linux/blob/master/drivers/net/wireless/mac80211_hwsim.c) 26 | # Copyright 2008 Jouni Malinen 27 | # Copyright (c) 2011, Javier Lopez 28 | # 29 | # DM17-0952 30 | 31 | define Profile/welled 32 | NAME:=welled 33 | KCONFIG:=CONFIG_VMCI_IMAGES=y 34 | PACKAGES:=kmod-3c59x kmod-e100 kmod-e1000 kmod-natsemi kmod-ne2k-pci \ 35 | kmod-pcnet32 kmod-8139too kmod-r8169 kmod-sis900 kmod-tg3 \ 36 | kmod-via-rhine kmod-via-velocity kmod-mac80211-hwsim libnl welled \ 37 | tcpdump iperf hostapd luci-ssl strace valgrind glib2 wireless-tools 38 | endef 39 | 40 | define Profile/welled/Description 41 | Profile for welled and dependencies 42 | endef 43 | $(eval $(call Profile,welled)) 44 | -------------------------------------------------------------------------------- /vmware_guest/target.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2018 Carnegie Mellon University. All Rights Reserved. 2 | # 3 | # NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING 4 | # INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON 5 | # UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | # AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR 7 | # PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF 8 | # THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF 9 | # ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT 10 | # INFRINGEMENT. 11 | # 12 | # Released under a GNU GPL 2.0-style license, please see license.txt or 13 | # contact permission@sei.cmu.edu for full terms. 14 | # 15 | # [DISTRIBUTION STATEMENT A] This material has been approved for public 16 | # release and unlimited distribution. Please see Copyright notice for 17 | # non-US Government use and distribution. Carnegie Mellon® and CERT® are 18 | # registered in the U.S. Patent and Trademark Office by Carnegie Mellon 19 | # University. 20 | # 21 | # This Software includes and/or makes use of the following Third-Party 22 | # Software subject to its own license: 23 | # 1. wmediumd (https://github.com/bcopeland/wmediumd) 24 | # Copyright 2011 cozybit Inc.. 25 | # 2. mac80211_hwsim (https://github.com/torvalds/linux/blob/master/drivers/net/wireless/mac80211_hwsim.c) 26 | # Copyright 2008 Jouni Malinen 27 | # Copyright (c) 2011, Javier Lopez 28 | # 29 | # DM17-0952 30 | 31 | BOARDNAME:=VMWare Guest 32 | FEATURES:=ext4 pci usb 33 | DEFAULT_PACKAGES += kmod-acpi-button kmod-button-hotplug kmod-vmw_vmci kmod-vsock kmod-vmw_vsock_vmci_transport kmod-fs-isofs kmod-scsi-cdrom 34 | CPU_TYPE := i486 35 | --------------------------------------------------------------------------------