Page MenuHomeFreeBSD

D15046.diff
No OneTemporary

D15046.diff

Index: head/sbin/ifconfig/ifclone.c
===================================================================
--- head/sbin/ifconfig/ifclone.c
+++ head/sbin/ifconfig/ifclone.c
@@ -181,7 +181,7 @@
clone_Copt_cb(const char *optarg __unused)
{
list_cloners();
- exit(0);
+ exit(exit_code);
}
static struct option clone_Copt = { .opt = "C", .opt_usage = "[-C]", .cb = clone_Copt_cb };
Index: head/sbin/ifconfig/ifconfig.h
===================================================================
--- head/sbin/ifconfig/ifconfig.h
+++ head/sbin/ifconfig/ifconfig.h
@@ -136,6 +136,7 @@
extern int newaddr;
extern int verbose;
extern int printifname;
+extern int exit_code;
void setifcap(const char *, int value, int s, const struct afswtch *);
Index: head/sbin/ifconfig/ifconfig.c
===================================================================
--- head/sbin/ifconfig/ifconfig.c
+++ head/sbin/ifconfig/ifconfig.c
@@ -99,6 +99,7 @@
int supmedia = 0;
int printkeys = 0; /* Print keying material for interfaces. */
+int exit_code = 0;
/* Formatter Strings */
char *f_inet, *f_inet6, *f_ether, *f_addr;
@@ -485,7 +486,7 @@
errx(1, "%s: cloning name too long",
ifname);
ifconfig(argc, argv, 1, NULL);
- exit(0);
+ exit(exit_code);
}
#ifdef JAIL
/*
@@ -499,7 +500,7 @@
errx(1, "%s: interface name too long",
ifname);
ifconfig(argc, argv, 0, NULL);
- exit(0);
+ exit(exit_code);
}
#endif
errx(1, "interface %s does not exist", ifname);
@@ -597,7 +598,7 @@
freeifaddrs(ifap);
freeformat();
- exit(0);
+ exit(exit_code);
}
static struct afswtch *afs = NULL;
Index: head/sbin/ifconfig/ifgroup.c
===================================================================
--- head/sbin/ifconfig/ifgroup.c
+++ head/sbin/ifconfig/ifgroup.c
@@ -140,7 +140,7 @@
if (ioctl(s, SIOCGIFGMEMB, (caddr_t)&ifgr) == -1) {
if (errno == EINVAL || errno == ENOTTY ||
errno == ENOENT)
- exit(0);
+ exit(exit_code);
else
err(1, "SIOCGIFGMEMB");
}
@@ -159,7 +159,7 @@
}
free(ifgr.ifgr_groups);
- exit(0);
+ exit(exit_code);
}
static struct cmd group_cmds[] = {
Index: head/sbin/ifconfig/iflagg.c
===================================================================
--- head/sbin/ifconfig/iflagg.c
+++ head/sbin/ifconfig/iflagg.c
@@ -41,9 +41,17 @@
strlcpy(rp.rp_ifname, name, sizeof(rp.rp_ifname));
strlcpy(rp.rp_portname, val, sizeof(rp.rp_portname));
- /* Don't choke if the port is already in this lagg. */
- if (ioctl(s, SIOCSLAGGPORT, &rp) && errno != EEXIST)
- err(1, "SIOCSLAGGPORT");
+ /*
+ * Do not exit with an error here. Doing so permits a
+ * failed NIC to take down an entire lagg.
+ *
+ * Don't error at all if the port is already in the lagg.
+ */
+ if (ioctl(s, SIOCSLAGGPORT, &rp) && errno != EEXIST) {
+ warnx("%s %s: SIOCSLAGGPORT: %s",
+ name, val, strerror(errno));
+ exit_code = 1;
+ }
}
static void

File Metadata

Mime Type
text/plain
Expires
Mon, Jul 13, 8:21 PM (8 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35043974
Default Alt Text
D15046.diff (2 KB)

Event Timeline