]> git.proxmox.com Git - mirror_frr.git/blame - pimd/pim_oil.h
bgpd: Accept no aggregate-address <IP> route-map <RMAP> commands
[mirror_frr.git] / pimd / pim_oil.h
CommitLineData
12e41d03 1/*
896014f4
DL
2 * PIM for Quagga
3 * Copyright (C) 2008 Everton da Silva Marques
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 *
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
18 */
12e41d03
DL
19
20#ifndef PIM_OIL_H
21#define PIM_OIL_H
22
23#include "pim_mroute.h"
24
0fba6e63
DS
25/*
26 * Where did we get this (S,G) from?
27 *
28 * IGMP - Learned from IGMP
29 * PIM - Learned from PIM
30 * SOURCE - Learned from Source multicast packet received
781a1745 31 * STAR - Inherited
0fba6e63
DS
32 */
33#define PIM_OIF_FLAG_PROTO_IGMP (1 << 0)
34#define PIM_OIF_FLAG_PROTO_PIM (1 << 1)
11e0acfb
DS
35#define PIM_OIF_FLAG_PROTO_STAR (1 << 2)
36#define PIM_OIF_FLAG_PROTO_VXLAN (1 << 3)
d45432cd
AK
37#define PIM_OIF_FLAG_PROTO_ANY \
38 (PIM_OIF_FLAG_PROTO_IGMP | PIM_OIF_FLAG_PROTO_PIM \
11e0acfb 39 | PIM_OIF_FLAG_PROTO_STAR | PIM_OIF_FLAG_PROTO_VXLAN)
12e41d03 40
1865a44a
DS
41/*
42 * We need a pimreg vif id from the kernel.
43 * Since ifindex == vif id for most cases and the number
44 * of expected interfaces is at most 100, using MAXVIFS -1
45 * is probably ok.
46 * Don't come running to me if this assumption is bad,
47 * fix it.
48 */
e34a317a
DS
49#define PIM_OIF_PIM_REGISTER_VIF 0
50#define PIM_MAX_USABLE_VIFS (MAXVIFS - 1)
1865a44a 51
d62a17ae 52struct channel_counts {
53 unsigned long long lastused;
cd333cf9 54 unsigned long origpktcnt;
d62a17ae 55 unsigned long pktcnt;
56 unsigned long oldpktcnt;
cd333cf9 57 unsigned long origbytecnt;
d62a17ae 58 unsigned long bytecnt;
59 unsigned long oldbytecnt;
cd333cf9 60 unsigned long origwrong_if;
d62a17ae 61 unsigned long wrong_if;
62 unsigned long oldwrong_if;
3667e8a0
DS
63};
64
12e41d03
DL
65/*
66 qpim_channel_oil_list holds a list of struct channel_oil.
67
68 Each channel_oil.oil is used to control an (S,G) entry in the Kernel
69 Multicast Forwarding Cache.
bbe598df
SP
70
71 There is a case when we create a channel_oil but don't install in the kernel
72
73 Case where (S, G) entry not installed in the kernel:
74 FRR receives IGMP/PIM (*, G) join and RP is not configured or
75 not-reachable, then create a channel_oil for the group G with the incoming
76 interface(channel_oil.oil.mfcc_parent) as invalid i.e "MAXVIF" and populate
77 the outgoing interface where join is received. Keep this entry in the stack,
78 but don't install in the kernel(channel_oil.installed = 0).
79
80 Case where (S, G) entry installed in the kernel:
81 When RP is configured and is reachable for the group G, and receiving a
82 join if channel_oil is already present then populate the incoming interface
83 and install the entry in the kernel, if channel_oil not present, then create
84 a new_channel oil(channel_oil.installed = 1).
85
86 is_valid: indicate if this entry is valid to get installed in kernel.
87 installed: indicate if this entry is installed in the kernel.
88
12e41d03
DL
89*/
90
91struct channel_oil {
856e863f
DS
92 struct pim_instance *pim;
93
d62a17ae 94 struct mfcctl oil;
95 int installed;
96 int oil_inherited_rescan;
97 int oil_size;
98 int oil_ref_count;
99 time_t oif_creation[MAXVIFS];
100 uint32_t oif_flags[MAXVIFS];
101 struct channel_counts cc;
102 struct pim_upstream *up;
e7cd85bd 103 time_t mroute_creation;
12e41d03
DL
104};
105
040d86ad
DS
106extern struct list *pim_channel_oil_list;
107
611925dc
DS
108void pim_oil_init(struct pim_instance *pim);
109void pim_oil_terminate(struct pim_instance *pim);
040d86ad 110
12e41d03 111void pim_channel_oil_free(struct channel_oil *c_oil);
4d9ad5dc
MS
112struct channel_oil *pim_find_channel_oil(struct pim_instance *pim,
113 struct prefix_sg *sg);
611925dc
DS
114struct channel_oil *pim_channel_oil_add(struct pim_instance *pim,
115 struct prefix_sg *sg,
8a3e7e9e 116 int input_vif_index, const char *name);
afb2f470
DS
117void pim_channel_oil_change_iif(struct pim_instance *pim,
118 struct channel_oil *c_oil, int input_vif_index,
119 const char *name);
8a3e7e9e 120void pim_channel_oil_del(struct channel_oil *c_oil, const char *name);
12e41d03 121
d62a17ae 122int pim_channel_add_oif(struct channel_oil *c_oil, struct interface *oif,
123 uint32_t proto_mask);
124int pim_channel_del_oif(struct channel_oil *c_oil, struct interface *oif,
1865a44a
DS
125 uint32_t proto_mask);
126
d62a17ae 127int pim_channel_oil_empty(struct channel_oil *c_oil);
781a1745 128
d62a17ae 129char *pim_channel_oil_dump(struct channel_oil *c_oil, char *buf, size_t size);
12e41d03 130#endif /* PIM_OIL_H */