open5gs / open5gs

Open5GS is a C-language Open Source implementation for 5G Core and EPC, i.e. the core network of LTE/NR network (Release-17)
https://open5gs.org
GNU Affero General Public License v3.0
1.84k stars 762 forks source link

[Bug]: Bug in gtp-u two interfaces with different source_intreface #2923

Closed ali64mohammad6464 closed 9 months ago

ali64mohammad6464 commented 9 months ago

Open5GS Release, Revision, or Tag

v2.7.0

Steps to reproduce

Hello,

As mentioned in the sgwu.yaml configuration file, it is possible to configure multiple addresses with different source_interface values for the gtpu interface.

#  sgwu:
#    gtpu:
#      - addr:
#        - 127.0.0.6
#        - ::1
#        teid_range_indication: 4
#        teid_range: 10
#        network_instance: internet
#        source_interface: 0
#      - addr: 127.0.10.4
#        teid_range_indication: 4
#        teid_range: 5
#        network_instance: ims
#        source_interface: 1
#

Following the this section, I defined two addresses, one with source_interface set to 0 and another with source_interface set to 1. My expectation was to see different addresses for the two PDRs in the Session Establishment Response message during session establishment. However, both addresses were the same, and it was the address I had set for source_interface = 0.

When I looked into the code, I found the reason for the issue. In the lib/pfcp/context.c file, on line 1185, the function that determines the address is called as follows:

...
        } else {
            ogs_gtpu_resource_t *resource = NULL;
            resource = ogs_pfcp_find_gtpu_resource(
                    &ogs_gtp_self()->gtpu_resource_list,
                    pdr->dnn, OGS_PFCP_INTERFACE_ACCESS);
            if (resource) {
...

In the last parameter of this function, a constant value, OGS_PFCP_INTERFACE_ACCESS, is used. This causes every PDR with any source_interface to be considered as "access," and the value 0 is used for its interface.

I replaced the value with pdr->src_if, and the bug was resolved.

Now my question is whether this was simply a bug or if there was a specific reason for considering the interface value as a constant.

thanks.

Logs

No response

Expected behaviour

My expectation was to see different addresses for the two PDRs in the Session Establishment Response message during session establishment.

Observed Behaviour

both addresses were the same, and it was the address I had set for source_interface = 0.

eNodeB/gNodeB

No response

UE Models and versions

No response

acetcom commented 9 months ago

@ali64mohammad6464

That's right, we fixed this and pushed it to the main branch.

Thank you so much! Sukchan

ali64mohammad6464 commented 9 months ago

Thanks.