[PFCP] Reduce DNS spam for FQDN nodes (#3431) (#3664)

Each received PFCP message triggered ogs_pfcp_node_find(), causing a DNS
resolution if node_id was FQDN. Under heavy traffic, this could lead to
excessive DNS queries.

- Implement a 300-second refresh interval to avoid repeated DNS lookups.
- Store last_dns_refresh in each node to defer new queries until needed.
- Treat config-based nodes with no Node ID as UNKNOWN, matching them by IP
  alone until ogs_pfcp_node_merge() updates their ID.
- Validate IPv4, IPv6, or FQDN types in ogs_pfcp_node_merge() and reject
  invalid IDs.
- Provide inline code comments for clarity and maintainability.
This commit is contained in:
Sukchan Lee 2025-01-18 12:15:00 +09:00
parent ba6a84d1b3
commit 9c370ff89a
5 changed files with 193 additions and 91 deletions

View file

@ -550,9 +550,17 @@ typedef struct ogs_pfcp_outer_header_removal_s {
uint8_t gtpu_extheader_deletion;
} ogs_pfcp_outer_header_removal_t;
/******************************************************************************
* PFCP Node ID structure
******************************************************************************/
#define OGS_PFCP_NODE_ID_IPV4 0
#define OGS_PFCP_NODE_ID_IPV6 1
#define OGS_PFCP_NODE_ID_FQDN 2
/******************************************************************************
* Add this line to define the UNKNOWN type. We use '3' since 0,1,2 are taken.
******************************************************************************/
#define OGS_PFCP_NODE_ID_UNKNOWN 0xf
typedef struct ogs_pfcp_node_id_s {
ED2(uint8_t spare:4;,
uint8_t type:4;)