Home Contents | # rawio.ifconfig | Rawio | Core4 Lua Event System

## SYNOPSIS

1. table = rawio.ifconfig(interface)
2. rawio.ifconfig(interface, table)

## DESCRIPTION

Functions for manipulating the configuration of network interfaces.

The first form returns a table that contains all items of the current interface configuration.

Key | Value type | Description
--- | --- | ---
broadcast | Boolean | True if this interface is able to handle broadcasts.
dynamic | Boolean | True if IP Address, Netmask, etc... is configured by DHCP.
ip | String | The IP address.
loopback | Boolean | True if this is a looped back interface.
mac | String | The hardware address.
metric | Number | The interface metric.
mtu | Number | The maximum transfer unit (Max. packet size.)
multicast | Boolean | True if this interface can handle multicasting.
netmask | String | The network mask in dotted quad format.
prefix | String | The network mask as number of prefix bits.
running | Boolean | True if the interface is enabled.
up | Boolean | True if the interface is enabled and properly configured.

The second form allows changing configuration values. The passed value table accepts the same key/value pairs as shown above, only values that are to be changed must be present in the table.

## RETURN VALUE

On success, returns a table containing key/value pairs. On error, three values are returned: nil, a string describing the error (The result of the C library call strerror() on the errno code) and the errno number from the standard C library.

## EXAMPLE

> > >
for k,v in pairs(rawio.ifconfig("eth0")) do print(string.format("%-12s %s", k, v)) end
ip 0.0.0.0 netmask 0.0.0.0 mac 00:22:8A:00:00:00 broadcast true mtu 1500 dynamic true running true metric 1 multicast false loopback false up true

## SEE ALSO

rawio:accept, rawio:bind, rawio:getsockopt, rawio.interfaces, rawio:listen, rawio:recvfrom, rawio:sendto, rawio:setsockopt, rawio:shutdown, rawio.socket