libite 2.6.1
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>

Go to the source code of this file.

Functions

size_t strlcpy (char *dst, const char *src, size_t siz)
 
int ifconfig (const char *ifname, const char *addr, const char *mask, int up)
 

Detailed Description

Author
Claudio Matsuoka
Joachim Wiberg
Date
2008-2021

Definition in file ifconfig.c.

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.

Definition at line 53 of file ifconfig.c.

◆ strlcpy()

size_t strlcpy ( char * dst,
const char * src,
size_t dsize )
extern

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.

Definition at line 44 of file strlcpy.c.