uxc: veth setup issues

未关闭
#38 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 4 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
linux
领域
networking

调研方向

从此处描述的 veth 配置和 ubus network.interface.virt0 up 调用开始,追踪 uxc create 和 autostart 生命周期,以及主机和容器的 netifd 实例。重现启动序列并验证 veth 对能够在无需手动干预的情况下创建,同时主机和容器的 netifd 不再争用该接口。

由索引模型根据 Issue 内容生成。

描述

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?

主要语言
C
星标
13
派生
49
平均合并
11 天 12 小时
30 天内合并 PR
3

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

openwrt/procd 的其他 Issue

查看 openwrt/procd 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。