eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit 5c29d18a50018e5dc81494662a0dd6daebf7d2b8
parent 74a4bf4d93feb0fc44f399cad6786b19ddeb4372
Author: cowmonk <cowmonk@based.pt>
Date:   Thu, 29 Oct 2026 12:57:15 -0700

simplify build system

Diffstat:
M.gitignore | 4++--
MHACKING | 38+++++++++-----------------------------
MINSTALL | 240+++----------------------------------------------------------------------------
AMakefile | 99+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MREADME | 394++++++++++++++++++++++++-------------------------------------------------------
Dacinclude.m4 | 91-------------------------------------------------------------------------------
Dbootstrap | 7-------
Dbootstrap-configure | 17-----------------
Aconfig.h | 23+++++++++++++++++++++++
Aconfig.mk | 17+++++++++++++++++
Amk/sources.mk | 718+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ascripts/check-tests | 41+++++++++++++++++++++++++++++++++++++++++
Ascripts/import-sources.awk | 100+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ascripts/import-upstream | 29+++++++++++++++++++++++++++++
Ascripts/test-certs | 35+++++++++++++++++++++++++++++++++++
15 files changed, 1201 insertions(+), 652 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -11,10 +11,8 @@ compile_commands.json tags cscope.* -Makefile Makefile.in aclocal.m4 -config.h config.h.in config.log config.status @@ -25,6 +23,8 @@ stamp-h1 build-aux autom4te.cache ell +build/ +libell.a src/iwd src/iwd.8 src/iwd.ap.5 diff --git a/HACKING b/HACKING @@ -1,32 +1,12 @@ -Submitting patches +Building this fork ================== -If you fixed a bug or you want to add support for something, patches are -welcome! The preferred method of submitting the patches to the project is by -email to the iwd mailing list: +Use make and config.mk; see README for installation and upstream imports. +Keep build changes separate from Wi-Fi behavior changes. Refresh the +checked-in mk/sources.mk with scripts/import-upstream after merging an +iwd release, review the resulting source lists, and run make check. - iwd@lists.linux.dev - -In order to ease the inclusion of your patch, it's important to follow -some rules, otherwise it will likely be rejected by maintainers. - -iwd rules for submitting patches follow most of the rules used by Linux kernel -(https://www.kernel.org/doc/Documentation/process/submitting-patches.rst) with -some remarks: - -1) Do *not* add "Signed-off-by" lines in your commit messages. iwd does not -use them, so including them is actually an error. - -2) Be sure to follow the coding style rules of iwd. They are listed in -doc/coding-style.txt. - -3) Split your patch according to the top-level directories. E.g.: if you added -a feature that touches files under 'unit/', 'src/' and 'doc/' -directories, split in three separated patches. Care should be taken to -structure patches in such a way as to not break compilation. The patches -should be split even if breaking the compilation is unavoidable. - -4) The commit message should follow 50/72 formatting which means the header -should be limited to 50 characters and the description should be wrapped at 72 -characters except if it contains quoted information from debug tools like -backtraces, compiler errors, etc. +The Makefile.am and configure.ac files are retained as upstream import +metadata. Changes to those files do not affect the supported build until +the manifest is refreshed. Do NOT regenerate Makefile or config.h with +Autohell. diff --git a/INSTALL b/INSTALL @@ -1,236 +1,10 @@ -Installation Instructions -************************* +Build with make; edit config.mk to set paths and tools. See README for +requirements, ELL initialization, optional targets, and upstream updates. -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free -Software Foundation, Inc. +For packaging: -This file is free documentation; the Free Software Foundation gives -unlimited permission to copy, distribute and modify it. - -Basic Installation -================== - -These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. (Caching is -disabled by default to prevent problems with accidental use of stale -cache files.) - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You only need -`configure.ac' if you want to change it or regenerate `configure' using -a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - -Some systems require unusual options for compilation or linking that the -`configure' script does not know about. Run `./configure --help' for -details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - -You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not support the `VPATH' -variable, you have to compile the package for one architecture at a -time in the source code directory. After you have installed the -package for one architecture, use `make distclean' before reconfiguring -for another architecture. - -Installation Names -================== - -By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PREFIX'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PREFIX', the package will -use PREFIX as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - -Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - -There may be some features `configure' cannot figure out automatically, -but needs to determine by the type of machine the package will run on. -Usually, assuming the package is built to be run on the _same_ -architectures, `configure' can figure that out, but if it prints a -message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the `--target=TYPE' option to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - -If you want to set default values for `configure' scripts to share, you -can create a site shell script called `config.site' that gives default -values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - -Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). Here is a another example: - - /bin/bash ./configure CONFIG_SHELL=/bin/bash - -Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent -configuration-related scripts to be executed by `/bin/bash'. - -`configure' Invocation -====================== - -`configure' recognizes the following options to control how it operates. - -`--help' -`-h' - Print a summary of the options to `configure', and exit. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. + git submodule update --init ell-src + make CC=clang + make PREFIX=/ DESTDIR=/path/to/package install +Installation does not modify init configuration or existing profiles. diff --git a/Makefile b/Makefile @@ -0,0 +1,99 @@ +.POSIX: + +all: src/iwd + +include config.mk +include mk/sources.mk + +BUILD_CPPFLAGS = -I$(ELL_DIR) -I. -DHAVE_CONFIG_H \ + -Dtypeof=__typeof__ \ + -DVERSION='"$(VERSION)"' -DDAEMON_CONFIGDIR='"$(CONFIGDIR)"' \ + -DDAEMON_STORAGEDIR='"$(STORAGEDIR)"' \ + -DUNITDIR='"unit/"' -DCERTDIR='"unit/"' $(CPPFLAGS) +BUILD_CFLAGS = -std=c99 -fvisibility=hidden $(OPT) $(CFLAGS) +IWD_OBJ = $(IWD_SRC:.c=.o) +MONITOR_OBJ = $(MONITOR_SRC:.c=.o) +MANPAGES = src/iwd.8 src/iwd.debug.7 src/iwd.config.5 \ + src/iwd.network.5 src/iwd.ap.5 monitor/iwmon.1 +CERTS = unit/cert-ca.pem unit/cert-server.pem \ + unit/cert-server-key-pkcs8.pem unit/cert-client.pem \ + unit/cert-client-key-pkcs8.pem unit/tls-settings.8021x + +.SUFFIXES: .c .o .rst .1 .5 .7 .8 + +.c.o: + $(CC) $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -c -o $@ $< + +$(IWD_OBJ) $(MONITOR_OBJ) $(TEST_OBJ): Makefile config.h config.mk mk/sources.mk $(HEADERS) $(ELL_HEADERS) $(ELL_DIR)/ell/ell.h + +$(ELL_OBJ): Makefile config.h config.mk mk/sources.mk $(ELL_HEADERS) $(ELL_DIR)/ell/ell.h + mkdir -p build/ell + source=$@; source=$(ELL_DIR)/ell/$${source##*/}; \ + $(CC) $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -c -o $@ "$${source%.o}.c" + +libell.a: $(ELL_OBJ) + rm -f $@ + $(AR) rcs $@ $(ELL_OBJ) + +src/iwd: $(IWD_OBJ) libell.a + $(CC) $(LDFLAGS) -o $@ $(IWD_OBJ) libell.a $(LDLIBS) + +monitor: monitor/iwmon + +monitor/iwmon: $(MONITOR_OBJ) libell.a + $(CC) $(LDFLAGS) -o $@ $(MONITOR_OBJ) libell.a $(LDLIBS) + +check: $(TESTS) + sh scripts/check-tests $(TESTS) + +unit/test-eapol: $(CERTS) + +unit/tls-settings.8021x: unit/gencerts.cnf scripts/test-certs + sh scripts/test-certs + +# Keep certificate generation in one recipe when building with make -j. +unit/cert-ca.pem unit/cert-server.pem unit/cert-server-key-pkcs8.pem \ +unit/cert-client.pem unit/cert-client-key-pkcs8.pem: unit/tls-settings.8021x + @test -f $@ || { printf 'Missing $@; run make clean first.\n' >&2; exit 1; } + +.rst.1: + $(RST2MAN) --strict --no-raw --no-generator --no-datestamp $< $@ +.rst.5: + $(RST2MAN) --strict --no-raw --no-generator --no-datestamp $< $@ +.rst.7: + $(RST2MAN) --strict --no-raw --no-generator --no-datestamp $< $@ +.rst.8: + $(RST2MAN) --strict --no-raw --no-generator --no-datestamp $< $@ + +man: $(MANPAGES) + +install: all + mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(CONFIGDIR) $(DESTDIR)$(STORAGEDIR) + cp src/iwd $(DESTDIR)$(BINDIR)/iwd + chmod 755 $(DESTDIR)$(BINDIR)/iwd + chmod 700 $(DESTDIR)$(STORAGEDIR) + +install-monitor: monitor + mkdir -p $(DESTDIR)$(BINDIR) + cp monitor/iwmon $(DESTDIR)$(BINDIR)/iwmon + chmod 755 $(DESTDIR)$(BINDIR)/iwmon + +install-man: man + for page in $(MANPAGES); do \ + section=$${page##*.}; name=$${page##*/}; \ + mkdir -p $(DESTDIR)$(MANDIR)/man$$section; \ + cp $$page $(DESTDIR)$(MANDIR)/man$$section/$$name || exit 1; \ + chmod 644 $(DESTDIR)$(MANDIR)/man$$section/$$name || exit 1; \ + done + +uninstall: + rm -f $(DESTDIR)$(BINDIR)/iwd $(DESTDIR)$(BINDIR)/iwmon + for page in $(MANPAGES); do \ + section=$${page##*.}; name=$${page##*/}; \ + rm -f $(DESTDIR)$(MANDIR)/man$$section/$$name; \ + done + +clean: + rm -f $(IWD_OBJ) $(MONITOR_OBJ) $(TEST_OBJ) $(ELL_OBJ) libell.a \ + src/iwd monitor/iwmon $(TESTS) $(MANPAGES) \ + unit/cert-*.pem unit/cert-*.csr unit/cert-*.srl unit/tls-settings.8021x diff --git a/README b/README @@ -1,278 +1,126 @@ -Wireless daemon for Linux -************************* +eiwd +==== -Copyright (C) 2013-2019 Intel Corporation. All rights reserved. +A D-Bus-free fork of iwd originally patched by dylanaraps. The supported +build uses a plain Makefile and config.mk. No AutoHell, pkg-config, Python, +or readline is needed to build the daemon. This should make it easier to +compile on systems which lack these utilities (like mine). +This project differs from the previous eiwd in that it aims to (eventually) +recover the lost iwctl feature. At the same time, still being compatible +with upstream. + +Requirements +------------ -Compilation and installation -============================ +Linux, Clang/LLVM (or a compatible C compiler), make, ar, and Linux UAPI +headers are required. The libc baseline is musl with explicit_bzero and +reallocarray, or glibc 2.26 or newer. The existing iwd/ELL code uses Linux +APIs and compiler extensions; this build does not make it POSIX-only. + +ELL is an existing project dependency, pinned by the ell-src submodule. +Initialize it once after cloning: + + git submodule update --init ell-src + +The build compiles ELL directly into a private static archive. It never +runs ELL's configure script or downloads dependencies. An unpacked copy +of ELL can also be supplied with ELL_DIR=/path/to/ell-source. + +Build and install +----------------- + + make + make DESTDIR=/path/to/package install + +The default target builds src/iwd. Edit config.mk for paths and tools, +or override variables on the command line: + + make CC=clang CFLAGS='-O2 -g' + make PREFIX=/ DESTDIR=/path/to/package install + +PREFIX=/ installs the daemon as /bin/iwd, matching MICE's layout. The +normal prefix is /usr/local. CONFIGDIR defaults to /etc/iwd and +STORAGEDIR to /var/lib/iwd. DESTDIR is only a staging prefix; it is never +compiled into runtime paths. No init service or configuration file is +installed automatically. Run iwd in the foreground from the init service. + +CFLAGS, CPPFLAGS and LDFLAGS are inherited from the environment. CC, AR, +OPT, LDLIBS and all paths can be overridden on the command line. Run +make clean before changing compiler, flags, libc, or command-line runtime +paths; Makefile and config.mk edits already invalidate the objects. + +For musllvm, add its bin directory to PATH and use the prefixed tools: + + make clean + make CC=x86_64-linux-musl-clang AR=x86_64-linux-musl-ar \ + LDFLAGS=-static PREFIX=/ DESTDIR=/path/to/package install + +The 2026-10-19 musllvm release was used to verify the static x86_64 build: +https://github.com/cowmonk/musllvm/releases/tag/musllvm-2026-10-19-ec3a09b6c0fc + +Additional targets +------------------ + + make monitor build monitor/iwmon + make install-monitor install iwmon + make check build and run the upstream daemon unit tests + make man render manual pages (requires rst2man) + make install-man install the manual pages + make uninstall remove installed binaries and manuals + make clean remove build outputs and generated test fixtures + +The unit tests additionally require OpenSSL's command-line tool to create +EAPoL certificate fixtures. Some tests require kernel crypto or keyring +features; they report skips where supported. Tests run from this source +directory. The Wi-Fi integration suite in autotests/ still uses D-Bus and +has not been ported. + +EAP-SIM/AKA tests assume HMAC-SHA1 and HMAC-SHA256 are available through +AF_ALG; they fail rather than skip when those algorithms are missing. +The check runner validates TAP output as well as process exit status. + +Current control support +----------------------- + +There is no D-Bus build switch in the supported Makefile, and no iwctl +target yet. Networks are configured through iwd's existing profile files. +The daemon still contains upstream D-Bus helpers, and ELL's D-Bus objects +are compiled to satisfy remaining internal references. No external D-Bus +library or running bus is required. Removing those internal references +and adding a local socket client are a future milestone for this project. + +Upstream updates +---------------- + +Makefile.am and configure.ac remain as upstream import metadata, outside +the supported build. Keeping their paths allows upstream source-list and +version changes to merge normally. Do NOT run autoreconf or configure; +they would overwrite the maintained Makefile and config.h. + +After merging an upstream release, refresh the checked-in manifest: + + sh scripts/import-upstream <upstream-release-tag-or-commit> + git diff -- mk/sources.mk + make clean + make + make check -In order to compile the source code you need following software packages: - - GCC compiler - - GNU C library - - Embedded Linux library - - readline (command line client) +The importer reads that Git revision's Makefile.am and configure.ac, +updates VERSION and the daemon, monitor, ELL, and unit-test source lists, +and stops on unsupported references or changed assignment forms. It does not merge +code, fetch anything, or change the ELL pin. Review new source files, +configuration macros, linker requirements, and internal API changes when +updating; the importer cannot resolve those changes automatically. + +Update ELL separately to a reviewed commit, initialize the pinned source, +and rebuild. Neither a normal build nor a version bump tracks a moving +ELL branch automatically. Keep the original iwd release number in the +manifest so iwd --version identifies the upstream base. -To configure run: - ./configure --prefix=/usr - -Configure automatically searches for all required components and packages. - -To compile and install run: - make && make install - - -Embedded Linux library -====================== - -In order to compile the daemon and control utility the development version -of Embedded Linux library is required to be present. The development -repositories can be found here: - - git://git.kernel.org/pub/scm/libs/ell/ell.git - https://kernel.googlesource.com/pub/scm/libs/ell/ell.git - -The build systems requires that the Embedded Linux library source code -is available on the same top level directory as the Wireless daemon -source code: - - . - |--- ell - | |--- ell - | `--- unit - `--- iwd - |--- src - `--- client - -It is not required to build or install Embedded Linux library. The build -will happen when building the Wireless daemon and it will then be linked -internally. - -When using --enable-external-ell build option, it is not required that the -Embedded Linux library source code is available in the top level directory. - -The tarballs include a copy of the Embedded Linux library source files. When -building from the tarballs, then it is not required to have the library -sources available in the top level directory. - - -Manual pages -============ - -The manual pages are generated from reStructuredText markup source files -during the normal build process. The generation requires the rst2man utility -from Python Docutils project. If rst2man is for some reason not available, -using --disable-manual-pages will skip the manual pages generation and -installation. - -When building from the tarballs, a copy of the generated manual pages is -included and the rst2man utility is actually not needed. - - -Configuration and options -========================= - -The configuration system provides switches to disable certain build time -configuration options which are generally useful and enabled by default: - - --disable-daemon - - Disable installation of Wireless daemon - - By default the Wireless daemon binary iwd is enabled and - placed into --libexecdir directory. - - --disable-client - - Disable installation of Wireless client utility - - By default the Wireless client binary iwctl is enabled - and place into --bindir directory. - - --disable-monitor - - Disable installation of Wireless monitor utility - - By default the Wireless monitor binary iwmon is enabled - and place into --bindir directory. - - --disable-dbus-policy - - Disable installation of D-Bus system policy configuration - - By default the accompanying D-Bus policy file will be - installed in the D-Bus data directory. The location of - that directory will be automatically detected or can be - manually configured via the --with-dbus-datadir option. - - The D-Bus policy is required for daemons to gain service - name ownership and clients to access them. When disabling - this option, manual installation of D-Bus polices is - required. - - Note: This option affects all D-Bus policy configurations. - - --disable-systemd-service - - Disable installation of systemd service configuration - - By default the accompanying systemd service unit with - D-Bus autostart configuration will be installed. The - locations will be automatically detected or can be - manually configured via --with-dbus-busdir option - and --with-systemd-unitdir option. - - Using systemd is optional, but highly recommended. When - disabling this option, manual installation is required. - - Note: This option affects all systemd unit setups. - - --disable-manual-pages - - Disable generation and installation of manual pages - - By default all available manual pages will be generated - and installed. When disabling this options, no manual - pages are installed. - - Note: This options affects all manual pages. - -When building for a system that wants to use wireless technology, disabling -any of the above options makes only limited sense. It may break the general -setup and usability for wireless connections. - -The configuration system provides switches for optional build time features -that can be enabled if the functionality is required: - - --enable-external-ell - - Enable usage of external Embedded Linux library - - This allows using an externally installed Embedded Linux - library instead of using the internal copy of ELL. - - Since the public API of Embedded Linux library is not yet - stable, the usage of the internal ELL copy is preferred. - - --enable-wired - - Enable installation of Ethernet authentication daemon - - This allows enabling the Ethernet daemon binary ead which - is then placed into --libexecdir directory. - - With this option the support for 802.1x for wired Ethernet - connections can be enabled. It provides its own D-Bus - policy and systemd configuration. - - --enable-hwsim - - Enable installation of Wireless simulation utility - - This allows enabling the Simulation daemon binary hwsim - which is then placed into --bindir directory. - - With this utility and mac80211_hwim kernel module the - simulation of 802.11 networks can be tested. It provides - its own D-Bus policy configuration. - - This utility is only useful for developers and should not - be considered for general installation. For this reason - no systemd configuration is provided. - - --enable-tools - - Enable compilation of various testing utilities - - This enables building of all utilities that are however - not installed and only useful during development. - - --enable-ofono - - Enable support for oFono SIM authentication - - Note: With --disable-daemon this option is ignored - - -Netlink monitoring -================== - -The included iwmon utility can be used to monitor the 802.11 subsystem -generic netlink commands and events. It uses the nlmon kernel driver -from Linux 3.10 and later. On startup network monitor interface named -named 'nlmon' is created unless another interface name is given on the -command line. If the monitor interface was created by the iwmon utility, -it will be removed on program exit. - -Manually the monitor interface can be created using the following -commands: - - ip link add name nlmon type nlmon - ip link set dev nlmon allmulticast on - ip link set dev nlmon up - -It is possible to create netlink traces in PCAP format using tcpdump -and then read them via iwmon utility: - - tcpdump -i nlmon -w trace-file.pcap - -The resulting PCAP files will use Linux cooked packet format containing -packets with ARPHRD_NETLINK type. They can be read using iwmon: - - iwmon -r trace-file.pcap - -At this time iwmon is not able to write PCAP files by itself. This might -change in future versions. - -When also the authentication protocol traffic on port 0x888e (ETH_P_PAE) -is needed, then a second capture is required: - - tcpdump -i any 'ether proto 0x888e' -w trace-pae.pcap - -It is possible to combine these two PCAP files using the mergecap utility -and create a combined trace file: - - mergecap -F pcap -w trace.pcap trace-file.pcap trace-pae.pcap - -This will create a trace.pcap file that includes the complete picture -of nl80211 netlink traffic and authentication messages. All packets are -merged in chronological order based on timestamps. - -Unfortunately it is not possible to instruct tcpdump filtering to do -this in a single capture. Post-processing of the PCAP files is required -at the moment. - - -Simulating devices -================== - -The Linux driver mac80211_hwsim provides the functionality to simulate -Wireless devices using fake virtual air. Just load the module. - - modprobe mac80211_hwsim radios=0 - -Providing the radios=0 is important since otherwise it starts out with -two new Wireless radios by default. - -With the provided hwsim utility it is now possible to add and remove -virtual radio devices. - - hwsim --create --keep - hwsim --destroy=<radio-id> - -The radio id assigned to each virtual device is its internal id used -by the Wireless device. - - -Information -=========== - -Mailing list: - https://lists.linux.dev/ - https://lore.kernel.org/iwd/ - -IRC: - irc://irc.oftc.net/#iwd - -Wiki: - https://iwd.wiki.kernel.org/ +The next client milestone is a separate local control interface and +client for device status, scanning, and connecting. Upstream's D-Bus +client sources remain available for reference. + +Upstream iwd documentation is in doc/ and the manual-page sources. +License and authorship information is in COPYING and AUTHORS. diff --git a/acinclude.m4 b/acinclude.m4 @@ -1,91 +0,0 @@ -AC_DEFUN([AC_PROG_CC_PIE], [ - AC_CACHE_CHECK([whether ${CC-cc} accepts -fPIE], ac_cv_prog_cc_pie, [ - echo 'void f(){}' > conftest.c - if test -z "`${CC-cc} -fPIE -pie -c conftest.c 2>&1`"; then - ac_cv_prog_cc_pie=yes - else - ac_cv_prog_cc_pie=no - fi - rm -rf conftest* - ]) -]) - -AC_DEFUN([AC_PROG_CC_ASAN], [ - AC_CACHE_CHECK([whether ${CC-cc} accepts -fsanitize=address], ac_cv_prog_cc_asan, [ - echo 'void f(){}' > conftest.c - if test -z "`${CC-cc} -fsanitize=address -c conftest.c 2>&1`"; then - ac_cv_prog_cc_asan=yes - else - ac_cv_prog_cc_asan=no - fi - rm -rf conftest* - ]) -]) - -AC_DEFUN([AC_PROG_CC_LSAN], [ - AC_CACHE_CHECK([whether ${CC-cc} accepts -fsanitize=leak], ac_cv_prog_cc_lsan, [ - echo 'void f(){}' > conftest.c - if test -z "`${CC-cc} -fsanitize=leak -c conftest.c 2>&1`"; then - ac_cv_prog_cc_lsan=yes - else - ac_cv_prog_cc_lsan=no - fi - rm -rf conftest* - ]) -]) - -AC_DEFUN([AC_PROG_CC_UBSAN], [ - AC_CACHE_CHECK([whether ${CC-cc} accepts -fsanitize=undefined], ac_cv_prog_cc_ubsan, [ - echo 'void f(){}' > conftest.c - if test -z "`${CC-cc} -fsanitize=undefined -c conftest.c 2>&1`"; then - ac_cv_prog_cc_ubsan=yes - else - ac_cv_prog_cc_ubsan=no - fi - rm -rf conftest* - ]) -]) - -AC_DEFUN([AC_PROG_CC_GCOV], [ - AC_CACHE_CHECK([whether ${CC-cc} accepts -fprofile-arcs], ac_cv_prog_cc_profile_arcs, [ - echo 'void f(){}' > conftest.c - if test -z "`${CC-cc} -fprofile-arcs -c conftest.c 2>&1`"; then - ac_cv_prog_cc_profile_arcs=yes - else - ac_cv_prog_cc_profile_arcs=no - fi - rm -rf conftest* - ]) - AC_CACHE_CHECK([whether ${CC-cc} accepts -ftest_coverage], ac_cv_prog_cc_test_coverage, [ - echo 'void f(){}' > conftest.c - if test -z "`${CC-cc} -ftest-coverage -c conftest.c 2>&1`"; then - ac_cv_prog_cc_test_coverage=yes - else - ac_cv_prog_cc_test_coverage=no - fi - rm -rf conftest* - ]) -]) - -AC_DEFUN([COMPILER_FLAGS], [ - if (test "${CFLAGS}" = ""); then - CFLAGS="-Wall -fsigned-char -fno-exceptions" - fi - if (test "$USE_MAINTAINER_MODE" = "yes"); then - CFLAGS+=" -Werror -Wextra" - CFLAGS+=" -Wno-unused-parameter" - CFLAGS+=" -Wno-missing-field-initializers" - CFLAGS+=" -Wdeclaration-after-statement" - CFLAGS+=" -Wmissing-declarations" - CFLAGS+=" -Wredundant-decls" - CFLAGS+=" -Wformat -Wformat-security" - if ( $CC -v 2>/dev/null | grep "gcc version" ); then - CFLAGS+=" -Wcast-align" - fi - fi - - if (test "$CC" = "clang"); then - CFLAGS+=" -Wno-unknown-warning-option" - CFLAGS+=" -Wno-unknown-pragmas" - fi -]) diff --git a/bootstrap b/bootstrap @@ -1,7 +0,0 @@ -#!/bin/sh - -if [ ! -d build-aux ]; then - mkdir build-aux -fi - -autoreconf --force --install --symlink diff --git a/bootstrap-configure b/bootstrap-configure @@ -1,17 +0,0 @@ -#!/bin/sh - -if [ -f config.status ]; then - make maintainer-clean -fi - -./bootstrap && \ - ./configure --enable-maintainer-mode \ - --enable-debug \ - --prefix=/usr \ - --localstatedir=/var \ - --enable-wired \ - --enable-hwsim \ - --enable-tools \ - --enable-ofono \ - --disable-dbus-policy \ - --disable-systemd-service $* diff --git a/config.h b/config.h @@ -0,0 +1,23 @@ +/* Linux with musl or glibc; no configure-time probes. */ +#ifndef EIWD_CONFIG_H +#define EIWD_CONFIG_H + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#ifndef _FILE_OFFSET_BITS +#define _FILE_OFFSET_BITS 64 +#endif + +#include <features.h> + +#define HAVE_LINUX_TYPES_H 1 +#define HAVE_LINUX_IF_ALG_H 1 +#define HAVE_EXPLICIT_BZERO 1 +#define HAVE_REALLOCARRAY 1 + +#ifdef __GLIBC__ /* Disgusting */ +#define HAVE_RAWMEMCHR 1 +#endif + +#endif diff --git a/config.mk b/config.mk @@ -0,0 +1,17 @@ +# Installation paths. MICE uses PREFIX=/ and BINDIR=/bin. +PREFIX = /usr/local +BINDIR = $(PREFIX)/bin +MANDIR = $(PREFIX)/share/man +CONFIGDIR = /etc/iwd +STORAGEDIR = /var/lib/iwd + +# Command-line assignments override these settings. CFLAGS, CPPFLAGS and +# LDFLAGS can also be supplied through the environment. +CC = clang +AR = ar +# These flags precede CFLAGS, so caller-supplied optimization flags win. +OPT = -O2 +# CFLAGS, CPPFLAGS and LDFLAGS are intentionally not assigned here. +LDLIBS = -ldl +ELL_DIR = ell-src +RST2MAN = rst2man diff --git a/mk/sources.mk b/mk/sources.mk @@ -0,0 +1,718 @@ +# Imported by scripts/import-upstream; review changes when updating iwd. +VERSION = 3.12 + +ELL_SRC = \ + $(ELL_DIR)/ell/util.c \ + $(ELL_DIR)/ell/test.c \ + $(ELL_DIR)/ell/test-dbus.c \ + $(ELL_DIR)/ell/strv.c \ + $(ELL_DIR)/ell/utf8.c \ + $(ELL_DIR)/ell/queue.c \ + $(ELL_DIR)/ell/hashmap.c \ + $(ELL_DIR)/ell/string.c \ + $(ELL_DIR)/ell/settings.c \ + $(ELL_DIR)/ell/main.c \ + $(ELL_DIR)/ell/idle.c \ + $(ELL_DIR)/ell/signal.c \ + $(ELL_DIR)/ell/timeout.c \ + $(ELL_DIR)/ell/io.c \ + $(ELL_DIR)/ell/ringbuf.c \ + $(ELL_DIR)/ell/log.c \ + $(ELL_DIR)/ell/checksum.c \ + $(ELL_DIR)/ell/netlink.c \ + $(ELL_DIR)/ell/genl.c \ + $(ELL_DIR)/ell/rtnl.c \ + $(ELL_DIR)/ell/dbus.c \ + $(ELL_DIR)/ell/dbus-message.c \ + $(ELL_DIR)/ell/dbus-util.c \ + $(ELL_DIR)/ell/dbus-service.c \ + $(ELL_DIR)/ell/dbus-client.c \ + $(ELL_DIR)/ell/dbus-name-cache.c \ + $(ELL_DIR)/ell/dbus-filter.c \ + $(ELL_DIR)/ell/gvariant-util.c \ + $(ELL_DIR)/ell/siphash.c \ + $(ELL_DIR)/ell/hwdb.c \ + $(ELL_DIR)/ell/cipher.c \ + $(ELL_DIR)/ell/random.c \ + $(ELL_DIR)/ell/uintset.c \ + $(ELL_DIR)/ell/base64.c \ + $(ELL_DIR)/ell/pem.c \ + $(ELL_DIR)/ell/tls.c \ + $(ELL_DIR)/ell/tls-record.c \ + $(ELL_DIR)/ell/tls-suites.c \ + $(ELL_DIR)/ell/tls-extensions.c \ + $(ELL_DIR)/ell/uuid.c \ + $(ELL_DIR)/ell/key.c \ + $(ELL_DIR)/ell/file.c \ + $(ELL_DIR)/ell/dir.c \ + $(ELL_DIR)/ell/net.c \ + $(ELL_DIR)/ell/dhcp.c \ + $(ELL_DIR)/ell/dhcp-transport.c \ + $(ELL_DIR)/ell/dhcp-lease.c \ + $(ELL_DIR)/ell/dhcp-util.c \ + $(ELL_DIR)/ell/dhcp-server.c \ + $(ELL_DIR)/ell/cert.c \ + $(ELL_DIR)/ell/cert-crypto.c \ + $(ELL_DIR)/ell/ecc-external.c \ + $(ELL_DIR)/ell/ecc.c \ + $(ELL_DIR)/ell/ecdh.c \ + $(ELL_DIR)/ell/time.c \ + $(ELL_DIR)/ell/path.c \ + $(ELL_DIR)/ell/dhcp6.c \ + $(ELL_DIR)/ell/icmp6.c \ + $(ELL_DIR)/ell/dhcp6-lease.c \ + $(ELL_DIR)/ell/dhcp6-transport.c \ + $(ELL_DIR)/ell/acd.c \ + $(ELL_DIR)/ell/netconfig.c \ + $(ELL_DIR)/ell/sysctl.c \ + $(ELL_DIR)/ell/notifylist.c \ + $(ELL_DIR)/ell/minheap.c + +ELL_HEADERS = \ + $(ELL_DIR)/ell/util.h \ + $(ELL_DIR)/ell/test.h \ + $(ELL_DIR)/ell/strv.h \ + $(ELL_DIR)/ell/utf8.h \ + $(ELL_DIR)/ell/queue.h \ + $(ELL_DIR)/ell/hashmap.h \ + $(ELL_DIR)/ell/string.h \ + $(ELL_DIR)/ell/settings.h \ + $(ELL_DIR)/ell/main.h \ + $(ELL_DIR)/ell/idle.h \ + $(ELL_DIR)/ell/signal.h \ + $(ELL_DIR)/ell/timeout.h \ + $(ELL_DIR)/ell/io.h \ + $(ELL_DIR)/ell/ringbuf.h \ + $(ELL_DIR)/ell/log.h \ + $(ELL_DIR)/ell/checksum.h \ + $(ELL_DIR)/ell/netlink.h \ + $(ELL_DIR)/ell/genl.h \ + $(ELL_DIR)/ell/dbus.h \ + $(ELL_DIR)/ell/rtnl.h \ + $(ELL_DIR)/ell/dbus-service.h \ + $(ELL_DIR)/ell/dbus-client.h \ + $(ELL_DIR)/ell/hwdb.h \ + $(ELL_DIR)/ell/cipher.h \ + $(ELL_DIR)/ell/random.h \ + $(ELL_DIR)/ell/uintset.h \ + $(ELL_DIR)/ell/base64.h \ + $(ELL_DIR)/ell/pem.h \ + $(ELL_DIR)/ell/tls.h \ + $(ELL_DIR)/ell/uuid.h \ + $(ELL_DIR)/ell/key.h \ + $(ELL_DIR)/ell/file.h \ + $(ELL_DIR)/ell/dir.h \ + $(ELL_DIR)/ell/net.h \ + $(ELL_DIR)/ell/dhcp.h \ + $(ELL_DIR)/ell/cert.h \ + $(ELL_DIR)/ell/ecc.h \ + $(ELL_DIR)/ell/ecdh.h \ + $(ELL_DIR)/ell/time.h \ + $(ELL_DIR)/ell/path.h \ + $(ELL_DIR)/ell/icmp6.h \ + $(ELL_DIR)/ell/dhcp6.h \ + $(ELL_DIR)/ell/acd.h \ + $(ELL_DIR)/ell/cleanup.h \ + $(ELL_DIR)/ell/netconfig.h \ + $(ELL_DIR)/ell/sysctl.h \ + $(ELL_DIR)/ell/notifylist.h \ + $(ELL_DIR)/ell/minheap.h \ + $(ELL_DIR)/ell/private.h \ + $(ELL_DIR)/ell/missing.h \ + $(ELL_DIR)/ell/test-private.h \ + $(ELL_DIR)/ell/main-private.h \ + $(ELL_DIR)/ell/netlink-private.h \ + $(ELL_DIR)/ell/rtnl-private.h \ + $(ELL_DIR)/ell/dbus-private.h \ + $(ELL_DIR)/ell/gvariant-private.h \ + $(ELL_DIR)/ell/siphash-private.h \ + $(ELL_DIR)/ell/asn1-private.h \ + $(ELL_DIR)/ell/pem-private.h \ + $(ELL_DIR)/ell/tls-private.h \ + $(ELL_DIR)/ell/net-private.h \ + $(ELL_DIR)/ell/dhcp-private.h \ + $(ELL_DIR)/ell/cert-private.h \ + $(ELL_DIR)/ell/ecc-private.h \ + $(ELL_DIR)/ell/time-private.h \ + $(ELL_DIR)/ell/dhcp6-private.h \ + $(ELL_DIR)/ell/icmp6-private.h \ + $(ELL_DIR)/ell/useful.h + +IWD_SRC = \ + src/main.c \ + src/netdev.c \ + src/wiphy.c \ + src/device.c \ + src/station.c \ + src/ie.c \ + src/dbus.c \ + src/mpdu.c \ + src/eapol.c \ + src/eapolutil.c \ + src/handshake.c \ + src/scan.c \ + src/common.c \ + src/agent.c \ + src/storage.c \ + src/network.c \ + src/wsc.c \ + src/backtrace.c \ + src/knownnetworks.c \ + src/rfkill.c \ + src/ft.c \ + src/ap.c \ + src/adhoc.c \ + src/sae.c \ + src/nl80211util.c \ + src/nl80211cmd.c \ + src/owe.c \ + src/blacklist.c \ + src/manager.c \ + src/erp.c \ + src/fils.c \ + src/anqp.c \ + src/anqputil.c \ + src/netconfig.c \ + src/netconfig-commit.c \ + src/resolve.c \ + src/hotspot.c \ + src/p2p.c \ + src/p2putil.c \ + src/module.c \ + src/rrm.c \ + src/frame-xchg.c \ + src/eap-wsc.c \ + src/wscutil.c \ + src/diagnostic.c \ + src/ip-pool.c \ + src/band.c \ + src/sysfs.c \ + src/offchannel.c \ + src/dpp-util.c \ + src/json.c \ + src/dpp.c \ + src/udev.c \ + src/pmksa.c \ + src/vendor_quirks.c \ + src/eap.c \ + src/eap-md5.c \ + src/eap-tls.c \ + src/eap-ttls.c \ + src/eap-mschapv2.c \ + src/eap-sim.c \ + src/eap-aka.c \ + src/eap-peap.c \ + src/eap-gtc.c \ + src/eap-pwd.c \ + src/util.c \ + src/crypto.c \ + src/simutil.c \ + src/simauth.c \ + src/watchlist.c \ + src/eap-tls-common.c \ + src/mschaputil.c + +MONITOR_SRC = \ + monitor/main.c \ + monitor/nlmon.c \ + monitor/pcap.c \ + monitor/display.c \ + src/ie.c \ + src/wscutil.c \ + src/mpdu.c \ + src/util.c \ + src/crypto.c \ + src/watchlist.c \ + src/eapolutil.c \ + src/nl80211cmd.c \ + src/p2putil.c \ + src/anqputil.c \ + src/band.c + +HEADERS = \ + linux/nl80211.h \ + src/iwd.h \ + src/missing.h \ + src/defs.h \ + src/netdev.h \ + src/wiphy.h \ + src/station.h \ + src/ie.h \ + src/dbus.h \ + src/mpdu.h \ + src/eapol.h \ + src/eapolutil.h \ + src/handshake.h \ + src/scan.h \ + src/common.h \ + src/agent.h \ + src/storage.h \ + src/network.h \ + src/wsc.h \ + src/backtrace.h \ + src/knownnetworks.h \ + src/rfkill.h \ + src/ft.h \ + src/ap.h \ + src/sae.h \ + src/nl80211util.h \ + src/nl80211cmd.h \ + src/owe.h \ + src/blacklist.h \ + src/erp.h \ + src/fils.h \ + src/auth-proto.h \ + src/anqp.h \ + src/anqputil.h \ + src/netconfig.h \ + src/resolve.h \ + src/p2p.h \ + src/p2putil.h \ + src/module.h \ + src/frame-xchg.h \ + src/eap-wsc.h \ + src/wscutil.h \ + src/diagnostic.h \ + src/ip-pool.h \ + src/band.h \ + src/sysfs.h \ + src/offchannel.h \ + src/dpp-util.h \ + src/json.h \ + src/pmksa.h \ + src/vendor_quirks.h \ + src/eap.h \ + src/eap-private.h \ + src/eap-mschapv2.h \ + src/util.h \ + src/crypto.h \ + src/simutil.h \ + src/simauth.h \ + src/watchlist.h \ + src/eap-tls-common.h \ + src/mschaputil.h \ + monitor/nlmon.h \ + monitor/pcap.h \ + monitor/display.h + +ELL_OBJ = \ + build/ell/util.o \ + build/ell/test.o \ + build/ell/test-dbus.o \ + build/ell/strv.o \ + build/ell/utf8.o \ + build/ell/queue.o \ + build/ell/hashmap.o \ + build/ell/string.o \ + build/ell/settings.o \ + build/ell/main.o \ + build/ell/idle.o \ + build/ell/signal.o \ + build/ell/timeout.o \ + build/ell/io.o \ + build/ell/ringbuf.o \ + build/ell/log.o \ + build/ell/checksum.o \ + build/ell/netlink.o \ + build/ell/genl.o \ + build/ell/rtnl.o \ + build/ell/dbus.o \ + build/ell/dbus-message.o \ + build/ell/dbus-util.o \ + build/ell/dbus-service.o \ + build/ell/dbus-client.o \ + build/ell/dbus-name-cache.o \ + build/ell/dbus-filter.o \ + build/ell/gvariant-util.o \ + build/ell/siphash.o \ + build/ell/hwdb.o \ + build/ell/cipher.o \ + build/ell/random.o \ + build/ell/uintset.o \ + build/ell/base64.o \ + build/ell/pem.o \ + build/ell/tls.o \ + build/ell/tls-record.o \ + build/ell/tls-suites.o \ + build/ell/tls-extensions.o \ + build/ell/uuid.o \ + build/ell/key.o \ + build/ell/file.o \ + build/ell/dir.o \ + build/ell/net.o \ + build/ell/dhcp.o \ + build/ell/dhcp-transport.o \ + build/ell/dhcp-lease.o \ + build/ell/dhcp-util.o \ + build/ell/dhcp-server.o \ + build/ell/cert.o \ + build/ell/cert-crypto.o \ + build/ell/ecc-external.o \ + build/ell/ecc.o \ + build/ell/ecdh.o \ + build/ell/time.o \ + build/ell/path.o \ + build/ell/dhcp6.o \ + build/ell/icmp6.o \ + build/ell/dhcp6-lease.o \ + build/ell/dhcp6-transport.o \ + build/ell/acd.o \ + build/ell/netconfig.o \ + build/ell/sysctl.o \ + build/ell/notifylist.o \ + build/ell/minheap.o + +build/ell/util.o: $(ELL_DIR)/ell/util.c +build/ell/test.o: $(ELL_DIR)/ell/test.c +build/ell/test-dbus.o: $(ELL_DIR)/ell/test-dbus.c +build/ell/strv.o: $(ELL_DIR)/ell/strv.c +build/ell/utf8.o: $(ELL_DIR)/ell/utf8.c +build/ell/queue.o: $(ELL_DIR)/ell/queue.c +build/ell/hashmap.o: $(ELL_DIR)/ell/hashmap.c +build/ell/string.o: $(ELL_DIR)/ell/string.c +build/ell/settings.o: $(ELL_DIR)/ell/settings.c +build/ell/main.o: $(ELL_DIR)/ell/main.c +build/ell/idle.o: $(ELL_DIR)/ell/idle.c +build/ell/signal.o: $(ELL_DIR)/ell/signal.c +build/ell/timeout.o: $(ELL_DIR)/ell/timeout.c +build/ell/io.o: $(ELL_DIR)/ell/io.c +build/ell/ringbuf.o: $(ELL_DIR)/ell/ringbuf.c +build/ell/log.o: $(ELL_DIR)/ell/log.c +build/ell/checksum.o: $(ELL_DIR)/ell/checksum.c +build/ell/netlink.o: $(ELL_DIR)/ell/netlink.c +build/ell/genl.o: $(ELL_DIR)/ell/genl.c +build/ell/rtnl.o: $(ELL_DIR)/ell/rtnl.c +build/ell/dbus.o: $(ELL_DIR)/ell/dbus.c +build/ell/dbus-message.o: $(ELL_DIR)/ell/dbus-message.c +build/ell/dbus-util.o: $(ELL_DIR)/ell/dbus-util.c +build/ell/dbus-service.o: $(ELL_DIR)/ell/dbus-service.c +build/ell/dbus-client.o: $(ELL_DIR)/ell/dbus-client.c +build/ell/dbus-name-cache.o: $(ELL_DIR)/ell/dbus-name-cache.c +build/ell/dbus-filter.o: $(ELL_DIR)/ell/dbus-filter.c +build/ell/gvariant-util.o: $(ELL_DIR)/ell/gvariant-util.c +build/ell/siphash.o: $(ELL_DIR)/ell/siphash.c +build/ell/hwdb.o: $(ELL_DIR)/ell/hwdb.c +build/ell/cipher.o: $(ELL_DIR)/ell/cipher.c +build/ell/random.o: $(ELL_DIR)/ell/random.c +build/ell/uintset.o: $(ELL_DIR)/ell/uintset.c +build/ell/base64.o: $(ELL_DIR)/ell/base64.c +build/ell/pem.o: $(ELL_DIR)/ell/pem.c +build/ell/tls.o: $(ELL_DIR)/ell/tls.c +build/ell/tls-record.o: $(ELL_DIR)/ell/tls-record.c +build/ell/tls-suites.o: $(ELL_DIR)/ell/tls-suites.c +build/ell/tls-extensions.o: $(ELL_DIR)/ell/tls-extensions.c +build/ell/uuid.o: $(ELL_DIR)/ell/uuid.c +build/ell/key.o: $(ELL_DIR)/ell/key.c +build/ell/file.o: $(ELL_DIR)/ell/file.c +build/ell/dir.o: $(ELL_DIR)/ell/dir.c +build/ell/net.o: $(ELL_DIR)/ell/net.c +build/ell/dhcp.o: $(ELL_DIR)/ell/dhcp.c +build/ell/dhcp-transport.o: $(ELL_DIR)/ell/dhcp-transport.c +build/ell/dhcp-lease.o: $(ELL_DIR)/ell/dhcp-lease.c +build/ell/dhcp-util.o: $(ELL_DIR)/ell/dhcp-util.c +build/ell/dhcp-server.o: $(ELL_DIR)/ell/dhcp-server.c +build/ell/cert.o: $(ELL_DIR)/ell/cert.c +build/ell/cert-crypto.o: $(ELL_DIR)/ell/cert-crypto.c +build/ell/ecc-external.o: $(ELL_DIR)/ell/ecc-external.c +build/ell/ecc.o: $(ELL_DIR)/ell/ecc.c +build/ell/ecdh.o: $(ELL_DIR)/ell/ecdh.c +build/ell/time.o: $(ELL_DIR)/ell/time.c +build/ell/path.o: $(ELL_DIR)/ell/path.c +build/ell/dhcp6.o: $(ELL_DIR)/ell/dhcp6.c +build/ell/icmp6.o: $(ELL_DIR)/ell/icmp6.c +build/ell/dhcp6-lease.o: $(ELL_DIR)/ell/dhcp6-lease.c +build/ell/dhcp6-transport.o: $(ELL_DIR)/ell/dhcp6-transport.c +build/ell/acd.o: $(ELL_DIR)/ell/acd.c +build/ell/netconfig.o: $(ELL_DIR)/ell/netconfig.c +build/ell/sysctl.o: $(ELL_DIR)/ell/sysctl.c +build/ell/notifylist.o: $(ELL_DIR)/ell/notifylist.c +build/ell/minheap.o: $(ELL_DIR)/ell/minheap.c + +TESTS = \ + unit/test-eap-sim \ + unit/test-cmac-aes \ + unit/test-arc4 \ + unit/test-hmac-md5 \ + unit/test-hmac-sha1 \ + unit/test-hmac-sha256 \ + unit/test-prf-sha1 \ + unit/test-kdf-sha256 \ + unit/test-ie \ + unit/test-band \ + unit/test-crypto \ + unit/test-mpdu \ + unit/test-eapol \ + unit/test-util \ + unit/test-ssid-security \ + unit/test-wsc \ + unit/test-eap-mschapv2 \ + unit/test-sae \ + unit/test-p2p \ + unit/test-dpp \ + unit/test-json \ + unit/test-nl80211util \ + unit/test-pmksa \ + unit/test-storage + +unit_test_eap_sim_OBJ = \ + unit/test-eap-sim.c \ + src/crypto.c \ + src/simutil.c \ + src/ie.c \ + src/watchlist.c \ + src/eapol.c \ + src/eapolutil.c \ + src/handshake.c \ + src/pmksa.c \ + src/eap.c \ + src/util.c \ + src/simauth.c \ + src/erp.c \ + src/band.c \ + src/eap-sim.c + +unit/test-eap-sim: $(unit_test_eap_sim_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_eap_sim_OBJ:.c=.o) libell.a $(LDLIBS) + +unit_test_cmac_aes_OBJ = \ + unit/test-cmac-aes.c \ + src/crypto.c + +unit/test-cmac-aes: $(unit_test_cmac_aes_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_cmac_aes_OBJ:.c=.o) libell.a $(LDLIBS) + +unit_test_arc4_OBJ = \ + unit/test-arc4.c \ + src/crypto.c + +unit/test-arc4: $(unit_test_arc4_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_arc4_OBJ:.c=.o) libell.a $(LDLIBS) + +unit_test_hmac_md5_OBJ = \ + unit/test-hmac-md5.c \ + src/crypto.c + +unit/test-hmac-md5: $(unit_test_hmac_md5_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_hmac_md5_OBJ:.c=.o) libell.a $(LDLIBS) + +unit_test_hmac_sha1_OBJ = \ + unit/test-hmac-sha1.c \ + src/crypto.c + +unit/test-hmac-sha1: $(unit_test_hmac_sha1_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_hmac_sha1_OBJ:.c=.o) libell.a $(LDLIBS) + +unit_test_hmac_sha256_OBJ = \ + unit/test-hmac-sha256.c \ + src/crypto.c + +unit/test-hmac-sha256: $(unit_test_hmac_sha256_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_hmac_sha256_OBJ:.c=.o) libell.a $(LDLIBS) + +unit_test_prf_sha1_OBJ = \ + unit/test-prf-sha1.c \ + src/crypto.c + +unit/test-prf-sha1: $(unit_test_prf_sha1_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_prf_sha1_OBJ:.c=.o) libell.a $(LDLIBS) + +unit_test_kdf_sha256_OBJ = \ + unit/test-kdf-sha256.c \ + src/crypto.c + +unit/test-kdf-sha256: $(unit_test_kdf_sha256_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_kdf_sha256_OBJ:.c=.o) libell.a $(LDLIBS) + +unit_test_ie_OBJ = \ + unit/test-ie.c \ + src/ie.c + +unit/test-ie: $(unit_test_ie_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_ie_OBJ:.c=.o) libell.a $(LDLIBS) + +unit_test_band_OBJ = \ + unit/test-band.c \ + src/band.c \ + src/ie.c + +unit/test-band: $(unit_test_band_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_band_OBJ:.c=.o) libell.a $(LDLIBS) + +unit_test_crypto_OBJ = \ + unit/test-crypto.c \ + src/crypto.c + +unit/test-crypto: $(unit_test_crypto_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_crypto_OBJ:.c=.o) libell.a $(LDLIBS) + +unit_test_mpdu_OBJ = \ + unit/test-mpdu.c \ + src/mpdu.c \ + src/ie.c + +unit/test-mpdu: $(unit_test_mpdu_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_mpdu_OBJ:.c=.o) libell.a $(LDLIBS) + +unit_test_eapol_OBJ = \ + unit/test-eapol.c \ + src/crypto.c \ + src/ie.c \ + src/watchlist.c \ + src/eapol.c \ + src/eapolutil.c \ + src/handshake.c \ + src/pmksa.c \ + src/eap.c \ + src/eap-tls.c \ + src/eap-ttls.c \ + src/eap-md5.c \ + src/util.c \ + src/eap-tls-common.c \ + src/erp.c \ + src/band.c \ + src/mschaputil.c + +unit/test-eapol: $(unit_test_eapol_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_eapol_OBJ:.c=.o) libell.a $(LDLIBS) + +unit_test_util_OBJ = \ + src/util.c \ + src/band.c \ + unit/test-util.c + +unit/test-util: $(unit_test_util_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_util_OBJ:.c=.o) libell.a $(LDLIBS) + +unit_test_ssid_security_OBJ = \ + unit/test-ssid-security.c \ + src/ie.c \ + src/common.c + +unit/test-ssid-security: $(unit_test_ssid_security_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_ssid_security_OBJ:.c=.o) libell.a $(LDLIBS) + +unit_test_wsc_OBJ = \ + unit/test-wsc.c \ + src/wscutil.c \ + src/crypto.c \ + src/ie.c \ + src/watchlist.c \ + src/eapol.c \ + src/eapolutil.c \ + src/handshake.c \ + src/pmksa.c \ + src/eap.c \ + src/util.c \ + src/erp.c \ + src/band.c \ + src/eap-wsc.c + +unit/test-wsc: $(unit_test_wsc_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_wsc_OBJ:.c=.o) libell.a $(LDLIBS) + +unit_test_eap_mschapv2_OBJ = \ + src/eap-mschapv2.c \ + src/eap.c \ + src/mschaputil.c \ + unit/test-eap-mschapv2.c + +unit/test-eap-mschapv2: $(unit_test_eap_mschapv2_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_eap_mschapv2_OBJ:.c=.o) libell.a $(LDLIBS) + +unit_test_sae_OBJ = \ + unit/test-sae.c \ + src/sae.c \ + src/crypto.c \ + src/ie.c \ + src/handshake.c \ + src/pmksa.c \ + src/erp.c \ + src/band.c \ + src/util.c \ + src/mpdu.c + +unit/test-sae: $(unit_test_sae_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_sae_OBJ:.c=.o) -Wl,-wrap,l_ecc_supported_ike_groups libell.a $(LDLIBS) + +unit_test_p2p_OBJ = \ + unit/test-p2p.c \ + src/wscutil.c \ + src/crypto.c \ + src/ie.c \ + src/util.c \ + src/p2putil.c \ + src/band.c + +unit/test-p2p: $(unit_test_p2p_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_p2p_OBJ:.c=.o) libell.a $(LDLIBS) + +unit_test_dpp_OBJ = \ + unit/test-dpp.c \ + src/dpp-util.c \ + src/band.c \ + src/util.c \ + src/crypto.c \ + src/json.c + +unit/test-dpp: $(unit_test_dpp_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_dpp_OBJ:.c=.o) libell.a $(LDLIBS) + +unit_test_json_OBJ = \ + unit/test-json.c \ + src/json.c + +unit/test-json: $(unit_test_json_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_json_OBJ:.c=.o) libell.a $(LDLIBS) + +unit_test_nl80211util_OBJ = \ + unit/test-nl80211util.c \ + src/nl80211util.c \ + src/band.c \ + src/ie.c \ + src/util.c + +unit/test-nl80211util: $(unit_test_nl80211util_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_nl80211util_OBJ:.c=.o) libell.a $(LDLIBS) + +unit_test_pmksa_OBJ = \ + unit/test-pmksa.c \ + src/pmksa.c + +unit/test-pmksa: $(unit_test_pmksa_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_pmksa_OBJ:.c=.o) libell.a $(LDLIBS) + +unit_test_storage_OBJ = \ + unit/test-storage.c \ + src/storage.c \ + src/crypto.c \ + src/common.c + +unit/test-storage: $(unit_test_storage_OBJ:.c=.o) libell.a + $(CC) $(LDFLAGS) -o $@ $(unit_test_storage_OBJ:.c=.o) libell.a $(LDLIBS) + +TEST_OBJ = \ + $(unit_test_eap_sim_OBJ:.c=.o) \ + $(unit_test_cmac_aes_OBJ:.c=.o) \ + $(unit_test_arc4_OBJ:.c=.o) \ + $(unit_test_hmac_md5_OBJ:.c=.o) \ + $(unit_test_hmac_sha1_OBJ:.c=.o) \ + $(unit_test_hmac_sha256_OBJ:.c=.o) \ + $(unit_test_prf_sha1_OBJ:.c=.o) \ + $(unit_test_kdf_sha256_OBJ:.c=.o) \ + $(unit_test_ie_OBJ:.c=.o) \ + $(unit_test_band_OBJ:.c=.o) \ + $(unit_test_crypto_OBJ:.c=.o) \ + $(unit_test_mpdu_OBJ:.c=.o) \ + $(unit_test_eapol_OBJ:.c=.o) \ + $(unit_test_util_OBJ:.c=.o) \ + $(unit_test_ssid_security_OBJ:.c=.o) \ + $(unit_test_wsc_OBJ:.c=.o) \ + $(unit_test_eap_mschapv2_OBJ:.c=.o) \ + $(unit_test_sae_OBJ:.c=.o) \ + $(unit_test_p2p_OBJ:.c=.o) \ + $(unit_test_dpp_OBJ:.c=.o) \ + $(unit_test_json_OBJ:.c=.o) \ + $(unit_test_nl80211util_OBJ:.c=.o) \ + $(unit_test_pmksa_OBJ:.c=.o) \ + $(unit_test_storage_OBJ:.c=.o) + diff --git a/scripts/check-tests b/scripts/check-tests @@ -0,0 +1,41 @@ +#!/bin/sh +# ELL can report failed TAP cases while returning exit status zero. +set -u +log=$(mktemp "${TMPDIR:-/tmp}/eiwd-tests.XXXXXXXX") || exit 1 +trap 'rm -f "$log"' 0 +trap 'exit 1' HUP INT TERM +failed=0 + +for test in "$@"; do + printf '\nRunning %s\n' "$test" + case $test in /*|./*) executable=$test ;; *) executable=./$test ;; esac + status=0 + "$executable" > "$log" 2>&1 || status=$? + cat "$log" + if [ "$status" -eq 77 ]; then + printf 'SKIP %s\n' "$test" + continue + fi + if [ "$status" -ne 0 ] || ! awk ' + /^Bail out!/ { failed = 1 } + /^not ok([ \t]|$)/ { + count++ + if ($0 !~ /#[ \t]*TODO/) + failed = 1 + } + /^ok([ \t]|$)/ { count++ } + /^1\.\.[0-9]+/ { + if (seen++) + failed = 1 + plan = $0 + sub(/^1\.\./, "", plan) + plan += 0 + } + END { exit (failed || !seen || count != plan) } + ' "$log"; then + printf 'FAIL %s (exit %s)\n' "$test" "$status" + failed=1 + fi +done + +exit "$failed" diff --git a/scripts/import-sources.awk b/scripts/import-sources.awk @@ -0,0 +1,100 @@ +# Read the upstream source assignments, including their continuation lines. +function assignment(line, key) { + if (line !~ /^[A-Za-z_][A-Za-z_0-9]*[ \t]*[+:?]?=/) + return + key = line + sub(/[ \t]*[+:?]?=.*/, "", key) + if (key !~ /^(ell_sources|ell_headers|ell_shared|eap_sources|src_iwd_SOURCES|monitor_iwmon_SOURCES|unit_test_.*_SOURCES)$/ || key == "unit_test_client_SOURCES") + return + if (line !~ /^[A-Za-z_][A-Za-z_0-9]*[ \t]*=/ || key in values) { + print "review changed upstream assignment: " key > "/dev/stderr" + bad = 1 + return + } + sub(/^[^=]*=[ \t]*/, "", line) + values[key] = line + if (key ~ /^unit_test_.*_SOURCES$/ && key != "unit_test_client_SOURCES") + tests[++ntests] = key +} + +function emit(name, value, suffix, n, words, i, file, count, seen) { + # All supported references are expanded explicitly. A new upstream + # reference must be reviewed instead of silently dropping its sources. + gsub(/\$\(eap_sources\)/, values["eap_sources"], value) + gsub(/\$\(builtin_sources\)/, "", value) + n = split(value, words, /[ \t]+/) + printf "%s =", name + for (i = 1; i <= n; i++) { + file = words[i] + if (file ~ /\$/) { + print "unsupported upstream source reference: " file > "/dev/stderr" + bad = 1 + } + if (file !~ suffix || seen[file]++) + continue + if (name ~ /^ELL_/) + sub(/^ell\//, "$(ELL_DIR)/ell/", file) + printf " \\\n\t%s", file + count++ + } + printf "\n\n" + if (!count) { + print "empty upstream source list: " name > "/dev/stderr" + bad = 1 + } +} + +{ + line = line $0 + if (sub(/\\[ \t]*$/, " ", line)) + next + assignment(line) + line = "" +} + +END { + print "# Imported by scripts/import-upstream; review changes when updating iwd." + print "VERSION = " version "\n" + emit("ELL_SRC", values["ell_sources"], "\\.c$") + emit("ELL_HEADERS", values["ell_headers"] " " values["ell_sources"] " " values["ell_shared"], "\\.h$") + emit("IWD_SRC", values["src_iwd_SOURCES"], "\\.c$") + emit("MONITOR_SRC", values["monitor_iwmon_SOURCES"], "\\.c$") + emit("HEADERS", values["src_iwd_SOURCES"] " " values["monitor_iwmon_SOURCES"], "\\.h$") + printf "ELL_OBJ =" + n = split(values["ell_sources"], words, /[ \t]+/) + for (i = 1; i <= n; i++) { + if (words[i] !~ /\.c$/) + continue + file = words[i] + sub(/^ell\//, "build/ell/", file) + sub(/\.c$/, ".o", file) + printf " \\\n\t%s", file + deps = deps file ": $(ELL_DIR)/" words[i] "\n" + } + print "\n\n" deps + printf "TESTS =" + for (i = 1; i <= ntests; i++) { + name = tests[i] + sub(/^unit_test_/, "unit/test-", name) + sub(/_SOURCES$/, "", name) + gsub(/_/, "-", name) + targets[i] = name + printf " \\\n\t%s", name + } + print "\n" + for (j = 1; j <= ntests; j++) { + name = tests[j] + sub(/_SOURCES$/, "_OBJ", name) + emit(name, values[tests[j]], "\\.c$") + # Convert only the emitted source variable at its point of use. + printf "%s: $(%s:.c=.o) libell.a\n", targets[j], name + printf "\t$(CC) $(LDFLAGS) -o $@ $(%s:.c=.o)", name + if (targets[j] == "unit/test-sae") + printf " -Wl,-wrap,l_ecc_supported_ike_groups" + print " libell.a $(LDLIBS)\n" + objects = objects " \\\n\t$(" name ":.c=.o)" + } + print "TEST_OBJ =" objects "\n" + if (bad || !ntests) + exit 1 +} diff --git a/scripts/import-upstream b/scripts/import-upstream @@ -0,0 +1,29 @@ +#!/bin/sh +# Refresh the checked-in source manifest. +set -eu + +if [ "$#" -ne 1 ]; then + printf 'usage: %s upstream-git-ref\n' "$0" >&2 + exit 1 +fi + +cd "$(dirname "$0")/.." +ref=$1 +tmpdir=$(mktemp -d "${TMPDIR:-/tmp}/eiwd-import.XXXXXXXX") +trap 'rm -f "$tmpdir/Makefile.am" "$tmpdir/configure.ac" "$tmpdir/sources.mk"; rmdir "$tmpdir"' 0 +trap 'exit 1' HUP INT TERM + +git show "$ref:Makefile.am" > "$tmpdir/Makefile.am" +git show "$ref:configure.ac" > "$tmpdir/configure.ac" +version=$(sed -n 's/^AC_INIT(\[iwd\],\[\([^]]*\)\]).*/\1/p' "$tmpdir/configure.ac") +if [ -z "$version" ]; then + printf 'cannot read iwd version from %s\n' "$ref" >&2 + exit 1 +fi + +awk -v version="$version" -f scripts/import-sources.awk \ + "$tmpdir/Makefile.am" > "$tmpdir/sources.mk" +if ! cmp -s "$tmpdir/sources.mk" mk/sources.mk; then + mv "$tmpdir/sources.mk" mk/sources.mk +fi +printf 'Imported iwd %s source lists from %s; review mk/sources.mk before building.\n' "$version" "$ref" diff --git a/scripts/test-certs b/scripts/test-certs @@ -0,0 +1,35 @@ +#!/bin/sh +# Fixtures used by the upstream EAPoL unit tests. +set -eu + +openssl genrsa -out unit/cert-ca-key.pem 2048 +openssl req -x509 -new -nodes -extensions ca_ext \ + -config unit/gencerts.cnf \ + -subj '/O=International Union of Example Organizations/CN=Certificate issuer guy/emailAddress=ca@mail.example' \ + -key unit/cert-ca-key.pem -sha256 -days 10000 -out unit/cert-ca.pem + +for role in server client; do + key=unit/cert-$role-key.pem + csr=unit/cert-$role.csr + cert=unit/cert-$role.pem + case $role in server) organization=Foo ;; client) organization=Bar ;; esac + openssl genrsa -out "$key" 2048 + openssl pkcs8 -topk8 -nocrypt -in "$key" -out "unit/cert-$role-key-pkcs8.pem" + openssl req -new -extensions cert_ext -config unit/gencerts.cnf \ + -subj "/O=$organization Example Organization/CN=$organization Example Organization/emailAddress=$role@mail.example" \ + -key "$key" -out "$csr" + openssl x509 -req -extensions server_ext -extfile unit/gencerts.cnf \ + -in "$csr" -CA unit/cert-ca.pem -CAkey unit/cert-ca-key.pem \ + -CAserial unit/cert-ca.srl -CAcreateserial -sha256 -days 10000 -out "$cert" +done + +{ + printf '%s\n' '[Security]' 'EAP-Method=TLS' 'EAP-Identity=abc@example.com' \ + 'EAP-TLS-CACert=embed:ca_cert' 'EAP-TLS-ClientCert=embed:client_cert' \ + 'EAP-TLS-ClientKey=embed:client_key' '[@pem@ca_cert]' + cat unit/cert-ca.pem + printf '%s\n' '[@pem@client_cert]' + cat unit/cert-client.pem + printf '%s\n' '[@pem@client_key]' + cat unit/cert-client-key-pkcs8.pem +} > unit/tls-settings.8021x