Lines Matching +full:software +full:- +full:dl
3 /*-
4 * SPDX-License-Identifier: BSD-1-Clause
7 * Berkeley Software Design, Inc. All rights reserved.
15 * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``AS IS'' AND
18 * ARE DISCLAIMED. IN NO EVENT SHALL Berkeley Software Design, Inc. BE LIABLE
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * try-and-error for region size.
50 #include "un-namespace.h"
57 #define SA_LEN(sa) (sa)->sa_len
60 #define SALIGN (sizeof(long) - 1)
61 #define SA_RLEN(sa) ((sa)->sa_len ? (((sa)->sa_len + SALIGN) & ~SALIGN) : (SALIGN + 1))
92 struct sockaddr_dl *dl; in getifaddrs() local
121 return (-1); in getifaddrs()
123 return (-1); in getifaddrs()
127 return (-1); in getifaddrs()
134 for (next = buf; next < buf + needed; next += rtm->rtm_msglen) { in getifaddrs()
136 if (rtm->rtm_version != RTM_VERSION) in getifaddrs()
138 switch (rtm->rtm_type) { in getifaddrs()
141 if (ifm->ifm_addrs & RTA_IFP) { in getifaddrs()
142 idx = ifm->ifm_index; in getifaddrs()
145 dcnt += if_data->ifi_datalen; in getifaddrs()
146 dl = (struct sockaddr_dl *)IF_MSGHDRL_RTA(ifm); in getifaddrs()
147 dcnt += SA_RLEN((struct sockaddr *)(void*)dl) + in getifaddrs()
149 ncnt += dl->sdl_nlen + 1; in getifaddrs()
156 if (idx && ifam->ifam_index != idx) in getifaddrs()
160 if (idx == 0 || (ifam->ifam_addrs & RTA_MASKS) == 0) in getifaddrs()
165 dcnt += if_data->ifi_datalen + ALIGNBYTES; in getifaddrs()
170 if ((RTA_MASKS & ifam->ifam_addrs & (1 << i)) in getifaddrs()
182 if ((RTA_MASKS & ifam->ifam_addrs & (1 << i)) in getifaddrs()
205 return(-1); in getifaddrs()
217 for (next = buf; next < buf + needed; next += rtm->rtm_msglen) { in getifaddrs()
219 if (rtm->rtm_version != RTM_VERSION) in getifaddrs()
221 switch (rtm->rtm_type) { in getifaddrs()
224 if ((ifm->ifm_addrs & RTA_IFP) == 0) { in getifaddrs()
229 idx = ifm->ifm_index; in getifaddrs()
230 dl = (struct sockaddr_dl *)IF_MSGHDRL_RTA(ifm); in getifaddrs()
233 ift->ifa_name = names; in getifaddrs()
234 ift->ifa_flags = (int)ifm->ifm_flags; in getifaddrs()
235 memcpy(names, dl->sdl_data, (size_t)dl->sdl_nlen); in getifaddrs()
236 names[dl->sdl_nlen] = 0; in getifaddrs()
237 names += dl->sdl_nlen + 1; in getifaddrs()
239 ift->ifa_addr = (struct sockaddr *)(void *)data; in getifaddrs()
240 memcpy(data, dl, (size_t)SA_LEN((struct sockaddr *) in getifaddrs()
241 (void *)dl)); in getifaddrs()
242 data += SA_RLEN((struct sockaddr *)(void *)dl); in getifaddrs()
246 ift->ifa_data = data = (void *)ALIGN(data); in getifaddrs()
247 memcpy(data, if_data, if_data->ifi_datalen); in getifaddrs()
248 data += if_data->ifi_datalen; in getifaddrs()
250 ift = (ift->ifa_next = ift + 1); in getifaddrs()
255 if (idx && ifam->ifam_index != idx) in getifaddrs()
258 if (idx == 0 || (ifam->ifam_addrs & RTA_MASKS) == 0) in getifaddrs()
260 ift->ifa_name = cif->ifa_name; in getifaddrs()
261 ift->ifa_flags = cif->ifa_flags; in getifaddrs()
262 ift->ifa_data = NULL; in getifaddrs()
268 if ((RTA_MASKS & ifam->ifam_addrs & (1 << i)) in getifaddrs()
280 if ((RTA_MASKS & ifam->ifam_addrs & (1 << i)) in getifaddrs()
287 ift->ifa_addr = in getifaddrs()
294 ift->ifa_netmask = in getifaddrs()
306 ift->ifa_broadaddr = in getifaddrs()
317 ift->ifa_data = data = (void *)ALIGN(data); in getifaddrs()
318 memcpy(data, if_data, if_data->ifi_datalen); in getifaddrs()
319 data += if_data->ifi_datalen; in getifaddrs()
321 ift = (ift->ifa_next = ift + 1); in getifaddrs()
328 if (--ift >= ifa) { in getifaddrs()
329 ift->ifa_next = NULL; in getifaddrs()