diff --git a/README.md b/README.md index 790dde3..daec840 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ Please add - **netmask** (**required**): Subnet mask of the network - **broadcast** (**required**): Broadcast address of the network - **interface** (_optional_): Which wlan card to use. Default: wlan0 +- **eth_interface** (_optional_): Which ethernet interface to use. Default: eth0 - **hide_ssid** (_optional_): Whether SSID is visible or hidden. 0 = visible, 1 = hidden. Defaults to visible - **dhcp** (_optional_): Enable or disable DHCP server. 0 = disable, 1 = enable. Defaults to disabled - **dhcp_start_addr** (_optional_): Start address for DHCP range. Required if DHCP enabled diff --git a/hassio-access-point/CHANGELOG.md b/hassio-access-point/CHANGELOG.md index 2eff248..c616f51 100644 --- a/hassio-access-point/CHANGELOG.md +++ b/hassio-access-point/CHANGELOG.md @@ -6,6 +6,11 @@ - Error: "wlan0: Could not connect to kernel driver" - https://raspberrypi.stackexchange.com/a/88297 - **If anyone has any knowledge relating to the underlying modules, or just wants to assist with testing this addon, please get in touch, submit PRs, etc.** +## [0.4.5] - 2023-04-23 + +### Added +- Optional config option to specify ethernet interface. Defaults to eth0. + ## [0.4.4] - 2022-12-20 ### Fixed diff --git a/hassio-access-point/config.json b/hassio-access-point/config.json index b0c5be2..65a35d1 100644 --- a/hassio-access-point/config.json +++ b/hassio-access-point/config.json @@ -1,6 +1,6 @@ { "name": "Hass.io Access Point", - "version": "0.4.4", + "version": "0.4.5", "slug": "hassio-access-point", "description": "Create a WiFi access point to directly connect devices to Home Assistant", "arch": ["armhf", "armv7", "aarch64", "amd64", "i386"], @@ -22,6 +22,7 @@ "netmask": "255.255.255.0", "broadcast": "192.168.99.255", "interface": "wlan0", + "eth_interface": "eth0", "hide_ssid": "0", "dhcp": "0", "dhcp_start_addr": "192.168.99.10", @@ -42,6 +43,7 @@ "netmask": "str", "broadcast": "str", "interface": "str", + "eth_interface": "str", "hide_ssid": "int", "dhcp": "int", "dhcp_start_addr": "str", diff --git a/hassio-access-point/run.sh b/hassio-access-point/run.sh index afea8d9..449fcb1 100644 --- a/hassio-access-point/run.sh +++ b/hassio-access-point/run.sh @@ -27,6 +27,7 @@ ADDRESS=$(jq --raw-output ".address" $CONFIG_PATH) NETMASK=$(jq --raw-output ".netmask" $CONFIG_PATH) BROADCAST=$(jq --raw-output ".broadcast" $CONFIG_PATH) INTERFACE=$(jq --raw-output ".interface" $CONFIG_PATH) +ETH_INTERFACE=$(jq --raw-output ".eth_interface" $CONFIG_PATH) HIDE_SSID=$(jq --raw-output ".hide_ssid" $CONFIG_PATH) DHCP=$(jq --raw-output ".dhcp" $CONFIG_PATH) DHCP_START_ADDR=$(jq --raw-output ".dhcp_start_addr" $CONFIG_PATH) @@ -45,6 +46,11 @@ if [ ${#INTERFACE} -eq 0 ]; then INTERFACE="wlan0" fi +# Set eth_interface as eth0 if not specified in config +if [ ${#ETH_INTERFACE} -eq 0 ]; then + INTERFACE="eth0" +fi + # Set debug as 0 if not specified in config if [ ${#DEBUG} -eq 0 ]; then DEBUG=0 @@ -214,7 +220,7 @@ if [ $DHCP -eq 1 ]; then if [ $CLIENT_INTERNET_ACCESS -eq 1 ]; then ## Route traffic - iptables-nft -t nat -A POSTROUTING -o eth0 -j MASQUERADE + iptables-nft -t nat -A POSTROUTING -o $ETH_INTERFACE -j MASQUERADE iptables-nft -P FORWARD ACCEPT iptables-nft -F FORWARD fi @@ -224,7 +230,7 @@ else ## No DHCP == No DNS. Must be set manually on client. ## Step 1: Routing if [ $CLIENT_INTERNET_ACCESS -eq 1 ]; then - iptables-nft -t nat -A POSTROUTING -o eth0 -j MASQUERADE + iptables-nft -t nat -A POSTROUTING -o $ETH_INTERFACE -j MASQUERADE iptables-nft -P FORWARD ACCEPT iptables-nft -F FORWARD fi