Page MenuHomeFreeBSD

D27380.diff
No OneTemporary

D27380.diff

Index: head/sbin/ifconfig/ifclone.c
===================================================================
--- head/sbin/ifconfig/ifclone.c
+++ head/sbin/ifconfig/ifclone.c
@@ -151,8 +151,7 @@
}
if (clone_cb == NULL) {
/* NB: no parameters */
- if (ioctl(s, SIOCIFCREATE2, &ifr) < 0)
- err(1, "SIOCIFCREATE2");
+ ioctl_ifcreate(s, &ifr);
} else {
clone_cb(s, &ifr);
}
Index: head/sbin/ifconfig/ifconfig.h
===================================================================
--- head/sbin/ifconfig/ifconfig.h
+++ head/sbin/ifconfig/ifconfig.h
@@ -160,3 +160,4 @@
void print_vhid(const struct ifaddrs *, const char *);
+void ioctl_ifcreate(int s, struct ifreq *);
Index: head/sbin/ifconfig/ifconfig.c
===================================================================
--- head/sbin/ifconfig/ifconfig.c
+++ head/sbin/ifconfig/ifconfig.c
@@ -198,6 +198,19 @@
exit(1);
}
+void
+ioctl_ifcreate(int s, struct ifreq *ifr)
+{
+ if (ioctl(s, SIOCIFCREATE2, ifr) < 0) {
+ switch (errno) {
+ case EEXIST:
+ errx(1, "interface %s already exists", ifr->ifr_name);
+ default:
+ err(1, "SIOCIFCREATE2");
+ }
+ }
+}
+
#define ORDERS_SIZE(x) sizeof(x) / sizeof(x[0])
static int
Index: head/sbin/ifconfig/ifieee80211.c
===================================================================
--- head/sbin/ifconfig/ifieee80211.c
+++ head/sbin/ifconfig/ifieee80211.c
@@ -5758,8 +5758,7 @@
memcmp(params.icp_bssid, zerobssid, sizeof(zerobssid)) == 0)
errx(1, "no bssid specified for WDS (use wlanbssid)");
ifr->ifr_data = (caddr_t) &params;
- if (ioctl(s, SIOCIFCREATE2, ifr) < 0)
- err(1, "SIOCIFCREATE2");
+ ioctl_ifcreate(s, ifr);
/* XXX preserve original name for ifclonecreate(). */
strlcpy(orig_name, name, sizeof(orig_name));
Index: head/sbin/ifconfig/iflagg.c
===================================================================
--- head/sbin/ifconfig/iflagg.c
+++ head/sbin/ifconfig/iflagg.c
@@ -324,8 +324,7 @@
lagg_create(int s, struct ifreq *ifr)
{
ifr->ifr_data = (caddr_t) &params;
- if (ioctl(s, SIOCIFCREATE2, ifr) < 0)
- err(1, "SIOCIFCREATE2");
+ ioctl_ifcreate(s, ifr);
}
static struct cmd lagg_cmds[] = {
Index: head/sbin/ifconfig/ifvlan.c
===================================================================
--- head/sbin/ifconfig/ifvlan.c
+++ head/sbin/ifconfig/ifvlan.c
@@ -162,8 +162,7 @@
errx(1, "must specify a parent device for vlan create");
ifr->ifr_data = (caddr_t) &params;
}
- if (ioctl(s, SIOCIFCREATE2, ifr) < 0)
- err(1, "SIOCIFCREATE2");
+ ioctl_ifcreate(s, ifr);
}
static void
Index: head/sbin/ifconfig/ifvxlan.c
===================================================================
--- head/sbin/ifconfig/ifvxlan.c
+++ head/sbin/ifconfig/ifvxlan.c
@@ -191,8 +191,7 @@
vxlan_check_params();
ifr->ifr_data = (caddr_t) &params;
- if (ioctl(s, SIOCIFCREATE2, ifr) < 0)
- err(1, "SIOCIFCREATE2");
+ ioctl_ifcreate(s, ifr);
}
static

File Metadata

Mime Type
text/plain
Expires
Wed, Jul 22, 1:37 PM (9 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35365738
Default Alt Text
D27380.diff (2 KB)

Event Timeline