]> git.proxmox.com Git - mirror_frr.git/blame - pimd/pim_msdp_packet.h
lib: enforce vrf_name_to_id by returning default_vrf when name is null
[mirror_frr.git] / pimd / pim_msdp_packet.h
CommitLineData
2a333e0f 1/*
2 * IP MSDP packet helpers
3 * Copyright (C) 2016 Cumulus Networks, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
896014f4
DL
15 * You should have received a copy of the GNU General Public License along
16 * with this program; see the file COPYING; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2a333e0f 18 */
19#ifndef PIM_MSDP_PACKET_H
20#define PIM_MSDP_PACKET_H
21
22/* type and length of a single tlv can be consider packet header */
23#define PIM_MSDP_HEADER_SIZE 3
3c72d654 24
25/* Keepalive TLV
26 0 1 2 3
27 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
28+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
29| 4 | 3 |
30+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
31*/
2a333e0f 32#define PIM_MSDP_KA_TLV_MAX_SIZE PIM_MSDP_HEADER_SIZE
3c72d654 33
34/* Source-Active TLV (x=8, y=12xEntryCount)
35 0 1 2 3
36 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
37+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
38| 1 | x + y | Entry Count |
39+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
40| RP Address |
41+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
42| Reserved | Sprefix Len | \
43+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \
44| Group Address | ) z
45+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ /
46| Source Address | /
47+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
48*/
49#define PIM_MSDP_SA_TLV_MAX_SIZE 9192
50#define PIM_MSDP_SA_X_SIZE 8
51#define PIM_MSDP_SA_ONE_ENTRY_SIZE 12
52#define PIM_MSDP_SA_Y_SIZE(entry_cnt) (PIM_MSDP_SA_ONE_ENTRY_SIZE * entry_cnt)
d62a17ae 53#define PIM_MSDP_SA_ENTRY_CNT2SIZE(entry_cnt) \
54 (PIM_MSDP_SA_X_SIZE + PIM_MSDP_SA_Y_SIZE(entry_cnt))
3c72d654 55/* SA TLV has to have atleast only one entry in it so x=8 + y=12 */
56#define PIM_MSDP_SA_TLV_MIN_SIZE PIM_MSDP_SA_ENTRY_CNT2SIZE(1)
c024cfac 57/* XXX: theoretically we can fix a max of 255 but that may result in packet
58 * fragmentation */
59#define PIM_MSDP_SA_MAX_ENTRY_CNT 120
3c72d654 60
15ad0c71 61#define PIM_MSDP_MAX_PACKET_SIZE max(PIM_MSDP_SA_TLV_MAX_SIZE, PIM_MSDP_KA_TLV_MAX_SIZE)
2a333e0f 62
63#define PIM_MSDP_PKT_TYPE_STRLEN 16
64
65void pim_msdp_pkt_ka_tx(struct pim_msdp_peer *mp);
66int pim_msdp_read(struct thread *thread);
472ad383 67void pim_msdp_pkt_sa_tx(struct pim_instance *pim);
3c72d654 68void pim_msdp_pkt_sa_tx_one(struct pim_msdp_sa *sa);
69void pim_msdp_pkt_sa_tx_to_one_peer(struct pim_msdp_peer *mp);
70
2a333e0f 71#endif