Reintroduce the IP rule&route for OAI UE through setup_ue_ipv4_route()

These rules & route are necessary to properly send packets on oaitun_ue1
interface:

1. This forces the packets coming from a subnet different than the UE's
   subnet to go back through oaitun_ue1 rather than via what the default
   route defined on the system (e.g., important if ping from the
   internet arrives).

2. On machines setting net.ipv4.conf.oaitun_ue1.rp_filter=1 (e.g.
   RHEL), this prevents that source filtering for packets coming back is
   applied and those packets be dropped. By default, many hosts have
   rp_filter=2, so no strict source filtering is applied, and it would
   work; on others, this rule prevents source filter dropping.
This commit is contained in:
Robert Schmidt
2024-08-02 15:29:36 +02:00
parent 2da09aba80
commit ffcf53fc75
4 changed files with 44 additions and 0 deletions
@@ -119,6 +119,7 @@ void capture_pdu_session_establishment_accept_msg(uint8_t *buffer, uint32_t msg_
addr->pdu_addr_oct3,
addr->pdu_addr_oct4);
nas_config(1, ip, "oaitun_ue");
setup_ue_ipv4_route(1, ip, "oaitun_ue");
LOG_T(NAS, "PDU SESSION ESTABLISHMENT ACCEPT - Received UE IP: %s\n", ip);
} else {
curPtr += psea_msg.pdu_addr_ie.pdu_length;
+2
View File
@@ -846,6 +846,7 @@ void decodeDownlinkNASTransport(as_nas_info_t *initialNasMsg, uint8_t * pdu_buff
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, "oaitun_ue");
setup_ue_ipv4_route(1, ip, "oaitun_ue");
} else {
LOG_E(NAS, "Received unexpected message in DLinformationTransfer %d\n", msg_type);
}
@@ -1432,6 +1433,7 @@ void *nas_nrue(void *args_p)
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, "oaitun_ue");
setup_ue_ipv4_route(1, ip, "oaitun_ue");
break;
}
}