diff options
author | Kristof Provost <kp@FreeBSD.org> | 2016-09-02 18:33:08 +0000 |
---|---|---|
committer | Kristof Provost <kp@FreeBSD.org> | 2016-09-02 18:33:08 +0000 |
commit | ec21434933d775bd60d0fed62c978fb07fa9ccdf (patch) | |
tree | 81f746879128bfa6684612cd981fb717af0d28c2 | |
parent | 2279a9a428305ee43111f62f4addf6a9826eacde (diff) | |
download | src-ec21434933d775bd60d0fed62c978fb07fa9ccdf.tar.gz src-ec21434933d775bd60d0fed62c978fb07fa9ccdf.zip |
Renaming libifc to libifconfig in response to feedback on initial commit of
this library. Sticking to 'libifconfig' (and 'ifconfig_' as function prefix)
should reduce chances of namespace collisions, make it more clear what the
library does, and be more in line with existing libraries.
Submitted by: Marie Helene Kvello-Aune <marieheleneka@gmail.com>
Differential Revision: https://reviews.freebsd.org/D7742
Reviewed by: cem, kp
Notes
Notes:
svn path=/head/; revision=305290
-rw-r--r-- | lib/Makefile | 2 | ||||
-rw-r--r-- | lib/libifconfig/Makefile (renamed from lib/libifc/Makefile) | 8 | ||||
-rw-r--r-- | lib/libifconfig/libifconfig.c (renamed from lib/libifc/libifc.c) | 78 | ||||
-rw-r--r-- | lib/libifconfig/libifconfig.h (renamed from lib/libifc/libifc.h) | 50 | ||||
-rw-r--r-- | lib/libifconfig/libifconfig_internal.c (renamed from lib/libifc/libifc_internal.c) | 14 | ||||
-rw-r--r-- | lib/libifconfig/libifconfig_internal.h (renamed from lib/libifc/libifc_internal.h) | 16 | ||||
-rw-r--r-- | share/examples/libifc/Makefile | 9 | ||||
-rw-r--r-- | share/examples/libifconfig/Makefile | 8 | ||||
-rw-r--r-- | share/examples/libifconfig/ifcreate.c (renamed from share/examples/libifc/ifcreate.c) | 16 | ||||
-rw-r--r-- | share/examples/libifconfig/ifdestroy.c (renamed from share/examples/libifc/ifdestroy.c) | 14 | ||||
-rw-r--r-- | share/examples/libifconfig/setdescription.c (renamed from share/examples/libifc/setdescription.c) | 20 | ||||
-rw-r--r-- | share/examples/libifconfig/setmtu.c (renamed from share/examples/libifc/setmtu.c) | 18 | ||||
-rw-r--r-- | share/mk/bsd.libnames.mk | 2 | ||||
-rw-r--r-- | share/mk/src.libnames.mk | 2 |
14 files changed, 128 insertions, 129 deletions
diff --git a/lib/Makefile b/lib/Makefile index 3005f247e860..16f746803305 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -60,7 +60,7 @@ SUBDIR= ${SUBDIR_BOOTSTRAP} \ ${_libgssapi} \ ${_librpcsec_gss} \ ${_libiconv_modules} \ - libifc \ + libifconfig \ libipsec \ libjail \ libkiconv \ diff --git a/lib/libifc/Makefile b/lib/libifconfig/Makefile index 49828d22a2e1..924752fac9e2 100644 --- a/lib/libifc/Makefile +++ b/lib/libifconfig/Makefile @@ -1,18 +1,18 @@ # $FreeBSD$ PACKAGE= lib${LIB} -LIB= ifc +LIB= ifconfig # Don't build shared library, for now. NO_PIC= SHLIBDIR?= /lib SHLIB_MAJOR= 1 -SRCS= libifc.c libifc_internal.c +SRCS= libifconfig.c libifconfig_internal.c INCSDIR= ${INCLUDEDIR} -INCS= libifc.h +INCS= libifconfig.h -#MAN= libifco.3 +#MAN= libifconfig.3 CFLAGS+= -I${.CURDIR} WARNS?=6 diff --git a/lib/libifc/libifc.c b/lib/libifconfig/libifconfig.c index 0cd575d6f64c..5acb56c845ca 100644 --- a/lib/libifc/libifc.c +++ b/lib/libifconfig/libifconfig.c @@ -71,16 +71,16 @@ #include <string.h> #include <unistd.h> -#include "libifc.h" -#include "libifc_internal.h" +#include "libifconfig.h" +#include "libifconfig_internal.h" -libifc_handle_t * -libifc_open(void) +ifconfig_handle_t * +ifconfig_open(void) { - struct libifc_handle *h; + struct ifconfig_handle *h; - h = calloc(1, sizeof(struct libifc_handle)); + h = calloc(1, sizeof(struct ifconfig_handle)); for (int i = 0; i <= AF_MAX; i++) { h->sockets[i] = -1; @@ -91,7 +91,7 @@ libifc_open(void) void -libifc_close(libifc_handle_t *h) +ifconfig_close(ifconfig_handle_t *h) { for (int i = 0; i <= AF_MAX; i++) { if (h->sockets[i] != -1) { @@ -102,29 +102,29 @@ libifc_close(libifc_handle_t *h) } -libifc_errtype -libifc_err_errtype(libifc_handle_t *h) +ifconfig_errtype +ifconfig_err_errtype(ifconfig_handle_t *h) { return (h->error.errtype); } int -libifc_err_errno(libifc_handle_t *h) +ifconfig_err_errno(ifconfig_handle_t *h) { return (h->error.errcode); } unsigned long -libifc_err_ioctlreq(libifc_handle_t *h) +ifconfig_err_ioctlreq(ifconfig_handle_t *h) { return (h->error.ioctl_request); } int -libifc_get_description(libifc_handle_t *h, const char *name, char **description) +ifconfig_get_description(ifconfig_handle_t *h, const char *name, char **description) { struct ifreq ifr; char *descr = NULL; @@ -141,7 +141,7 @@ libifc_get_description(libifc_handle_t *h, const char *name, char **description) ifr.ifr_buffer.buffer = descr; ifr.ifr_buffer.length = descrlen; - if (libifc_ioctlwrap(h, AF_LOCAL, SIOCGIFDESCR, + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFDESCR, &ifr) != 0) { return (-1); } @@ -166,7 +166,7 @@ libifc_get_description(libifc_handle_t *h, const char *name, char **description) int -libifc_set_description(libifc_handle_t *h, const char *name, +ifconfig_set_description(ifconfig_handle_t *h, const char *name, const char *newdescription) { struct ifreq ifr; @@ -180,7 +180,7 @@ libifc_set_description(libifc_handle_t *h, const char *name, * TODO: Decide whether this should be an error condition instead. */ if (desclen == 0) { - return (libifc_unset_description(h, name)); + return (ifconfig_unset_description(h, name)); } (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); @@ -193,7 +193,7 @@ libifc_set_description(libifc_handle_t *h, const char *name, return (-1); } - if (libifc_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR, &ifr) != 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR, &ifr) != 0) { free(ifr.ifr_buffer.buffer); return (-1); } @@ -202,7 +202,7 @@ libifc_set_description(libifc_handle_t *h, const char *name, } -int libifc_unset_description(libifc_handle_t *h, const char *name) +int ifconfig_unset_description(ifconfig_handle_t *h, const char *name) { struct ifreq ifr; @@ -211,14 +211,14 @@ int libifc_unset_description(libifc_handle_t *h, const char *name) ifr.ifr_buffer.length = 0; ifr.ifr_buffer.buffer = NULL; - if (libifc_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR, &ifr) < 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR, &ifr) < 0) { return (-1); } return (0); } -int libifc_set_name(libifc_handle_t *h, const char *name, const char *newname) +int ifconfig_set_name(ifconfig_handle_t *h, const char *name, const char *newname) { struct ifreq ifr; char *tmpname; @@ -234,7 +234,7 @@ int libifc_set_name(libifc_handle_t *h, const char *name, const char *newname) (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); ifr.ifr_data = tmpname; - if (libifc_ioctlwrap(h, AF_LOCAL, SIOCSIFNAME, &ifr) != 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFNAME, &ifr) != 0) { free(tmpname); return (-1); } @@ -243,27 +243,27 @@ int libifc_set_name(libifc_handle_t *h, const char *name, const char *newname) } -int libifc_set_mtu(libifc_handle_t *h, const char *name, const int mtu) +int ifconfig_set_mtu(ifconfig_handle_t *h, const char *name, const int mtu) { struct ifreq ifr; memset(&ifr, 0, sizeof(struct ifreq)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); ifr.ifr_mtu = mtu; - if (libifc_ioctlwrap(h, AF_LOCAL, SIOCSIFMTU, &ifr) < 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFMTU, &ifr) < 0) { return (-1); } return (0); } -int libifc_get_mtu(libifc_handle_t *h, const char *name, int *mtu) +int ifconfig_get_mtu(ifconfig_handle_t *h, const char *name, int *mtu) { struct ifreq ifr; memset(&ifr, 0, sizeof(struct ifreq)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - if (libifc_ioctlwrap(h, AF_LOCAL, SIOCGIFMTU, &ifr) == -1) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFMTU, &ifr) == -1) { return (-1); } *mtu = ifr.ifr_mtu; @@ -271,27 +271,27 @@ int libifc_get_mtu(libifc_handle_t *h, const char *name, int *mtu) } -int libifc_set_metric(libifc_handle_t *h, const char *name, const int mtu) +int ifconfig_set_metric(ifconfig_handle_t *h, const char *name, const int mtu) { struct ifreq ifr; memset(&ifr, 0, sizeof(struct ifreq)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); ifr.ifr_mtu = mtu; - if (libifc_ioctlwrap(h, AF_LOCAL, SIOCSIFMETRIC, &ifr) < 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFMETRIC, &ifr) < 0) { return (-1); } return (0); } -int libifc_get_metric(libifc_handle_t *h, const char *name, int *metric) +int ifconfig_get_metric(ifconfig_handle_t *h, const char *name, int *metric) { struct ifreq ifr; memset(&ifr, 0, sizeof(struct ifreq)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - if (libifc_ioctlwrap(h, AF_LOCAL, SIOCGIFMETRIC, &ifr) == -1) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFMETRIC, &ifr) == -1) { return (-1); } *metric = ifr.ifr_metric; @@ -299,16 +299,16 @@ int libifc_get_metric(libifc_handle_t *h, const char *name, int *metric) } -int libifc_set_capability(libifc_handle_t *h, const char *name, +int ifconfig_set_capability(ifconfig_handle_t *h, const char *name, const int capability) { struct ifreq ifr; - struct libifc_capabilities ifcap; + struct ifconfig_capabilities ifcap; int flags; int value; memset(&ifr, 0, sizeof(struct ifreq)); - if (libifc_get_capability(h, name, &ifcap) != 0) { + if (ifconfig_get_capability(h, name, &ifcap) != 0) { return (-1); } @@ -329,22 +329,22 @@ int libifc_set_capability(libifc_handle_t *h, const char *name, * set for this request. */ ifr.ifr_reqcap = flags; - if (libifc_ioctlwrap(h, AF_LOCAL, SIOCSIFCAP, &ifr) < 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFCAP, &ifr) < 0) { return (-1); } return (0); } -int libifc_get_capability(libifc_handle_t *h, const char *name, - struct libifc_capabilities *capability) +int ifconfig_get_capability(ifconfig_handle_t *h, const char *name, + struct ifconfig_capabilities *capability) { struct ifreq ifr; memset(&ifr, 0, sizeof(struct ifreq)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - if (libifc_ioctlwrap(h, AF_LOCAL, SIOCGIFCAP, &ifr) < 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFCAP, &ifr) < 0) { return (-1); } capability->curcap = ifr.ifr_curcap; @@ -353,21 +353,21 @@ int libifc_get_capability(libifc_handle_t *h, const char *name, } -int libifc_destroy_interface(libifc_handle_t *h, const char *name) +int ifconfig_destroy_interface(ifconfig_handle_t *h, const char *name) { struct ifreq ifr; memset(&ifr, 0, sizeof(struct ifreq)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - if (libifc_ioctlwrap(h, AF_LOCAL, SIOCIFDESTROY, &ifr) < 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCIFDESTROY, &ifr) < 0) { return (-1); } return (0); } -int libifc_create_interface(libifc_handle_t *h, const char *name, char **ifname) +int ifconfig_create_interface(ifconfig_handle_t *h, const char *name, char **ifname) { struct ifreq ifr; @@ -389,7 +389,7 @@ int libifc_create_interface(libifc_handle_t *h, const char *name, char **ifname) /* No special handling for this interface type. */ - if (libifc_ioctlwrap(h, AF_LOCAL, SIOCIFCREATE2, &ifr) < 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCIFCREATE2, &ifr) < 0) { return (-1); } *ifname = strdup(ifr.ifr_name); diff --git a/lib/libifc/libifc.h b/lib/libifconfig/libifconfig.h index 6b947f99a489..a005aa83b33c 100644 --- a/lib/libifc/libifc.h +++ b/lib/libifconfig/libifconfig.h @@ -34,16 +34,16 @@ typedef enum { OTHER, IOCTL, SOCKET -} libifc_errtype; +} ifconfig_errtype; /* * Opaque definition so calling application can just pass a * pointer to it for library use. */ -struct libifc_handle; -typedef struct libifc_handle libifc_handle_t; +struct ifconfig_handle; +typedef struct ifconfig_handle ifconfig_handle_t; -struct libifc_capabilities { +struct ifconfig_capabilities { /** Current capabilities (ifconfig prints this as 'options')*/ int curcap; /** Requested capabilities (ifconfig prints this as 'capabilities')*/ @@ -55,57 +55,57 @@ struct libifc_capabilities { * Example usage: *{@code * // Create state object - * libifc_handle_t *lifh = libifc_open(); + * ifconfig_handle_t *lifh = ifconfig_open(); * * // Do stuff with it * * // Dispose of the state object - * libifc_close(lifh); + * ifconfig_close(lifh); * lifh = NULL; *} */ -libifc_handle_t *libifc_open(void); +ifconfig_handle_t *ifconfig_open(void); /** Frees resources held in the provided state object. * @param h The state object to close. - * @see #libifc_open(void) + * @see #ifconfig_open(void) */ -void libifc_close(libifc_handle_t *h); +void ifconfig_close(ifconfig_handle_t *h); /** Identifies what kind of error occured. */ -libifc_errtype libifc_err_errtype(libifc_handle_t *h); +ifconfig_errtype ifconfig_err_errtype(ifconfig_handle_t *h); /** Retrieves the errno associated with the error, if any. */ -int libifc_err_errno(libifc_handle_t *h); +int ifconfig_err_errno(ifconfig_handle_t *h); /** If error type was IOCTL, this identifies which request failed. */ -unsigned long libifc_err_ioctlreq(libifc_handle_t *h); +unsigned long ifconfig_err_ioctlreq(ifconfig_handle_t *h); -int libifc_get_description(libifc_handle_t *h, const char *name, +int ifconfig_get_description(ifconfig_handle_t *h, const char *name, char **description); -int libifc_set_description(libifc_handle_t *h, const char *name, +int ifconfig_set_description(ifconfig_handle_t *h, const char *name, const char *newdescription); -int libifc_unset_description(libifc_handle_t *h, const char *name); -int libifc_set_name(libifc_handle_t *h, const char *name, const char *newname); -int libifc_set_mtu(libifc_handle_t *h, const char *name, const int mtu); -int libifc_get_mtu(libifc_handle_t *h, const char *name, int *mtu); +int ifconfig_unset_description(ifconfig_handle_t *h, const char *name); +int ifconfig_set_name(ifconfig_handle_t *h, const char *name, const char *newname); +int ifconfig_set_mtu(ifconfig_handle_t *h, const char *name, const int mtu); +int ifconfig_get_mtu(ifconfig_handle_t *h, const char *name, int *mtu); -int libifc_set_metric(libifc_handle_t *h, const char *name, const int metric); -int libifc_get_metric(libifc_handle_t *h, const char *name, int *metric); +int ifconfig_set_metric(ifconfig_handle_t *h, const char *name, const int metric); +int ifconfig_get_metric(ifconfig_handle_t *h, const char *name, int *metric); -int libifc_set_capability(libifc_handle_t *h, const char *name, +int ifconfig_set_capability(ifconfig_handle_t *h, const char *name, const int capability); -int libifc_get_capability(libifc_handle_t *h, const char *name, - struct libifc_capabilities *capability); +int ifconfig_get_capability(ifconfig_handle_t *h, const char *name, + struct ifconfig_capabilities *capability); /** Destroy a virtual interface * @param name Interface to destroy */ -int libifc_destroy_interface(libifc_handle_t *h, const char *name); +int ifconfig_destroy_interface(ifconfig_handle_t *h, const char *name); /** Creates a (virtual) interface * @param name Name of interface to create. Example: bridge or bridge42 * @param name ifname Is set to actual name of created interface */ -int libifc_create_interface(libifc_handle_t *h, const char *name, +int ifconfig_create_interface(ifconfig_handle_t *h, const char *name, char **ifname); diff --git a/lib/libifc/libifc_internal.c b/lib/libifconfig/libifconfig_internal.c index 341cec419323..304c2800e22a 100644 --- a/lib/libifc/libifc_internal.c +++ b/lib/libifconfig/libifconfig_internal.c @@ -40,11 +40,11 @@ #include <unistd.h> -#include "libifc.h" // Needed for libifc_errstate -#include "libifc_internal.h" +#include "libifconfig.h" // Needed for ifconfig_errstate +#include "libifconfig_internal.h" int -libifc_ioctlwrap_ret(libifc_handle_t *h, unsigned long request, int rcode) +ifconfig_ioctlwrap_ret(ifconfig_handle_t *h, unsigned long request, int rcode) { if (rcode != 0) { h->error.errtype = IOCTL; @@ -56,17 +56,17 @@ libifc_ioctlwrap_ret(libifc_handle_t *h, unsigned long request, int rcode) int -libifc_ioctlwrap(libifc_handle_t *h, const int addressfamily, +ifconfig_ioctlwrap(ifconfig_handle_t *h, const int addressfamily, unsigned long request, struct ifreq *ifr) { int s; - if (libifc_socket(h, addressfamily, &s) != 0) { + if (ifconfig_socket(h, addressfamily, &s) != 0) { return (-1); } int rcode = ioctl(s, request, ifr); - return (libifc_ioctlwrap_ret(h, request, rcode)); + return (ifconfig_ioctlwrap_ret(h, request, rcode)); } @@ -74,7 +74,7 @@ libifc_ioctlwrap(libifc_handle_t *h, const int addressfamily, * Function to get socket for the specified address family. * If the socket doesn't already exist, attempt to create it. */ -int libifc_socket(libifc_handle_t *h, const int addressfamily, int *s) +int ifconfig_socket(ifconfig_handle_t *h, const int addressfamily, int *s) { if (addressfamily > AF_MAX) { h->error.errtype = SOCKET; diff --git a/lib/libifc/libifc_internal.h b/lib/libifconfig/libifconfig_internal.h index b68e9d22f270..2320ca7b3767 100644 --- a/lib/libifc/libifc_internal.h +++ b/lib/libifconfig/libifconfig_internal.h @@ -32,14 +32,14 @@ #pragma once -#include "libifc.h" +#include "libifconfig.h" struct errstate { /** * Type of error. */ - libifc_errtype errtype; + ifconfig_errtype errtype; /** * The error occured in this ioctl() request. @@ -53,7 +53,7 @@ struct errstate { int errcode; }; -struct libifc_handle { +struct ifconfig_handle { struct errstate error; int sockets[AF_MAX + 1]; }; @@ -69,7 +69,7 @@ struct libifc_handle { * {@code * static void myfunc() \{ * int s; - * if (libifc_socket(AF_LOCAL, &s) != 0) \{ + * if (ifconfig_socket(AF_LOCAL, &s) != 0) \{ * // Handle error state here * \} * // user code here @@ -77,11 +77,11 @@ struct libifc_handle { * } * } */ -int libifc_socket(libifc_handle_t *h, const int addressfamily, int *s); +int ifconfig_socket(ifconfig_handle_t *h, const int addressfamily, int *s); /** Function used by other wrapper functions to populate _errstate when appropriate.*/ -int libifc_ioctlwrap_ret(libifc_handle_t *h, unsigned long request, int rcode); +int ifconfig_ioctlwrap_ret(ifconfig_handle_t *h, unsigned long request, int rcode); -/** Function to wrap ioctl() and automatically populate libifc_errstate when appropriate.*/ -int libifc_ioctlwrap(libifc_handle_t *h, const int addressfamily, +/** Function to wrap ioctl() and automatically populate ifconfig_errstate when appropriate.*/ +int ifconfig_ioctlwrap(ifconfig_handle_t *h, const int addressfamily, unsigned long request, struct ifreq *ifr); diff --git a/share/examples/libifc/Makefile b/share/examples/libifc/Makefile deleted file mode 100644 index 876c3caeac8e..000000000000 --- a/share/examples/libifc/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD$ - -default: - $(CC) -Wall -fPIC -lifc -g -o example_setdescription setdescription.c - $(CC) -Wall -fPIC -lifc -g -o example_setmtu setmtu.c - $(CC) -Wall -fPIC -lifc -g -o example_ifdestroy ifdestroy.c - $(CC) -Wall -fPIC -lifc -g -o example_ifcreate ifcreate.c -clean: - rm -f example_* diff --git a/share/examples/libifconfig/Makefile b/share/examples/libifconfig/Makefile new file mode 100644 index 000000000000..6926f65b1afa --- /dev/null +++ b/share/examples/libifconfig/Makefile @@ -0,0 +1,8 @@ +# $FreeBSD$ +default: + $(CC) -Wall -fPIC -lifconfig -g -o example_setdescription setdescription.c + $(CC) -Wall -fPIC -lifconfig -g -o example_setmtu setmtu.c + $(CC) -Wall -fPIC -lifconfig -g -o example_ifdestroy ifdestroy.c + $(CC) -Wall -fPIC -lifconfig -g -o example_ifcreate ifcreate.c +clean: + rm -f example_* diff --git a/share/examples/libifc/ifcreate.c b/share/examples/libifconfig/ifcreate.c index 0c461c8f5720..8f5dde506d2e 100644 --- a/share/examples/libifc/ifcreate.c +++ b/share/examples/libifconfig/ifcreate.c @@ -37,7 +37,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <libifc.h> +#include <libifconfig.h> int main(int argc, char *argv[]) @@ -55,21 +55,21 @@ int main(int argc, char *argv[]) printf("Requested interface name: %s\n", ifname); - libifc_handle_t *lifh = libifc_open(); - if (libifc_create_interface(lifh, ifname, &ifactualname) == 0) { + ifconfig_handle_t *lifh = ifconfig_open(); + if (ifconfig_create_interface(lifh, ifname, &ifactualname) == 0) { printf("Successfully created interface '%s'\n", ifactualname); - libifc_close(lifh); + ifconfig_close(lifh); lifh = NULL; free(ifname); free(ifactualname); return (0); } else { - switch (libifc_err_errtype(lifh)) { + switch (ifconfig_err_errtype(lifh)) { case SOCKET: warnx("couldn't create socket. This shouldn't happen.\n"); break; case IOCTL: - if (libifc_err_ioctlreq(lifh) == SIOCIFCREATE2) { + if (ifconfig_err_ioctlreq(lifh) == SIOCIFCREATE2) { warnx( "Failed to create interface (SIOCIFCREATE2)\n"); } @@ -79,12 +79,12 @@ int main(int argc, char *argv[]) "This is a thorough example accommodating for temporary" " 'not implemented yet' errors. That's likely what happened" " now. If not, your guess is as good as mine. ;)" - " Error code: %d\n", libifc_err_errno( + " Error code: %d\n", ifconfig_err_errno( lifh)); break; } - libifc_close(lifh); + ifconfig_close(lifh); lifh = NULL; free(ifname); free(ifactualname); diff --git a/share/examples/libifc/ifdestroy.c b/share/examples/libifconfig/ifdestroy.c index bcfa11113f5e..029e70a8d9b0 100644 --- a/share/examples/libifc/ifdestroy.c +++ b/share/examples/libifconfig/ifdestroy.c @@ -37,7 +37,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <libifc.h> +#include <libifconfig.h> int main(int argc, char *argv[]) @@ -55,20 +55,20 @@ int main(int argc, char *argv[]) printf("Interface name: %s\n", ifname); - libifc_handle_t *lifh = libifc_open(); - if (libifc_destroy_interface(lifh, ifname) == 0) { + ifconfig_handle_t *lifh = ifconfig_open(); + if (ifconfig_destroy_interface(lifh, ifname) == 0) { printf("Successfully destroyed interface '%s'.", ifname); - libifc_close(lifh); + ifconfig_close(lifh); lifh = NULL; free(ifname); return (0); } else { - switch (libifc_err_errtype(lifh)) { + switch (ifconfig_err_errtype(lifh)) { case SOCKET: warnx("couldn't create socket. This shouldn't happen.\n"); break; case IOCTL: - if (libifc_err_ioctlreq(lifh) == SIOCIFDESTROY) { + if (ifconfig_err_ioctlreq(lifh) == SIOCIFDESTROY) { warnx( "Failed to destroy interface (SIOCIFDESTROY)\n"); } @@ -79,7 +79,7 @@ int main(int argc, char *argv[]) break; } - libifc_close(lifh); + ifconfig_close(lifh); lifh = NULL; free(ifname); return (-1); diff --git a/share/examples/libifc/setdescription.c b/share/examples/libifconfig/setdescription.c index d66a883a0e61..656aba75976f 100644 --- a/share/examples/libifc/setdescription.c +++ b/share/examples/libifconfig/setdescription.c @@ -35,7 +35,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <libifc.h> +#include <libifconfig.h> int main(int argc, char *argv[]) @@ -54,27 +54,27 @@ int main(int argc, char *argv[]) printf("Interface name: %s\n", ifname); - libifc_handle_t *lifh = libifc_open(); - if (libifc_get_description(lifh, ifname, &curdescr) == 0) { + ifconfig_handle_t *lifh = ifconfig_open(); + if (ifconfig_get_description(lifh, ifname, &curdescr) == 0) { printf("Old description: %s\n", curdescr); } printf("New description: %s\n\n", ifdescr); - if (libifc_set_description(lifh, ifname, ifdescr) == 0) { + if (ifconfig_set_description(lifh, ifname, ifdescr) == 0) { printf("New description successfully set.\n"); } else { - switch (libifc_err_errtype(lifh)) { + switch (ifconfig_err_errtype(lifh)) { case SOCKET: - err(libifc_err_errno(lifh), "Socket error"); + err(ifconfig_err_errno(lifh), "Socket error"); break; case IOCTL: - err(libifc_err_errno( + err(ifconfig_err_errno( lifh), "IOCTL(%lu) error", - libifc_err_ioctlreq(lifh)); + ifconfig_err_ioctlreq(lifh)); break; case OTHER: - err(libifc_err_errno(lifh), "Other error"); + err(ifconfig_err_errno(lifh), "Other error"); break; } } @@ -86,6 +86,6 @@ int main(int argc, char *argv[]) ifdescr = NULL; curdescr = NULL; - libifc_close(lifh); + ifconfig_close(lifh); return (0); } diff --git a/share/examples/libifc/setmtu.c b/share/examples/libifconfig/setmtu.c index be63e18dafa7..4d5a0f8d5f92 100644 --- a/share/examples/libifc/setmtu.c +++ b/share/examples/libifconfig/setmtu.c @@ -37,7 +37,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <libifc.h> +#include <libifconfig.h> int main(int argc, char *argv[]) @@ -58,26 +58,26 @@ int main(int argc, char *argv[]) printf("Interface name: %s\n", ifname); printf("New MTU: %d", mtu); - libifc_handle_t *lifh = libifc_open(); - if (libifc_set_mtu(lifh, ifname, mtu) == 0) { + ifconfig_handle_t *lifh = ifconfig_open(); + if (ifconfig_set_mtu(lifh, ifname, mtu) == 0) { printf("Successfully changed MTU of %s to %d\n", ifname, mtu); - libifc_close(lifh); + ifconfig_close(lifh); lifh = NULL; free(ifname); return (0); } else { - switch (libifc_err_errtype(lifh)) { + switch (ifconfig_err_errtype(lifh)) { case SOCKET: warnx("couldn't create socket. This shouldn't happen.\n"); break; case IOCTL: - if (libifc_err_ioctlreq(lifh) == SIOCSIFMTU) { + if (ifconfig_err_ioctlreq(lifh) == SIOCSIFMTU) { warnx("Failed to set MTU (SIOCSIFMTU)\n"); } else { warnx( "Failed to set MTU due to error in unexpected ioctl() call %lu. Error code: %i.\n", - libifc_err_ioctlreq(lifh), - libifc_err_errno(lifh)); + ifconfig_err_ioctlreq(lifh), + ifconfig_err_errno(lifh)); } break; default: @@ -86,7 +86,7 @@ int main(int argc, char *argv[]) break; } - libifc_close(lifh); + ifconfig_close(lifh); lifh = NULL; free(ifname); return (-1); diff --git a/share/mk/bsd.libnames.mk b/share/mk/bsd.libnames.mk index ff051f243f76..a3e6f2e0f622 100644 --- a/share/mk/bsd.libnames.mk +++ b/share/mk/bsd.libnames.mk @@ -82,7 +82,7 @@ LIBIBMAD?= ${DESTDIR}${LIBDIR}/libibmad.a LIBIBSDP?= ${DESTDIR}${LIBDIR}/libibsdp.a LIBIBUMAD?= ${DESTDIR}${LIBDIR}/libibumad.a LIBIBVERBS?= ${DESTDIR}${LIBDIR}/libibverbs.a -LIBIFC?= ${DESTDIR}${LIBDIR}/libifc.a +LIBIFCONFIG?= ${DESTDIR}${LIBDIR}/libifconfig.a LIBIPSEC?= ${DESTDIR}${LIBDIR}/libipsec.a LIBJAIL?= ${DESTDIR}${LIBDIR}/libjail.a LIBKADM5CLNT?= ${DESTDIR}${LIBDIR}/libkadm5clnt.a diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk index 94b5d6190cd2..f65ce01c0081 100644 --- a/share/mk/src.libnames.mk +++ b/share/mk/src.libnames.mk @@ -105,7 +105,7 @@ _LIBRARIES= \ heimntlm \ heimsqlite \ hx509 \ - ifc \ + ifconfig \ ipsec \ jail \ kadm5clnt \ |