Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
IF_UTIL(3)		    Library Functions Manual		    IF_UTIL(3)

NAME
       if_util -- system networking interface utility routines

LIBRARY
       PDEL Library (libpdel, -lpdel)

SYNOPSIS
       #include	<sys/types.h>
       #include	<netinet/in.h>
       #include	<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 net-
       working 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 in-
       terface 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  net-
       masks)  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 free-
       ing 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, respec-
       tively.

       if_add_ip_addr()	 configures  a	new  IP	address	on the interface named
       ifname, using the netmask mask and destination dest.  Existing  IP  ad-
       dresses	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 destina-
       tion 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 ad-
       dress 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
       Archie Cobbs <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.

FreeBSD	ports 15.0		April 22, 2002			    IF_UTIL(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=if_get_arp&sektion=3&manpath=FreeBSD+Ports+15.0>

home | help