Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mme): Fix network address in create bearer packet filter #12038

Merged
merged 4 commits into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 7 additions & 5 deletions lte/gateway/c/core/oai/tasks/grpc_service/SpgwServiceImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,19 +342,21 @@ bool SpgwServiceImpl::fillIpv4(packet_filter_contents_t* pf_content,
if (!ipv4network.success) {
return false;
}
uint32_t ipv4addrHBO = ipv4network.addr_hbo;
for (int i = (TRAFFIC_FLOW_TEMPLATE_IPV4_ADDR_SIZE - 1); i >= 0; --i) {
pf_content->ipv4remoteaddr[i].addr = (unsigned char)ipv4addrHBO & 0xFF;
ipv4addrHBO = ipv4addrHBO >> 8;
}

uint32_t mask = UINT32_MAX; // all ones
mask =
(mask << (32 -
ipv4network.mask_len)); // first mask_len bits are 1s, rest 0s
uint32_t ipv4addrHBO = ipv4network.addr_hbo;

for (int i = (TRAFFIC_FLOW_TEMPLATE_IPV4_ADDR_SIZE - 1); i >= 0; --i) {
pf_content->ipv4remoteaddr[i].mask = (unsigned char)mask & 0xFF;
pf_content->ipv4remoteaddr[i].addr =
(unsigned char)ipv4addrHBO & pf_content->ipv4remoteaddr[i].mask;
ipv4addrHBO = ipv4addrHBO >> 8;
mask = mask >> 8;
}

OAILOG_DEBUG(
LOG_UTIL,
"Network Address: %d.%d.%d.%d "
Expand Down
4 changes: 4 additions & 0 deletions lte/gateway/python/integ_tests/s1aptests/s1ap_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,10 @@ def _verify_dl_flow(self, dl_flow_rules=None):
},
},
)
print(
"OVS DL flows created ", len(total_dl_ovs_flows_created),
"expected ", total_num_dl_flows_to_be_verified,
)
assert (
len(total_dl_ovs_flows_created)
== total_num_dl_flows_to_be_verified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_attach_detach_maxbearers_twopdns(self):
self._s1ap_wrapper.configUEDevice(num_ues)

# 1 oai PDN + 1 dedicated bearer, 1 ims pdn + 8 dedicated bearers
loop = 8
num_ims_ded_bearers = 8

# APN of the secondary PDN
ims = {
Expand Down Expand Up @@ -129,14 +129,20 @@ def test_attach_detach_maxbearers_twopdns(self):
print("Sleeping for 5 seconds")
time.sleep(5)
num_flows_per_bearer = 4
for idx in range(loop):
pdn_count = 1
for idx in range(num_ims_ded_bearers):
# Add dedicated bearer to 2nd PDN
print(
"********************** Adding dedicated bearer to ims"
" PDN",
)

uniq_port_idx = pdn_count * 100 + idx * num_flows_per_bearer

flow_lists2.append(
self._spgw_util.create_default_ipv4_flows(port_idx=(idx * num_flows_per_bearer) + 10),
self._spgw_util.create_default_ipv4_flows(
port_idx=uniq_port_idx,
),
)
self._spgw_util.create_bearer(
"IMSI" + "".join([str(i) for i in req.imsi]),
Expand Down