diff options
author | Neels Janosch Hofmeyr <nhofmeyr@sysmocom.de> | 2022-11-26 02:58:08 +0100 |
---|---|---|
committer | Neels Janosch Hofmeyr <nhofmeyr@sysmocom.de> | 2022-11-26 03:05:42 +0100 |
commit | abecf789261e53bdb99a0ab275008e4d8f65cb6d (patch) | |
tree | 84de8f2fd125fdffe9ef558b86c90ba9aec1ca77 /src | |
parent | c41bfcbbf0a364eaefe1782a60e41562edd0e3aa (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/libosmo-pfcp/pfcp_msg.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libosmo-pfcp/pfcp_msg.c b/src/libosmo-pfcp/pfcp_msg.c index ff8860a..18b9113 100644 --- a/src/libosmo-pfcp/pfcp_msg.c +++ b/src/libosmo-pfcp/pfcp_msg.c @@ -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; |