ip tuntap add 对应的 C 代码:从命令到 ioctl
ip tuntap add dev tun0 mode tun 的核心是 open /dev/net/tun + TUNSETIFF。它只创建接口,不管 ip link up、ip addr add;持久化要 TUNSETPERSIST。
31 posts
ip tuntap add dev tun0 mode tun 的核心是 open /dev/net/tun + TUNSETIFF。它只创建接口,不管 ip link up、ip addr add;持久化要 TUNSETPERSIST。
先用 ip/tcpdump/ping 纯命令行创建和验证 TUN,再用 60 行 C 程序读包、改 ICMP、写回 TUN,让 ping 真正收到 reply。
A complete, runnable mapping from an AMX data model to UCI: ODL, event callback, libuci writes, and a GitHub demo repository.
Three levels of UCI integration: the shell uci command, libuci in C, and an AMX UCI backend module. Includes code skeletons and the uloop blocking pitfall.
The official examples/client.c hands a received fd to ustream_fd and parses lines in notify_read. ustream handles nonblocking I/O, edge-triggered reads, buffering and partial writes. Includes a complete TCP echo server and explains why you do not split every socket write into a state machine.
Build a minimal ubus server/client in C: ubus_connect, ubus_add_object, ubus_lookup_id, ubus_invoke, blobmsg policy, uloop and ACL pitfalls. Includes compile and run output.
Subscribe via RSS to get new posts automatically.
Technical questions, feedback and leads: use the guestbook.