]> git.proxmox.com Git - mirror_frr.git/blob - pimd/pim_mroute.h
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / pimd / pim_mroute.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * PIM for Quagga
4 * Copyright (C) 2008 Everton da Silva Marques
5 */
6
7 #ifndef PIM_MROUTE_H
8 #define PIM_MROUTE_H
9
10 /*
11 For msghdr.msg_control in Solaris 10
12 */
13 #ifndef _XPG4_2
14 #define _XPG4_2
15 #endif
16 #ifndef __EXTENSIONS__
17 #define __EXTENSIONS__
18 #endif
19
20
21 #define PIM_MROUTE_MIN_TTL (1)
22
23 #if PIM_IPV == 4
24
25 #include <netinet/in.h>
26 #if defined(HAVE_LINUX_MROUTE_H)
27 #include <linux/mroute.h>
28 #else
29 #include "linux/mroute.h"
30 #endif
31
32 typedef struct vifctl pim_vifctl;
33 typedef struct igmpmsg kernmsg;
34 typedef struct sioc_sg_req pim_sioc_sg_req;
35
36 #define vc_vifi vifc_vifi
37 #define vc_flags vifc_flags
38 #define vc_threshold vifc_threshold
39 #define vc_rate_limit vifc_rate_limit
40 #define vc_lcl_addr vifc_lcl_addr
41 #define vc_lcl_ifindex vifc_lcl_ifindex
42 #define vc_rmt_addr vifc_rmt_addr
43
44 #define msg_im_msgtype im_msgtype
45 #define msg_im_vif im_vif
46 #define msg_im_src im_src
47 #define msg_im_dst im_dst
48
49 #ifndef IGMPMSG_WRVIFWHOLE
50 #define IGMPMSG_WRVIFWHOLE 4 /* For PIM processing */
51 #endif
52
53 #ifndef GMMSG_NOCACHE
54 #define GMMSG_NOCACHE IGMPMSG_NOCACHE /* For PIM processing */
55 #define GMMSG_WHOLEPKT IGMPMSG_WHOLEPKT /* For PIM processing */
56 #define GMMSG_WRONGVIF IGMPMSG_WRONGVIF /* For PIM processing */
57 #define GMMSG_WRVIFWHOLE IGMPMSG_WRVIFWHOLE /* For PIM processing */
58 #endif
59
60 #ifndef PIM_IPPROTO
61 #define PIM_IPPROTO IPPROTO_IP
62 #endif
63 #ifndef PIM_SIOCGETSGCNT
64 #define PIM_SIOCGETSGCNT SIOCGETSGCNT
65 #endif
66
67 #else /* PIM_IPV != 4 */
68
69 #include <netinet/ip6.h>
70
71 #if defined(HAVE_LINUX_MROUTE6_H)
72 #include <linux/mroute6.h>
73 #else
74 #include "linux/mroute6.h"
75 #endif
76
77 #ifndef MRT_INIT
78 #define MRT_BASE MRT6_BASE
79 #define MRT_INIT MRT6_INIT
80 #define MRT_DONE MRT6_DONE
81 #define MRT_ADD_VIF MRT6_ADD_MIF
82 #define MRT_DEL_VIF MRT6_DEL_MIF
83 #define MRT_ADD_MFC MRT6_ADD_MFC
84 #define MRT_DEL_MFC MRT6_DEL_MFC
85 #define MRT_VERSION MRT6_VERSION
86 #define MRT_ASSERT MRT6_ASSERT
87 #define MRT_PIM MRT6_PIM
88 #define MRT_TABLE MRT6_TABLE
89 #endif
90
91 #ifndef PIM_IPPROTO
92 #define PIM_IPPROTO IPPROTO_IPV6
93 #endif
94
95 #ifndef PIM_SIOCGETSGCNT
96 #define PIM_SIOCGETSGCNT SIOCGETSGCNT_IN6
97 #endif
98
99 #ifndef MRT6MSG_WRMIFWHOLE
100 #define MRT6MSG_WRMIFWHOLE 4 /* For PIM processing */
101 #endif
102
103 #ifndef GMMSG_NOCACHE
104 #define GMMSG_NOCACHE MRT6MSG_NOCACHE /* For PIM processing */
105 #define GMMSG_WHOLEPKT MRT6MSG_WHOLEPKT /* For PIM processing */
106 #define GMMSG_WRONGVIF MRT6MSG_WRONGMIF /* For PIM processing */
107 #define GMMSG_WRVIFWHOLE MRT6MSG_WRMIFWHOLE /* For PIM processing */
108 #endif
109
110 typedef struct mif6ctl pim_vifctl;
111 typedef struct mrt6msg kernmsg;
112 typedef mifi_t vifi_t;
113 typedef struct sioc_sg_req6 pim_sioc_sg_req;
114
115 #define vc_vifi mif6c_mifi
116 #define vc_flags mif6c_flags
117 #define vc_threshold vifc_threshold
118 #define vc_pifi mif6c_pifi
119 #define vc_rate_limit vifc_rate_limit
120
121 #define msg_im_msgtype im6_msgtype
122 #define msg_im_vif im6_mif
123 #define msg_im_src im6_src
124 #define msg_im_dst im6_dst
125
126 #ifndef MAXVIFS
127 #define MAXVIFS IF_SETSIZE
128 #endif
129
130 #define VIFF_REGISTER MIFF_REGISTER
131 #endif
132
133
134 /*
135 Above: from <linux/mroute.h>
136 */
137
138 struct channel_oil;
139 struct pim_instance;
140
141 int pim_mroute_socket_enable(struct pim_instance *pim);
142 int pim_mroute_socket_disable(struct pim_instance *pim);
143
144 int pim_mroute_add_vif(struct interface *ifp, pim_addr ifaddr,
145 unsigned char flags);
146 int pim_mroute_del_vif(struct interface *ifp);
147
148 int pim_upstream_mroute_add(struct channel_oil *c_oil, const char *name);
149 int pim_upstream_mroute_iif_update(struct channel_oil *c_oil, const char *name);
150 int pim_static_mroute_add(struct channel_oil *c_oil, const char *name);
151 void pim_static_mroute_iif_update(struct channel_oil *c_oil,
152 int input_vif_index,
153 const char *name);
154 int pim_mroute_del(struct channel_oil *c_oil, const char *name);
155
156 void pim_mroute_update_counters(struct channel_oil *c_oil);
157 bool pim_mroute_allow_iif_in_oil(struct channel_oil *c_oil,
158 int oif_index);
159 int pim_mroute_msg(struct pim_instance *pim, const char *buf, size_t buf_size,
160 ifindex_t ifindex);
161 int pim_mroute_msg_nocache(int fd, struct interface *ifp, const kernmsg *msg);
162 int pim_mroute_msg_wholepkt(int fd, struct interface *ifp, const char *buf,
163 size_t len);
164 int pim_mroute_msg_wrongvif(int fd, struct interface *ifp, const kernmsg *msg);
165 int pim_mroute_msg_wrvifwhole(int fd, struct interface *ifp, const char *buf,
166 size_t len);
167 int pim_mroute_set(struct pim_instance *pim, int enable);
168 #endif /* PIM_MROUTE_H */