GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  IF_UTIL (3)

NAME

if_util - system networking interface utility routines

CONTENTS

Library
Synopsis
Description
Return Values
See Also
History
Authors
Bugs

LIBRARY

PDEL Library (libpdel, -lpdel)

SYNOPSIS


.In sys/types.h
.In netinet/in.h
.In pdel/net/if_util.h int if_get_list char ***listp const char *mtype int if_get_type const char *ifname int if_get_flags const char *ifname int if_set_flags const char *ifname int flags int if_get_mtu const char *ifname int if_set_mtu const char *ifname u_int mtu int if_get_link_addr const char *ifname struct sockaddr_dl **sdlp const char *mtype int if_get_ip_addrs const char *ifname struct in_addr **iplistp struct in_addr **nmlistp const char *mtype int if_get_ip_addr const char *ifname struct in_addr *ipp struct in_addr *nmp int if_add_ip_addr const char *iface struct in_addr ip struct in_addr mask struct in_addr dest int if_del_ip_addr const char *iface struct in_addr ip struct in_addr mask struct in_addr dest int if_get_arp struct in_addr ip u_char *ether int if_set_arp struct in_addr ip const u_char *ether int temp int publish int if_flush_arp void

DESCRIPTION

These functions are useful for accessing and configuring system networking interfaces, especially for IP networking.

if_get_list constructs a list of the names of all interfaces present in the system. Zero or more strings are allocated and pointed to by the elements of a newly allocated array of pointers. The length of the array is returned by if_get_list and a pointer to the array is stored in *listp. Each string, as well as the array itself, is allocated with typed_mem(3) type mtype. The caller is responsible for eventually freeing the individual strings as well as the array itself.

if_get_type returns the type of the interface named ifname. The interface types are defined in the include file <net/if_types.h>.

if_get_flags gets the flags associated with the interface named ifname. The interface flags are defined in the include file <net/if.h>.

if_set_flags attempts to set the flags associated with the interface named ifname.

if_get_mtu returns the current MTU associated with the interface named ifname.

if_set_mtu attempts to set the MTU associated with the interface named ifname.

if_get_link_addr retrieves the link layer address associated with the interface named ifname, allocates a buffer with typed_mem(3) type mtype to hold it, and stores a pointer to the buffer in *sdlp. The caller is responsible for eventually freeing the buffer. The struct sockaddr_dl type is defined in the include file <net/if_dl.h>.

if_get_ip_addrs retrieves the list of all IP addresses (with netmasks) configured on the interface named ifname. The IP addresses and netmasks are stored in two arrays allocated with typed_mem(3) type mtype, and pointers to these arrays are stored in *iplistp and *nmlistp, respectively. The caller is responsible for eventually freeing the arrays. The length of the arrays is returned.

if_get_ip_addr retrieves the first IP address and netmask configured on the interface named ifname and stores them in *ipp and *nmp, respectively.

if_add_ip_addr configures a new IP address on the interface named ifname, using the netmask mask and destination dest. Existing IP addresses configured on the interface are not removed. dest should be 0.0.0.0 for non-point-to-point interfaces.

if_del_ip_addr removes a configured IP address, netmask, and destination from the interface named ifname. dest should be 0.0.0.0 for non-point-to-point interfaces.

if_get_arp retrieves the ARP table entry associated with the IP address ip and stores it in the buffer pointed to by ether, which must be at least six bytes long.

if_set_arp sets an ARP table entry for the IP address ip to resolve to the Ethernet address pointed to by ether. The temp flag indicates a temporary entry. The publish flag indicates that the local machine should proxy-ARP for this IP address. If ether is NULL, any matching ARP table entry is cleared. The

if_flush_arp clears the ARP table.

RETURN VALUES

All of the above functions return -1 to indicate an error, with errno set appropriately.

SEE ALSO

libpdel(3), typed_mem(3), route_msg(3), uroute(3), route(4)

HISTORY

The PDEL library was developed at Packet Design, LLC. http://www.packetdesign.com/

AUTHORS


.An Archie Cobbs Aq archie@freebsd.org

BUGS

There is no way to retrieve destination addresses configured on a point-to-point interface.

These routines should be less IPv4-centric.

Search for    or go to Top of page |  Section 3 |  Main Index


Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.