mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-27 05:28:51 +00:00
Merge pull request #8772 from idryzhov/bfd-key-packed
bfdd: fix bfd key structure
This commit is contained in:
commit
8f55a5f267
17
bfdd/bfd.h
17
bfdd/bfd.h
@ -173,15 +173,26 @@ enum bfd_session_flags {
|
|||||||
BFD_SESS_FLAG_PASSIVE = 1 << 10, /* Passive mode */
|
BFD_SESS_FLAG_PASSIVE = 1 << 10, /* Passive mode */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* BFD session hash keys */
|
/*
|
||||||
|
* BFD session hash key.
|
||||||
|
*
|
||||||
|
* This structure must not have any padding bytes because their value is
|
||||||
|
* unspecified after the struct assignment. Even when all fields of two keys
|
||||||
|
* are the same, if the padding bytes are different, then the calculated hash
|
||||||
|
* value is different, and the hash lookup will fail.
|
||||||
|
*
|
||||||
|
* Currently, the structure fields are correctly aligned, and the "packed"
|
||||||
|
* attribute is added as a precaution. "family" and "mhop" fields are two-bytes
|
||||||
|
* to eliminate unaligned memory access to "peer" and "local".
|
||||||
|
*/
|
||||||
struct bfd_key {
|
struct bfd_key {
|
||||||
uint16_t family;
|
uint16_t family;
|
||||||
uint8_t mhop;
|
uint16_t mhop;
|
||||||
struct in6_addr peer;
|
struct in6_addr peer;
|
||||||
struct in6_addr local;
|
struct in6_addr local;
|
||||||
char ifname[MAXNAMELEN];
|
char ifname[MAXNAMELEN];
|
||||||
char vrfname[MAXNAMELEN];
|
char vrfname[MAXNAMELEN];
|
||||||
};
|
} __attribute__((packed));
|
||||||
|
|
||||||
struct bfd_session_stats {
|
struct bfd_session_stats {
|
||||||
uint64_t rx_ctrl_pkt;
|
uint64_t rx_ctrl_pkt;
|
||||||
|
Loading…
Reference in New Issue
Block a user