Yicong-Huang commented on code in PR #7141:
URL: https://github.com/apache/texera/pull/7141#discussion_r3768780689


##########
bin/local-dev/main.sh:
##########
@@ -466,6 +466,43 @@ fi
 # Both platform probes follow the same two steps: the interface backing the
 # default route first (most reliable on a laptop that may have wifi +
 # thunderbolt + tailscale all active), then a scan as a fallback.
+_detect_host_lan_ip_windows() {
+    local iface_details="" local_ip=""
+
+    local 
virt_excl="vEthernet|WSL|Hyper-V|VirtualBox|Docker|Bridge|tap|tun|cni|flannel|cali|kube|Local|tailscale|zerotier|wg|McAfee"
+    # Use 'netsh interface ip show route' to find the list of interfaces
+    # associated with the 0.0.0.0/0 (default) route and trace the respective 
indices
+    local idx_list
+    idx_list=$(netsh interface ip show route 2>/dev/null | \
+            awk -v excl="$virt_excl" '{
+                for (i = 1; i < NF; i++) {
+                    if ($i == "0.0.0.0/0") {
+                            print $(i+1)
+                    }
+                }
+            }')
+
+    # Iterate through candidate indices, inspect adapter name and grab the 
first physical LAN IP
+    for idx in $idx_list; do
+        iface_details=$(netsh interface ip show addresses "$idx" 2>/dev/null)
+
+        # Skip if adapter name is empty or matches virtual/VPN exclusions
+        iface_name=$(echo "$iface_details" | awk -F'"' '/Configuration for 
interface/ {print $2}')
+        if [[ -z "$iface_name" ]] || echo "$iface_name" | grep -qE 
"$virt_excl"; then

Review Comment:
   This match is case-exact, but Windows adapter names are capitalized display 
names. Nine of the sixteen tokens (`tailscale`, `zerotier`, `tap`, `tun`, 
`cni`, `flannel`, `cali`, `kube`, `wg`) are lowercase Linux *device* names 
carried over from the peer, so they can never fire here. Reproduced against a 
fake netsh: with default routes via Idx 22 (`Tailscale`) and Idx 14 
(`Ethernet`), the probe returns the tailscale address — the one address 
lakekeeper cannot route back to. `ZeroTier One [...]` slips through identically.
   
   ```suggestion
           if [[ -z "$iface_name" ]] || echo "$iface_name" | grep -qiE 
"$virt_excl"; then
   ```



##########
bin/local-dev/main.sh:
##########
@@ -466,6 +466,43 @@ fi
 # Both platform probes follow the same two steps: the interface backing the
 # default route first (most reliable on a laptop that may have wifi +
 # thunderbolt + tailscale all active), then a scan as a fallback.
+_detect_host_lan_ip_windows() {
+    local iface_details="" local_ip=""
+
+    local 
virt_excl="vEthernet|WSL|Hyper-V|VirtualBox|Docker|Bridge|tap|tun|cni|flannel|cali|kube|Local|tailscale|zerotier|wg|McAfee"
+    # Use 'netsh interface ip show route' to find the list of interfaces
+    # associated with the 0.0.0.0/0 (default) route and trace the respective 
indices
+    local idx_list
+    idx_list=$(netsh interface ip show route 2>/dev/null | \
+            awk -v excl="$virt_excl" '{

Review Comment:
   The exclusion moved down to the adapter name, so this awk program never 
reads `excl`.
   
   ```suggestion
               awk '{
   ```



##########
bin/local-dev/main.sh:
##########
@@ -466,6 +466,43 @@ fi
 # Both platform probes follow the same two steps: the interface backing the
 # default route first (most reliable on a laptop that may have wifi +
 # thunderbolt + tailscale all active), then a scan as a fallback.
+_detect_host_lan_ip_windows() {
+    local iface_details="" local_ip=""

Review Comment:
   `iface_name` and the `idx` loop variable land in the global scope. Both 
peers declare all of theirs — linux includes its `idx` at `main.sh:522` — and 
the previous round of this function did too.
   
   ```suggestion
       local iface_details="" local_ip="" iface_name="" idx=""
   ```



##########
bin/local-dev/main.sh:
##########
@@ -466,6 +466,43 @@ fi
 # Both platform probes follow the same two steps: the interface backing the
 # default route first (most reliable on a laptop that may have wifi +
 # thunderbolt + tailscale all active), then a scan as a fallback.
+_detect_host_lan_ip_windows() {
+    local iface_details="" local_ip=""
+
+    local 
virt_excl="vEthernet|WSL|Hyper-V|VirtualBox|Docker|Bridge|tap|tun|cni|flannel|cali|kube|Local|tailscale|zerotier|wg|McAfee"

Review Comment:
   `Local` was inert while the regex tested the gateway column; now that it 
tests adapter names it matches the physical "Local Area Connection". 
Reproduced: a single default route on that adapter makes the probe return 1, 
and with no fallback scan behind it `main.sh:586` hard-exits.
   
   ```suggestion
       local 
virt_excl="vEthernet|WSL|Hyper-V|VirtualBox|Docker|Bridge|tap|tun|cni|flannel|cali|kube|tailscale|zerotier|wg|McAfee"
   ```



##########
bin/local-dev/main.sh:
##########
@@ -466,6 +466,43 @@ fi
 # Both platform probes follow the same two steps: the interface backing the
 # default route first (most reliable on a laptop that may have wifi +
 # thunderbolt + tailscale all active), then a scan as a fallback.
+_detect_host_lan_ip_windows() {
+    local iface_details="" local_ip=""
+
+    local 
virt_excl="vEthernet|WSL|Hyper-V|VirtualBox|Docker|Bridge|tap|tun|cni|flannel|cali|kube|Local|tailscale|zerotier|wg|McAfee"
+    # Use 'netsh interface ip show route' to find the list of interfaces
+    # associated with the 0.0.0.0/0 (default) route and trace the respective 
indices
+    local idx_list
+    idx_list=$(netsh interface ip show route 2>/dev/null | \
+            awk -v excl="$virt_excl" '{
+                for (i = 1; i < NF; i++) {
+                    if ($i == "0.0.0.0/0") {
+                            print $(i+1)
+                    }
+                }
+            }')
+
+    # Iterate through candidate indices, inspect adapter name and grab the 
first physical LAN IP
+    for idx in $idx_list; do
+        iface_details=$(netsh interface ip show addresses "$idx" 2>/dev/null)
+
+        # Skip if adapter name is empty or matches virtual/VPN exclusions
+        iface_name=$(echo "$iface_details" | awk -F'"' '/Configuration for 
interface/ {print $2}')
+        if [[ -z "$iface_name" ]] || echo "$iface_name" | grep -qE 
"$virt_excl"; then
+            continue
+        fi
+        

Review Comment:
   Whitespace-only line.
   
   ```suggestion
   
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to