peebles / rpi3-wifi-station-ap-stretch

Version that works for Stretch
113 stars 31 forks source link

avoid eth0 ip addr and wlan0 ip addr on same subnet #8

Open rudiratlos opened 6 years ago

rudiratlos commented 6 years ago

/lib/dhcpcd/dhcpcd-hooks/10-wpa_supplicant:

if [ -z "$wpa_supplicant_conf" ]; then for x in \ /etc/wpa_supplicant/wpa_supplicant-"$interface".conf \ /etc/wpa_supplicant/wpa_supplicant.conf \ /etc/wpa_supplicant-"$interface".conf \ /etc/wpa_supplicant.conf \ ; do if [ -s "$x" ]; then wpa_supplicant_conf="$x" break fi done fi : ${wpa_supplicant_conf:=/etc/wpa_supplicant.conf}

if [ "$ifwireless" = "1" ] && \ type wpa_supplicant >/dev/null 2>&1 && \ type wpa_cli >/dev/null 2>&1 then if [ "$reason" = "IPV4LL" ]; then date >> /var/log/wpa_supplicant.log wpa_supplicant -B -iwlan0 -f/var/log/wpa_supplicant.log -c/etc/wpa_supplicant/wpa_supplicant.conf fi if [ "$reason" = "BOUND" ] && [ "$interface" = "wlan0" ]; then date >>/var/log/wpa_supplicant.log wlan0_ip=ip addr show dev wlan0 | awk '/inet / { print $2 }' wlan0_subn=ip addr show dev wlan0 | awk '/inet / { print $4 }' eth0_subn=ip addr show dev eth0 | awk '/inet / { print $4 }' echo BOUND interface:$interface if_up:$if_up $wlan0_ip >>/var/log/wpa_supplicant.log

if [ "$eth0_subn" = "$wlan0_subn" ]; then
  echo "eth0 wlan0 on same subnet $wlan0_subn, flush ip from wlan0" >>/var/log/wpa_supplicant.log
  ip addr flush dev wlan0 >>/var/log/wpa_supplicant.log 2>&1
fi

fi fi