libite
Functions
ifconfig.c File Reference
#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>
Include dependency graph for ifconfig.c:

Functions

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...
 

Detailed Description

Author
Claudio Matsuoka
Joachim Wiberg
Date
2008-2021

Function Documentation

◆ ifconfig()

int ifconfig ( const char *  ifname,
const char *  addr,
const char *  mask,
int  up 
)

Basic ifconfig like operations on an interface.

Parameters
ifnameName of interface to operate on
addrIf up then set this optional IPv4 address
maskIf up and addr, and addr is not INADDR_ANY, then set netmask
upControl 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
dstDestination string
srcSource string
dsizeTotal 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.