LocalIP (macOS): improve detection
When a VPN session is enabled, the default route interface is changed to `utun*`, however `ipconfig` doesn't support it for some reason Use `ifconfig` instead
This commit is contained in:
parent
ccd5d9f526
commit
b313d39366
1 changed files with 2 additions and 2 deletions
4
neofetch
4
neofetch
|
@ -3878,10 +3878,10 @@ get_local_ip() {
|
|||
"Mac OS X" | "macOS" | "iPhone OS")
|
||||
if [[ "${local_ip_interface[0]}" == "auto" ]]; then
|
||||
interface="$(route get 1 | awk -F': ' '/interface/ {printf $2; exit}')"
|
||||
local_ip="$(ipconfig getifaddr "$interface")"
|
||||
local_ip="$(ifconfig "$interface" | grep "inet " | awk '{print $2}')"
|
||||
else
|
||||
for interface in "${local_ip_interface[@]}"; do
|
||||
local_ip="$(ipconfig getifaddr "$interface")"
|
||||
local_ip="$(ifconfig "$interface" | grep "inet " | awk '{print $2}')"
|
||||
if [[ -n "$local_ip" ]]; then
|
||||
prin "$interface" "$local_ip"
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue