#include <arpa/inet.h>
#include <errno.h>
#include <net/if.h>
#include <netinet/in.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <unistd.h>
|
size_t | strlcpy (char *dst, const char *src, size_t siz) |
| Safe version of strncpy() from OpenBSD. More...
|
|
int | ifconfig (const char *ifname, const char *addr, const char *mask, int up) |
| Basic ifconfig like operations on an interface. More...
|
|
- Author
- Claudio Matsuoka
-
Joachim Wiberg
- Date
- 2008-2021
- Copyright
- MIT License
◆ ifconfig()
int ifconfig |
( |
const char * |
ifname, |
|
|
const char * |
addr, |
|
|
const char * |
mask, |
|
|
int |
up |
|
) |
| |
Basic ifconfig like operations on an interface.
- Parameters
-
ifname | Name of interface to operate on |
addr | If up then set this optional IPv4 address |
mask | If up and addr , and addr is not INADDR_ANY , then set netmask |
up | Control IFF_UP flag on interface |
- Returns
- POSIX OK(0) on success, or non-zero on error.
◆ strlcpy()
size_t strlcpy |
( |
char * |
dst, |
|
|
const char * |
src, |
|
|
size_t |
dsize |
|
) |
| |
Safe version of strncpy() from OpenBSD.
- Parameters
-
dst | Destination string |
src | Source string |
dsize | Total maximum size of dst |
This function copies string src
to buffer dst
of size dsize
bytes. At most dsize-1 chars will be copied. Always NUL terminates (unless dsize==0).
- Returns
- strlen(src); if retval >= dsize, truncation occurred.