]> git.proxmox.com Git - mirror_frr.git/blame - pimd/pim_msdp_packet.h
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / pimd / pim_msdp_packet.h
CommitLineData
acddc0ed 1// SPDX-License-Identifier: GPL-2.0-or-later
2a333e0f 2/*
3 * IP MSDP packet helpers
4 * Copyright (C) 2016 Cumulus Networks, Inc.
2a333e0f 5 */
6#ifndef PIM_MSDP_PACKET_H
7#define PIM_MSDP_PACKET_H
8
9/* type and length of a single tlv can be consider packet header */
10#define PIM_MSDP_HEADER_SIZE 3
3c72d654 11
12/* Keepalive TLV
13 0 1 2 3
14 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
15+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
16| 4 | 3 |
17+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
18*/
2a333e0f 19#define PIM_MSDP_KA_TLV_MAX_SIZE PIM_MSDP_HEADER_SIZE
3c72d654 20
21/* Source-Active TLV (x=8, y=12xEntryCount)
22 0 1 2 3
23 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
24+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
25| 1 | x + y | Entry Count |
26+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
27| RP Address |
28+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
29| Reserved | Sprefix Len | \
30+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \
31| Group Address | ) z
32+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ /
33| Source Address | /
34+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
35*/
36#define PIM_MSDP_SA_TLV_MAX_SIZE 9192
37#define PIM_MSDP_SA_X_SIZE 8
38#define PIM_MSDP_SA_ONE_ENTRY_SIZE 12
39#define PIM_MSDP_SA_Y_SIZE(entry_cnt) (PIM_MSDP_SA_ONE_ENTRY_SIZE * entry_cnt)
d62a17ae 40#define PIM_MSDP_SA_ENTRY_CNT2SIZE(entry_cnt) \
41 (PIM_MSDP_SA_X_SIZE + PIM_MSDP_SA_Y_SIZE(entry_cnt))
3c72d654 42/* SA TLV has to have atleast only one entry in it so x=8 + y=12 */
43#define PIM_MSDP_SA_TLV_MIN_SIZE PIM_MSDP_SA_ENTRY_CNT2SIZE(1)
c024cfac 44/* XXX: theoretically we can fix a max of 255 but that may result in packet
45 * fragmentation */
46#define PIM_MSDP_SA_MAX_ENTRY_CNT 120
3c72d654 47
7a8ce9d5
DS
48#define PIM_MSDP_MAX_PACKET_SIZE \
49 MAX(PIM_MSDP_SA_TLV_MAX_SIZE, PIM_MSDP_KA_TLV_MAX_SIZE)
2a333e0f 50
51#define PIM_MSDP_PKT_TYPE_STRLEN 16
52
53void pim_msdp_pkt_ka_tx(struct pim_msdp_peer *mp);
cc9f21da 54void pim_msdp_read(struct thread *thread);
472ad383 55void pim_msdp_pkt_sa_tx(struct pim_instance *pim);
3c72d654 56void pim_msdp_pkt_sa_tx_one(struct pim_msdp_sa *sa);
57void pim_msdp_pkt_sa_tx_to_one_peer(struct pim_msdp_peer *mp);
9fbd9fc4 58void pim_msdp_pkt_sa_tx_one_to_one_peer(struct pim_msdp_peer *mp,
6fff2cc6 59 struct in_addr rp, pim_sgaddr sg);
3c72d654 60
2a333e0f 61#endif