diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2019-03-13 18:18:36 +0100 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2019-05-17 02:27:08 +0200 |
commit | c2034b2550eb29a1564994838c94720e1a78ba8e (patch) | |
tree | 65fcd3773a8afc3f0ff4a24ad0bf0898bd00d45d /vrrpd/vrrp_packet.h | |
parent | vrrpd: allow centisecond precision for vrrpv2 (diff) | |
download | frr-c2034b2550eb29a1564994838c94720e1a78ba8e.tar.xz frr-c2034b2550eb29a1564994838c94720e1a78ba8e.zip |
vrrpd: include auth fields in v2 packet
Based on looking at other vendors, seems I misinterpreted the RFC - type
0 auth (no authentication) still requires the authentication fields to
be present, just set to all zero.
This should fix VRRPv2 interop with other vendors.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'vrrpd/vrrp_packet.h')
-rw-r--r-- | vrrpd/vrrp_packet.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/vrrpd/vrrp_packet.h b/vrrpd/vrrp_packet.h index 2061b63c6..475e4780d 100644 --- a/vrrpd/vrrp_packet.h +++ b/vrrpd/vrrp_packet.h @@ -70,6 +70,10 @@ struct vrrp_pkt { * When used, this is actually an array of one or the other, not an * array of union. If N v4 addresses are stored then * sizeof(addrs) == N * sizeof(struct in_addr). + * + * Under v2, the last 2 entries in this array are the authentication + * data fields. We don't support auth in v2 so these are always just 8 + * bytes of 0x00. */ union { struct in_addr v4; @@ -77,17 +81,18 @@ struct vrrp_pkt { } addrs[]; } __attribute__((packed)); -#define VRRP_PKT_SIZE(_f, _naddr) \ +#define VRRP_PKT_SIZE(_f, _ver, _naddr) \ ({ \ size_t _asz = ((_f) == AF_INET) ? sizeof(struct in_addr) \ : sizeof(struct in6_addr); \ - sizeof(struct vrrp_hdr) + (_asz * (_naddr)); \ + size_t _auth = 2 * sizeof(uint32_t) * (3 - (_ver)); \ + sizeof(struct vrrp_hdr) + (_asz * (_naddr)) + _auth; \ }) -#define VRRP_MIN_PKT_SIZE_V4 VRRP_PKT_SIZE(AF_INET, 1) -#define VRRP_MAX_PKT_SIZE_V4 VRRP_PKT_SIZE(AF_INET, 255) -#define VRRP_MIN_PKT_SIZE_V6 VRRP_PKT_SIZE(AF_INET6, 1) -#define VRRP_MAX_PKT_SIZE_V6 VRRP_PKT_SIZE(AF_INET6, 255) +#define VRRP_MIN_PKT_SIZE_V4 VRRP_PKT_SIZE(AF_INET, 3, 1) +#define VRRP_MAX_PKT_SIZE_V4 VRRP_PKT_SIZE(AF_INET, 2, 255) +#define VRRP_MIN_PKT_SIZE_V6 VRRP_PKT_SIZE(AF_INET6, 3, 1) +#define VRRP_MAX_PKT_SIZE_V6 VRRP_PKT_SIZE(AF_INET6, 3, 255) #define VRRP_MIN_PKT_SIZE VRRP_MIN_PKT_SIZE_V4 #define VRRP_MAX_PKT_SIZE VRRP_MAX_PKT_SIZE_V6 |