Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
obj-*
debian/.debhelper/
debian/*.debhelper
debian/debhelper-build-stamp
debian/*.debhelper.log
debian/*.substvars
debian/files
debian/dawn/
debian/changelog
debian/tmp/
27 changes: 27 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Source: dawn
Section: net
Priority: optional
Maintainer: Berlin Open Wireless Lab <[email protected]>
Build-Depends: debhelper-compat (= 13),
cmake,
pkg-config,
libnl-3-dev,
libnl-genl-3-dev,
libjson-c-dev,
libubus-dev,
libubox-dev,
libiwinfo-dev,
libuci-dev,
libgcrypt20-dev
Standards-Version: 4.7.0
Homepage: https://github.com/berlin-open-wireless-lab/DAWN
Rules-Requires-Root: no

Package: dawn
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, ubus, ubusd
Recommends: hostapd
Description: Decentralized Wi-Fi controller (client steering, 802.11k/v helper)
DAWN is a decentralized Wi-Fi controller intended to steer clients to the
best AP. This package installs the dawn daemon and a systemd service.
Assumes ubus/ubusd are present. Hostapd integration is recommended.
36 changes: 36 additions & 0 deletions debian/dawn.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[Unit]
Description=DAWN decentralized Wi-Fi controller
Documentation=https://github.com/berlin-open-wireless-lab/DAWN
After=network-online.target ubusd.service
Wants=network-online.target ubusd.service

[Service]
Type=simple
EnvironmentFile=-/etc/default/dawn
User=dawn
Group=dawn
ExecStart=/usr/sbin/dawn $DAWN_OPTS
Restart=on-failure
RestartSec=3
SupplementaryGroups=ubus

NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ProtectKernelLogs=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectControlGroups=true
PrivateDevices=true
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK
RestrictRealtime=true
RestrictSUIDSGID=true
LockPersonality=true
MemoryDenyWriteExecute=true
SystemCallArchitectures=native
ReadOnlyPaths=/etc/dawn /run/ubus/ubus.sock
ReadWritePaths=/var/lib/dawn

[Install]
WantedBy=multi-user.target
3 changes: 3 additions & 0 deletions debian/dawn.tmpfiles
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Create runtime/state directories
d /var/lib/dawn 0750 dawn dawn -
d /etc/dawn 0750 root dawn -
5 changes: 5 additions & 0 deletions debian/default/dawn
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Extra flags for DAWN. Examples:
# -c /etc/dawn/dawn.json
# --log-level debug
# --ubus-socket /run/ubus.sock
DAWN_OPTS="-c /etc/dawn/dawn.json"
15 changes: 15 additions & 0 deletions debian/examples/dawn.json.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"ubus": {
"socket": "/run/ubus.sock",
"timeout_ms": 2000
},
"logging": {
"level": "info",
"syslog": true
},
"steering": {
"enabled": true,
"rssi_threshold": -72
}
}

15 changes: 15 additions & 0 deletions debian/generate-changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

cd "$(dirname "$0")/.."

COMMIT_DATE=$(git log -1 --format='%cd' --date=format:'%Y%m%d' 2>/dev/null || echo '00000000')
COMMIT_HASH=$(git log -1 --format='%h' 2>/dev/null || echo 'unknown')
COMMIT_TIMESTAMP=$(git log -1 --format='%cd' --date=rfc2822 2>/dev/null || date -R)

cat > debian/changelog <<EOF
dawn (0.0.${COMMIT_DATE}) unstable; urgency=medium

* Latest version (${COMMIT_HASH})

-- Russ Dill <[email protected]> ${COMMIT_TIMESTAMP}
EOF
3 changes: 3 additions & 0 deletions debian/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
debian/dawn.service lib/systemd/system/
debian/default/dawn etc/default/
debian/examples/dawn.json.example usr/share/doc/dawn/examples/
33 changes: 33 additions & 0 deletions debian/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh
set -e

case "$1" in
configure)
if ! getent group dawn >/dev/null; then
addgroup --system dawn
fi
if ! id dawn >/dev/null 2>&1; then
adduser --system --ingroup dawn --home /var/lib/dawn --no-create-home \
--disabled-login --shell /usr/sbin/nologin dawn
fi

# Ensure dirs exist with right perms
install -d -o dawn -g dawn -m 0750 /var/lib/dawn
install -d -o root -g dawn -m 0750 /etc/dawn

# Drop a minimal config if none exists yet
if [ ! -e /etc/dawn/dawn.json ] && [ -f /usr/share/doc/dawn/examples/dawn.json.example ]; then
cp /usr/share/doc/dawn/examples/dawn.json.example /etc/dawn/dawn.json
chown root:dawn /etc/dawn/dawn.json
chmod 0640 /etc/dawn/dawn.json
fi

# Register tmpfiles + service (don’t auto-enable on install)
if command -v systemd-tmpfiles >/dev/null 2>&1; then
systemd-tmpfiles --create /usr/lib/tmpfiles.d/dawn.conf 2>/dev/null || true
fi
systemctl --system daemon-reload >/dev/null 2>&1 || true
;;
esac

exit 0
13 changes: 13 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/make -f
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
dh $@ --buildsystem=cmake

override_dh_auto_configure:
dh_auto_configure -- \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DDAWN_DEFAULT_CONFIG_DIR=/etc/dawn

override_dh_installsystemd:
dh_installsystemd --name=dawn --no-enable --no-start
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (native)
2 changes: 2 additions & 0 deletions debian/watch
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
version=4
# Fill this when you start tagging releases
2 changes: 1 addition & 1 deletion src/include/multicastsocket.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __DAWN_MULTICASTSTSOCKET_H
#define __DAWN_MULTICASTSSOCKET_H
#define __DAWN_MULTICASTSTSOCKET_H

#include <arpa/inet.h>

Expand Down
2 changes: 1 addition & 1 deletion src/storage/datastorage.c
Original file line number Diff line number Diff line change
Expand Up @@ -1332,8 +1332,8 @@ void insert_macs_from_file() {
}
}

fclose(fp);
dawn_unregmem(fp);
fclose(fp);
if (line)
{
free(line);
Expand Down