mirror of
https://github.com/yibaiba/hideck.git
synced 2026-12-06 08:02:21 +00:00
fix(ims): omit synthetic CNI and document PANI BSSID deviation
Why: TS 24.229 R.3.1.1A forbids inventing a cell id, and 7.2A.4.3 NOTE 3 wants a real AP BSSID that this host does not have. Why this works: default Cellular-Network-Info is now empty; FormatCellularNetworkInfo is only for a real TAC/CellID; PANI still uses a stable local MAC unless a BSSID is supplied, and the alignment doc records the deviation. Remaining: none for DEV-06/DEV-07 unit scope.
This commit is contained in:
1 parent
89f65d4eb9
commit
7c6cdab3be
3 files changed
+61
-8
No files matched your search
@@ -4,7 +4,7 @@
|
||||
|
||||
## 规范基线
|
||||
|
||||
- 本次 SIP/SDP 对齐基线固定为 GSMA IR.51 v9.0 与 GSMA IR.92 v21.0;后续版本升级必须同步更新本表和对应回归测试。
|
||||
- 本次 SIP/SDP 对齐基线固定为 GSMA IR.51 v10.0 与 GSMA IR.92 v21.0;后续版本升级必须同步更新本表和对应回归测试。
|
||||
- GSMA IR.51:IMS over untrusted Wi-Fi,VoWiFi IMS 功能继承 IR.92 要求。
|
||||
- GSMA IR.92:IMS voice and SMS profile,包含 SIP precondition、会话定时器、语音媒体和 SMS over IP 要求。
|
||||
- 3GPP TS 24.302:EPC via non-3GPP access。
|
||||
@@ -30,6 +30,8 @@
|
||||
| SIP session timer | RFC 4028、IR.92 2.2.8 | `voice/session_timer.go` | session timer 与 422/UPDATE/re-INVITE 测试 | 已实现 |
|
||||
| SMS over IMS | TS 24.341 | `sms`、`imscore/sms*` | RP-DATA、RP-ACK、状态报告和 SMMA 测试 | 已实现 |
|
||||
| IMS 紧急注册、紧急 URI 和 emergency ePDG 选择 | TS 24.229、IR.51 | `imscore/emergency_register.go`、`voice/emergency*`、`startup.SelectEmergencyEPDG` | emergency 单元测试 | 协议构造已实现但默认禁用;普通启动和拨号路径不调用 |
|
||||
| P-Access-Network-Info `i-wlan-node-id` | TS 24.229 7.2A.4.3 NOTE 3 | `imscore/helpers.go` `GenerateStableWlanNodeID` | `TestGenerateStableWlanNodeID`、`TestGeneratePAccessNetworkInfoPrefersRealBSSID` | **已知偏差**:本形态无 802.11 关联,使用身份派生的本地管理 MAC;若宿主能读到真实 BSSID 则优先使用。不得写成已对齐。该值也是紧急定位标识,合成值不可用于 PSAP 定位。 |
|
||||
| Cellular-Network-Info | TS 24.229 R.3.1.1A / 7.2.15.1 | `imscore/helpers.go` `GenerateDefaultCellularNetworkInfo` | `TestGenerateDefaultCellularNetworkInfoOmitsSyntheticCell` | VoWiFi 关射频时省略该头;有真实小区时用 `FormatCellularNetworkInfo`。禁止随机 TAC/CellID。 |
|
||||
|
||||
## 验证边界
|
||||
|
||||
|
||||
+35
-7
@@ -243,7 +243,7 @@ func IsFatalNetworkError(err error) bool {
|
||||
// GenerateStablePAccessNetworkInfo builds the WLAN P-Access-Network-Info
|
||||
// value used by the recovered implementation.
|
||||
func GenerateStablePAccessNetworkInfo(seed string) string {
|
||||
return fmt.Sprintf(`IEEE-802.11; i-wlan-node-id="%s"`, GenerateStableWlanNodeID(seed))
|
||||
return GeneratePAccessNetworkInfo(seed, "")
|
||||
}
|
||||
|
||||
// GenerateStablePAccessNetworkInfoByIdentity builds PANI from an identity.
|
||||
@@ -267,6 +267,9 @@ func AppendPAccessNetworkCountry(pani, iso2 string) string {
|
||||
}
|
||||
|
||||
// GenerateStableWlanNodeID derives a stable WLAN node ID from an identity.
|
||||
// This host has no 802.11 association, so the value is a locally administered
|
||||
// MAC derived from identity rather than a real AP BSSID (TS 24.229 7.2A.4.3
|
||||
// NOTE 3). Callers that have a real BSSID should pass it via PAccessNetworkInfo.
|
||||
func GenerateStableWlanNodeID(seed string) string {
|
||||
seed = strings.TrimSpace(seed)
|
||||
if seed == "" {
|
||||
@@ -278,6 +281,19 @@ func GenerateStableWlanNodeID(seed string) string {
|
||||
return fmt.Sprintf("%x", digest[:6])
|
||||
}
|
||||
|
||||
// GeneratePAccessNetworkInfo prefers a real BSSID when the host can read one.
|
||||
func GeneratePAccessNetworkInfo(seed, bssid string) string {
|
||||
nodeID := strings.ReplaceAll(strings.ToLower(strings.TrimSpace(bssid)), ":", "")
|
||||
nodeID = strings.ReplaceAll(nodeID, "-", "")
|
||||
if nodeID == "" {
|
||||
nodeID = GenerateStableWlanNodeID(seed)
|
||||
}
|
||||
if nodeID == "" {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf(`IEEE-802.11; i-wlan-node-id="%s"`, nodeID)
|
||||
}
|
||||
|
||||
func stablePANIGenerationSeed(candidates []string) string {
|
||||
for _, candidate := range candidates {
|
||||
if seed := strings.TrimSpace(candidate); seed != "" {
|
||||
@@ -303,18 +319,30 @@ func GenerateRandomIMEIForModel(model string) string {
|
||||
return prefix + string(imeiCheckDigit(prefix))
|
||||
}
|
||||
|
||||
// GenerateDefaultCellularNetworkInfo builds a default cellular network info
|
||||
// string from the SIM profile.
|
||||
// GenerateDefaultCellularNetworkInfo omits Cellular-Network-Info when the
|
||||
// radio is off and no real cell is available (TS 24.229 R.3.1.1A).
|
||||
func GenerateDefaultCellularNetworkInfo(mcc, mnc string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// FormatCellularNetworkInfo builds the header from a real camped cell.
|
||||
// Empty TAC or CellID returns an empty string so the header is omitted.
|
||||
func FormatCellularNetworkInfo(mcc, mnc, tac, cellID string, ageSeconds int) string {
|
||||
mcc = strings.TrimSpace(mcc)
|
||||
mncValue, err := strconv.Atoi(strings.TrimSpace(mnc))
|
||||
if err != nil || len(mcc) != 3 || mncValue < 0 || mncValue > 999 {
|
||||
return ""
|
||||
}
|
||||
// Proper E-UTRAN FDD cell identity: MCC(3) + MNC(2) + TAC(4 hex) + CellID(4 hex).
|
||||
// O2/giffgaff UK uses FDD, and a well-formed 13-char cell id.
|
||||
cellID := fmt.Sprintf("%s%02d%s%s", mcc, mncValue, strings.ToUpper(randomHex(4)), strings.ToUpper(randomHex(4)))
|
||||
return fmt.Sprintf("3GPP-E-UTRAN-FDD;utran-cell-id-3gpp=%s;cell-info-age=3600", cellID)
|
||||
tac = strings.TrimSpace(tac)
|
||||
cellID = strings.TrimSpace(cellID)
|
||||
if tac == "" || cellID == "" {
|
||||
return ""
|
||||
}
|
||||
if ageSeconds < 0 {
|
||||
ageSeconds = 0
|
||||
}
|
||||
identity := fmt.Sprintf("%s%02d%s%s", mcc, mncValue, strings.ToUpper(tac), strings.ToUpper(cellID))
|
||||
return fmt.Sprintf("3GPP-E-UTRAN-FDD;utran-cell-id-3gpp=%s;cell-info-age=%d", identity, ageSeconds)
|
||||
}
|
||||
|
||||
func imeiCheckDigit(prefix string) byte {
|
||||
|
||||
@@ -79,6 +79,29 @@ func TestGenerateStablePAccessNetworkInfo(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGeneratePAccessNetworkInfoPrefersRealBSSID(t *testing.T) {
|
||||
got := GeneratePAccessNetworkInfo("user@example.com", "AA:BB:CC:DD:EE:FF")
|
||||
if got != `IEEE-802.11; i-wlan-node-id="aabbccddeeff"` {
|
||||
t.Fatalf("real BSSID PANI = %q", got)
|
||||
}
|
||||
if GeneratePAccessNetworkInfo("user@example.com", "") != GenerateStablePAccessNetworkInfo("user@example.com") {
|
||||
t.Fatal("empty BSSID should fall back to identity-derived node id")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGenerateDefaultCellularNetworkInfoOmitsSyntheticCell(t *testing.T) {
|
||||
if got := GenerateDefaultCellularNetworkInfo("234", "15"); got != "" {
|
||||
t.Fatalf("default CNI = %q, want omitted", got)
|
||||
}
|
||||
got := FormatCellularNetworkInfo("234", "15", "00ab", "1234", 12)
|
||||
if got != "3GPP-E-UTRAN-FDD;utran-cell-id-3gpp=2341500AB1234;cell-info-age=12" {
|
||||
t.Fatalf("real CNI = %q", got)
|
||||
}
|
||||
if FormatCellularNetworkInfo("234", "15", "", "1234", 12) != "" {
|
||||
t.Fatal("CNI with empty TAC should be omitted")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGenerateStableWlanNodeID(t *testing.T) {
|
||||
id := GenerateStableWlanNodeID("user@example.com")
|
||||
if id != "b6c9a289323b" {
|
||||
|
||||
Reference in new issue
Block a user