diff options
Diffstat (limited to 'sbin/ifconfig/ifconfig.c')
-rw-r--r-- | sbin/ifconfig/ifconfig.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index e47d0000c7abd..e6e7908e18cd5 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -198,6 +198,19 @@ usage(void) 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 |