openwrt / openwrt/procd

uxc: veth setup issues

Open
#38 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
11
Forks
40
PR merge metrics
No merged PRs in 30d

Description

If I create a simple veth pair with the uxc jail settings...

config device
    option type 'veth'
    option name 'vhost0'
    option peer_name 'virt0'
    option ipv6 '0'

config interface 'virt0'
    option device 'vhost0'
    option proto 'dhcp'
    option jail 'alpine'
    option jail_device 'vhost'

..add virt0 to br-lan:

config device
    option name 'br-lan'
    option type 'bridge'
    list ports 'eth0'
    list ports 'virt0'

...and then create the container:

$ /etc/init.d/network restart
$ uxc create alpine

...then there's no set up veth pair on the host (while netifd is spawned in the container)

The only way I could find to get it working is call the ubus "up" function before create, using ip isn't sufficient:

$ uxc kill alpine
$ /etc/init.d/network restart
$ ubus call network.interface.virt0 up

Now I get:

netifd: Network device 'virt0' link is up
netifd: veth 'vhost0' link is up
netifd: Interface 'virt0' has link connectivity
netifd: Interface 'virt0' is setting up now

The veth pair exists, and the host netifd already set it up via dhcp.

Upon uxc create alpine the container netifd fights the host one:

netifd: virt0 (20): udhcpc: started, v1.37.0
netifd: virt0 (23837): udhcpc: SIOCGIFINDEX: No such device
netifd: virt0 (23837): udhcpc: received SIGTERM
netifd: virt0 (23837): udhcpc: unicasting a release of 192.168.0.183 to 192.168.0.1
netifd: virt0 (23837): udhcpc: sending release
netifd: virt0 (23837): udhcpc: can't bind to interface vhost0: No such device
netifd: virt0 (23837): udhcpc: bindtodevice: No such device
netifd: virt0 (23837): udhcpc: entering released state
netifd: virt0 (23837): Command failed: ubus call network.interface notify_proto { "action": 0, "link-up": false, "keep": false, "interface": "virt0" } (Permission denied)

While that doesn't seems to be a problem, now I have connectivity in both directions.

But obviously something is off. As netifd is spawned per container, I assume the intention is that's the instance supposed to set up veth. My ubus call makes it work for me, but that makes the host netifd setup the veth pair. And the fact that it doesn't come up without intervention breaks autostart upon host boot. What am I missing?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Trace the uxc create and autostart lifecycle alongside the host and container netifd instances, starting with the veth configuration and the ubus network.interface.virt0 up call described here. Reproduce the boot sequence and verify that the veth pair is created without manual intervention, while host and container netifd no longer compete for the interface.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.