diff --git a/src/osmo-upf/upf_gtpu_echo.c b/src/osmo-upf/upf_gtpu_echo.c index d8958e8..b234065 100644 --- a/src/osmo-upf/upf_gtpu_echo.c +++ b/src/osmo-upf/upf_gtpu_echo.c @@ -65,6 +65,21 @@ static int rx_echo_req(struct upf_gtp_dev *dev, const struct osmo_sockaddr *remo return tx_echo_resp(dev, remote, rx_h->ext.seq_nr); } +static void rx_echo_resp(struct upf_gtp_dev *dev, const struct osmo_sockaddr *remote, const struct gtp1u_hdr *rx_h, + size_t msg_len) +{ + if (msg_len < (sizeof(*rx_h) + 2)) { + LOG_GTP_DEV(dev, LOGL_ERROR, + "<- %s: rx GTPv1-U Echo Response, but message is too short (%zu < %zu)\n", + osmo_sockaddr_to_str_c(OTC_SELECT, remote), msg_len, (sizeof(*rx_h) + 2)); + return; + } + + uint8_t recovery_count = rx_h->data2[1]; + LOG_GTP_DEV(dev, LOGL_INFO, "<- %s: rx GTPv1-U Echo Response: seq_nr=%u recovery_count=%u\n", + osmo_sockaddr_to_str(remote), rx_h->ext.seq_nr, recovery_count); +} + static int tx_echo_resp(struct upf_gtp_dev *dev, const struct osmo_sockaddr *remote, uint16_t seq_nr) { struct msgb *msg; @@ -153,6 +168,9 @@ int upf_gtpu_echo_read_cb(struct osmo_fd *ofd, unsigned int what) switch (h->msg_type) { case GTP1U_MSGTYPE_ECHO_REQ: return rx_echo_req(dev, &remote, h, sz); + case GTP1U_MSGTYPE_ECHO_RSP: + rx_echo_resp(dev, &remote, h, sz); + return 0; default: LOG_GTP_DEV(dev, LOGL_ERROR, "rx: GTPv1-U message type %u not supported\n", h->msg_type); return -1;