]>
Commit | Line | Data |
---|---|---|
1 | // SPDX-License-Identifier: GPL-2.0-or-later | |
2 | /* | |
3 | * IP MSDP packet helpers | |
4 | * Copyright (C) 2016 Cumulus Networks, Inc. | |
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 | |
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 | */ | |
19 | #define PIM_MSDP_KA_TLV_MAX_SIZE PIM_MSDP_HEADER_SIZE | |
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) | |
40 | #define PIM_MSDP_SA_ENTRY_CNT2SIZE(entry_cnt) \ | |
41 | (PIM_MSDP_SA_X_SIZE + PIM_MSDP_SA_Y_SIZE(entry_cnt)) | |
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) | |
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 | |
47 | ||
48 | #define PIM_MSDP_MAX_PACKET_SIZE \ | |
49 | MAX(PIM_MSDP_SA_TLV_MAX_SIZE, PIM_MSDP_KA_TLV_MAX_SIZE) | |
50 | ||
51 | #define PIM_MSDP_PKT_TYPE_STRLEN 16 | |
52 | ||
53 | void pim_msdp_pkt_ka_tx(struct pim_msdp_peer *mp); | |
54 | void pim_msdp_read(struct thread *thread); | |
55 | void pim_msdp_pkt_sa_tx(struct pim_instance *pim); | |
56 | void pim_msdp_pkt_sa_tx_one(struct pim_msdp_sa *sa); | |
57 | void pim_msdp_pkt_sa_tx_to_one_peer(struct pim_msdp_peer *mp); | |
58 | void pim_msdp_pkt_sa_tx_one_to_one_peer(struct pim_msdp_peer *mp, | |
59 | struct in_addr rp, pim_sgaddr sg); | |
60 | ||
61 | #endif |