Skip to content

general: S40network: bring up eth0 only when it exists - #2890

Open
Rogash1 wants to merge 1 commit into
OpenIPC:masterfrom
Rogash1:s40network-no-eth0
Open

Rogash1 wants to merge 1 commit into
OpenIPC:masterfrom
Rogash1:s40network-no-eth0

Conversation

@Rogash1

@Rogash1 Rogash1 commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Problem

When no Wi-Fi device is configured, S40network brought up eth0 unconditionally. A board without Ethernet has no eth0, so every boot printed an error from the eth0 interface setup instead of a statement of what happened.

The change brings eth0 up only when /sys/class/net/eth0 exists and otherwise says there is nothing to bring up. Boards with Ethernet, and every Wi-Fi path, are unchanged.

Hardware tested on

FH8626V100, Tenda CP3 V2.2 (Wi-Fi only, no Ethernet), RAM-loaded OpenIPC image, booted with no Wi-Fi device configured.

Evidence

Before (boot log):

Starting network...
ip: "dev" requires an argument

After:

Starting network...
No wlandev and no eth0: nothing to bring up
$ bash .github/scripts/test_network_failover.sh | tail -1
All network failover checks passed.

Scope

  • No kernel patches under general/package/all-patches/linux/ (those go to OpenIPC/linux)
  • No files specific to a single retail camera model (those go to OpenIPC/builder)
  • No probing or bring-up tooling (that goes to OpenIPC/ipctool)
  • Nothing under general/overlay/ or in a shared load_<vendor> script hardcodes a value specific to my board
  • Package sources come from an OpenIPC repository, and any version bump keeps at least the specificity of the pin it replaces (a new package should pin a full 40-character SHA)
  • No LD_PRELOAD, and no binaries that cannot be rebuilt from source
  • New code is selected by a defconfig, so CI actually builds it

Origin

This work adds support needed for the Tenda CP3 V2.2 based on the Fullhan FH8626V100. The implementation was developed with Claude assisting the reverse-engineering analysis of the official Tenda firmware and was repeatedly validated on a physical CP3 V2.2. Reverse-engineering was performed with REA and by direct analysis of the official device firmware and its observable hardware behaviour.

The Fullhan media SDK was not available during this work and was never used. No proprietary Tenda/Fullhan firmware images, binaries, SDK material, disassemblies, boot-ROM dumps or extracted vendor blobs are included in this contribution. The implementation is independently authored from the observed behaviour, public/open-source code and hardware testing.

I am submitting the work so the implementation and hardware findings are available to the OpenIPC community for review, testing and further development. I hope it is a useful base for others working with FH8626V100 hardware, and the community is very welcome to refine and carry it forward.

Without a configured Wi-Fi device the script brought up eth0
unconditionally. A Wi-Fi-only board has no eth0, and ifup then failed
with an error at every boot. Check for the interface first and say that
there is nothing to bring up otherwise.
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Skip eth0 bring-up when no Ethernet interface exists

🐞 Bug fix 🕐 Less than 10 minutes

Grey Divider

AI Description

• Check for eth0 before bringing it up when no Wi-Fi device is configured.
• Log that there is nothing to bring up on Wi-Fi-only boards, avoiding a boot-time error.
Merge Risk 🟢 Low

Evidence: Partial. The repository source does not provide a runtime observation proving that /sys/class/net/eth0 is always available whenever ifup eth0 could succeed. The false-negative path is therefore assessed as a plausible hypothesis rather than a verified deployment condition. The provider did not establish exact full-PR base and head diff revisions; assessment is based on the supplied changed-file inventory and current checked-out source. The report lists 9 more gaps.

Blast radius 🟢 Low 💥 1 capability

  • 1 affected end-to-end capability after fault-specific containment; implementation boundaries do not widen its functional scope.
  • The changed branch decides whether the configured eth0 interface is initialized during S40network startup.
  • The interface stanza supplies DHCP and MAC setup for that same end-to-end wired-network behavior, so it is an implementation hop in this capability rather than a separate capability.
Sources

general/overlay/etc/init.d/S40network[286-293]

	ifup lo
	if [ -n "$dev" ]; then
		set_wireless
	elif [ -e /sys/class/net/eth0 ]; then
		ifup eth0
	else
		echo "No wlandev and no eth0: nothing to bring up"
	fi
Behavioral complexity 🟢 Low 🧩 Straightforward

  • Before: the no-wlandev branch unconditionally called ifup eth0.
  • After: it first checks for the eth0 sysfs node and otherwise logs a message.
  • The new correctness condition is that the guard must agree with whether eth0 is available for ifup.
  • This is a single direct branch and does not introduce interacting states, ordering protocols, transformations, compatibility handling, or coordinated invariants.
  • The existing DHCP and MAC setup remain unchanged in the eth0 interface stanza.
Sources

general/overlay/etc/init.d/S40network[286-293]

	ifup lo
	if [ -n "$dev" ]; then
		set_wireless
	elif [ -e /sys/class/net/eth0 ]; then
		ifup eth0
	else
		echo "No wlandev and no eth0: nothing to bring up"
	fi

general/overlay/etc/network/interfaces.d/eth0[1-2]

iface eth0 inet dhcp
    hwaddress ether $(get_mac eth0)
Potential damage 🟡 Medium 🩹 Temporary loss

  • A false-negative existence check can leave a usable wired interface without DHCP or its configured MAC setup, causing temporary loss of wired network access.
  • The source supports the eth0 DHCP configuration and direct startup call, but does not show persistent state corruption or external side effects.
  • If eth0 is genuinely absent, the changed behavior is harmless and avoids a failed command.
  • Re-running S40network start after eth0 becomes visible can retry initialization.
  • Reverting the code restores the unconditional ifup attempt, but neither rollback nor the changed code repairs a missed lease automatically; no worker or retry path is established for this no-wlandev/no-eth0 branch.
Sources

general/overlay/etc/init.d/S40network[286-293]

	ifup lo
	if [ -n "$dev" ]; then
		set_wireless
	elif [ -e /sys/class/net/eth0 ]; then
		ifup eth0
	else
		echo "No wlandev and no eth0: nothing to bring up"
	fi

general/overlay/etc/network/interfaces.d/eth0[1-2]

iface eth0 inet dhcp
    hwaddress ether $(get_mac eth0)
Assessed commit 859fc14 > Snapshot assessment: the current PR revision could not be verified.
Diagram

graph TD
  Start["Network start"] --> Loopback["Bring up loopback"] --> Wifi{"Wi-Fi configured?"} -->|No| Ethernet{"eth0 exists?"} -->|No| Nothing["Log nothing to do"]
  Wifi -->|Yes| Wireless["Wireless setup"]
  Ethernet -->|Yes| Wired["Bring up eth0"]
Loading
High-Level Assessment

Keep the sysfs existence check at the no-wlandev branch: S40network already uses that check elsewhere, and it preserves the existing Ethernet and Wi-Fi behavior. Handling a failed ifup instead would still attempt to configure a nonexistent interface.

Files changed (1) +3 / -1

Bug fix (1) +3 / -1
S40networkGuard eth0 startup when no Wi-Fi device is configured +3/-1

Guard eth0 startup when no Wi-Fi device is configured

• The no-wlandev path now calls ifup eth0 only when /sys/class/net/eth0 exists. Otherwise it prints a message instead of attempting to bring up an absent interface; the configured Wi-Fi path is unchanged.

general/overlay/etc/init.d/S40network

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can enable the Remediation agent and Qodo fixes findings in a dedicated fix PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@openipc-ai openipc-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reproduced on the qemu-bench twin (hi3516ev300, release rootfs, eth0 renamed away before S40network, no wlandev):

master: Starting network...
        ip: SIOCGIFINDEX: No such device
PR:     Starting network...
        No wlandev and no eth0: nothing to bring up

With eth0 present, nothing changes: udhcpc: lease of 10.0.2.15 on both. The image built from this branch, booted on the fh8626v100 twin (where the GMAC doesn't probe), prints the same new line. test_network_failover.sh passes.

@openipc-ai
openipc-ai enabled auto-merge (squash) November 17, 2026 19:47

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants