Add/Parse Geneve Option for Multicast Tag
维护者通常 2 天内回复
评估
这个 Issue 还没有评估数据。
描述
With the additional Geneve option added as part of Multicast replication in https://github.com/oxidecomputer/dendrite/pull/14, we need to update the Geneve engine in OPTE to parse and set this option.
Here's the P4 code showing the additions:
const bit<7> GENEVE_OPT_OXIDE_MCAST = 0x01;
/* Geneve option for an `mcast_tag`.
* This is a 2-bit field that indicates the type of
* multicast traffic:
* 0 - Replicate packets to ports set for external multicast traffic
* 1 - Replicate packets to ports set for underlay multicast traffic
* 2 - Replicate packets to ports set for underlay and external multicast
traffic (bifurcated)
*
* The rest of the option is reserved.
*/
header geneve_opt_mcast_h {
bit<2> mcast_tag;
bit<30> reserved;
}
struct geneve_opt_headers_t {
geneve_opt_h ox_external_tag;
geneve_opt_h ox_external_tag;
// Multicast-specific options
geneve_opt_mcast_h ox_mcast_tag;
}
Here's a test helper used in packet testing to generate the option as part of a Geneve (encapsulated) packet:
/// Build a Geneve packet with a possible multicast tag.
pub fn gen_geneve_packet_with_mcast_tag(
src: Endpoint,
dst: Endpoint,
inner_type: u16,
vni: u32,
tag_ingress: bool,
mcast_tag: Option<u8>, // New parameter for multicast tag
payload: &[u8],
) -> Packet {
let udp_stack = match src.get_ip("src").unwrap() {
IpAddr::V4(_) => {
vec![inner_type, ipv4::IPPROTO_UDP.into(), eth::ETHER_IPV4]
}
IpAddr::V6(_) => {
vec![inner_type, ipv6::IPPROTO_UDP.into(), eth::ETHER_IPV6]
}
};
let mut pkt = Packet::gen(src, dst, udp_stack, Some(payload)).unwrap();
let geneve = pkt.hdrs.geneve_hdr.as_mut().unwrap();
geneve.vni = vni;
match (tag_ingress, mcast_tag) {
(true, Some(tag)) if tag < 3 => {
geneve.opt_len = 2;
// Multicast tag option
#[rustfmt::skip]
geneve.options.extend_from_slice(&[
// First 2 bytes: Geneve option class (0x0129)
// The OXIDE vendor-specific class identifier
0x01, 0x29,
// Third byte: Critical bit (0) + Option type (1)
// Type 1 represents multicast tagged packets
0x01,
// Fourth byte: Option(s) length
0x01,
// Fifth byte: Tag value (encoded in the data)
(tag & 0x03) << 6,
// Sixth byte: reserved
0x00,
// Seventh byte
0x00,
// Eighth byte
0x00,
]);
let extra_bytes = geneve.options.len() as u16;
match src.get_ip("src").unwrap() {
IpAddr::V4(_) => {
pkt.hdrs.ipv4_hdr.as_mut().unwrap().ipv4_total_len +=
extra_bytes
}
IpAddr::V6(_) => {
pkt.hdrs.ipv6_hdr.as_mut().unwrap().ipv6_payload_len +=
extra_bytes
}
}
pkt.hdrs.udp_hdr.as_mut().unwrap().udp_len += extra_bytes;
}
(true, Some(_)) => {
// Multicast tag is not valid
panic!("Multicast tag must be less than 3");
}
(true, None) => {
// External packet option
geneve.opt_len = 1;
#[rustfmt::skip]
geneve.options.extend_from_slice(&[
// First 2 bytes: Geneve option class (0x0129)
// The OXIDE vendor-specific class identifier
0x01, 0x29,
// Third byte: Critical bit (0) + Option type (1)
0x00,
// reserved + body len
0x00,
]);
let extra_bytes = geneve.options.len() as u16;
match src.get_ip("src").unwrap() {
IpAddr::V4(_) => {
pkt.hdrs.ipv4_hdr.as_mut().unwrap().ipv4_total_len +=
extra_bytes
}
IpAddr::V6(_) => {
pkt.hdrs.ipv6_hdr.as_mut().unwrap().ipv6_payload_len +=
extra_bytes
}
}
pkt.hdrs.udp_hdr.as_mut().unwrap().udp_len += extra_bytes;
}
_ => {}
}
pkt
}
- 主要语言
- Rust
- 星标
- 82
- 派生
- 16
- 平均合并
- 3 天 6 小时
- 30 天内合并 PR
- 11
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
oxidecomputer/opte 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
oxidecomputer/opte#1125 ·
维护者通常 2 天内回复
-
`PortBuilder::add_layer` doesn't need a mutex可能已有人在做 @FelixMcFelix 于 54 天前认领。 未关闭cleanup
难度 2/5 1-3 小时 新手友好度 84/100
oxidecomputer/opte#1061 ·
维护者通常 2 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 85/100
oxidecomputer/opte#1052 ·
维护者通常 2 天内回复
-
good first issue
难度 2/5 1-3 小时 新手友好度 62/100
oxidecomputer/opte#341 ·
维护者通常 2 天内回复
-
`Layer` creation should not unwrap `KStatNamed`可能已有人在做 @FelixMcFelix 于 54 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 40/100
oxidecomputer/opte#1126 ·
维护者通常 2 天内回复
查看 oxidecomputer/opte 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
qingjian-team/qingjian#1181 ·
维护者通常 2 天内回复
-
bug P2: medium
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
[Bug] StreamLifecycleConfig clamps post-TTFT stream timeouts to remaining admission budget可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
lbjlaq/Antigravity-Manager#4063 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
solutionscay/skiff#297 ·
维护者通常 1 天内回复