Create tun_if module for TUN interface handling
Move openair3/RRC/NAS/nas_config.c to common/utils/tun_if.c, and remove the former from all targets.
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
#include "PduSessionEstablishmentAccept.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "nr_nas_msg_sim.h"
|
||||
#include "openair2/RRC/NAS/nas_config.h"
|
||||
#include "common/utils/tun_if.h"
|
||||
#include "openair2/SDAP/nr_sdap/nr_sdap.h"
|
||||
|
||||
static uint16_t getShort(uint8_t *input)
|
||||
@@ -132,14 +132,14 @@ void capture_pdu_session_establishment_accept_msg(uint8_t *buffer, uint32_t msg_
|
||||
addr[i] = *curPtr++;
|
||||
char ip[20];
|
||||
capture_ipv4_addr(&addr[0], ip, sizeof(ip));
|
||||
nas_config(1, ip, NULL, "oaitun_ue");
|
||||
tun_config(1, ip, NULL, "oaitun_ue");
|
||||
setup_ue_ipv4_route(1, ip, "oaitun_ue");
|
||||
} else if (psea_msg.pdu_addr_ie.pdu_type == PDU_SESSION_TYPE_IPV6) {
|
||||
for (int i = 0; i < 8; ++i)
|
||||
addr[i] = *curPtr++;
|
||||
char ipv6[40];
|
||||
capture_ipv6_addr(addr, ipv6, sizeof(ipv6));
|
||||
nas_config(1, NULL, ipv6, "oaitun_ue");
|
||||
tun_config(1, NULL, ipv6, "oaitun_ue");
|
||||
} else if (psea_msg.pdu_addr_ie.pdu_type == PDU_SESSION_TYPE_IPV4V6) {
|
||||
// 24.501 Sec 9.11.4.10: "If the PDU session type value indicates
|
||||
// IPv4v6, the PDU address information in octet 4 to octet 11
|
||||
@@ -151,7 +151,7 @@ void capture_pdu_session_establishment_accept_msg(uint8_t *buffer, uint32_t msg_
|
||||
capture_ipv6_addr(addr, ipv6, sizeof(ipv6));
|
||||
char ipv4[20];
|
||||
capture_ipv4_addr(&addr[8], ipv4, sizeof(ipv4));
|
||||
nas_config(1, ipv4, ipv6, "oaitun_ue");
|
||||
tun_config(1, ipv4, ipv6, "oaitun_ue");
|
||||
setup_ue_ipv4_route(1, ipv4, "oaitun_ue");
|
||||
} else {
|
||||
LOG_E(NAS, "unknown/unhandled PDU session establishment accept PDU type %d\n", psea_msg.pdu_addr_ie.pdu_type);
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
#include "RegistrationAccept.h"
|
||||
#include "FGSDeregistrationRequestUEOriginating.h"
|
||||
#include "intertask_interface.h"
|
||||
#include "openair2/RRC/NAS/nas_config.h"
|
||||
#include "common/utils/tun_if.h"
|
||||
#include <openair3/NAS/COMMON/NR_NAS_defs.h>
|
||||
#include <openair1/SIMULATION/ETH_TRANSPORT/proto.h>
|
||||
#include "openair2/SDAP/nr_sdap/nr_sdap.h"
|
||||
@@ -845,7 +845,7 @@ void decodeDownlinkNASTransport(as_nas_info_t *initialNasMsg, uint8_t * pdu_buff
|
||||
char ip[20];
|
||||
sprintf(ip, "%d.%d.%d.%d", *(ip_p), *(ip_p + 1), *(ip_p + 2), *(ip_p + 3));
|
||||
LOG_A(NAS, "Received PDU Session Establishment Accept\n");
|
||||
nas_config(1, ip, NULL, "oaitun_ue");
|
||||
tun_config(1, ip, NULL, "oaitun_ue");
|
||||
setup_ue_ipv4_route(1, ip, "oaitun_ue");
|
||||
} else {
|
||||
LOG_E(NAS, "Received unexpected message in DLinformationTransfer %d\n", msg_type);
|
||||
@@ -1432,7 +1432,7 @@ void *nas_nrue(void *args_p)
|
||||
char ip[20];
|
||||
snprintf(ip, sizeof(ip), "%d.%d.%d.%d", *(ip_p), *(ip_p + 1), *(ip_p + 2), *(ip_p + 3));
|
||||
LOG_I(NAS, "Received PDU Session Establishment Accept, UE IP: %s\n", ip);
|
||||
nas_config(1, ip, NULL, "oaitun_ue");
|
||||
tun_config(1, ip, NULL, "oaitun_ue");
|
||||
setup_ue_ipv4_route(1, ip, "oaitun_ue");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ Description Defines functions used to handle EPS bearer contexts.
|
||||
#include "esm_ebr.h"
|
||||
|
||||
#include "esm_ebr_context.h"
|
||||
#include "openair2/RRC/NAS/nas_config.h"
|
||||
#include "common/utils/tun_if.h"
|
||||
|
||||
#include "emm_sap.h"
|
||||
#include "system.h"
|
||||
@@ -207,7 +207,7 @@ int esm_ebr_context_create(
|
||||
char *ip_addr = pdn->ip_addr;
|
||||
snprintf(ip, sizeof(ip), "%d.%d.%d.%d", ip_addr[0], ip_addr[1], ip_addr[2], ip_addr[3]);
|
||||
const char *ifn = get_softmodem_params()->nsa ? "oaitun_nru" : "oaitun_ue";
|
||||
nas_config(1, ip, NULL, ifn);
|
||||
tun_config(1, ip, NULL, ifn);
|
||||
setup_ue_ipv4_route(1, ip, ifn);
|
||||
} break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user