Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151112973
D7742.id19942.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
22 KB
Referenced Files
None
Subscribers
None
D7742.id19942.diff
View Options
Index: lib/Makefile
===================================================================
--- lib/Makefile
+++ lib/Makefile
@@ -60,7 +60,7 @@
${_libgssapi} \
${_librpcsec_gss} \
${_libiconv_modules} \
- libifc \
+ libifconfig \
libipsec \
libjail \
libkiconv \
Index: lib/libifc/Makefile
===================================================================
--- lib/libifc/Makefile
+++ lib/libifc/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
Index: lib/libifc/libifc.h
===================================================================
--- lib/libifc/libifc.h
+++ lib/libifc/libifc.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 @@
* 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);
Index: lib/libifc/libifc.c
===================================================================
--- lib/libifc/libifc.c
+++ lib/libifc/libifc.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 @@
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_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 @@
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 @@
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 @@
* 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 @@
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 @@
}
-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 @@
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 @@
(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_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_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_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 @@
* 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_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 @@
/* 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);
Index: lib/libifc/libifc_internal.h
===================================================================
--- lib/libifc/libifc_internal.h
+++ lib/libifc/libifc_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 @@
int errcode;
};
-struct libifc_handle {
+struct ifconfig_handle {
struct errstate error;
int sockets[AF_MAX + 1];
};
@@ -69,7 +69,7 @@
* {@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 @@
* }
* }
*/
-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);
Index: lib/libifc/libifc_internal.c
===================================================================
--- lib/libifc/libifc_internal.c
+++ lib/libifc/libifc_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 @@
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 @@
* 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;
Index: share/examples/libifc/Makefile
===================================================================
--- share/examples/libifc/Makefile
+++ share/examples/libifc/Makefile
@@ -1,9 +1,8 @@
# $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
+ $(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_*
Index: share/examples/libifc/ifcreate.c
===================================================================
--- share/examples/libifc/ifcreate.c
+++ share/examples/libifc/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 @@
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 @@
"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);
Index: share/examples/libifc/ifdestroy.c
===================================================================
--- share/examples/libifc/ifdestroy.c
+++ share/examples/libifc/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 @@
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 @@
break;
}
- libifc_close(lifh);
+ ifconfig_close(lifh);
lifh = NULL;
free(ifname);
return (-1);
Index: share/examples/libifc/setdescription.c
===================================================================
--- share/examples/libifc/setdescription.c
+++ share/examples/libifc/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 @@
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 @@
ifdescr = NULL;
curdescr = NULL;
- libifc_close(lifh);
+ ifconfig_close(lifh);
return (0);
}
Index: share/examples/libifc/setmtu.c
===================================================================
--- share/examples/libifc/setmtu.c
+++ share/examples/libifc/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 @@
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 @@
break;
}
- libifc_close(lifh);
+ ifconfig_close(lifh);
lifh = NULL;
free(ifname);
return (-1);
Index: share/mk/bsd.libnames.mk
===================================================================
--- share/mk/bsd.libnames.mk
+++ share/mk/bsd.libnames.mk
@@ -82,7 +82,7 @@
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
Index: share/mk/src.libnames.mk
===================================================================
--- share/mk/src.libnames.mk
+++ share/mk/src.libnames.mk
@@ -105,7 +105,7 @@
heimntlm \
heimsqlite \
hx509 \
- ifc \
+ ifconfig \
ipsec \
jail \
kadm5clnt \
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 7, 4:06 AM (11 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31010165
Default Alt Text
D7742.id19942.diff (22 KB)
Attached To
Mode
D7742: Rename libifc back to libifconfig
Attached
Detach File
Event Timeline
Log In to Comment