mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-upf.git
synced 2025-10-23 08:12:03 +00:00
upf gtp-u echo: rx Echo Response messages
Support receiving of Echo Responses, so far showed an error log for unsupported message type. Just log the message. Prep for upcoming patch to allow sending Echo Requests from VTY. Change-Id: Idad417746a1ea797e8fbfe04ca9c84923a6118fa
This commit is contained in:
@@ -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);
|
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)
|
static int tx_echo_resp(struct upf_gtp_dev *dev, const struct osmo_sockaddr *remote, uint16_t seq_nr)
|
||||||
{
|
{
|
||||||
struct msgb *msg;
|
struct msgb *msg;
|
||||||
@@ -153,6 +168,9 @@ int upf_gtpu_echo_read_cb(struct osmo_fd *ofd, unsigned int what)
|
|||||||
switch (h->msg_type) {
|
switch (h->msg_type) {
|
||||||
case GTP1U_MSGTYPE_ECHO_REQ:
|
case GTP1U_MSGTYPE_ECHO_REQ:
|
||||||
return rx_echo_req(dev, &remote, h, sz);
|
return rx_echo_req(dev, &remote, h, sz);
|
||||||
|
case GTP1U_MSGTYPE_ECHO_RSP:
|
||||||
|
rx_echo_resp(dev, &remote, h, sz);
|
||||||
|
return 0;
|
||||||
default:
|
default:
|
||||||
LOG_GTP_DEV(dev, LOGL_ERROR, "rx: GTPv1-U message type %u not supported\n", h->msg_type);
|
LOG_GTP_DEV(dev, LOGL_ERROR, "rx: GTPv1-U message type %u not supported\n", h->msg_type);
|
||||||
return -1;
|
return -1;
|
||||||
|
Reference in New Issue
Block a user