summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Fiddaman <omnios@citrus-it.co.uk>2020-02-27 10:52:02 +0000
committerAndy Fiddaman <omnios@citrus-it.co.uk>2022-03-07 16:42:39 +0000
commitbf41048984a6ceae3ab49d5d80ce3c32693924b1 (patch)
tree90793854be8524c3509f6bcd446712068e6cbe97
parent6feac2e3ccf4b4d8651a254d516ae86b1b1b3e4f (diff)
downloadillumos-joyent-bf41048984a6ceae3ab49d5d80ce3c32693924b1.tar.gz
14435 overlay encapsulation bind failure error message is unhelpful
Reviewed by: Robert Mustacchi <rm+illumos@fingolfin.org> Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r--usr/src/lib/libdladm/common/libdladm.c12
-rw-r--r--usr/src/lib/libdladm/common/libdladm.h5
-rw-r--r--usr/src/lib/libdladm/common/libdlvnic.c19
3 files changed, 24 insertions, 12 deletions
diff --git a/usr/src/lib/libdladm/common/libdladm.c b/usr/src/lib/libdladm/common/libdladm.c
index 55e6d3e1e0..767f8d7ffe 100644
--- a/usr/src/lib/libdladm/common/libdladm.c
+++ b/usr/src/lib/libdladm/common/libdladm.c
@@ -20,15 +20,12 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2015, Joyent, Inc.
- */
-
-/*
- * Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
*/
/*
+ * Copyright (c) 2015, Joyent, Inc.
* Copyright 2020 Peter Tribble.
+ * Copyright 2022 OmniOS Community Edition (OmniOSce) Association.
*/
#include <unistd.h>
@@ -447,6 +444,9 @@ dladm_status2str(dladm_status_t status, char *buf)
case DLADM_STATUS_BAD_ENCAP:
s = "invalid encapsulation protocol";
break;
+ case DLADM_STATUS_ADDRNOTAVAIL:
+ s = "can't assign requested address";
+ break;
default:
s = "<unknown error>";
break;
@@ -497,6 +497,8 @@ dladm_errno2status(int err)
return (DLADM_STATUS_FLOW_IDENTICAL);
case EADDRINUSE:
return (DLADM_STATUS_ADDRINUSE);
+ case EADDRNOTAVAIL:
+ return (DLADM_STATUS_ADDRNOTAVAIL);
default:
return (DLADM_STATUS_FAILED);
}
diff --git a/usr/src/lib/libdladm/common/libdladm.h b/usr/src/lib/libdladm/common/libdladm.h
index 5a97bacaa0..a2e56047d2 100644
--- a/usr/src/lib/libdladm/common/libdladm.h
+++ b/usr/src/lib/libdladm/common/libdladm.h
@@ -24,7 +24,7 @@
/*
* Copyright 2015, Joyent, Inc.
- * Copyright 2020 OmniOS Community Edition (OmniOSce) Association
+ * Copyright 2022 OmniOS Community Edition (OmniOSce) Association
*/
#ifndef _LIBDLADM_H
@@ -181,7 +181,8 @@ typedef enum {
DLADM_STATUS_PORT_NOPROTO,
DLADM_STATUS_INVALID_MTU,
DLADM_STATUS_PERSIST_ON_TEMP,
- DLADM_STATUS_BAD_ENCAP
+ DLADM_STATUS_BAD_ENCAP,
+ DLADM_STATUS_ADDRNOTAVAIL
} dladm_status_t;
typedef enum {
diff --git a/usr/src/lib/libdladm/common/libdlvnic.c b/usr/src/lib/libdladm/common/libdlvnic.c
index 73c001b744..d76fcf0b08 100644
--- a/usr/src/lib/libdladm/common/libdlvnic.c
+++ b/usr/src/lib/libdladm/common/libdlvnic.c
@@ -405,7 +405,7 @@ dladm_vnic_create(dladm_handle_t handle, const char *vnic, datalink_id_t linkid,
{
dladm_vnic_attr_t attr;
datalink_id_t vnic_id;
- datalink_class_t class;
+ datalink_class_t class, pclass;
uint32_t media = DL_ETHER;
uint32_t link_flags;
char name[MAXLINKNAMELEN];
@@ -443,7 +443,7 @@ dladm_vnic_create(dladm_handle_t handle, const char *vnic, datalink_id_t linkid,
if (!is_etherstub) {
if ((status = dladm_datalink_id2info(handle, linkid,
- &link_flags, &class, &media, NULL, 0)) != DLADM_STATUS_OK)
+ &link_flags, &pclass, &media, NULL, 0)) != DLADM_STATUS_OK)
return (status);
/* Disallow persistent objects on top of temporary ones */
@@ -452,8 +452,8 @@ dladm_vnic_create(dladm_handle_t handle, const char *vnic, datalink_id_t linkid,
return (DLADM_STATUS_PERSIST_ON_TEMP);
/* Links cannot be created on top of these object types */
- if (class == DATALINK_CLASS_VNIC ||
- class == DATALINK_CLASS_VLAN)
+ if (pclass == DATALINK_CLASS_VNIC ||
+ pclass == DATALINK_CLASS_VLAN)
return (DLADM_STATUS_BADARG);
}
@@ -548,8 +548,17 @@ dladm_vnic_create(dladm_handle_t handle, const char *vnic, datalink_id_t linkid,
attr.va_force = (flags & DLADM_OPT_FORCE) != 0;
status = i_dladm_vnic_create_sys(handle, &attr);
- if (status != DLADM_STATUS_OK)
+ if (status != DLADM_STATUS_OK) {
+ if (!is_etherstub && pclass == DATALINK_CLASS_OVERLAY &&
+ status == DLADM_STATUS_ADDRNOTAVAIL) {
+ char errmsg[DLADM_STRSIZE];
+ (void) dladm_errlist_append(errs,
+ "failed to start overlay device; "
+ "could not open underlay socket: %s",
+ dladm_status2str(status, errmsg));
+ }
goto done;
+ }
vnic_created = B_TRUE;
/* Save vnic configuration and its properties */