osmo_pfcp_ip_addrs_set(): do not set port number

struct osmo_pfcp_ip_addrs uses an osmo_sockaddr for storing IP
addresses. Even though osmo_sockaddr contains a port number, no port
number gets encoded in PFCP messages. Hence always set the port to 0.

I noticed that when osmo_pfcp_ip_addrs_set() is invoked with an
osmo_sockaddr that incidentally has a port number set, subsequent
logging of e.g. a PFCP F-TEID shows a port number, which is confusing.

Change-Id: Ib29a123c06d459c99d7c1c0b9a7694fb78cd9fd8
This commit is contained in:
Neels Hofmeyr 2022-11-26 02:58:08 +01:00
parent c41bfcbbf0
commit abecf78926
1 changed files with 4 additions and 0 deletions

View File

@ -494,16 +494,20 @@ uint64_t osmo_pfcp_next_seid(uint64_t *next_seid_state)
return *next_seid_state;
}
/* Set either dst->v4 or dst->v6 to addr, depending on addr->family. Set the IP address to addr and port to 0, not
* copying the port information from addr. Return zero on success, negative on error (i.e. no known family in addr). */
int osmo_pfcp_ip_addrs_set(struct osmo_pfcp_ip_addrs *dst, const struct osmo_sockaddr *addr)
{
switch (addr->u.sas.ss_family) {
case AF_INET:
dst->v4_present = true;
dst->v4 = *addr;
osmo_sockaddr_set_port(&dst->v4.u.sa, 0);
return 0;
case AF_INET6:
dst->v6_present = true;
dst->v6 = *addr;
osmo_sockaddr_set_port(&dst->v6.u.sa, 0);
return 0;
default:
return -ENOTSUP;