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