forked from cilium/cilium
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
优先级
🔴 高优先级
问题描述
VNI 解析函数接受任意 uint64 值(最大 18,446,744,073,709,551,615),但 VXLAN/VNI 通常使用 24-bit 值(最大 16,777,215)。没有上限验证可能导致下游系统故障。
影响范围
系统稳定性: 超大 VNI 值可能:
- 导致下游网络组件故障
- 破坏 VNI 索引结构
- 引起意外的网络行为
相关代码位置
- 文件:
pkg/endpoint/api/endpoint_api_manager.go:591 - 测试:
pkg/endpoint/id/id_test.go:161(测试中使用 max 24-bit VNI: 16777215) - PR: 7niu v1.19.0 rc.1 #6
当前状态
- Review 状态: @zbb88888 确认 "后续修复"
- 来源: PR 7niu v1.19.0 rc.1 #6 代码审查反馈
建议的解决方案
添加 VNI 上限常量和验证逻辑:
const MaxVNI = 16777215 // 24-bit max for VXLAN
func parseVNIFromPod(pod *slim_corev1.Pod, vniAnnotationKey string, logger *slog.Logger) (uint64, error) {
// ... existing parsing logic ...
parsedVNI, err := strconv.ParseUint(vniStr, 10, 64)
if err != nil {
return 0, fmt.Errorf("invalid VNI annotation %q value %q: %w", vniAnnotationKey, vniStr, err)
}
if parsedVNI == 0 {
return 0, fmt.Errorf("VNI annotation %q has invalid value 0", vniAnnotationKey)
}
// 添加上限验证
if parsedVNI > MaxVNI {
return 0, fmt.Errorf("VNI %d exceeds maximum %d (24-bit limit)", parsedVNI, MaxVNI)
}
return parsedVNI, nil
}相关链接
- PR 7niu v1.19.0 rc.1 #6: 7niu v1.19.0 rc.1
此 issue 由 PR #6 code review 自动生成
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels