disable wifi option

pull/9/head
Jordan Sokolic 2020-09-06 21:42:15 +03:00
parent 544c77a97a
commit b854d8adb6
2 changed files with 20 additions and 10 deletions

View File

@ -1,6 +1,6 @@
### Sample OpenWRT config file ###
## general
## General
# source image for Raspberry Pi build target
SOURCE_IMG=openwrt-19.07.3-brcm2708-bcm2708-rpi-ext4-factory.img
# source for build (x86) target
@ -23,7 +23,7 @@ UPSTREAM_DNS_SERVER=8.8.8.8
LAN_NAME=openwrt-lan
# Host interface which will provide the LAN link for OpenWRT.
# Can be a physical interface or a VLAN of the primary interface.
# For example if WAN_PARENT is eth0, LAN_PARENT can be eth0.10 for
# For example if WAN_PARENT is eth0, LAN_PARENT can be eth0.10 for
# VLAN 10. VLAN interface will be created if it doesn't exist.
LAN_PARENT=eth0.10
# DNS search domain for LAN DHCP clients
@ -37,14 +37,19 @@ LAN_ADDR=192.168.16.2
# openwrt doesn't accept CIDR notation; must match LAN_SUBNET
LAN_NETMASK=255.255.255.0
# wifi settings
## Wifi settings
WIFI_ENABLED=true
WIFI_IFACE=wlan0
WIFI_SSID=test123
WIFI_ENCRYPTION=psk2
WIFI_KEY=12345678
# Only one of the following sections at a time (5 / 2.4 GHz) are supported!
## 5GHz 802.11ac (if your hw supports it)
# WIFI_HW_MODE=11a
# WIFI_HT_MODE=VHT80
# WIFI_CHANNEL=36
## 2.4 GHz 802.11g
WIFI_HW_MODE=11g
WIFI_HT_MODE=HT20
WIFI_CHANNEL=6

19
run.sh
View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# set -x
function _usage() {
@ -6,6 +6,7 @@ function _usage() {
echo "Usage: $0 [/path/to/openwrt.conf]"
exit 1
}
SCRIPT_DIR=$(cd $(dirname $0) && pwd )
DEFAULT_CONFIG_FILE=$SCRIPT_DIR/openwrt.conf
CONFIG_FILE=${1:-$DEFAULT_CONFIG_FILE}
@ -45,7 +46,6 @@ function _gen_config() {
echo "* generating network config"
set -a
source $CONFIG_FILE
_get_phy_from_dev
for file in etc/config/*.tpl; do
envsubst <${file} >${file%.tpl}
docker cp ${file%.tpl} $CONTAINER:/${file%.tpl}
@ -115,22 +115,27 @@ function _reload_fw() {
/sbin/fw3 -q restart'
}
function main() {
function _prepare_wifi() {
test $WIFI_ENABLED = 'true' || return
test -z $WIFI_IFACE && _usage
cd "${SCRIPT_DIR}"
_get_phy_from_dev
_nmcli
echo "* moving device $WIFI_PHY to docker network namespace"
sudo iw phy "$WIFI_PHY" set netns $pid
_set_hairpin $WIFI_IFACE
}
function main() {
cd "${SCRIPT_DIR}"
_create_or_start_container
echo "* moving device $WIFI_PHY to docker network namespace"
pid=$(docker inspect -f '{{.State.Pid}}' $CONTAINER)
sudo iw phy "$WIFI_PHY" set netns $pid
echo "* creating netns symlink '$CONTAINER'"
sudo mkdir -p /var/run/netns
sudo ln -sf /proc/$pid/ns/net /var/run/netns/$CONTAINER
_set_hairpin $WIFI_IFACE
_prepare_wifi
echo "* setting up host macvlan interface"
sudo ip link add macvlan0 link $LAN_PARENT type macvlan mode bridge