Skip to content

Match localnetwork is not supported on Windows (no getifaddrs in win32compat) #858

Description

@steffen-heil-secforge

Summary

On Windows, the ssh_config Match localnetwork criterion never matches and logs:

match localnetwork: not supported on this platform

Cause

check_match_ifaddrs() in readconf.c is gated on HAVE_IFADDRS_H. The Windows build (contrib/win32/openssh/config.h.vs) does not define it, and contrib/win32/win32compat/ provides no getifaddrs() implementation, so the #else branch (which prints "not supported on this platform") is what gets compiled. The same gate also disables the getifaddrs() path used by BindInterface in sshconnect.c.

Repro

ssh_config:

Match localnetwork 127.0.0.0/8
    Compression yes

ssh -G -F <cfg> somehost -> compression stays no; with -v you get match localnetwork: not supported on this platform. (OpenSSH_for_Windows_10.0p2)

Proposed fix

Add a getifaddrs()/freeifaddrs() shim in win32compat, implemented over the Win32 GetAdaptersAddresses() API; define HAVE_IFADDRS_H; register the new sources in the build. This enables Match localnetwork (client-side in 10.0) and the BindInterface interface enumeration. Disabled/disconnected adapters are returned without IFF_UP, so the existing consumers skip them (matches POSIX getifaddrs(3) semantics).

I have an implementation with a unit test, built and verified on Windows x64 — PR to follow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions