/*-1* Copyright (c) 2020 Kristof Provost <[email protected]>2*3* Redistribution and use in source and binary forms, with or without4* modification, are permitted provided that the following conditions5* are met:6* 1. Redistributions of source code must retain the above copyright7* notice, this list of conditions and the following disclaimer.8* 2. Redistributions in binary form must reproduce the above copyright9* notice, this list of conditions and the following disclaimer in the10* documentation and/or other materials provided with the distribution.11*12* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND13* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE14* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE15* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE16* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL17* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS18* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)19* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT20* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY21* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF22* SUCH DAMAGE.23*/2425#include <sys/param.h>26#include <sys/ioctl.h>27#include <sys/linker.h>28#include <sys/module.h>29#include <sys/socket.h>30#include <sys/types.h>3132#include <net/if.h>3334#include <errno.h>35#include <fcntl.h>36#include <stdio.h>37#include <strings.h>3839#include <atf-c.h>40#include "freebsd_test_suite/macros.h"4142ATF_TC(params);43ATF_TC_HEAD(params, tc)44{45atf_tc_set_md_var(tc, "require.user", "root");46atf_tc_set_md_var(tc, "require.kmods", "if_epair");47}4849ATF_TC_BODY(params, tc)50{51struct ifreq ifr;52int s;5354s = socket(AF_INET, SOCK_DGRAM, 0);55if (s < 0)56atf_tc_fail("Failed to create socket");5758bzero(&ifr, sizeof(ifr));59ifr.ifr_data = (caddr_t)-1;60(void) strlcpy(ifr.ifr_name, "epair", sizeof(ifr.ifr_name));6162if (ioctl(s, SIOCIFCREATE2, &ifr) < 0)63atf_tc_fail("Failed to create interface");6465if (ioctl(s, SIOCIFDESTROY, &ifr) < 0)66atf_tc_fail("Failed to destroy interface");67}6869ATF_TP_ADD_TCS(tp)70{71ATF_TP_ADD_TC(tp, params);7273return (atf_no_error());74}757677