Skip to content

autoconfig: validate the static IP settings - #194

Open
igorpecovnik wants to merge 1 commit into
mainfrom
autoconfig-validate-static-ip
Open

igorpecovnik wants to merge 1 commit into
mainfrom
autoconfig-validate-static-ip

Conversation

@igorpecovnik

Copy link
Copy Markdown
Member

A static address that can't work leaves a headless board unreachable, with no hint why. A forum user set everything else up correctly (Ethernet off, Wi-Fi on, static IP) but entered 192.168.1.255 / 255.255.255.0, the subnet's broadcast address. The imager accepted it, and the board never came up on the network.

Change: the static IP block is checked as a whole and errors show inline, like the existing URL fields (Field error= + TextInput invalid). Saving isn't blocked, same as the URL checks.

field flagged when
IP address not a valid IPv4 address, or the network / broadcast address of its subnet (/31 and /32 exempt)
Netmask not a contiguous dotted-quad mask
Gateway not a valid IPv4 address, outside the IP's subnet, or equal to the IP
DNS server anything other than IPv4 addresses separated by spaces or commas

The subnet maths uses arithmetic, not JS bitwise ops, which are signed 32-bit and break above 127.x.x.x.

The new strings are in en.json only; the nightly data-sync-locales job translates them.

Checked by running the validator on its own (node, types stripped): the forum case → ipNotHost; .0/24 and .255.255/16 → ipNotHost; .255/23, a /31 and 200.x/24 → OK; bad mask, gateway outside the subnet, gateway = IP, 300 octet, non-IP DNS → each flagged; empty fields → nothing. Not built or clicked through in the app: there's no Tauri/Node toolchain here, so please let CI build it.

Related: armbian/build#10840 (unattended first login; also fixes the 8.8.8.8, 1.1.1.1 DNS form the placeholder suggests, which previously produced invalid netplan YAML) · #193

A static address that can't work leaves a headless board unreachable
with no hint why. A forum user entered 192.168.1.255/24, the subnet's
broadcast address; the imager accepted it and first boot never came up
on the network.

Check the static IP block as a whole and flag it inline, like the URL
fields: a well-formed IPv4 address and contiguous netmask, an address
that is a usable host (not the network or broadcast address of its
subnet; /31 and /32 are exempt), a gateway inside that subnet and not
the device itself, and DNS servers as IPv4 addresses separated by
spaces or commas. English strings only; the nightly locale sync
translates them.

Signed-off-by: Igor Pecovnik <igor@armbian.com>
@github-actions

Copy link
Copy Markdown

🧪 Test Builds

Version: 0.0.0-pr.194 | PR: #194 | Status: ready for testing

Platform Download
Linux x64 📦 .deb / .AppImage
Windows x64 📦 .exe
macOS ARM64 📦 .dmg
ℹ️ About these builds
  • 🔓 Public downloads via nightly.link (no GitHub login required)
  • ⚠️ Unsigned builds for testing purposes only
  • ⏰ Expires in 7 days
  • 🔄 Updated on every push to this PR

@github-actions github-actions Bot added the status: ready for review Ready to be reviewed label Sep 28, 2026
@SuperKali

SuperKali commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Thanks Igor, catching the broadcast address is a good one.

Found one gap: a space at the end of the IP.

The check ignores spaces, so 192.168.1.50 passes without any warning. The imager then saves it exactly as typed, the board ends up with 192.168.1.50 /24, and netplan rejects it. So we're back to the forum case: a board that never shows up on the network. Easy to hit when you paste an address from somewhere.

Simplest fix is to flag the trailing space in the check. Trimming the value before it's saved works too.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: ready for review Ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants