haiku/headers/posix/net/if_dl.h
Augustin Cavalier e4104854c3 if_dl: Increase size of sdl_data from 20 to 46 bytes.
FreeBSD's is presently 46 bytes. CID 1422869 warns that it can get overrun
in if_attach() in copying if_xname which is IF_NAMESIZE bytes (32).

This breaks ABI, but BeOS did not have sockaddr_dl, it is only a modern-GCC
ABI break. Since most applications assume that sockaddr_dl is variable-length
and is null-terminated, as well as not used very often, hopefully this will
require relatively few rebuilds.
2018-06-20 21:26:21 -04:00

29 lines
868 B
C

/*
* Copyright 2006-2018 Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _NET_IF_DL_H
#define _NET_IF_DL_H
#include <stdint.h>
/* Link level sockaddr structure */
struct sockaddr_dl {
uint8_t sdl_len; /* Total length of sockaddr */
uint8_t sdl_family; /* AF_LINK */
uint16_t sdl_e_type; /* link level frame type */
uint32_t sdl_index; /* index for interface */
uint8_t sdl_type; /* interface type */
uint8_t sdl_nlen; /* interface name length (not terminated with a null byte) */
uint8_t sdl_alen; /* link level address length */
uint8_t sdl_slen; /* link layer selector length */
uint8_t sdl_data[46]; /* minimum work area, can be larger */
};
/* Macro to get a pointer to the link level address */
#define LLADDR(s) ((uint8_t *)((s)->sdl_data + (s)->sdl_nlen))
#endif /* _NET_IF_DL_H */