Skip to content

Commit e15490c

Browse files
committed
Merge remote-tracking branch 'upstream/master' into rsarwad_merge_csfb
2 parents ec6d70a + 1e28bfe commit e15490c

File tree

205 files changed

+20818
-17047
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

205 files changed

+20818
-17047
lines changed

feg/gateway/services/testcore/hss/servicers/hss_swx_proxy_integration_test.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,22 @@ import (
2424
)
2525

2626
func TestMAR_Successful(t *testing.T) {
27-
testMARSuccessful(t, true)
28-
testMARSuccessful(t, false)
27+
testMARSuccessful(t, true, false)
28+
testMARSuccessful(t, false, false)
29+
testMARSuccessful(t, true, true)
30+
testMARSuccessful(t, false, true)
2931
}
3032

31-
func testMARSuccessful(t *testing.T, verifyAuthorization bool) {
33+
func testMARSuccessful(t *testing.T, verifyAuthorization bool, clearAAAserver bool) {
3234
hss := getTestHSSDiameterServer(t)
35+
subscriber, err := hss.GetSubscriberData(context.Background(), &lteprotos.SubscriberID{Id: "sub1"})
36+
assert.NoError(t, err)
37+
if clearAAAserver {
38+
subscriber.State.TgppAaaServerName = ""
39+
}
40+
_, err = hss.UpdateSubscriber(context.Background(), subscriber)
41+
assert.NoError(t, err)
42+
3343
swxProxy := getTestSwxProxy(t, hss, verifyAuthorization, false, true)
3444
mar := &fegprotos.AuthenticationRequest{
3545
UserName: "sub1",

feg/gateway/services/testcore/hss/servicers/sa.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,32 @@ func NewSAA(srv *HomeSubscriberServer, msg *diam.Message) (*diam.Message, error)
6666
}
6767

6868
answer := ConstructSuccessAnswer(msg, sar.SessionID, srv.Config.Server, diam.TGPP_SWX_APP_ID)
69-
answer.NewAVP(avp.TGPPAAAServerName, avp.Mbit|avp.Vbit, diameter.Vendor3GPP, aaaServer)
7069
answer.NewAVP(avp.UserName, avp.Mbit, 0, sar.UserName)
70+
7171
switch sar.ServerAssignmentType {
72+
case servicers.ServerAssignnmentType_USER_DEREGISTRATION:
73+
subscriber.State.TgppAaaServerName = ""
74+
subscriber.State.TgppAaaServerRegistered = false
75+
err = srv.store.UpdateSubscriber(subscriber)
76+
if err != nil {
77+
err = fmt.Errorf("Failed to deregister 3GPP AAA server: %v", err)
78+
return ConstructFailureAnswer(msg, sar.SessionID, srv.Config.Server, uint32(diam.UnableToComply)), err
79+
}
80+
7281
case servicers.ServerAssignmentType_REGISTRATION:
7382
subscriber.State.TgppAaaServerRegistered = true
7483
err = srv.store.UpdateSubscriber(subscriber)
7584
if err != nil {
7685
err = fmt.Errorf("Failed to register 3GPP AAA server: %v", err)
7786
return ConstructFailureAnswer(msg, sar.SessionID, srv.Config.Server, uint32(diam.UnableToComply)), err
7887
}
79-
fallthrough
88+
answer.NewAVP(avp.TGPPAAAServerName, avp.Mbit|avp.Vbit, diameter.Vendor3GPP, aaaServer)
89+
answer.AddAVP(getNon3GPPUserDataAVP(subscriber.GetNon_3Gpp()))
90+
8091
case servicers.ServerAssignmentType_AAA_USER_DATA_REQUEST:
92+
answer.NewAVP(avp.TGPPAAAServerName, avp.Mbit|avp.Vbit, diameter.Vendor3GPP, aaaServer)
8193
answer.AddAVP(getNon3GPPUserDataAVP(subscriber.GetNon_3Gpp()))
94+
8295
default:
8396
err = fmt.Errorf("server assignment type not implemented: %v", sar.ServerAssignmentType)
8497
return ConstructFailureAnswer(msg, sar.SessionID, srv.Config.Server, uint32(diam.UnableToComply)), err

feg/gateway/services/testcore/hss/servicers/sa_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,19 @@ func TestNewSAA_SuccessfulRegistration(t *testing.T) {
3939
assert.True(t, subscriber.GetState().GetTgppAaaServerRegistered())
4040
}
4141

42+
func TestNewSAA_SuccessfulDeregistration(t *testing.T) {
43+
sar := createSAR("sub1", definitions.ServerAssignnmentType_USER_DEREGISTRATION)
44+
server := test.NewTestHomeSubscriberServer(t)
45+
response, err := hss.NewSAA(server, sar)
46+
assert.NoError(t, err)
47+
checkSAASuccessDeregistration(t, response)
48+
49+
subscriber, err := server.GetSubscriberData(context.Background(), &lteprotos.SubscriberID{Id: "sub1"})
50+
assert.NoError(t, err)
51+
assert.False(t, subscriber.GetState().GetTgppAaaServerRegistered())
52+
assert.Empty(t, subscriber.GetState().TgppAaaServerName)
53+
}
54+
4255
func TestNewSAA_SuccessfulUserDataRequest(t *testing.T) {
4356
sar := createSAR("sub1", definitions.ServerAssignmentType_AAA_USER_DATA_REQUEST)
4457
server := test.NewTestHomeSubscriberServer(t)
@@ -167,6 +180,16 @@ func checkSAASuccess(t *testing.T, response *diam.Message) {
167180
assert.Equal(t, datatype.UTF8String("12345"), profile.SubscriptionId.SubscriptionIdData)
168181
}
169182

183+
// checkSAASuccessDeregistration ensures that a successful SAA with a deregistration command contains all the expected data
184+
func checkSAASuccessDeregistration(t *testing.T, response *diam.Message) {
185+
saa := testUnmarshalSAA(t, response)
186+
assert.Equal(t, diam.Success, int(saa.ResultCode))
187+
assert.Equal(t, datatype.DiameterIdentity(""), saa.AAAServerName)
188+
assert.Equal(t, datatype.UTF8String("sub1"), saa.UserName)
189+
assert.Equal(t, int32(definitions.AuthSessionState_NO_STATE_MAINTAINED), saa.AuthSessionState)
190+
191+
}
192+
170193
// testUnmarshalSAA unmarshals an SAA message and checks that the SessionID,
171194
// OriginHost, and OriginRealm fields are as expected.
172195
func testUnmarshalSAA(t *testing.T, response *diam.Message) definitions.SAA {

lte/cloud/go/services/cellular/utils/lte_bands.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,29 @@ var bands = [...]LTEBand{
3737
{ID: 4, Mode: FDDMode, StartEarfcnDl: 1950, StartEarfcnUl: 19950, CountEarfcn: 450},
3838
{ID: 28, Mode: FDDMode, StartEarfcnDl: 9210, StartEarfcnUl: 27210, CountEarfcn: 450},
3939
// TDDMode
40+
{ID: 33, Mode: TDDMode, StartEarfcnDl: 36000, CountEarfcn: 200},
41+
{ID: 34, Mode: TDDMode, StartEarfcnDl: 36200, CountEarfcn: 150},
42+
{ID: 35, Mode: TDDMode, StartEarfcnDl: 36350, CountEarfcn: 600},
43+
{ID: 36, Mode: TDDMode, StartEarfcnDl: 36950, CountEarfcn: 600},
44+
{ID: 37, Mode: TDDMode, StartEarfcnDl: 37550, CountEarfcn: 200},
4045
{ID: 38, Mode: TDDMode, StartEarfcnDl: 37750, CountEarfcn: 500},
4146
{ID: 39, Mode: TDDMode, StartEarfcnDl: 38250, CountEarfcn: 400},
4247
{ID: 40, Mode: TDDMode, StartEarfcnDl: 38650, CountEarfcn: 1000},
4348
{ID: 41, Mode: TDDMode, StartEarfcnDl: 39650, CountEarfcn: 1940},
4449
{ID: 42, Mode: TDDMode, StartEarfcnDl: 41590, CountEarfcn: 2000},
4550
{ID: 43, Mode: TDDMode, StartEarfcnDl: 43590, CountEarfcn: 2000},
51+
{ID: 44, Mode: TDDMode, StartEarfcnDl: 45590, CountEarfcn: 1000},
52+
{ID: 45, Mode: TDDMode, StartEarfcnDl: 46590, CountEarfcn: 200},
53+
{ID: 46, Mode: TDDMode, StartEarfcnDl: 46790, CountEarfcn: 7750},
54+
{ID: 47, Mode: TDDMode, StartEarfcnDl: 54540, CountEarfcn: 700},
4655
{ID: 48, Mode: TDDMode, StartEarfcnDl: 55240, CountEarfcn: 1500},
56+
{ID: 49, Mode: TDDMode, StartEarfcnDl: 56740, CountEarfcn: 1500},
57+
{ID: 50, Mode: TDDMode, StartEarfcnDl: 58240, CountEarfcn: 850},
58+
{ID: 51, Mode: TDDMode, StartEarfcnDl: 59090, CountEarfcn: 50},
59+
{ID: 52, Mode: TDDMode, StartEarfcnDl: 59140, CountEarfcn: 1000},
60+
// Adding Band #53 require changes in the python code cause it's
61+
// start_freq_dl is float value.
62+
//{ID: 53, Mode: TDDMode, StartEarfcnDl: 60140, CountEarfcn: 115},
4763
}
4864

4965
// EarfcnDLInRange checks that an EARFCN-DL belongs to a band

lte/cloud/go/services/cellular/utils/lte_bands_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func TestGetBand(t *testing.T) {
3535
}
3636

3737
func TestGetBandError(t *testing.T) {
38-
expectedErr := [...]uint32{45590, 45591}
38+
expectedErr := [...]uint32{60140, 60255}
3939

4040
for _, earfcndl := range expectedErr {
4141
_, err := utils.GetBand(earfcndl)

lte/cloud/go/services/eps_authentication/servicers/test_utils/test_subscribers.go

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,50 @@ const (
1919
defaultMaxDlBitRate = uint64(200000000)
2020
)
2121

22-
// GetTestSubscribers returns a slice of SubscriberData protos to be used
23-
// for testing authentication.
22+
// GetTestSubscribers returns SubscriberData protos with different settings
23+
// to be used for testing authentication. More users can be added.
2424
func GetTestSubscribers() []*protos.SubscriberData {
2525
subs := make([]*protos.SubscriberData, 0)
2626

27+
// Default subscriber
28+
sub := generateDefaultSub("sub1")
29+
subs = append(subs, sub)
30+
31+
// Default Subs with a blank AAA server
32+
sub = generateDefaultSub("sub1_noAAAsrv")
33+
sub.State.TgppAaaServerName = ""
34+
subs = append(subs, sub)
35+
36+
// Empty sub
37+
sub = &protos.SubscriberData{
38+
Sid: &protos.SubscriberID{Id: "empty_sub"},
39+
NetworkId: &orc8rprotos.NetworkID{Id: "test"},
40+
}
41+
subs = append(subs, sub)
42+
43+
// Subscriber without auth key
44+
sub = &protos.SubscriberData{
45+
Sid: &protos.SubscriberID{Id: "missing_auth_key"},
46+
NetworkId: &orc8rprotos.NetworkID{Id: "test"},
47+
Lte: &protos.LTESubscription{
48+
State: protos.LTESubscription_ACTIVE,
49+
AuthAlgo: protos.LTESubscription_MILENAGE,
50+
AuthOpc: []byte("\x8e'\xb6\xaf\x0ei.u\x0f2fz;\x14`]"),
51+
},
52+
State: &protos.SubscriberState{
53+
LteAuthNextSeq: 7350,
54+
TgppAaaServerName: defaultServerHost,
55+
},
56+
}
57+
subs = append(subs, sub)
58+
59+
return subs
60+
}
61+
62+
func generateDefaultSub(subscriberID string) *protos.SubscriberData{
63+
// Default user
2764
sub := &protos.SubscriberData{
28-
Sid: &protos.SubscriberID{Id: "sub1"},
65+
Sid: &protos.SubscriberID{Id: subscriberID},
2966
NetworkId: &orc8rprotos.NetworkID{Id: "test"},
3067
Lte: &protos.LTESubscription{
3168
State: protos.LTESubscription_ACTIVE,
@@ -64,28 +101,6 @@ func GetTestSubscribers() []*protos.SubscriberData {
64101
},
65102
SubProfile: "test_profile",
66103
}
67-
subs = append(subs, sub)
68104

69-
sub = &protos.SubscriberData{
70-
Sid: &protos.SubscriberID{Id: "empty_sub"},
71-
NetworkId: &orc8rprotos.NetworkID{Id: "test"},
72-
}
73-
subs = append(subs, sub)
74-
75-
sub = &protos.SubscriberData{
76-
Sid: &protos.SubscriberID{Id: "missing_auth_key"},
77-
NetworkId: &orc8rprotos.NetworkID{Id: "test"},
78-
Lte: &protos.LTESubscription{
79-
State: protos.LTESubscription_ACTIVE,
80-
AuthAlgo: protos.LTESubscription_MILENAGE,
81-
AuthOpc: []byte("\x8e'\xb6\xaf\x0ei.u\x0f2fz;\x14`]"),
82-
},
83-
State: &protos.SubscriberState{
84-
LteAuthNextSeq: 7350,
85-
TgppAaaServerName: defaultServerHost,
86-
},
87-
}
88-
subs = append(subs, sub)
89-
90-
return subs
105+
return sub
91106
}

lte/gateway/c/oai/lib/secu/nas_stream_eea1.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
33
* contributor license agreements. See the NOTICE file distributed with
44
* this work for additional information regarding copyright ownership.
5-
* The OpenAirInterface Software Alliance licenses this file to You under
5+
* The OpenAirInterface Software Alliance licenses this file to You under
66
* the Apache License, Version 2.0 (the "License"); you may not use this file
7-
* except in compliance with the License.
7+
* except in compliance with the License.
88
* You may obtain a copy of the License at
99
*
1010
* http://www.apache.org/licenses/LICENSE-2.0
@@ -41,7 +41,6 @@ int nas_stream_encrypt_eea1(
4141
//uint32_t byte_length;
4242
uint32_t *KS;
4343
uint32_t K[4], IV[4];
44-
uint32_t len = 0;
4544

4645
DevAssert(stream_cipher != NULL);
4746
DevAssert(stream_cipher->key != NULL);
@@ -113,8 +112,6 @@ int nas_stream_encrypt_eea1(
113112
}
114113

115114
free_wrapper((void **) &KS);
116-
len = sizeof(out);
117-
memset(out, 0, len);
118115
memcpy(out, stream_cipher->message, n * 4);
119116

120117
if (zero_bit > 0) {

lte/gateway/c/oai/lib/secu/nas_stream_eea2.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
33
* contributor license agreements. See the NOTICE file distributed with
44
* this work for additional information regarding copyright ownership.
5-
* The OpenAirInterface Software Alliance licenses this file to You under
5+
* The OpenAirInterface Software Alliance licenses this file to You under
66
* the Apache License, Version 2.0 (the "License"); you may not use this file
7-
* except in compliance with the License.
7+
* except in compliance with the License.
88
* You may obtain a copy of the License at
99
*
1010
* http://www.apache.org/licenses/LICENSE-2.0
@@ -41,7 +41,6 @@ int nas_stream_encrypt_eea2(
4141
uint8_t *data;
4242
uint32_t zero_bit = 0;
4343
uint32_t byte_length;
44-
uint32_t len = 0;
4544

4645
DevAssert(stream_cipher != NULL);
4746
DevAssert(out != NULL);
@@ -76,8 +75,6 @@ int nas_stream_encrypt_eea2(
7675
data[byte_length - 1] =
7776
data[byte_length - 1] & (uint8_t)(0xFF << (8 - zero_bit));
7877

79-
len = sizeof(out);
80-
memset(out, 0, len);
8178
memcpy(out, data, byte_length);
8279
free_wrapper((void **) &data);
8380
free_wrapper((void **) &ctx);

lte/gateway/c/oai/tasks/mme_app/mme_app_bearer.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -932,9 +932,7 @@ void mme_app_handle_delete_session_rsp(
932932
* send pdn disconnect response to NAS.
933933
* NAS will trigger deactivate Bearer Context Req to UE
934934
*/
935-
if (
936-
(mme_config.eps_network_feature_support.ims_voice_over_ps_session_in_s1) &&
937-
(ue_context_p->emm_context.esm_ctx.is_pdn_disconnect)) {
935+
if (ue_context_p->emm_context.esm_ctx.is_pdn_disconnect) {
938936
pdn_disconnect_rsp.ue_id = ue_context_p->mme_ue_s1ap_id;
939937
pdn_disconnect_rsp.lbi = delete_sess_resp_pP->lbi;
940938
if ((nas_proc_pdn_disconnect_rsp(&pdn_disconnect_rsp)) != RETURNok) {

lte/gateway/c/oai/tasks/mme_app/mme_app_defs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ int map_sgs_emm_cause(SgsRejectCause_t sgs_cause);
338338
pthread_rwlock_wrlock(&(mMEsTATS)->rw_lock)
339339
#define mme_stats_unlock(mMEsTATS) pthread_rwlock_unlock(&(mMEsTATS)->rw_lock)
340340

341-
#define mme_app_compare_tmsi(_tmsi1, _tmsi2) \
341+
#define MME_APP_COMPARE_TMSI(_tmsi1, _tmsi2) \
342342
( \
343343
(_tmsi1.tmsi[0] != _tmsi2.tmsi[0]) || (_tmsi1.tmsi[1] != _tmsi2.tmsi[1]) ||\
344344
(_tmsi1.tmsi[2] != _tmsi2.tmsi[2]) || (_tmsi1.tmsi[3] != _tmsi2.tmsi[3])) \

0 commit comments

Comments
 (0)