1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-15 04:32:11 +00:00

Merge pull request #2524 from jvonau/2515_fix

2515 fix [another "secondary gateway" precaution]
This commit is contained in:
A Holt 2020-09-15 10:16:20 -04:00 committed by GitHub
commit 5a625ebf8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 9 deletions

View file

@ -59,7 +59,7 @@ virtual_network_devices: "-e ap0 -e lo -e br0 -e tun -e br- -e docker -e bridge0
# Set defaults for discovery process as strings
wifi1: "not found-1"
wifi2: "not found-2"
exclude_device: "none"
exclude_devices: "none"
device_gw: "none"
prior_gw_device: ""

View file

@ -106,27 +106,35 @@
register: wifi_gateway_found
when: discovered_wireless_iface != "none"
- name: Set has_wifi_gateway for {{ discovered_wireless_iface }} if gateway is detected
- name: Set has_wifi_gateway for {{ discovered_wireless_iface }} if WiFi gateway is detected
set_fact:
exclude_device: "-e {{ discovered_wireless_iface }}"
has_wifi_gateway: True
when: discovered_wireless_iface != "none" and (wifi_gateway_found.stdout|int > 0)
- name: Detect secondary gateway active
shell: ip r | grep default | grep -v {{ discovered_wan_iface }} | awk '{print $5}'
register: second_gateway_found
- name: Set exclude_devices for {{ second_gateway_found.stdout }} if gateway is detected
set_fact:
exclude_devices: "-e {{ second_gateway_found.stdout }}"
when: second_gateway_found.changed
# XO hack here ap_device would not be active therefore not set with
# wired as gw use ap_device to exclude eth0 from network calulations
#- name: XO laptop override 2 WiFi on LAN
# set_fact:
# exclude_device: "eth0"
# exclude_devices: "-e eth0"
# when: iiab_wan_iface != "eth0" and discovered_wireless_iface != "none" and xo_model == "XO-1.5"
- name: Exclude reserved Network Adapter if defined - takes adapter name
set_fact:
exclude_device: "-e {{ reserved_device }} {{ exclude_device }}"
exclude_devices: "-e {{ reserved_device }} {{ exclude_devices }}"
when: reserved_device is defined
- name: Count LAN ifaces
shell: ls /sys/class/net | grep -v {{ virtual_network_devices }} -e wwlan -e ppp -e {{ device_gw }} {{ exclude_device }} | wc -l
shell: ls /sys/class/net | grep -v {{ virtual_network_devices }} -e wwlan -e ppp -e {{ device_gw }} {{ exclude_devices }} | wc -l
register: num_lan_interfaces_result
- name: Calculate number of LAN interfaces including WiFi
@ -135,7 +143,7 @@
# LAN - pick non WAN's
- name: Create list of LAN (non WAN) ifaces
shell: ls /sys/class/net | grep -v {{ virtual_network_devices }} -e wwlan -e ppp -e {{ device_gw }} {{ exclude_device }}
shell: ls /sys/class/net | grep -v {{ virtual_network_devices }} -e wwlan -e ppp -e {{ device_gw }} {{ exclude_devices }}
when: num_lan_interfaces != "0"
register: lan_list_result
@ -241,8 +249,8 @@
value: "{{ discovered_wireless_iface }}"
- option: discovered_wired_iface
value: "{{ discovered_wired_iface }}"
# - option: 'iiab_wireless_lan_iface
# value: '{{ iiab_wireless_lan_iface }}"
- option: 'exclude_devices'
value: "{{ exclude_devices }}"
- option: num_lan_interfaces
value: "{{ num_lan_interfaces }}"
- option: gui_static_wan