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

Uplink Packet drop in upf-flow-process node #285

Closed
Networkmama opened this issue Jun 21, 2022 · 10 comments
Closed

Uplink Packet drop in upf-flow-process node #285

Networkmama opened this issue Jun 21, 2022 · 10 comments

Comments

@Networkmama
Copy link

Hi @RoadRunnr, @ivan4th
I am trying to integrate OPEN5GS core with travel ping UPF.
With few code modifications to ope5gs core, I am able to establish PFCP session b/w Travel ping UPF and OPEN5GS core.

After Session creation, When i verify ping b/w UE and Data network in UP link direction, I see packet drops in flow process node, because of the ACL rule failure.
However, Packet drop does not occur in Down link direction. DL packets are sent to UE without any issues.

Could you please provide your inputs on this?

I have attached Session Establishment pcap,upf commands output and data path logs. uplink_error.zip

Thanks

@mitmitmitm
Copy link
Contributor

mitmitmitm commented Jun 22, 2022 via email

@Networkmama
Copy link
Author

Are you perhaps willing to share?

Sure. I created a pull request.

@mitmitmitm
Copy link
Contributor

mitmitmitm commented Jun 23, 2022 via email

@infinitydon
Copy link

Got it resolved now @Networkmama ?

@Networkmama
Copy link
Author

Hi @infinitydon
Not yet. I am working on it.

@mitmitmitm
Copy link
Contributor

Starting from OGS commit 8fe2e506c0f2893c079bfb5596f9b2cabc757b6c, I got OGS working with upg-vpp by applying the following patch to OGS:

diff --git a/lib/pfcp/build.c b/lib/pfcp/build.c
index 723153f38..411950134 100644
--- a/lib/pfcp/build.c
+++ b/lib/pfcp/build.c
@@ -286,9 +286,11 @@ void ogs_pfcp_build_create_pdr(
     message->pdi.source_interface.u8 = pdr->src_if;
 
     if (pdr->dnn) {
+        const char *dnn = pdr->src_if == OGS_PFCP_INTERFACE_ACCESS ?
+            UPF_DNN_ACCESS : UPF_DNN_CORE;
         message->pdi.network_instance.presence = 1;
         message->pdi.network_instance.len = ogs_fqdn_build(
-            pdrbuf[i].dnn, pdr->dnn, strlen(pdr->dnn));
+            pdrbuf[i].dnn, (char *) dnn, strlen(dnn));
         message->pdi.network_instance.data = pdrbuf[i].dnn;
     }
 
@@ -401,9 +403,11 @@ void ogs_pfcp_build_update_pdr(
     message->pdi.source_interface.u8 = pdr->src_if;
 
     if (pdr->dnn) {
+        const char *dnn = pdr->src_if == OGS_PFCP_INTERFACE_ACCESS ?
+            UPF_DNN_ACCESS : UPF_DNN_CORE;
         message->pdi.network_instance.presence = 1;
         message->pdi.network_instance.len = ogs_fqdn_build(
-            pdrbuf[i].dnn, pdr->dnn, strlen(pdr->dnn));
+            pdrbuf[i].dnn, (char *) dnn, strlen(dnn));
         message->pdi.network_instance.data = pdrbuf[i].dnn;
     }
 
@@ -473,9 +477,11 @@ void ogs_pfcp_build_create_far(
             far->dst_if;
 
         if (far->dnn) {
+            const char *dnn = far->dst_if == OGS_PFCP_INTERFACE_ACCESS ?
+                UPF_DNN_ACCESS : UPF_DNN_CORE;
             message->forwarding_parameters.network_instance.presence = 1;
             message->forwarding_parameters.network_instance.len =
-                ogs_fqdn_build(farbuf[i].dnn, far->dnn, strlen(far->dnn));
+                ogs_fqdn_build(farbuf[i].dnn, (char *) dnn, strlen(dnn));
             message->forwarding_parameters.network_instance.data =
                 farbuf[i].dnn;
         }
@@ -544,9 +550,11 @@ void ogs_pfcp_build_update_far_activate(
         destination_interface.u8 = far->dst_if;
 
     if (far->dnn) {
+        const char *dnn = far->dst_if == OGS_PFCP_INTERFACE_ACCESS ?
+            UPF_DNN_ACCESS : UPF_DNN_CORE;
         message->update_forwarding_parameters.network_instance.presence = 1;
         message->update_forwarding_parameters.network_instance.len =
-            ogs_fqdn_build(farbuf[i].dnn, far->dnn, strlen(far->dnn));
+            ogs_fqdn_build(farbuf[i].dnn, (char *) dnn, strlen(dnn));
         message->update_forwarding_parameters.network_instance.data =
             farbuf[i].dnn;
     }
diff --git a/lib/pfcp/ogs-pfcp.h b/lib/pfcp/ogs-pfcp.h
index 9f631b708..f6898cdaf 100644
--- a/lib/pfcp/ogs-pfcp.h
+++ b/lib/pfcp/ogs-pfcp.h
@@ -30,6 +30,9 @@
 
 #define OGS_PFCP_UDP_PORT               8805
 
+#define UPF_DNN_ACCESS "access.oai.org"
+#define UPF_DNN_CORE "core.oai.org"
+
 #define OGS_MAX_NUM_OF_PDR              16
 #define OGS_MAX_NUM_OF_FAR              16
 #define OGS_MAX_NUM_OF_URR              16
diff --git a/lib/pfcp/types.h b/lib/pfcp/types.h
index 285f0cfa4..2649cf825 100644
--- a/lib/pfcp/types.h
+++ b/lib/pfcp/types.h
@@ -342,14 +342,14 @@ ED2(uint8_t reserved:7;,
  * The EDRT flag may be set if the FORW flag is set.
  * The DDPN flag may be set with any of the DROP and BUFF flags.
  */
-#define OGS_PFCP_APPLY_ACTION_DROP                          (1<<0)
-#define OGS_PFCP_APPLY_ACTION_FORW                          (1<<1)
-#define OGS_PFCP_APPLY_ACTION_BUFF                          (1<<2)
-#define OGS_PFCP_APPLY_ACTION_NOCP                          (1<<3)
-#define OGS_PFCP_APPLY_ACTION_DUPL                          (1<<4)
-#define OGS_PFCP_APPLY_ACTION_IPMA                          (1<<5)
-#define OGS_PFCP_APPLY_ACTION_IPMD                          (1<<6)
-#define OGS_PFCP_APPLY_ACTION_DFRT                          (1<<7)
+#define OGS_PFCP_APPLY_ACTION_DROP                          (1<<0<<8)
+#define OGS_PFCP_APPLY_ACTION_FORW                          (1<<1<<8)
+#define OGS_PFCP_APPLY_ACTION_BUFF                          (1<<2<<8)
+#define OGS_PFCP_APPLY_ACTION_NOCP                          (1<<3<<8)
+#define OGS_PFCP_APPLY_ACTION_DUPL                          (1<<4<<8)
+#define OGS_PFCP_APPLY_ACTION_IPMA                          (1<<5<<8)
+#define OGS_PFCP_APPLY_ACTION_IPMD                          (1<<6<<8)
+#define OGS_PFCP_APPLY_ACTION_DFRT                          (1<<7<<8)
 #define OGS_PFCP_APPLY_ACTION_EDRT                          (1<<8)
 #define OGS_PFCP_APPLY_ACTION_BDPN                          (1<<9)
 #define OGS_PFCP_APPLY_ACTION_DDPN                          (1<<10)
diff --git a/src/smf/npcf-handler.c b/src/smf/npcf-handler.c
index 863c7e996..62f04110d 100644
--- a/src/smf/npcf-handler.c
+++ b/src/smf/npcf-handler.c
@@ -527,6 +527,10 @@ bool smf_npcf_smpolicycontrol_handle_create(
         ul_pdr->f_teid.chid = 1;
         ul_pdr->f_teid.choose_id = OGS_PFCP_DEFAULT_CHOOSE_ID;
         ul_pdr->f_teid_len = 2;
+        ogs_assert(OGS_OK ==
+            ogs_pfcp_paa_to_ue_ip_addr(&sess->session.paa,
+                &ul_pdr->ue_ip_addr, &ul_pdr->ue_ip_addr_len));
+        ul_pdr->ue_ip_addr.sd = OGS_PFCP_UE_IP_DST;
 
         cp2up_pdr->f_teid.ipv4 = 1;
         cp2up_pdr->f_teid.ipv6 = 1;

Both uplink and downlink traffic were successful. I used the following compose file to start upg-vpp and then attached OGS smf to it's network:

services:
  upf:
    container_name: upf
    image: rdefosseoai/oai-upf-vpp
    privileged: true
    ulimits:
      core: -1
    environment:
      - N3_IPV4_ADDRESS_REMOTE=10.15.193.106
      - N4_IPV4_ADDRESS_REMOTE=10.15.199.101
      - N6_IPV4_ADDRESS_REMOTE=10.15.196.107
      - N3_IPV4_ADDRESS_LOCAL=10.15.193.102
      - N4_IPV4_ADDRESS_LOCAL=10.15.199.102
      - N6_IPV4_ADDRESS_LOCAL=10.15.196.102
      - GW_ID=1
      - MNC03=01
      - MCC=001
      - REALM=3gppnetwork.org
      - NWI_N3=access.oai.org
      - NWI_N6=core.oai.org
      - NETWORK_UE_IP=10.45.0.0/16
      - VPP_MAIN_CORE=0
      - VPP_CORE_WORKER=1
      - VPP_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/vpp_plugins/ # Ubntu18.04
      # - INTERFACE_CP=eth0
      - NSSAI_SD_0=000009
      - SST=1
      - DNN=internet
      - REGISTER_NRF=yes
      - NRF_IP_ADDR=10.15.199.90
      - NRF_PORT=29510
      - HTTP_VERSION=2
    networks:
      default:
        ipv4_address: 10.15.199.102
      n3:
        ipv4_address: 10.15.193.102
      n6:
        ipv4_address: 10.15.196.102

networks:
  default:
    name: 5gc-service-bus
    ipam:
      config:
        - subnet: 10.15.199.0/24
  n3:
    ipam:
      config:
        - subnet: 10.15.193.0/24
  n6:
    ipam:
      config:
        - subnet: 10.15.196.0/24

@Networkmama
Copy link
Author

@infinitydon, @mitmitmitm
Sorry, I could not respond in last 2 days.

I was able to get it working after adding UE IP address to Up link pdr list.
I have created open5gs/open5gs#1642 PR

Starting from OGS commit 8fe2e506c0f2893c079bfb5596f9b2cabc757b6c, I got OGS working with upg-vpp by applying the following patch to OGS:

We should be able to run open5gs from latest sources.
Maintainer has already merged pull requests
open5gs/open5gs#1625, open5gs/open5gs#1629, open5gs/open5gs#1630

ogs_assert(OGS_OK == ogs_pfcp_paa_to_ue_ip_addr(&sess->session.paa, &ul_pdr->ue_ip_addr, &ul_pdr-> ue_ip_addr_len));
ul_pdr->ue_ip_addr.sd = OGS_PFCP_UE_IP_DST;

This is almost inline with my change, but i don't see the reason of ul_pdr destination flag.

Thanks

@infinitydon
Copy link

@Networkmama - No problem, can you let me know the outcome when you test with the latest Open5gs main branch?

Also are you using the upg-vpp without any changes to the code?

@Networkmama
Copy link
Author

@infinitydon

can you let me know the outcome when you test with the latest Open5gs main branch?

With open5gs/open5gs#1642 PR , I am able to test upg-vpp without any issues.

Also are you using the upg-vpp without any changes to the code?

Yes, There are no changes.

@infinitydon
Copy link

infinitydon commented Jul 12, 2022

@Networkmama - Tested with vpp-upg v1.2.1 and Open5gs commit fe11ee1 but the SMF had an error when PDU activation was attempted:

07/11 20:09:36.232: [app] INFO: Configuration: '/open5gs/config-map/smf.yaml' (../lib/app/ogs-init.c:126)
07/11 20:09:36.232: [app] INFO: File Logging: '/var/log/open5gs/smf.log' (../lib/app/ogs-init.c:129)
07/11 20:09:36.246: [smf] WARNING: No diameter configuration (../src/smf/fd-path.c:30)
07/11 20:09:36.246: [gtp] INFO: gtp_server() [10.0.1.195]:2123 (../lib/gtp/path.c:30)
07/11 20:09:36.246: [gtp] INFO: gtp_server() [10.0.1.195]:2152 (../lib/gtp/path.c:30)
07/11 20:09:36.246: [pfcp] INFO: pfcp_server() [10.0.1.195]:8805 (../lib/pfcp/path.c:30)
07/11 20:09:36.246: [pfcp] INFO: ogs_pfcp_connect() [10.0.4.9]:8805 (../lib/pfcp/path.c:61)
07/11 20:09:36.246: [sbi] INFO: nghttp2_server() [0.0.0.0]:80 (../lib/sbi/nghttp2-server.c:146)
07/11 20:09:36.247: [app] INFO: SMF initialize...done (../src/smf/app.c:31)
07/11 20:09:36.249: [smf] INFO: [62f4d524-0155-41ed-a8f9-2f191c6fc2fc] NF registered [Heartbeat:10s] (../src/smf/nf-sm.c:203)
07/11 20:09:36.253: [core] WARNING: Unknown TLV type [32768] (../lib/core/ogs-tlv-msg.c:590)
07/11 20:09:36.253: [core] WARNING: Unknown TLV type [32770] (../lib/core/ogs-tlv-msg.c:590)
07/11 20:09:36.253: [smf] INFO: PFCP associated (../src/smf/pfcp-sm.c:174)
07/11 20:50:31.302: [smf] INFO: [Added] Number of SMF-UEs is now 1 (../src/smf/context.c:892)
07/11 20:50:31.302: [smf] INFO: [Added] Number of SMF-Sessions is now 1 (../src/smf/context.c:2978)
07/11 20:50:31.303: [app] WARNING: Try to discover [UDM] (../lib/sbi/path.c:116)
07/11 20:50:31.304: [smf] INFO: [62f37f08-0155-41ed-8bb9-ff65c74bd64c] (NF-discover) NF registered (../src/smf/nnrf-handler.c:288)
07/11 20:50:31.306: [smf] INFO: [62f37f08-0155-41ed-8bb9-ff65c74bd64c] (NF-discover) NF Profile updated (../src/smf/nnrf-handler.c:336)
07/11 20:50:31.307: [app] WARNING: Try to discover [PCF] (../lib/sbi/path.c:116)
07/11 20:50:31.308: [smf] INFO: [48fa11fc-0155-41ed-a925-a9ae70a7d910] (NF-discover) NF registered (../src/smf/nnrf-handler.c:288)
07/11 20:50:31.310: [smf] INFO: [48fa11fc-0155-41ed-a925-a9ae70a7d910] (NF-discover) NF Profile updated (../src/smf/nnrf-handler.c:336)
07/11 20:50:31.314: [smf] INFO: UE SUPI[imsi-208930000000031] DNN[internet] IPv4[10.45.0.2] IPv6[] (../src/smf/npcf-handler.c:497)
07/11 20:50:31.323: [core] WARNING: Unknown TLV type [32774] (../lib/core/ogs-tlv-msg.c:590)
07/11 20:50:31.323: [smf] ERROR: PFCP Cause [73] : Not Accepted (../src/smf/n4-handler.c:180)

UPF config:

ip table add 1
ip table add 2
     
set interface ip table n3 1
set interface mtu 9001 n3
set interface ip address n3 10.0.3.10/24
set interface state n3 up
     
set interface ip table n4 0
set interface mtu 9001 n4
set interface ip address n4 10.0.4.9/24
set interface state n4 up
     
set interface ip table n6 2
set interface mtu 9001 n6
set interface ip address n6 10.0.5.9/24
set interface state n6 up
     
ip route add 0.0.0.0/0 table 2 via 10.0.5.10 n6
ip route add 0.0.0.0/0 table 1 via 10.0.3.1 n3
ip route add 0.0.0.0/0 table 0 via 10.0.4.1 n4
ip route add 48.0.0.0/8 table 2 via 10.0.5.244 n6
     
upf pfcp endpoint ip 10.0.4.9 vrf 0
     
upf nwi name access vrf 1
upf nwi name internet vrf 2
upf nwi name core vrf 0
     
upf specification release 16
     
upf gtpu endpoint ip 10.0.3.10 nwi access teid 0x00001234/2

SMF config:

logger:
    file: /var/log/open5gs/smf.log

parameter:
    no_ipv6: true

smf:
    sbi:
    - addr: 0.0.0.0
      advertise: control-plane-smf
    pfcp:
       dev: eth0
    gtpc:
      dev: eth0
    gtpu:
      dev: eth0
    subnet:
     - addr: [10.45.0.1/16](http:https://10.45.0.1/16)
       dnn: internet
    dns:
      - 8.8.8.8
      - 8.8.4.4
    mtu: 1400

nrf:
 sbi:
  name: control-plane-nrf

upf:
  pfcp:
    - addr: 10.0.4.9
      dnn: internet

metrics:
    addr: 0.0.0.0
    port: 9090

Can you share the configuration that worked for you and the vpp-upg/Open5gs versions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants