1*57741Ssklower.\" Copyright (c) 1993 The Regents of the University of California. 2*57741Ssklower.\" All rights reserved. 3*57741Ssklower.\" 4*57741Ssklower.\" This code is derived from software contributed to Berkeley by 5*57741Ssklower.\" Donn Seeley at BSDI. 6*57741Ssklower.\" 7*57741Ssklower.\" %sccs.include.redist.man% 8*57741Ssklower.\" 9*57741Ssklower.\" @(#)linkaddr.3 5.1 (Berkeley) 01/29/93 10*57741Ssklower.\" 11*57741Ssklower.Dd 12*57741Ssklower.Dt LINK_ADDR 3 13*57741Ssklower.Os BSD 4.4 14*57741Ssklower.Sh NAME 15*57741Ssklower.Nm link_addr , 16*57741Ssklower.Nm link_ntoa 17*57741Ssklower.Nd elementary address specification routines for link level access 18*57741Ssklower.Sh SYNOPSIS 19*57741Ssklower.Fd #include <sys/types.h> 20*57741Ssklower.Fd #include <sys/socket.h> 21*57741Ssklower.Fd #include <net/if_dl.h> 22*57741Ssklower.Ft void 23*57741Ssklower.Fn link_addr "const char *addr" "struct sockaddr_dl *sdl" 24*57741Ssklower.Ft char * 25*57741Ssklower.Fn link_ntoa "const struct sockaddr_dl *sdl" 26*57741Ssklower.Sh DESCRIPTION 27*57741SsklowerThe routine 28*57741Ssklower.Fn link_addr 29*57741Ssklowerinterprets character strings representing 30*57741Ssklowerlink-level addresses, returning binary information suitable 31*57741Ssklowerfor use in system calls. 32*57741SsklowerThe routine 33*57741Ssklower.Fn link_ntoa 34*57741Ssklowertakes 35*57741Ssklowera link-level 36*57741Sskloweraddresses and returns 37*57741Ssklower.Tn ASCII 38*57741Ssklowerstrings representing some of the information present 39*57741Ssklower(The link level address itself, and the interface name 40*57741Sskloweror number, if present.) 41*57741SsklowerThis facility is still experimental, and had there been 42*57741Ssklowerfurther development of the system would have been subject to change. 43*57741Ssklower.Pp 44*57741SsklowerThe syntax employed by 45*57741Ssklower.Fn link_addr 46*57741Sskloweris an optional network interface identifier (a string of the 47*57741Ssklowerform 48*57741Ssklower.Dq name\ unit , 49*57741Ssklowersuitable for the first argument to 50*57741Ssklower.Xr ifconfig 4 ) 51*57741Ssklowerfollowed by a colon when the interface identifier is present, 52*57741Ssklowerfollowed in all cases by a sequence of hexadecimal 53*57741Ssklower.Dq digits 54*57741Ssklower(optionally separated by periods), 55*57741Ssklowerof the form: 56*57741Ssklower.Bd -filled -offset indent 57*57741Ssklower<name unit :> <hex digits>.<hex digits>.<hex digits> 58*57741Ssklower.Ed 59*57741Ssklower.Pp 60*57741SsklowerEach pair of hexadecimal digits represents a byte 61*57741Ssklowerwith the leading digit indicating the higher-ordered bits. 62*57741SsklowerA period following an even number of bytes has no 63*57741Ssklowereffect (but may be used to increase legitibility). 64*57741SsklowerA period following an odd number of bytes has the 65*57741Ssklowereffective of filling the byte of address being translated 66*57741Ssklowerto have its higher order bits filled with zeros. 67*57741Ssklower.Pp 68*57741SsklowerThus le0:8.0.9.13.d.30 represents an ethernet address 69*57741Ssklowerto be transmitted on the first lance ethernet interface. 70*57741Ssklower.Sh RETURN VALUES 71*57741Ssklower.Fn link_ntoa 72*57741Sskloweralways returns a null terminated string. 73*57741Ssklower.Fn link_addr 74*57741Ssklowerhas no return value. 75*57741Ssklower(See 76*57741Ssklower.Sx BUGS . ) 77*57741Ssklower.Sh SEE ALSO 78*57741Ssklower.Xr iso 4 , 79*57741Ssklower.Sh HISTORY 80*57741SsklowerThe 81*57741Ssklower.Fn link_addr 82*57741Ssklowerand 83*57741Ssklower.Fn link_ntoa 84*57741Ssklowerfunctions appeared in 85*57741Ssklower.Bx 4.3 Reno . 86*57741Ssklower.Sh BUGS 87*57741SsklowerThe returned values for link_ntoa 88*57741Ssklowerreside in a static memory area. 89*57741SsklowerThe function 90*57741Ssklower.Fn link_addr 91*57741Ssklowershould diagnose improperly formed input, and there should be an unambiguous 92*57741Ssklowerway to recognize this. 93