summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorliuyacan <liuyacan@corp.netease.com>2021-08-02 20:15:05 +0800
committerliuyacan <liuyacan@corp.netease.com>2021-08-02 20:17:43 +0800
commitbc0c754116a287f7b6c24fbd0dffd6ef04f7957b (patch)
tree9eb51540388fd46c9682db9c9511a79fa46de68f /src
parentf71796e5279e086c669699e2fd8ee110d7086afa (diff)
vcl: fix sendto for dgrams
We need to set rmt address before sending connect, otherwise VPP would connect to 0.0.0.0:0 and return invalid remote ip. Type: fix Signed-off-by: liuyacan <liuyacan@corp.netease.com> Change-Id: I85ae6931c2ba9f2f77c9ab19a2f801f50745449c
Diffstat (limited to 'src')
-rw-r--r--src/vcl/vppcom.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 940a8b92dc1..62aeff636b8 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -4060,6 +4060,10 @@ vppcom_session_sendto (uint32_t session_handle, void *buffer,
if (!vcl_session_is_cl (s))
return VPPCOM_EINVAL;
+ s->transport.is_ip4 = ep->is_ip4;
+ s->transport.rmt_port = ep->port;
+ vcl_ip_copy_from_ep (&s->transport.rmt_ip, ep);
+
/* Session not connected/bound in vpp. Create it by 'connecting' it */
if (PREDICT_FALSE (s->session_state == VCL_STATE_CLOSED))
{
@@ -4075,10 +4079,6 @@ vppcom_session_sendto (uint32_t session_handle, void *buffer,
return rv;
s = vcl_session_get (wrk, session_index);
}
-
- s->transport.is_ip4 = ep->is_ip4;
- s->transport.rmt_port = ep->port;
- vcl_ip_copy_from_ep (&s->transport.rmt_ip, ep);
}
if (flags)