aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2019-07-04 14:20:17 +0200
committerFlorin Coras <florin.coras@gmail.com>2019-07-09 16:52:29 +0000
commit50f4a417147ae4aae6ad8cddb0c7709420c712f0 (patch)
treece77bd2b3413c5c111358c5f0938b42817a0cd22 /src/vnet
parentbfb9fe34615dc6532a3cdb85304046abdb417e55 (diff)
udp: UDPC handle open fail
Type: fix Change-Id: Ib8fb4957f4da9e464e2575c45c8ff3828db89872 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/udp/udp.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c
index 1fb7a507544..fafe8900242 100644
--- a/src/vnet/udp/udp.c
+++ b/src/vnet/udp/udp.c
@@ -357,9 +357,10 @@ udpc_connection_open (transport_endpoint_cfg_t * rmt)
u32 thread_index = vlib_num_workers ()? 1 : vlib_get_main ()->thread_index;
u32 uc_index;
uc_index = udp_open_connection (rmt);
+ if (uc_index == (u32) ~ 0)
+ return -1;
uc = udp_connection_get (uc_index, thread_index);
- if (uc)
- uc->is_connected = 1;
+ uc->is_connected = 1;
return uc_index;
}
@@ -367,11 +368,13 @@ u32
udpc_connection_listen (u32 session_index, transport_endpoint_t * lcl)
{
udp_connection_t *listener;
- u32 li;
- li = udp_session_bind (session_index, lcl);
- listener = udp_listener_get (li);
+ u32 li_index;
+ li_index = udp_session_bind (session_index, lcl);
+ if (li_index == (u32) ~ 0)
+ return -1;
+ listener = udp_listener_get (li_index);
listener->is_connected = 1;
- return li;
+ return li_index;
}
/* *INDENT-OFF* */