xref: /freebsd/lib/libc/net/linkaddr.3 (revision dc36d6f9bb1753f3808552f3afd30eda9a7b206a)
158f0484fSRodney W. Grimes.\" Copyright (c) 1993
258f0484fSRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
358f0484fSRodney W. Grimes.\"
458f0484fSRodney W. Grimes.\" This code is derived from software contributed to Berkeley by
558f0484fSRodney W. Grimes.\" Donn Seeley at BSDI.
658f0484fSRodney W. Grimes.\"
758f0484fSRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
858f0484fSRodney W. Grimes.\" modification, are permitted provided that the following conditions
958f0484fSRodney W. Grimes.\" are met:
1058f0484fSRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
1158f0484fSRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
1258f0484fSRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
1358f0484fSRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
1458f0484fSRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
15*fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors
1658f0484fSRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
1758f0484fSRodney W. Grimes.\"    without specific prior written permission.
1858f0484fSRodney W. Grimes.\"
1958f0484fSRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2058f0484fSRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2158f0484fSRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2258f0484fSRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2358f0484fSRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2458f0484fSRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2558f0484fSRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2658f0484fSRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2758f0484fSRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2858f0484fSRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2958f0484fSRodney W. Grimes.\" SUCH DAMAGE.
3058f0484fSRodney W. Grimes.\"
3167228c46SBruce M Simpson.Dd February 28, 2007
3258f0484fSRodney W. Grimes.Dt LINK_ADDR 3
33a307d598SRuslan Ermilov.Os
3458f0484fSRodney W. Grimes.Sh NAME
3558f0484fSRodney W. Grimes.Nm link_addr ,
3658f0484fSRodney W. Grimes.Nm link_ntoa
3758f0484fSRodney W. Grimes.Nd elementary address specification routines for link level access
3825bb73e0SAlexey Zelkin.Sh LIBRARY
3925bb73e0SAlexey Zelkin.Lb libc
4058f0484fSRodney W. Grimes.Sh SYNOPSIS
4132eef9aeSRuslan Ermilov.In sys/types.h
4232eef9aeSRuslan Ermilov.In sys/socket.h
4332eef9aeSRuslan Ermilov.In net/if_dl.h
4458f0484fSRodney W. Grimes.Ft void
4558f0484fSRodney W. Grimes.Fn link_addr "const char *addr" "struct sockaddr_dl *sdl"
4658f0484fSRodney W. Grimes.Ft char *
4758f0484fSRodney W. Grimes.Fn link_ntoa "const struct sockaddr_dl *sdl"
4858f0484fSRodney W. Grimes.Sh DESCRIPTION
4958f0484fSRodney W. GrimesThe routine
5058f0484fSRodney W. Grimes.Fn link_addr
5158f0484fSRodney W. Grimesinterprets character strings representing
5258f0484fSRodney W. Grimeslink-level addresses, returning binary information suitable
5358f0484fSRodney W. Grimesfor use in system calls.
5458f0484fSRodney W. GrimesThe routine
5558f0484fSRodney W. Grimes.Fn link_ntoa
5658f0484fSRodney W. Grimestakes
5758f0484fSRodney W. Grimesa link-level
5858f0484fSRodney W. Grimesaddress and returns an
5958f0484fSRodney W. Grimes.Tn ASCII
6058f0484fSRodney W. Grimesstring representing some of the information present,
6158f0484fSRodney W. Grimesincluding the link level address itself, and the interface name
6258f0484fSRodney W. Grimesor number, if present.
6358f0484fSRodney W. GrimesThis facility is experimental and is
6458f0484fSRodney W. Grimesstill subject to change.
6558f0484fSRodney W. Grimes.Pp
6658f0484fSRodney W. GrimesFor
6758f0484fSRodney W. Grimes.Fn link_addr ,
6858f0484fSRodney W. Grimesthe string
6958f0484fSRodney W. Grimes.Fa addr
7058f0484fSRodney W. Grimesmay contain
7158f0484fSRodney W. Grimesan optional network interface identifier of the form
7258f0484fSRodney W. Grimes.Dq "name unit-number" ,
7358f0484fSRodney W. Grimessuitable for the first argument to
74e1f4e80cSMike Pritchard.Xr ifconfig 8 ,
7558f0484fSRodney W. Grimesfollowed in all cases by a colon and
7658f0484fSRodney W. Grimesan interface address in the form of
7758f0484fSRodney W. Grimesgroups of hexadecimal digits
7858f0484fSRodney W. Grimesseparated by periods.
7958f0484fSRodney W. GrimesEach group represents a byte of address;
8058f0484fSRodney W. Grimesaddress bytes are filled left to right from
8158f0484fSRodney W. Grimeslow order bytes through high order bytes.
8258f0484fSRodney W. Grimes.Pp
8358f0484fSRodney W. Grimes.\" A regular expression may make this format clearer:
8458f0484fSRodney W. Grimes.\" .Bd -literal -offset indent
8558f0484fSRodney W. Grimes.\" ([a-z]+[0-9]+:)?[0-9a-f]+(\e.[0-9a-f]+)*
8658f0484fSRodney W. Grimes.\" .Ed
8758f0484fSRodney W. Grimes.\" .Pp
8858f0484fSRodney W. GrimesThus
8958f0484fSRodney W. Grimes.Li le0:8.0.9.13.d.30
9058f0484fSRodney W. Grimesrepresents an ethernet address
9158f0484fSRodney W. Grimesto be transmitted on the first Lance ethernet interface.
9258f0484fSRodney W. Grimes.Sh RETURN VALUES
931fae73b1SRuslan ErmilovThe
9458f0484fSRodney W. Grimes.Fn link_ntoa
951fae73b1SRuslan Ermilovfunction
9658f0484fSRodney W. Grimesalways returns a null terminated string.
971fae73b1SRuslan ErmilovThe
9858f0484fSRodney W. Grimes.Fn link_addr
991fae73b1SRuslan Ermilovfunction
10058f0484fSRodney W. Grimeshas no return value.
10158f0484fSRodney W. Grimes(See
10258f0484fSRodney W. Grimes.Sx BUGS . )
103010b7c6cSGarrett Wollman.Sh SEE ALSO
10467228c46SBruce M Simpson.Xr getnameinfo 3
10558f0484fSRodney W. Grimes.Sh HISTORY
10658f0484fSRodney W. GrimesThe
10758f0484fSRodney W. Grimes.Fn link_addr
10858f0484fSRodney W. Grimesand
10958f0484fSRodney W. Grimes.Fn link_ntoa
11058f0484fSRodney W. Grimesfunctions appeared in
11158f0484fSRodney W. Grimes.Bx 4.3 Reno .
11258f0484fSRodney W. Grimes.Sh BUGS
11358f0484fSRodney W. GrimesThe returned values for link_ntoa
11458f0484fSRodney W. Grimesreside in a static memory area.
11558f0484fSRodney W. Grimes.Pp
11658f0484fSRodney W. GrimesThe function
11758f0484fSRodney W. Grimes.Fn link_addr
11858f0484fSRodney W. Grimesshould diagnose improperly formed input, and there should be an unambiguous
11958f0484fSRodney W. Grimesway to recognize this.
12058f0484fSRodney W. Grimes.Pp
12158f0484fSRodney W. GrimesIf the
12258f0484fSRodney W. Grimes.Va sdl_len
12358f0484fSRodney W. Grimesfield of the link socket address
12458f0484fSRodney W. Grimes.Fa sdl
12558f0484fSRodney W. Grimesis 0,
12658f0484fSRodney W. Grimes.Fn link_ntoa
12758f0484fSRodney W. Grimeswill not insert a colon before the interface address bytes.
12858f0484fSRodney W. GrimesIf this translated address is given to
12958f0484fSRodney W. Grimes.Fn link_addr
13058f0484fSRodney W. Grimeswithout inserting an initial colon,
13158f0484fSRodney W. Grimesthe latter will not interpret it correctly.
132