mirror of
				https://github.com/open5gs/open5gs.git
				synced 2025-11-03 21:43:25 +00:00 
			
		
		
		
	[SMF] Use PFCP Outer hdr. removal type IP regardless of sess. type
Previously, Outer Header Removal was set according to PDU session type. However, outer header IP version is independent of inner packet IP version or PDU session type. It typically depends on UPF and gNB configuration. Set it to GTP-U/UDP/IP to handle both IPv4 and IPv6 cases, according to TS 29.244, Table 8.2.64-1, Note 4: "The CP function shall use this value to instruct UP function to remove the GTP-U/UDP/IP header regardless it is IPv4 or IPv6." No changes at UPF are necessary because it already ignores Outer Header Removal Description type and Kernel correctly decapsulates the outer IP header at socket level.
This commit is contained in:
		@@ -2116,19 +2116,8 @@ smf_bearer_t *smf_qos_flow_add(smf_sess_t *sess)
 | 
				
			|||||||
        ul_pdr->src_if_type = OGS_PFCP_3GPP_INTERFACE_TYPE_N3_3GPP_ACCESS;
 | 
					        ul_pdr->src_if_type = OGS_PFCP_3GPP_INTERFACE_TYPE_N3_3GPP_ACCESS;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ul_pdr->outer_header_removal_len = 1;
 | 
					    ul_pdr->outer_header_removal_len = 1;
 | 
				
			||||||
    if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4) {
 | 
					    ul_pdr->outer_header_removal.description =
 | 
				
			||||||
        ul_pdr->outer_header_removal.description =
 | 
					        OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IP;
 | 
				
			||||||
            OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV4;
 | 
					 | 
				
			||||||
    } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV6) {
 | 
					 | 
				
			||||||
        ul_pdr->outer_header_removal.description =
 | 
					 | 
				
			||||||
            OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV6;
 | 
					 | 
				
			||||||
    } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4V6) {
 | 
					 | 
				
			||||||
        ul_pdr->outer_header_removal.description =
 | 
					 | 
				
			||||||
            OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IP;
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
        ogs_error("Invalid session_type [%d]", sess->session.session_type);
 | 
					 | 
				
			||||||
        ogs_assert_if_reached();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* FAR */
 | 
					    /* FAR */
 | 
				
			||||||
    dl_far = ogs_pfcp_far_add(&sess->pfcp);
 | 
					    dl_far = ogs_pfcp_far_add(&sess->pfcp);
 | 
				
			||||||
@@ -2332,19 +2321,8 @@ void smf_sess_create_indirect_data_forwarding(smf_sess_t *sess)
 | 
				
			|||||||
            OGS_PFCP_3GPP_INTERFACE_TYPE_SGW_UPF_GTP_U_FOR_UL_DATA_FORWARDING;
 | 
					            OGS_PFCP_3GPP_INTERFACE_TYPE_SGW_UPF_GTP_U_FOR_UL_DATA_FORWARDING;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        pdr->outer_header_removal_len = 1;
 | 
					        pdr->outer_header_removal_len = 1;
 | 
				
			||||||
        if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4) {
 | 
					        pdr->outer_header_removal.description =
 | 
				
			||||||
            pdr->outer_header_removal.description =
 | 
					            OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IP;
 | 
				
			||||||
                OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV4;
 | 
					 | 
				
			||||||
        } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV6) {
 | 
					 | 
				
			||||||
            pdr->outer_header_removal.description =
 | 
					 | 
				
			||||||
                OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV6;
 | 
					 | 
				
			||||||
        } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4V6) {
 | 
					 | 
				
			||||||
            pdr->outer_header_removal.description =
 | 
					 | 
				
			||||||
                OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IP;
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            ogs_error("Invalid session_type [%d]", sess->session.session_type);
 | 
					 | 
				
			||||||
            ogs_assert_if_reached();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        far = ogs_pfcp_far_add(&sess->pfcp);
 | 
					        far = ogs_pfcp_far_add(&sess->pfcp);
 | 
				
			||||||
        ogs_assert(far);
 | 
					        ogs_assert(far);
 | 
				
			||||||
@@ -2527,19 +2505,8 @@ void smf_sess_create_cp_up_data_forwarding(smf_sess_t *sess)
 | 
				
			|||||||
    cp2up_pdr->src_if = OGS_PFCP_INTERFACE_CP_FUNCTION;
 | 
					    cp2up_pdr->src_if = OGS_PFCP_INTERFACE_CP_FUNCTION;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cp2up_pdr->outer_header_removal_len = 1;
 | 
					    cp2up_pdr->outer_header_removal_len = 1;
 | 
				
			||||||
    if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4) {
 | 
					    cp2up_pdr->outer_header_removal.description =
 | 
				
			||||||
        cp2up_pdr->outer_header_removal.description =
 | 
					        OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IP;
 | 
				
			||||||
            OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV4;
 | 
					 | 
				
			||||||
    } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV6) {
 | 
					 | 
				
			||||||
        cp2up_pdr->outer_header_removal.description =
 | 
					 | 
				
			||||||
            OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV6;
 | 
					 | 
				
			||||||
    } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4V6) {
 | 
					 | 
				
			||||||
        cp2up_pdr->outer_header_removal.description =
 | 
					 | 
				
			||||||
            OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IP;
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
        ogs_error("Invalid session_type [%d]", sess->session.session_type);
 | 
					 | 
				
			||||||
        ogs_assert_if_reached();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    up2cp_pdr = ogs_pfcp_pdr_add(&sess->pfcp);
 | 
					    up2cp_pdr = ogs_pfcp_pdr_add(&sess->pfcp);
 | 
				
			||||||
    ogs_assert(up2cp_pdr);
 | 
					    ogs_assert(up2cp_pdr);
 | 
				
			||||||
@@ -2557,19 +2524,8 @@ void smf_sess_create_cp_up_data_forwarding(smf_sess_t *sess)
 | 
				
			|||||||
        up2cp_pdr->src_if_type = OGS_PFCP_3GPP_INTERFACE_TYPE_N3_3GPP_ACCESS;
 | 
					        up2cp_pdr->src_if_type = OGS_PFCP_3GPP_INTERFACE_TYPE_N3_3GPP_ACCESS;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    up2cp_pdr->outer_header_removal_len = 1;
 | 
					    up2cp_pdr->outer_header_removal_len = 1;
 | 
				
			||||||
    if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4) {
 | 
					    up2cp_pdr->outer_header_removal.description =
 | 
				
			||||||
        up2cp_pdr->outer_header_removal.description =
 | 
					        OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IP;
 | 
				
			||||||
            OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV4;
 | 
					 | 
				
			||||||
    } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV6) {
 | 
					 | 
				
			||||||
        up2cp_pdr->outer_header_removal.description =
 | 
					 | 
				
			||||||
            OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV6;
 | 
					 | 
				
			||||||
    } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4V6) {
 | 
					 | 
				
			||||||
        up2cp_pdr->outer_header_removal.description =
 | 
					 | 
				
			||||||
            OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IP;
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
        ogs_error("Invalid session_type [%d]", sess->session.session_type);
 | 
					 | 
				
			||||||
        ogs_assert_if_reached();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    qos_flow = smf_default_bearer_in_sess(sess);
 | 
					    qos_flow = smf_default_bearer_in_sess(sess);
 | 
				
			||||||
    ogs_assert(qos_flow);
 | 
					    ogs_assert(qos_flow);
 | 
				
			||||||
@@ -2705,19 +2661,8 @@ smf_bearer_t *smf_bearer_add(smf_sess_t *sess)
 | 
				
			|||||||
    ul_pdr->src_if_type = OGS_PFCP_3GPP_INTERFACE_TYPE_N3_3GPP_ACCESS;
 | 
					    ul_pdr->src_if_type = OGS_PFCP_3GPP_INTERFACE_TYPE_N3_3GPP_ACCESS;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ul_pdr->outer_header_removal_len = 1;
 | 
					    ul_pdr->outer_header_removal_len = 1;
 | 
				
			||||||
    if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4) {
 | 
					    ul_pdr->outer_header_removal.description =
 | 
				
			||||||
        ul_pdr->outer_header_removal.description =
 | 
					        OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IP;
 | 
				
			||||||
            OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV4;
 | 
					 | 
				
			||||||
    } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV6) {
 | 
					 | 
				
			||||||
        ul_pdr->outer_header_removal.description =
 | 
					 | 
				
			||||||
            OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV6;
 | 
					 | 
				
			||||||
    } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4V6) {
 | 
					 | 
				
			||||||
        ul_pdr->outer_header_removal.description =
 | 
					 | 
				
			||||||
            OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IP;
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
        ogs_error("Invalid session_type [%d]", sess->session.session_type);
 | 
					 | 
				
			||||||
        ogs_assert_if_reached();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* FAR */
 | 
					    /* FAR */
 | 
				
			||||||
    dl_far = ogs_pfcp_far_add(&sess->pfcp);
 | 
					    dl_far = ogs_pfcp_far_add(&sess->pfcp);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1897,37 +1897,15 @@ bool smf_nsmf_handle_created_data_in_vsmf(
 | 
				
			|||||||
        ogs_assert(dl_pdr);
 | 
					        ogs_assert(dl_pdr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        dl_pdr->outer_header_removal_len = 1;
 | 
					        dl_pdr->outer_header_removal_len = 1;
 | 
				
			||||||
        if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4) {
 | 
					        dl_pdr->outer_header_removal.description =
 | 
				
			||||||
            dl_pdr->outer_header_removal.description =
 | 
					            OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IP;
 | 
				
			||||||
                OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV4;
 | 
					 | 
				
			||||||
        } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV6) {
 | 
					 | 
				
			||||||
            dl_pdr->outer_header_removal.description =
 | 
					 | 
				
			||||||
                OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV6;
 | 
					 | 
				
			||||||
        } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4V6) {
 | 
					 | 
				
			||||||
            dl_pdr->outer_header_removal.description =
 | 
					 | 
				
			||||||
                OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IP;
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            ogs_error("Unknown session-type [%d]", sess->session.session_type);
 | 
					 | 
				
			||||||
            return false;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ul_pdr = qos_flow->ul_pdr;
 | 
					        ul_pdr = qos_flow->ul_pdr;
 | 
				
			||||||
        ogs_assert(ul_pdr);
 | 
					        ogs_assert(ul_pdr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ul_pdr->outer_header_removal_len = 1;
 | 
					        ul_pdr->outer_header_removal_len = 1;
 | 
				
			||||||
        if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4) {
 | 
					        ul_pdr->outer_header_removal.description =
 | 
				
			||||||
            ul_pdr->outer_header_removal.description =
 | 
					            OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IP;
 | 
				
			||||||
                OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV4;
 | 
					 | 
				
			||||||
        } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV6) {
 | 
					 | 
				
			||||||
            ul_pdr->outer_header_removal.description =
 | 
					 | 
				
			||||||
                OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV6;
 | 
					 | 
				
			||||||
        } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4V6) {
 | 
					 | 
				
			||||||
            ul_pdr->outer_header_removal.description =
 | 
					 | 
				
			||||||
                OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IP;
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            ogs_error("Unknown session-type [%d]", sess->session.session_type);
 | 
					 | 
				
			||||||
            return false;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ul_far = qos_flow->ul_far;
 | 
					        ul_far = qos_flow->ul_far;
 | 
				
			||||||
        ogs_assert(ul_far);
 | 
					        ogs_assert(ul_far);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user