diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2017-07-31 02:32:12 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2017-07-31 02:32:12 +0000 |
commit | ad1b458d74ae3c53db2a805cf6927eb4271b6c71 (patch) | |
tree | 2d143d747b51a9116b2e1b099a173c813d3737fc /sbin/ifconfig | |
parent | a1363b540024269cf815f5fc4fc0c9c849aa3434 (diff) |
The handling of 'add' used by bridge and switch in ifconfig does not
error out if the ioctl returns EEXIST. Do the same for the switch
specific 'addlocal' and 'portno' ioctls so netstart won't error out
when rerun with the same settings in hostname.switchN.
ok reyk@
Diffstat (limited to 'sbin/ifconfig')
-rw-r--r-- | sbin/ifconfig/brconfig.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sbin/ifconfig/brconfig.c b/sbin/ifconfig/brconfig.c index 12ed5e7e99e..1f240b133ce 100644 --- a/sbin/ifconfig/brconfig.c +++ b/sbin/ifconfig/brconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: brconfig.c,v 1.15 2017/06/07 16:47:29 naddy Exp $ */ +/* $OpenBSD: brconfig.c,v 1.16 2017/07/31 02:32:11 jsg Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -203,7 +203,7 @@ addlocal(const char *ifsname, int d) strlcpy(breq.ifbr_ifsname, ifsname, sizeof(breq.ifbr_ifsname)); if (ioctl(s, SIOCBRDGADDL, (caddr_t)&breq) < 0) { if (errno == EEXIST) - errx(1, "%s: local port exists already", name); + return; else err(1, "%s: ioctl SIOCBRDGADDL %s", name, ifsname); } @@ -1076,8 +1076,12 @@ switch_portno(const char *ifname, const char *val) errx(1, "invalid arg for portidx: %s", val); breq.ifbr_portno = newportidx; - if (ioctl(s, SIOCSWSPORTNO, (caddr_t)&breq) < 0) - err(1, "%s", name); + if (ioctl(s, SIOCSWSPORTNO, (caddr_t)&breq) < 0) { + if (errno == EEXIST) + return; + else + err(1, "%s", name); + } } #endif |