aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/udp
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-10-21 16:07:46 -0700
committerDave Barach <openvpp@barachs.net>2020-04-03 22:10:22 +0000
commit00e01d3e875bb18397ff81e0f58f9b468477f473 (patch)
tree277b9ce692a465644de5d3481b42e6cce6394f46 /src/vnet/udp
parent39aa7a5202a6a875bd6f5d341cb07f19ab0bf51e (diff)
session: improve error reporting
Type: improvement Change-Id: I9dd850a1ce85b0adb5136233f176117e0ee38817 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/udp')
-rw-r--r--src/vnet/udp/udp.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c
index 3632204f863..65d50fff395 100644
--- a/src/vnet/udp/udp.c
+++ b/src/vnet/udp/udp.c
@@ -418,16 +418,18 @@ udp_open_connection (transport_endpoint_cfg_t * rmt)
udp_connection_t *uc;
ip46_address_t lcl_addr;
u16 lcl_port;
+ int rv;
- if (transport_alloc_local_endpoint (TRANSPORT_PROTO_UDP, rmt, &lcl_addr,
- &lcl_port))
- return -1;
+ rv = transport_alloc_local_endpoint (TRANSPORT_PROTO_UDP, rmt, &lcl_addr,
+ &lcl_port);
+ if (rv)
+ return rv;
if (udp_is_valid_dst_port (lcl_port, rmt->is_ip4))
{
/* If specific source port was requested abort */
if (rmt->peer.port)
- return -1;
+ return SESSION_E_PORTINUSE;
/* Try to find a port that's not used */
while (udp_is_valid_dst_port (lcl_port, rmt->is_ip4))
@@ -435,10 +437,7 @@ udp_open_connection (transport_endpoint_cfg_t * rmt)
lcl_port = transport_alloc_local_port (TRANSPORT_PROTO_UDP,
&lcl_addr);
if (lcl_port < 1)
- {
- clib_warning ("Failed to allocate src port");
- return -1;
- }
+ return SESSION_E_PORTINUSE;
}
}