disable wifi option
parent
544c77a97a
commit
b854d8adb6
|
@ -1,6 +1,6 @@
|
||||||
### Sample OpenWRT config file ###
|
### Sample OpenWRT config file ###
|
||||||
|
|
||||||
## general
|
## General
|
||||||
# source image for Raspberry Pi build target
|
# source image for Raspberry Pi build target
|
||||||
SOURCE_IMG=openwrt-19.07.3-brcm2708-bcm2708-rpi-ext4-factory.img
|
SOURCE_IMG=openwrt-19.07.3-brcm2708-bcm2708-rpi-ext4-factory.img
|
||||||
# source for build (x86) target
|
# source for build (x86) target
|
||||||
|
@ -23,7 +23,7 @@ UPSTREAM_DNS_SERVER=8.8.8.8
|
||||||
LAN_NAME=openwrt-lan
|
LAN_NAME=openwrt-lan
|
||||||
# Host interface which will provide the LAN link for OpenWRT.
|
# Host interface which will provide the LAN link for OpenWRT.
|
||||||
# Can be a physical interface or a VLAN of the primary interface.
|
# 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.
|
# VLAN 10. VLAN interface will be created if it doesn't exist.
|
||||||
LAN_PARENT=eth0.10
|
LAN_PARENT=eth0.10
|
||||||
# DNS search domain for LAN DHCP clients
|
# 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
|
# openwrt doesn't accept CIDR notation; must match LAN_SUBNET
|
||||||
LAN_NETMASK=255.255.255.0
|
LAN_NETMASK=255.255.255.0
|
||||||
|
|
||||||
# wifi settings
|
## Wifi settings
|
||||||
|
WIFI_ENABLED=true
|
||||||
WIFI_IFACE=wlan0
|
WIFI_IFACE=wlan0
|
||||||
WIFI_SSID=test123
|
WIFI_SSID=test123
|
||||||
WIFI_ENCRYPTION=psk2
|
WIFI_ENCRYPTION=psk2
|
||||||
WIFI_KEY=12345678
|
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_HW_MODE=11a
|
||||||
# WIFI_HT_MODE=VHT80
|
# WIFI_HT_MODE=VHT80
|
||||||
# WIFI_CHANNEL=36
|
# WIFI_CHANNEL=36
|
||||||
|
## 2.4 GHz 802.11g
|
||||||
WIFI_HW_MODE=11g
|
WIFI_HW_MODE=11g
|
||||||
WIFI_HT_MODE=HT20
|
WIFI_HT_MODE=HT20
|
||||||
WIFI_CHANNEL=6
|
WIFI_CHANNEL=6
|
19
run.sh
19
run.sh
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
# set -x
|
# set -x
|
||||||
|
|
||||||
function _usage() {
|
function _usage() {
|
||||||
|
@ -6,6 +6,7 @@ function _usage() {
|
||||||
echo "Usage: $0 [/path/to/openwrt.conf]"
|
echo "Usage: $0 [/path/to/openwrt.conf]"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
SCRIPT_DIR=$(cd $(dirname $0) && pwd )
|
SCRIPT_DIR=$(cd $(dirname $0) && pwd )
|
||||||
DEFAULT_CONFIG_FILE=$SCRIPT_DIR/openwrt.conf
|
DEFAULT_CONFIG_FILE=$SCRIPT_DIR/openwrt.conf
|
||||||
CONFIG_FILE=${1:-$DEFAULT_CONFIG_FILE}
|
CONFIG_FILE=${1:-$DEFAULT_CONFIG_FILE}
|
||||||
|
@ -45,7 +46,6 @@ function _gen_config() {
|
||||||
echo "* generating network config"
|
echo "* generating network config"
|
||||||
set -a
|
set -a
|
||||||
source $CONFIG_FILE
|
source $CONFIG_FILE
|
||||||
_get_phy_from_dev
|
|
||||||
for file in etc/config/*.tpl; do
|
for file in etc/config/*.tpl; do
|
||||||
envsubst <${file} >${file%.tpl}
|
envsubst <${file} >${file%.tpl}
|
||||||
docker cp ${file%.tpl} $CONTAINER:/${file%.tpl}
|
docker cp ${file%.tpl} $CONTAINER:/${file%.tpl}
|
||||||
|
@ -115,22 +115,27 @@ function _reload_fw() {
|
||||||
/sbin/fw3 -q restart'
|
/sbin/fw3 -q restart'
|
||||||
}
|
}
|
||||||
|
|
||||||
function main() {
|
function _prepare_wifi() {
|
||||||
|
test $WIFI_ENABLED = 'true' || return
|
||||||
test -z $WIFI_IFACE && _usage
|
test -z $WIFI_IFACE && _usage
|
||||||
cd "${SCRIPT_DIR}"
|
|
||||||
_get_phy_from_dev
|
_get_phy_from_dev
|
||||||
_nmcli
|
_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
|
_create_or_start_container
|
||||||
|
|
||||||
echo "* moving device $WIFI_PHY to docker network namespace"
|
|
||||||
pid=$(docker inspect -f '{{.State.Pid}}' $CONTAINER)
|
pid=$(docker inspect -f '{{.State.Pid}}' $CONTAINER)
|
||||||
sudo iw phy "$WIFI_PHY" set netns $pid
|
|
||||||
|
|
||||||
echo "* creating netns symlink '$CONTAINER'"
|
echo "* creating netns symlink '$CONTAINER'"
|
||||||
sudo mkdir -p /var/run/netns
|
sudo mkdir -p /var/run/netns
|
||||||
sudo ln -sf /proc/$pid/ns/net /var/run/netns/$CONTAINER
|
sudo ln -sf /proc/$pid/ns/net /var/run/netns/$CONTAINER
|
||||||
|
|
||||||
_set_hairpin $WIFI_IFACE
|
_prepare_wifi
|
||||||
|
|
||||||
echo "* setting up host macvlan interface"
|
echo "* setting up host macvlan interface"
|
||||||
sudo ip link add macvlan0 link $LAN_PARENT type macvlan mode bridge
|
sudo ip link add macvlan0 link $LAN_PARENT type macvlan mode bridge
|
||||||
|
|
Loading…
Reference in New Issue