summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Goodfellow <ryan.goodfellow@oxide.computer>2022-06-09 07:52:45 -0700
committerJoshua M. Clulow <josh@sysmgr.org>2022-06-09 07:52:45 -0700
commit2514b110a74b7a0ce021feff362fe3c4c2352b43 (patch)
treec64cde52100ce37fc6b4d94afd76c4717b9b09cd
parent7a15b0ec33c685e4e6b096454b077a52604acf9b (diff)
downloadillumos-joyent-2514b110a74b7a0ce021feff362fe3c4c2352b43.tar.gz
14724 failed delete of IP address made it undeletable
Reviewed by: Andy Fiddaman <andy@omnios.org> Reviewed by: Gordon Ross <Gordon.W.Ross@gmail.com> Reviewed by: Robert Mustacchi <rm@fingolfin.org> Approved by: Joshua M. Clulow <josh@sysmgr.org>
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/in.ndpd/main.c3
-rw-r--r--usr/src/lib/libipadm/common/ipadm_ndpd.c7
-rw-r--r--usr/src/uts/common/inet/ip.h3
3 files changed, 10 insertions, 3 deletions
diff --git a/usr/src/cmd/cmd-inet/usr.lib/in.ndpd/main.c b/usr/src/cmd/cmd-inet/usr.lib/in.ndpd/main.c
index 2bae04288e..9660e67d06 100644
--- a/usr/src/cmd/cmd-inet/usr.lib/in.ndpd/main.c
+++ b/usr/src/cmd/cmd-inet/usr.lib/in.ndpd/main.c
@@ -19,6 +19,7 @@
* CDDL HEADER END
*
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2022 Oxide Computer Company
*/
#include "defs.h"
@@ -2418,7 +2419,7 @@ ndpd_delete_addrs(const char *ifname)
}
if (IN6_IS_ADDR_UNSPECIFIED(&pi->pi_token)) {
logmsg(LOG_ERR, "token does not exist for %s", ifname);
- return (EINVAL);
+ return (ENOENT);
}
if (ifsock < 0) {
diff --git a/usr/src/lib/libipadm/common/ipadm_ndpd.c b/usr/src/lib/libipadm/common/ipadm_ndpd.c
index 29ea8ccf51..95e6df2d0a 100644
--- a/usr/src/lib/libipadm/common/ipadm_ndpd.c
+++ b/usr/src/lib/libipadm/common/ipadm_ndpd.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, Chris Fraire <cfraire@me.com>.
+ * Copyright 2022 Oxide Computer Company
*/
/*
@@ -129,8 +130,12 @@ i_ipadm_delete_ipv6addrs(ipadm_handle_t iph, ipadm_addrobj_t ipaddr)
*/
status = i_ipadm_send_ndpd_cmd(ipaddr->ipadm_ifname, ipaddr,
IPADM_DELETE_ADDRS);
- if (status == IPADM_NDPD_NOT_RUNNING)
+
+ /* if the entry is not found, or ndpd is not running, just carry on */
+ if (status == IPADM_NDPD_NOT_RUNNING || status == IPADM_ENXIO ||
+ status == IPADM_NOTFOUND)
status = IPADM_SUCCESS;
+
if (status == IPADM_SUCCESS)
status = i_ipadm_delete_addr(iph, ipaddr);
diff --git a/usr/src/uts/common/inet/ip.h b/usr/src/uts/common/inet/ip.h
index 9858fd65ec..c081c44a04 100644
--- a/usr/src/uts/common/inet/ip.h
+++ b/usr/src/uts/common/inet/ip.h
@@ -25,6 +25,7 @@
* Copyright 2017 Nexenta Systems, Inc.
* Copyright 2017 OmniTI Computer Consulting, Inc. All rights reserved.
* Copyright 2019, Joyent, Inc.
+ * Copyright 2022 Oxide Computer Company
*/
#ifndef _INET_IP_H
@@ -2009,7 +2010,7 @@ enum { IF_CMD = 1, LIF_CMD, ARP_CMD, XARP_CMD, MSFILT_CMD, MISC_CMD };
#define IPI_DONTCARE 0 /* For ioctl encoded values that don't matter */
/* Flag values in ipi_flags */
-#define IPI_PRIV 0x1 /* Root only command */
+#define IPI_PRIV 0x1 /* Command requires PRIV_SYS_IP_CONFIG */
#define IPI_MODOK 0x2 /* Permitted on mod instance of IP */
#define IPI_WR 0x4 /* Need to grab writer access */
#define IPI_GET_CMD 0x8 /* branch to mi_copyout on success */