diff options
author | liuyacan <liuyacan@corp.netease.com> | 2021-08-02 20:15:05 +0800 |
---|---|---|
committer | liuyacan <liuyacan@corp.netease.com> | 2021-08-02 20:17:43 +0800 |
commit | bc0c754116a287f7b6c24fbd0dffd6ef04f7957b (patch) | |
tree | 9eb51540388fd46c9682db9c9511a79fa46de68f | |
parent | f71796e5279e086c669699e2fd8ee110d7086afa (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
-rw-r--r-- | src/vcl/vppcom.c | 8 |
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) |