GSP
Quick Navigator

Search Site

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

Support
Customer Portal
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
LINK_ADDR(3) FreeBSD Library Functions Manual LINK_ADDR(3)

link_addr, link_ntoa, link_ntoa_relementary address specification routines for link level access

Standard C Library (libc, -lc)

#include <sys/types.h>
#include <sys/socket.h>
#include <net/if_dl.h>

int
link_addr(const char *addr, struct sockaddr_dl *sdl);

char *
link_ntoa(const struct sockaddr_dl *sdl);

int
link_ntoa_r(const struct sockaddr_dl *sdl, char *obuf, size_t *buflen);

The routine () parses a character string addr representing a link-level address, and stores the resulting address in the structure pointed to by sdl. A link-level address consists of an optional interface name, followed by a colon (which is required in all cases), followed by an address consisting of either a string of hexadecimal digits, or a series of hexadecimal octets separated by one of the characters ‘.’, ‘:’, or ‘-’.

Thus le0:8.0.9.13.d.30 represents an ethernet address to be transmitted on the first Lance ethernet interface.

The link_ntoa() function always returns a null terminated string.

The link_ntoa_r() function returns 0 on success, or -1 if the provided buffer was not large enough; in the latter case, the contents of the buffer are indeterminate, but a trailing NUL will always be written if the buffer was at least one byte in size.

The link_addr() function returns 0 on success. If the address did not appear to be a valid link-level address, -1 is returned and errno is set to indicate the error.

The link_addr() and link_ntoa() functions appeared in 4.3BSD-Reno. The link_ntoa_r() function appeared in FreeBSD 15.0.

The returned values for link_ntoa reside in a static memory area.

If the sdl_len field of the link socket address sdl is 0, link_ntoa() will not insert a colon before the interface address bytes. If this translated address is given to link_addr() without inserting an initial colon, the latter will not interpret it correctly.

May 9, 2025 FreeBSD 15.1-RELEASE-p1

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