neels has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-pfcp/+/30321 )


Change subject: osmo_pfcp_ip_addrs_set(): do not set port number
......................................................................

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
---
M src/libosmo-pfcp/pfcp_msg.c
1 file changed, 4 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-pfcp refs/changes/21/30321/1

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 @@
        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;

--
To view, visit https://gerrit.osmocom.org/c/libosmo-pfcp/+/30321
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-pfcp
Gerrit-Branch: master
Gerrit-Change-Id: Ib29a123c06d459c99d7c1c0b9a7694fb78cd9fd8
Gerrit-Change-Number: 30321
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofm...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to