/freebsd/sbin/ifconfig/ |
H A D | af_link.c | 88 print_lladdr(struct sockaddr_dl *sdl) in print_lladdr() argument 90 if (match_ether(sdl)) { in print_lladdr() 91 print_ether((struct ether_addr *)LLADDR(sdl), "ether"); in print_lladdr() 93 int n = sdl->sdl_nlen > 0 ? sdl->sdl_nlen + 1 : 0; in print_lladdr() 94 printf("\tlladdr %s\n", link_ntoa(sdl) + n); in print_lladdr() 113 struct sockaddr_dl *sdl; in link_status() local 118 sdl = satosdl(ifa->ifa_addr); in link_status() 119 if (sdl == NULL || sdl->sdl_alen == 0) in link_status() 122 print_lladdr(sdl); in link_status() 132 if ((sdl->sdl_type != IFT_ETHER && in link_status() [all …]
|
/freebsd/lib/libc/net/ |
H A D | linkaddr.c | 50 link_addr(const char *addr, struct sockaddr_dl *sdl) in link_addr() argument 52 char *cp = sdl->sdl_data; in link_addr() 53 char *cplim = sdl->sdl_len + (char *)sdl; in link_addr() 56 bzero((char *)&sdl->sdl_family, sdl->sdl_len - 1); in link_addr() 57 sdl->sdl_family = AF_LINK; in link_addr() 82 sdl->sdl_nlen = cp - sdl->sdl_data; in link_addr() 109 sdl->sdl_alen = cp - LLADDR(sdl); in link_addr() 110 new = cp - (char *)sdl; in link_addr() 111 if (new > sizeof(*sdl)) in link_addr() 112 sdl->sdl_len = new; in link_addr() [all …]
|
/freebsd/lib/libnetbsd/ |
H A D | sockaddr_snprintf.c | 93 debug_dl(char *str, size_t len, const struct sockaddr_dl *sdl) in debug_dl() argument 95 const uint8_t *s = (const void *)sdl->sdl_data; in debug_dl() 100 SALEN(sdl), sdl->sdl_family, sdl->sdl_index, in debug_dl() 101 sdl->sdl_type, sdl->sdl_nlen, sdl->sdl_alen, sdl->sdl_slen, in debug_dl() 122 const struct sockaddr_dl *sdl = NULL; in sockaddr_snprintf() local 156 sdl = ((const struct sockaddr_dl *)(const void *)sa); in sockaddr_snprintf() 158 if (sdl->sdl_slen == 0 && sdl->sdl_nlen == 0 in sockaddr_snprintf() 159 && sdl->sdl_alen == 0) { in sockaddr_snprintf() 160 salen = sizeof(*sdl); in sockaddr_snprintf() 162 sdl->sdl_index); in sockaddr_snprintf() [all …]
|
/freebsd/contrib/netbsd-tests/lib/libutil/ |
H A D | t_sockaddr_snprintf.c | 156 struct sockaddr_dl sdl; in ATF_TC_BODY() local 159 memset(&sdl, 0, sizeof(sdl)); in ATF_TC_BODY() 160 sdl.sdl_len = sizeof(sdl); in ATF_TC_BODY() 161 sdl.sdl_family = AF_LINK; in ATF_TC_BODY() 162 sdl.sdl_index = 0; in ATF_TC_BODY() 163 sdl.sdl_type = 0; in ATF_TC_BODY() 164 sdl.sdl_nlen = 0; in ATF_TC_BODY() 165 sdl.sdl_alen = 6; in ATF_TC_BODY() 166 sdl.sdl_slen = 0; in ATF_TC_BODY() 167 memcpy(sdl.sdl_data, "\01\02\03\04\05\06", 6); in ATF_TC_BODY() [all …]
|
/freebsd/contrib/netbsd-tests/sys/net/ |
H A D | t_print.c | 143 struct sockaddr_dl sdl; in ATF_TC_BODY() local 145 memset(&sdl, 0, sizeof(sdl)); in ATF_TC_BODY() 147 memcpy(&sdl.sdl_addr, &tst[i].ia, sizeof(sdl.sdl_addr)); in ATF_TC_BODY() 148 sdl.sdl_index = (uint16_t)i; in ATF_TC_BODY() 149 r = sdl_print(buf, l, &sdl); in ATF_TC_BODY() 160 memcpy(&sdl.sdl_addr, &tst[i].ia, sizeof(sdl.sdl_addr)); in ATF_TC_BODY() 161 sdl.sdl_index = (uint16_t)i; in ATF_TC_BODY() 162 r = sdl_print(buf, l, &sdl); in ATF_TC_BODY()
|
/freebsd/usr.sbin/arp/ |
H A D | arp.c | 72 typedef void (action_fn)(struct sockaddr_dl *sdl, struct sockaddr_in *s_in, 83 struct sockaddr_in *dst, struct sockaddr_dl *sdl); 389 struct sockaddr_dl *sdl; in set_rtsock() local 406 sdl = (struct sockaddr_dl *)(SA_SIZE(addr) + (char *)addr); in set_rtsock() 408 if ((sdl->sdl_family != AF_LINK) || in set_rtsock() 410 !valid_type(sdl->sdl_type)) { in set_rtsock() 414 sdl_m->sdl_type = sdl->sdl_type; in set_rtsock() 415 sdl_m->sdl_index = sdl->sdl_index; in set_rtsock() 464 struct sockaddr_dl *sdl; in delete_rtsock() local 482 sdl = (struct sockaddr_dl *)(SA_SIZE(addr) + (char *)addr); in delete_rtsock() [all …]
|
H A D | arp_netlink.c | 199 struct sockaddr_dl sdl = { in print_entry() local 205 memcpy(sdl.sdl_data, NLA_DATA(neigh->nda_lladdr), sdl.sdl_alen); in print_entry() 207 if ((sdl.sdl_type == IFT_ETHER || in print_entry() 208 sdl.sdl_type == IFT_L2VLAN || in print_entry() 209 sdl.sdl_type == IFT_BRIDGE) && in print_entry() 210 sdl.sdl_alen == ETHER_ADDR_LEN) in print_entry() 212 ether_ntoa((struct ether_addr *)LLADDR(&sdl))); in print_entry() 215 xo_emit("{:mac-address/%s}", link_ntoa(&sdl)); in print_entry() 378 set_nl(uint32_t ifindex, struct sockaddr_in *dst, struct sockaddr_dl *sdl, char *host) in set_nl() argument 411 snl_add_msg_attr(&nw, NDA_LLADDR, sdl->sdl_alen, LLADDR(sdl)); in set_nl()
|
/freebsd/usr.sbin/rtsold/ |
H A D | if.c | 259 lladdropt_length(struct sockaddr_dl *sdl) in lladdropt_length() argument 261 switch (sdl->sdl_type) { in lladdropt_length() 271 lladdropt_fill(struct sockaddr_dl *sdl, struct nd_opt_hdr *ndopt) in lladdropt_fill() argument 277 switch (sdl->sdl_type) { in lladdropt_fill() 282 memcpy(addr, LLADDR(sdl), ETHER_ADDR_LEN); in lladdropt_fill() 286 "unsupported link type(%d)", sdl->sdl_type); in lladdropt_fill() 299 struct sockaddr_dl *sdl = NULL, *ret_sdl; in if_nametosdl() local 318 sdl = (struct sockaddr_dl *)(void *)sa; in if_nametosdl() 319 if (strlen(name) != sdl->sdl_nlen) in if_nametosdl() 321 if (strncmp(&sdl->sdl_data[0], in if_nametosdl() [all …]
|
/freebsd/contrib/blocklist/port/ |
H A D | sockaddr_snprintf.c | 148 debug_dl(char *str, size_t len, const struct sockaddr_dl *sdl) in debug_dl() argument 150 const uint8_t *s = (const void *)sdl->sdl_data; in debug_dl() 155 SLEN(sdl), sdl->sdl_family, sdl->sdl_index, in debug_dl() 156 sdl->sdl_type, sdl->sdl_nlen, sdl->sdl_alen, sdl->sdl_slen, in debug_dl() 180 const struct sockaddr_dl *sdl = NULL; in sockaddr_snprintf() local 220 sdl = ((const struct sockaddr_dl *)(const void *)sa); in sockaddr_snprintf() 221 (void)strlcpy(addr = abuf, link_ntoa(sdl), sizeof(abuf)); in sockaddr_snprintf() 295 if (sdl && addr != abuf) { in sockaddr_snprintf() 356 debug_dl(nbuf, sizeof(nbuf), sdl); in sockaddr_snprintf()
|
/freebsd/tests/sys/net/routing/ |
H A D | rtsock_print.h | 196 const struct sockaddr_dl *sdl; in sa_print() local 219 sdl = (const struct sockaddr_dl *)sa; in sa_print() 220 int sdl_index = sdl->sdl_index; in sa_print() 224 printf(" af=link len=%d sdl_index=%d if_name=%s", sdl->sdl_len, sdl_index, ifbuf); in sa_print() 226 if (sdl->sdl_nlen) { in sa_print() 228 memcpy(_ifname, sdl->sdl_data, sdl->sdl_nlen); in sa_print() 229 _ifname[sdl->sdl_nlen] = '\0'; in sa_print() 232 if (sdl->sdl_alen) { in sa_print() 234 const char *lladdr = LLADDR(sdl); in sa_print() 235 for (int i = 0; i < sdl->sdl_alen; i++) { in sa_print() [all …]
|
H A D | rtsock_common.h | 619 struct sockaddr_dl *sdl = (struct sockaddr_dl *)sa; in sa_convert_str_to_sa() local 620 memset(sdl, 0, sizeof(struct sockaddr_dl)); in sa_convert_str_to_sa() 621 sdl->sdl_family = AF_LINK; in sa_convert_str_to_sa() 622 sdl->sdl_len = sizeof(struct sockaddr_dl); in sa_convert_str_to_sa() 623 sdl->sdl_index = ifindex; in sa_convert_str_to_sa() 624 sdl->sdl_alen = 6; in sa_convert_str_to_sa() 625 struct ether_addr *ea = (struct ether_addr *)LLADDR(sdl); in sa_convert_str_to_sa() 816 struct sockaddr_dl *sdl = (struct sockaddr_dl *)sa; in _validate_message_sockaddrs() local 817 int data_len = sdl->sdl_nlen + sdl->sdl_alen; in _validate_message_sockaddrs() 823 data_len, rtm_len, sdl->sdl_nlen, sdl->sdl_alen); in _validate_message_sockaddrs()
|
/freebsd/sys/net/ |
H A D | if_infiniband.c | 544 struct sockaddr_dl *sdl; in infiniband_resolvemulti() local 558 sdl = (struct sockaddr_dl *)sa; in infiniband_resolvemulti() 559 e_addr = LLADDR(sdl); in infiniband_resolvemulti() 570 sdl = link_init_sdl(ifp, *llsa, IFT_INFINIBAND); in infiniband_resolvemulti() 571 sdl->sdl_alen = INFINIBAND_ADDR_LEN; in infiniband_resolvemulti() 572 e_addr = LLADDR(sdl); in infiniband_resolvemulti() 575 *llsa = (struct sockaddr *)sdl; in infiniband_resolvemulti() 590 sdl = link_init_sdl(ifp, *llsa, IFT_INFINIBAND); in infiniband_resolvemulti() 591 sdl->sdl_alen = INFINIBAND_ADDR_LEN; in infiniband_resolvemulti() 592 e_addr = LLADDR(sdl); in infiniband_resolvemulti() [all …]
|
H A D | route.c | 371 const struct sockaddr_dl *sdl; in info_get_ifp() local 373 sdl = (const struct sockaddr_dl *)info->rti_info[RTAX_IFP]; in info_get_ifp() 374 if (sdl->sdl_family != AF_LINK) in info_get_ifp() 377 if (sdl->sdl_index != 0) in info_get_ifp() 378 return (ifnet_byindex(sdl->sdl_index)); in info_get_ifp() 379 if (sdl->sdl_nlen > 0) { in info_get_ifp() 381 if (sdl->sdl_nlen + offsetof(struct sockaddr_dl, sdl_data) > sdl->sdl_len) in info_get_ifp() 383 if (sdl->sdl_nlen >= IF_NAMESIZE) in info_get_ifp() 386 memcpy(if_name, sdl->sdl_data, sdl->sdl_nlen); in info_get_ifp()
|
H A D | if_ethersubr.c | 984 struct sockaddr_dl *sdl; in ether_sprintf() 1003 sdl = (struct sockaddr_dl *)ifa->ifa_addr; in ether_ifattach() 1004 sdl->sdl_type = IFT_ETHER; in ether_ifattach() 1005 sdl->sdl_alen = ifp->if_addrlen; in ether_ifattach() 1006 bcopy(lla, LLADDR(sdl), ifp->if_addrlen); in ether_ifattach() 1022 uuid_ether_add(LLADDR(sdl)); in ether_ifattach() 1036 struct sockaddr_dl *sdl; in ether_ifattach() 1038 sdl = (struct sockaddr_dl *)(ifp->if_addr->ifa_addr); in ether_ifattach() 1039 uuid_ether_del(LLADDR(sdl)); 1217 struct sockaddr_dl *sdl; in ether_ioctl() 994 struct sockaddr_dl *sdl; ether_ifattach() local 1046 struct sockaddr_dl *sdl; ether_ifdetach() local 1227 struct sockaddr_dl *sdl; ether_resolvemulti() local [all...] |
/freebsd/libexec/bootpd/ |
H A D | rtmsg.c | 119 struct sockaddr_dl *sdl; in bsd_arp_set() local 145 sdl = (struct sockaddr_dl *)(sin->sin_len + (char *)sin); in bsd_arp_set() 147 if (sdl->sdl_family == AF_LINK && in bsd_arp_set() 148 !(rtm->rtm_flags & RTF_GATEWAY)) switch (sdl->sdl_type) { in bsd_arp_set() 162 if (sdl->sdl_family != AF_LINK) { in bsd_arp_set() 168 sdl_m.sdl_type = sdl->sdl_type; in bsd_arp_set() 169 sdl_m.sdl_index = sdl->sdl_index; in bsd_arp_set()
|
/freebsd/tools/regression/netinet/ipbroadcast/ |
H A D | ipbroadcast.c | 112 struct sockaddr_dl *sdl; in main() local 331 sdl = (struct sockaddr_dl *)CMSG_DATA(cmsgp); in main() 332 memset(sdl, 0, sizeof(struct sockaddr_dl)); in main() 333 sdl->sdl_family = AF_LINK; in main() 334 sdl->sdl_len = sizeof(struct sockaddr_dl); in main() 335 sdl->sdl_index = if_nametoindex(ifname); in main() 339 sdl->sdl_family); in main() 341 sdl->sdl_len); in main() 343 sdl->sdl_index); in main()
|
/freebsd/usr.bin/netstat/ |
H A D | if.c | 277 struct sockaddr_dl *sdl; in next_ifma() local 279 sdl = (struct sockaddr_dl *)ifma->ifma_name; in next_ifma() 281 strcmp(sdl->sdl_data, name) == 0) in next_ifma() 333 struct sockaddr_dl *sdl; in process_ifa_addr() local 336 sdl = (struct sockaddr_dl *)ifa->ifa_addr; in process_ifa_addr() 337 snprintf(linknum, sizeof(linknum), "<Link#%d>", sdl->sdl_index); in process_ifa_addr() 340 if (sdl->sdl_nlen == 0 && in process_ifa_addr() 341 sdl->sdl_alen == 0 && in process_ifa_addr() 342 sdl->sdl_slen == 0) in process_ifa_addr() 349 if (sdl->sdl_nlen == 0 && in process_ifa_addr() [all …]
|
H A D | common.c | 92 struct sockaddr_dl *sdl; in prepare_ifmap() local 109 sdl = (struct sockaddr_dl *)ifa->ifa_addr; in prepare_ifmap() 110 ifindex = sdl->sdl_index; in prepare_ifmap()
|
/freebsd/usr.sbin/ndp/ |
H A D | ndp.c | 468 struct sockaddr_dl *sdl; in set() local 477 sdl = (struct sockaddr_dl *)(ALIGN(sin->sin6_len) + (char *)sin); in set() 479 if (sdl->sdl_family == AF_LINK && in set() 481 if (valid_type(sdl->sdl_type)) in set() 489 if (sdl->sdl_family != AF_LINK) { in set() 493 sdl_m.sdl_type = sdl->sdl_type; in set() 494 sdl_m.sdl_index = sdl->sdl_index; in set() 550 struct sockaddr_dl *sdl; in delete_rtsock() local 567 sdl = (struct sockaddr_dl *)(ALIGN(sin->sin6_len) + (char *)sin); in delete_rtsock() 569 if (sdl->sdl_family == AF_LINK && in delete_rtsock() [all …]
|
H A D | ndp_netlink.c | 227 struct sockaddr_dl sdl = { in print_entry() local 234 sdl.sdl_alen = NLA_DATA_LEN(neigh->nda_lladdr), in print_entry() 235 memcpy(sdl.sdl_data, NLA_DATA(neigh->nda_lladdr), sdl.sdl_alen); in print_entry() 241 llwidth = strlen(ether_str(&sdl)); in print_entry() 255 xo_emit(xobuf, host_buf, ether_str(&sdl), ifname); in print_entry() 475 set_nl(uint32_t ifindex, struct sockaddr_in6 *dst, struct sockaddr_dl *sdl, char *host) in set_nl() argument 505 snl_add_msg_attr(&nw, NDA_LLADDR, sdl->sdl_alen, LLADDR(sdl)); in set_nl()
|
/freebsd/share/examples/libifconfig/ |
H A D | status.c | 190 struct sockaddr_dl *sdl; in print_link_addr() local 193 sdl = (struct sockaddr_dl *)ifa->ifa_addr; in print_link_addr() 194 if ((sdl != NULL) && (sdl->sdl_alen > 0)) { in print_link_addr() 195 if (((sdl->sdl_type == IFT_ETHER) || in print_link_addr() 196 (sdl->sdl_type == IFT_L2VLAN) || in print_link_addr() 197 (sdl->sdl_type == IFT_BRIDGE)) && in print_link_addr() 198 (sdl->sdl_alen == ETHER_ADDR_LEN)) { in print_link_addr() 199 ether_ntoa_r((struct ether_addr *)LLADDR(sdl), in print_link_addr() 203 n = sdl->sdl_nlen > 0 ? sdl->sdl_nlen + 1 : 0; in print_link_addr() 205 printf("\tlladdr %s\n", link_ntoa(sdl) + n); in print_link_addr()
|
/freebsd/sbin/ipf/ipsend/ |
H A D | 44arp.c | 65 struct sockaddr_dl *sdl; in arp() local 106 sdl = (struct sockaddr_dl *)(sin + 1); in arp() 110 bcopy(LLADDR(sdl), eaddr, sdl->sdl_alen); in arp()
|
/freebsd/contrib/bsnmp/snmp_mibII/ |
H A D | mibII.c | 678 get_physaddr(struct mibif *ifp, struct sockaddr_dl *sdl, u_char *ptr) in get_physaddr() argument 683 if (sdl->sdl_alen == 0) { in get_physaddr() 696 if (ifp->physaddrlen != sdl->sdl_alen) { in get_physaddr() 704 if ((np = realloc(ifp->physaddr, sdl->sdl_alen)) == NULL) { in get_physaddr() 711 ifp->physaddrlen = sdl->sdl_alen; in get_physaddr() 1005 process_arp(const struct rt_msghdr *rtm, const struct sockaddr_dl *sdl, in process_arp() argument 1012 if (sdl->sdl_alen == 0) in process_arp() 1014 if ((ifp = mib_find_if_sys(sdl->sdl_index)) == NULL) in process_arp() 1019 sdl->sdl_data + sdl->sdl_nlen, sdl->sdl_alen)) == NULL) in process_arp() 1043 struct sockaddr_dl *sdl; in handle_rtmsg() local [all …]
|
/freebsd/contrib/wpa/src/l2_packet/ |
H A D | l2_packet_freebsd.c | 207 struct sockaddr_dl *sdl; in eth_get() 222 sdl = (struct sockaddr_dl *)(ifm + 1); in eth_get() 226 if (sdl->sdl_family != AF_LINK || sdl->sdl_nlen == 0 || in eth_get() 227 os_memcmp(sdl->sdl_data, device, sdl->sdl_nlen) != 0) in eth_get() 229 os_memcpy(ea, LLADDR(sdl), sdl->sdl_alen); in eth_get()
|
/freebsd/usr.sbin/ifmcstat/ |
H A D | ifmcstat.c | 100 struct sockaddr_dl sdl; member 385 struct sockaddr_dl sdl; in ll_addrlist() local 399 KREAD(ifa.ifa_addr, &sdl, struct sockaddr_dl); in ll_addrlist() 400 if (sdl.sdl_alen == 0) in ll_addrlist() 403 getnameinfo((struct sockaddr *)&sdl, sdl.sdl_len, in ll_addrlist() 424 KREAD(ifm.ifma_addr, &sdl, struct sockaddr_dl); in ll_addrlist() 426 getnameinfo((struct sockaddr *)&sdl, in ll_addrlist() 427 sdl.sdl_len, addrbuf, sizeof(addrbuf), in ll_addrlist() 482 struct sockaddr_dl sdl; in if6_addrlist() local 499 KREAD(ifm.ifma_lladdr, &sdl, struct sockaddr_dl); in if6_addrlist() [all …]
|