Conversation
cathay4t
left a comment
There was a problem hiding this comment.
The IFLA_IPTUN_COLLECT_METADATA should be fixed and also expose Ipv4Addr instead of Vec<u8>
| // pub const IPVLAN_MODE_L3S: int = 2; | ||
| // pub const IPVLAN_MODE_MAX: int = 3; | ||
| // | ||
| // FROM https://elixir.bootlin.com/linux/v5.9.8/source/include/uapi/linux/if_tunnel.h#L58 |
There was a problem hiding this comment.
This is not official kernel website and there is no need to mention it.
| pub const IFLA_IPTUN_ENCAP_DPORT: u16 = 18; | ||
| pub const IFLA_IPTUN_COLLECT_METADATA: u16 = 19; | ||
| pub const IFLA_IPTUN_FWMARK: u16 = 20; | ||
| pub const __IFLA_IPTUN_MAX: u16 = 21; |
There was a problem hiding this comment.
Please remove this constant. It is changing and private to kernel only.
| Local(Vec<u8>), | ||
| Remote(Vec<u8>), |
There was a problem hiding this comment.
Exposing Vec<u8> is not helping user. Please parse them into Ipv4Addr.
| // https://elixir.bootlin.com/linux/v5.9.8/source/net/ipv4/ipip.c#L598 | ||
| #[derive(Debug, PartialEq, Eq, Clone)] | ||
| pub enum InfoIpTun { | ||
| Unspec(Vec<u8>), |
There was a problem hiding this comment.
No need to expose it. Kernel is not using it anyway.
| EncapFlags(u16), | ||
| EncapSport(u16), | ||
| EncapDport(u16), | ||
| CollectMetadata(u8), |
There was a problem hiding this comment.
The kernel has if (nla_put_flag(skb, IFLA_IPTUN_COLLECT_METADATA)) which indicate this is a boolean with 0 size in data.
| | Tos(ref value) | ||
| | Proto(ref value) | ||
| | Pmtudisc(ref value) | ||
| | CollectMetadata(ref value) |
There was a problem hiding this comment.
The kernel indicate CollectMetadata should emit no data at all.
| EncapDport(parse_u16_be(payload).context("invalid IFLA_IPTUN_ENCAP_DPORT value")?) | ||
| } | ||
| IFLA_IPTUN_COLLECT_METADATA => CollectMetadata( | ||
| parse_u8(payload).context("invalid IFLA_IPTUN_COLLECT_METADATA value")?, |
There was a problem hiding this comment.
The kernel code indicate, once IFLA_IPTUN_COLLECT_METADATA exist in netlink message, it means CollectMeta(true).
|
@tomjshine It has been a while. We are splitting this project into small parts. Besides fixing above change requests, could you move your PR to https://github.com/rust-netlink/netlink-packet-route Thank you! |
Adding support to create/get ipip tunnels. This has been modeled off the previous VxLAN work. No experience with Rust, so any feedback welcome :).
Before:
After: (running
./create_ipip)