1ec214349SKristof Provost /* 2b1d757bcSAlan Somers * Copyright (c) 2016-2017, Marie Helene Kvello-Aune 3ec214349SKristof Provost * All rights reserved. 4ec214349SKristof Provost * 5ec214349SKristof Provost * Redistribution and use in source and binary forms, with or without modification, 6ec214349SKristof Provost * are permitted provided that the following conditions are met: 7ec214349SKristof Provost * 8ec214349SKristof Provost * 1. Redistributions of source code must retain the above copyright notice, 9ec214349SKristof Provost * thislist of conditions and the following disclaimer. 10ec214349SKristof Provost * 11ec214349SKristof Provost * 2. Redistributions in binary form must reproduce the above copyright notice, 12ec214349SKristof Provost * this list of conditions and the following disclaimer in the documentation and/or 13ec214349SKristof Provost * other materials provided with the distribution. 14ec214349SKristof Provost * 15ec214349SKristof Provost * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16ec214349SKristof Provost * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17ec214349SKristof Provost * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18ec214349SKristof Provost * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19ec214349SKristof Provost * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20ec214349SKristof Provost * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21ec214349SKristof Provost * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22ec214349SKristof Provost * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23ec214349SKristof Provost * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24ec214349SKristof Provost * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25ec214349SKristof Provost * 26ec214349SKristof Provost * $FreeBSD$ 27ec214349SKristof Provost */ 28ec214349SKristof Provost 29ec214349SKristof Provost #pragma once 30ec214349SKristof Provost 3194cba803SRyan Moeller #include <sys/types.h> 3294cba803SRyan Moeller 3394cba803SRyan Moeller #include <net/if.h> 3494cba803SRyan Moeller 35b1d757bcSAlan Somers #include <netinet/in.h> 36b1d757bcSAlan Somers #include <netinet6/in6_var.h> 37b1d757bcSAlan Somers 38b1d757bcSAlan Somers #define ND6_IFF_DEFAULTIF 0x8000 39b1d757bcSAlan Somers 40ec214349SKristof Provost typedef enum { 41b1d757bcSAlan Somers OK = 0, 42b1d757bcSAlan Somers OTHER, 43b1d757bcSAlan Somers IOCTL, 44b1d757bcSAlan Somers SOCKET 45ec214349SKristof Provost } ifconfig_errtype; 46ec214349SKristof Provost 47ec214349SKristof Provost /* 48ec214349SKristof Provost * Opaque definition so calling application can just pass a 49ec214349SKristof Provost * pointer to it for library use. 50ec214349SKristof Provost */ 51ec214349SKristof Provost struct ifconfig_handle; 52ec214349SKristof Provost typedef struct ifconfig_handle ifconfig_handle_t; 53ec214349SKristof Provost 54b1d757bcSAlan Somers struct carpreq; 55b1d757bcSAlan Somers struct ifaddrs; 56e5539fb6SRyan Moeller struct ifbropreq; 57e5539fb6SRyan Moeller struct ifbreq; 58b1d757bcSAlan Somers struct in6_ndireq; 59b1d757bcSAlan Somers struct lagg_reqall; 60b1d757bcSAlan Somers struct lagg_reqflags; 61b1d757bcSAlan Somers struct lagg_reqopts; 62b1d757bcSAlan Somers struct lagg_reqport; 63b1d757bcSAlan Somers 64e5539fb6SRyan Moeller /** Stores extra info associated with a bridge(4) interface */ 65e5539fb6SRyan Moeller struct ifconfig_bridge_status { 66e5539fb6SRyan Moeller struct ifbropreq *params; /**< current operational parameters */ 67e5539fb6SRyan Moeller struct ifbreq *members; /**< list of bridge members */ 68e5539fb6SRyan Moeller size_t members_count; /**< how many member interfaces */ 69e5539fb6SRyan Moeller uint32_t cache_size; /**< size of address cache */ 70e5539fb6SRyan Moeller uint32_t cache_lifetime; /**< address cache entry lifetime */ 71e5539fb6SRyan Moeller }; 72e5539fb6SRyan Moeller 73ec214349SKristof Provost struct ifconfig_capabilities { 74ec214349SKristof Provost /** Current capabilities (ifconfig prints this as 'options')*/ 75ec214349SKristof Provost int curcap; 76ec214349SKristof Provost /** Requested capabilities (ifconfig prints this as 'capabilities')*/ 77ec214349SKristof Provost int reqcap; 78ec214349SKristof Provost }; 79ec214349SKristof Provost 80b1d757bcSAlan Somers /** Stores extra info associated with an inet address */ 81b1d757bcSAlan Somers struct ifconfig_inet_addr { 82b1d757bcSAlan Somers const struct sockaddr_in *sin; 83b1d757bcSAlan Somers const struct sockaddr_in *netmask; 84b1d757bcSAlan Somers const struct sockaddr_in *dst; 85b1d757bcSAlan Somers const struct sockaddr_in *broadcast; 86b1d757bcSAlan Somers int prefixlen; 87b1d757bcSAlan Somers uint8_t vhid; 88b1d757bcSAlan Somers }; 89b1d757bcSAlan Somers 90b1d757bcSAlan Somers /** Stores extra info associated with an inet6 address */ 91b1d757bcSAlan Somers struct ifconfig_inet6_addr { 92b1d757bcSAlan Somers struct sockaddr_in6 *sin6; 93b1d757bcSAlan Somers struct sockaddr_in6 *dstin6; 94b1d757bcSAlan Somers struct in6_addrlifetime lifetime; 95b1d757bcSAlan Somers int prefixlen; 96b1d757bcSAlan Somers uint32_t flags; 97b1d757bcSAlan Somers uint8_t vhid; 98b1d757bcSAlan Somers }; 99b1d757bcSAlan Somers 100b1d757bcSAlan Somers /** Stores extra info associated with a lagg(4) interface */ 101b1d757bcSAlan Somers struct ifconfig_lagg_status { 102b1d757bcSAlan Somers struct lagg_reqall *ra; 103b1d757bcSAlan Somers struct lagg_reqopts *ro; 104b1d757bcSAlan Somers struct lagg_reqflags *rf; 105b1d757bcSAlan Somers }; 106b1d757bcSAlan Somers 107ec214349SKristof Provost /** Retrieves a new state object for use in other API calls. 108ec214349SKristof Provost * Example usage: 109ec214349SKristof Provost *{@code 110ec214349SKristof Provost * // Create state object 111b1d757bcSAlan Somers * ifconfig_handle_t *lifh; 112b1d757bcSAlan Somers * lifh = ifconfig_open(); 113b1d757bcSAlan Somers * if (lifh == NULL) { 114b1d757bcSAlan Somers * // Handle error 115b1d757bcSAlan Somers * } 116ec214349SKristof Provost * 117b1d757bcSAlan Somers * // Do stuff with the handle 118ec214349SKristof Provost * 119ec214349SKristof Provost * // Dispose of the state object 120ec214349SKristof Provost * ifconfig_close(lifh); 121ec214349SKristof Provost * lifh = NULL; 122ec214349SKristof Provost *} 123ec214349SKristof Provost */ 124ec214349SKristof Provost ifconfig_handle_t *ifconfig_open(void); 125ec214349SKristof Provost 126ec214349SKristof Provost /** Frees resources held in the provided state object. 127ec214349SKristof Provost * @param h The state object to close. 128ec214349SKristof Provost * @see #ifconfig_open(void) 129ec214349SKristof Provost */ 130ec214349SKristof Provost void ifconfig_close(ifconfig_handle_t *h); 131ec214349SKristof Provost 132*09703627SGordon Bergling /** Identifies what kind of error occurred. */ 133ec214349SKristof Provost ifconfig_errtype ifconfig_err_errtype(ifconfig_handle_t *h); 134ec214349SKristof Provost 135ec214349SKristof Provost /** Retrieves the errno associated with the error, if any. */ 136ec214349SKristof Provost int ifconfig_err_errno(ifconfig_handle_t *h); 137ec214349SKristof Provost 138b1d757bcSAlan Somers typedef void (*ifconfig_foreach_func_t)(ifconfig_handle_t *h, 139b1d757bcSAlan Somers struct ifaddrs *ifa, void *udata); 140b1d757bcSAlan Somers 141b1d757bcSAlan Somers /** Iterate over every network interface 142b1d757bcSAlan Somers * @param h An open ifconfig state object 143b1d757bcSAlan Somers * @param cb A callback function to call with a pointer to each interface 144b1d757bcSAlan Somers * @param udata An opaque value that will be passed to the callback. 145b1d757bcSAlan Somers * @return 0 on success, nonzero if the list could not be iterated 146b1d757bcSAlan Somers */ 147b1d757bcSAlan Somers int ifconfig_foreach_iface(ifconfig_handle_t *h, ifconfig_foreach_func_t cb, 148b1d757bcSAlan Somers void *udata); 149b1d757bcSAlan Somers 150b1d757bcSAlan Somers /** Iterate over every address on a single network interface 151b1d757bcSAlan Somers * @param h An open ifconfig state object 152b1d757bcSAlan Somers * @param ifa A pointer that was supplied by a previous call to 153b1d757bcSAlan Somers * ifconfig_foreach_iface 154b1d757bcSAlan Somers * @param udata An opaque value that will be passed to the callback. 155b1d757bcSAlan Somers * @param cb A callback function to call with a pointer to each ifaddr 156b1d757bcSAlan Somers */ 157b1d757bcSAlan Somers void ifconfig_foreach_ifaddr(ifconfig_handle_t *h, struct ifaddrs *ifa, 158b1d757bcSAlan Somers ifconfig_foreach_func_t cb, void *udata); 159b1d757bcSAlan Somers 160ec214349SKristof Provost /** If error type was IOCTL, this identifies which request failed. */ 161ec214349SKristof Provost unsigned long ifconfig_err_ioctlreq(ifconfig_handle_t *h); 162ec214349SKristof Provost int ifconfig_get_description(ifconfig_handle_t *h, const char *name, 163ec214349SKristof Provost char **description); 164ec214349SKristof Provost int ifconfig_set_description(ifconfig_handle_t *h, const char *name, 165ec214349SKristof Provost const char *newdescription); 166ec214349SKristof Provost int ifconfig_unset_description(ifconfig_handle_t *h, const char *name); 1679a2ff315SKristof Provost int ifconfig_set_name(ifconfig_handle_t *h, const char *name, 1689a2ff315SKristof Provost const char *newname); 169c2803f1aSAndriy Voskoboinyk int ifconfig_get_orig_name(ifconfig_handle_t *h, const char *ifname, 170c2803f1aSAndriy Voskoboinyk char **orig_name); 171b1d757bcSAlan Somers int ifconfig_set_fib(ifconfig_handle_t *h, const char *name, int fib); 172b1d757bcSAlan Somers int ifconfig_get_fib(ifconfig_handle_t *h, const char *name, int *fib); 173ec214349SKristof Provost int ifconfig_set_mtu(ifconfig_handle_t *h, const char *name, const int mtu); 174ec214349SKristof Provost int ifconfig_get_mtu(ifconfig_handle_t *h, const char *name, int *mtu); 175b1d757bcSAlan Somers int ifconfig_get_nd6(ifconfig_handle_t *h, const char *name, 176b1d757bcSAlan Somers struct in6_ndireq *nd); 1779a2ff315SKristof Provost int ifconfig_set_metric(ifconfig_handle_t *h, const char *name, 1789a2ff315SKristof Provost const int metric); 179ec214349SKristof Provost int ifconfig_get_metric(ifconfig_handle_t *h, const char *name, int *metric); 180ec214349SKristof Provost int ifconfig_set_capability(ifconfig_handle_t *h, const char *name, 181ec214349SKristof Provost const int capability); 182ec214349SKristof Provost int ifconfig_get_capability(ifconfig_handle_t *h, const char *name, 183ec214349SKristof Provost struct ifconfig_capabilities *capability); 184ec214349SKristof Provost 185b1d757bcSAlan Somers /** Retrieve the list of groups to which this interface belongs 186b1d757bcSAlan Somers * @param h An open ifconfig state object 187b1d757bcSAlan Somers * @param name The interface name 188b1d757bcSAlan Somers * @param ifgr return argument. The caller is responsible for freeing 189b1d757bcSAlan Somers * ifgr->ifgr_groups 190b1d757bcSAlan Somers * @return 0 on success, nonzero on failure 191b1d757bcSAlan Somers */ 192b1d757bcSAlan Somers int ifconfig_get_groups(ifconfig_handle_t *h, const char *name, 193b1d757bcSAlan Somers struct ifgroupreq *ifgr); 194b1d757bcSAlan Somers int ifconfig_get_ifstatus(ifconfig_handle_t *h, const char *name, 195b1d757bcSAlan Somers struct ifstat *stat); 196b1d757bcSAlan Somers 197b1d757bcSAlan Somers /** Retrieve the interface media information 198b1d757bcSAlan Somers * @param h An open ifconfig state object 199b1d757bcSAlan Somers * @param name The interface name 200b1d757bcSAlan Somers * @param ifmr Return argument. The caller is responsible for freeing it 201b1d757bcSAlan Somers * @return 0 on success, nonzero on failure 202b1d757bcSAlan Somers */ 203b1d757bcSAlan Somers int ifconfig_media_get_mediareq(ifconfig_handle_t *h, const char *name, 204b1d757bcSAlan Somers struct ifmediareq **ifmr); 205c4ba4aa5SRyan Moeller 206b1d757bcSAlan Somers const char *ifconfig_media_get_status(const struct ifmediareq *ifmr); 207c4ba4aa5SRyan Moeller 208c4ba4aa5SRyan Moeller typedef int ifmedia_t; 209c4ba4aa5SRyan Moeller 210c4ba4aa5SRyan Moeller #define INVALID_IFMEDIA ((ifmedia_t)-1) 211c4ba4aa5SRyan Moeller 212c4ba4aa5SRyan Moeller /** Retrieve the name of a media type 213c4ba4aa5SRyan Moeller * @param media The media to be named 214c4ba4aa5SRyan Moeller * @return A pointer to the media type name, or NULL on failure 215c4ba4aa5SRyan Moeller */ 216c4ba4aa5SRyan Moeller const char *ifconfig_media_get_type(ifmedia_t media); 217c4ba4aa5SRyan Moeller 218c4ba4aa5SRyan Moeller /** Retrieve a media type by its name 219c4ba4aa5SRyan Moeller * @param name The name of a media type 220c4ba4aa5SRyan Moeller * @return The media type value, or INVALID_IFMEDIA on failure 221c4ba4aa5SRyan Moeller */ 222c4ba4aa5SRyan Moeller ifmedia_t ifconfig_media_lookup_type(const char *name); 223c4ba4aa5SRyan Moeller 224c4ba4aa5SRyan Moeller /** Retrieve the name of a media subtype 225c4ba4aa5SRyan Moeller * @param media The media subtype to be named 226c4ba4aa5SRyan Moeller * @return A pointer to the media subtype name, or NULL on failure 227c4ba4aa5SRyan Moeller */ 228c4ba4aa5SRyan Moeller const char *ifconfig_media_get_subtype(ifmedia_t media); 229c4ba4aa5SRyan Moeller 230c4ba4aa5SRyan Moeller /** Retrieve a media subtype by its name 231c4ba4aa5SRyan Moeller * @param media The top level media type whose subtype we want 232c4ba4aa5SRyan Moeller * @param name The name of a media subtype 233c4ba4aa5SRyan Moeller * @return The media subtype value, or INVALID_IFMEDIA on failure 234c4ba4aa5SRyan Moeller */ 235c4ba4aa5SRyan Moeller ifmedia_t ifconfig_media_lookup_subtype(ifmedia_t media, const char *name); 236c4ba4aa5SRyan Moeller 237c4ba4aa5SRyan Moeller /** Retrieve the name of a media mode 238c4ba4aa5SRyan Moeller * @param media The media mode to be named 239c4ba4aa5SRyan Moeller * @return A pointer to the media mode name, or NULL on failure 240c4ba4aa5SRyan Moeller */ 241c4ba4aa5SRyan Moeller const char *ifconfig_media_get_mode(ifmedia_t media); 242c4ba4aa5SRyan Moeller 243c4ba4aa5SRyan Moeller /** Retrieve a media mode by its name 244c4ba4aa5SRyan Moeller * @param media The top level media type whose mode we want 245c4ba4aa5SRyan Moeller * @param name The name of a media mode 246c4ba4aa5SRyan Moeller * @return The media mode value, or INVALID_IFMEDIA on failure 247c4ba4aa5SRyan Moeller */ 248c4ba4aa5SRyan Moeller ifmedia_t ifconfig_media_lookup_mode(ifmedia_t media, const char *name); 249c4ba4aa5SRyan Moeller 250c4ba4aa5SRyan Moeller /** Retrieve an array of media options 251c4ba4aa5SRyan Moeller * @param media The media for which to obtain the options 252c4ba4aa5SRyan Moeller * @return Pointer to an array of pointers to option names, 253c4ba4aa5SRyan Moeller * terminated by a NULL pointer, or simply NULL on failure. 254c4ba4aa5SRyan Moeller * The caller is responsible for freeing the array but not its 255c4ba4aa5SRyan Moeller * contents. 256c4ba4aa5SRyan Moeller */ 257c4ba4aa5SRyan Moeller const char **ifconfig_media_get_options(ifmedia_t media); 258c4ba4aa5SRyan Moeller 259c4ba4aa5SRyan Moeller /** Retrieve an array of media options by names 260c4ba4aa5SRyan Moeller * @param media The top level media type whose options we want 261c4ba4aa5SRyan Moeller * @param opts Pointer to an array of string pointers naming options 262c4ba4aa5SRyan Moeller * @param nopts Number of elements in the opts array 263c4ba4aa5SRyan Moeller * @return Pointer to an array of media options, one for each option named 264c4ba4aa5SRyan Moeller * in opts. NULL is returned instead with errno set to ENOMEM if 265c4ba4aa5SRyan Moeller * allocating the return array fails or EINVAL if media is not 266c4ba4aa5SRyan Moeller * valid. A media option in the array will be INVALID_IFMEDIA 267c4ba4aa5SRyan Moeller * when lookup failed for the option named in that position in 268c4ba4aa5SRyan Moeller * opts. The caller is responsible for freeing the array. 269c4ba4aa5SRyan Moeller */ 270c4ba4aa5SRyan Moeller ifmedia_t *ifconfig_media_lookup_options(ifmedia_t media, const char **opts, 271c4ba4aa5SRyan Moeller size_t nopts); 272b1d757bcSAlan Somers 273b12a960eSRyan Moeller /** Retrieve the reason the interface is down 274b12a960eSRyan Moeller * @param h An open ifconfig state object 275b12a960eSRyan Moeller * @param name The interface name 276b12a960eSRyan Moeller * @param ifdr Return argument. 277b12a960eSRyan Moeller * @return 0 on success, nonzero on failure 278b12a960eSRyan Moeller */ 279b12a960eSRyan Moeller int ifconfig_media_get_downreason(ifconfig_handle_t *h, const char *name, 280b12a960eSRyan Moeller struct ifdownreason *ifdr); 281b12a960eSRyan Moeller 282b1d757bcSAlan Somers int ifconfig_carp_get_info(ifconfig_handle_t *h, const char *name, 283b1d757bcSAlan Somers struct carpreq *carpr, int ncarpr); 284b1d757bcSAlan Somers 285b1d757bcSAlan Somers /** Retrieve additional information about an inet address 286b1d757bcSAlan Somers * @param h An open ifconfig state object 287b1d757bcSAlan Somers * @param name The interface name 288*09703627SGordon Bergling * @param ifa Pointer to the address structure of interest 289b1d757bcSAlan Somers * @param addr Return argument. It will be filled with additional information 290b1d757bcSAlan Somers * about the address. 291b1d757bcSAlan Somers * @return 0 on success, nonzero on failure. 292b1d757bcSAlan Somers */ 293b1d757bcSAlan Somers int ifconfig_inet_get_addrinfo(ifconfig_handle_t *h, 294b1d757bcSAlan Somers const char *name, struct ifaddrs *ifa, struct ifconfig_inet_addr *addr); 295b1d757bcSAlan Somers 296b1d757bcSAlan Somers /** Retrieve additional information about an inet6 address 297b1d757bcSAlan Somers * @param h An open ifconfig state object 298b1d757bcSAlan Somers * @param name The interface name 299*09703627SGordon Bergling * @param ifa Pointer to the address structure of interest 300b1d757bcSAlan Somers * @param addr Return argument. It will be filled with additional information 301b1d757bcSAlan Somers * about the address. 302b1d757bcSAlan Somers * @return 0 on success, nonzero on failure. 303b1d757bcSAlan Somers */ 304b1d757bcSAlan Somers int ifconfig_inet6_get_addrinfo(ifconfig_handle_t *h, 305b1d757bcSAlan Somers const char *name, struct ifaddrs *ifa, struct ifconfig_inet6_addr *addr); 306b1d757bcSAlan Somers 307e5539fb6SRyan Moeller /** Retrieve additional information about a bridge(4) interface */ 308e5539fb6SRyan Moeller int ifconfig_bridge_get_bridge_status(ifconfig_handle_t *h, 309e5539fb6SRyan Moeller const char *name, struct ifconfig_bridge_status **bridge); 310e5539fb6SRyan Moeller 311e5539fb6SRyan Moeller /** Frees the structure returned by ifconfig_bridge_get_bridge_status. Does 312e5539fb6SRyan Moeller * nothing if the argument is NULL 313e5539fb6SRyan Moeller * @param bridge Pointer to the structure to free 314e5539fb6SRyan Moeller */ 315e5539fb6SRyan Moeller void ifconfig_bridge_free_bridge_status(struct ifconfig_bridge_status *bridge); 316e5539fb6SRyan Moeller 317b1d757bcSAlan Somers /** Retrieve additional information about a lagg(4) interface */ 318b1d757bcSAlan Somers int ifconfig_lagg_get_lagg_status(ifconfig_handle_t *h, 319b1d757bcSAlan Somers const char *name, struct ifconfig_lagg_status **lagg_status); 320b1d757bcSAlan Somers 321b1d757bcSAlan Somers /** Retrieve additional information about a member of a lagg(4) interface */ 322b1d757bcSAlan Somers int ifconfig_lagg_get_laggport_status(ifconfig_handle_t *h, 323b1d757bcSAlan Somers const char *name, struct lagg_reqport *rp); 324b1d757bcSAlan Somers 325e5539fb6SRyan Moeller /** Frees the structure returned by ifconfig_lagg_get_lagg_status. Does 326e5539fb6SRyan Moeller * nothing if the argument is NULL 327b1d757bcSAlan Somers * @param laggstat Pointer to the structure to free 328b1d757bcSAlan Somers */ 329b1d757bcSAlan Somers void ifconfig_lagg_free_lagg_status(struct ifconfig_lagg_status *laggstat); 330b1d757bcSAlan Somers 331ec214349SKristof Provost /** Destroy a virtual interface 332ec214349SKristof Provost * @param name Interface to destroy 333ec214349SKristof Provost */ 334ec214349SKristof Provost int ifconfig_destroy_interface(ifconfig_handle_t *h, const char *name); 335ec214349SKristof Provost 336ec214349SKristof Provost /** Creates a (virtual) interface 337ec214349SKristof Provost * @param name Name of interface to create. Example: bridge or bridge42 338ec214349SKristof Provost * @param name ifname Is set to actual name of created interface 339ec214349SKristof Provost */ 340ec214349SKristof Provost int ifconfig_create_interface(ifconfig_handle_t *h, const char *name, 341ec214349SKristof Provost char **ifname); 342b1d757bcSAlan Somers 343b1d757bcSAlan Somers /** Creates a (virtual) interface 344b1d757bcSAlan Somers * @param name Name of interface to create. Example: vlan0 or ix0.50 345b1d757bcSAlan Somers * @param name ifname Is set to actual name of created interface 346b1d757bcSAlan Somers * @param vlandev Name of interface to attach to 347b1d757bcSAlan Somers * @param vlanid VLAN ID/Tag. Must not be 0. 348b1d757bcSAlan Somers */ 349b1d757bcSAlan Somers int ifconfig_create_interface_vlan(ifconfig_handle_t *h, const char *name, 350b1d757bcSAlan Somers char **ifname, const char *vlandev, const unsigned short vlantag); 351b1d757bcSAlan Somers 352b1d757bcSAlan Somers int ifconfig_set_vlantag(ifconfig_handle_t *h, const char *name, 353b1d757bcSAlan Somers const char *vlandev, const unsigned short vlantag); 3540710ec8cSRyan Moeller 3550710ec8cSRyan Moeller /** Gets the names of all interface cloners available on the system 3560710ec8cSRyan Moeller * @param bufp Set to the address of the names buffer on success or NULL 3570710ec8cSRyan Moeller * if an error occurs. This buffer must be freed when done. 3580710ec8cSRyan Moeller * @param lenp Set to the number of names in the returned buffer or 0 3590710ec8cSRyan Moeller * if an error occurs. Each name is contained within an 3600710ec8cSRyan Moeller * IFNAMSIZ length slice of the buffer, for a total buffer 3610710ec8cSRyan Moeller * length of *lenp * IFNAMSIZ bytes. 3620710ec8cSRyan Moeller */ 3630710ec8cSRyan Moeller int ifconfig_list_cloners(ifconfig_handle_t *h, char **bufp, size_t *lenp); 364