1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * Copyright (C) 2008 Everton da Silva Marques
11 For msghdr.msg_control in Solaris 10
16 #ifndef __EXTENSIONS__
17 #define __EXTENSIONS__
21 #define PIM_MROUTE_MIN_TTL (1)
25 #include <netinet/in.h>
26 #if defined(HAVE_LINUX_MROUTE_H)
27 #include <linux/mroute.h>
29 #include "linux/mroute.h"
32 typedef struct vifctl pim_vifctl
;
33 typedef struct igmpmsg kernmsg
;
34 typedef struct sioc_sg_req pim_sioc_sg_req
;
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
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
49 #ifndef IGMPMSG_WRVIFWHOLE
50 #define IGMPMSG_WRVIFWHOLE 4 /* For PIM processing */
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 */
61 #define PIM_IPPROTO IPPROTO_IP
63 #ifndef PIM_SIOCGETSGCNT
64 #define PIM_SIOCGETSGCNT SIOCGETSGCNT
67 #else /* PIM_IPV != 4 */
69 #include <netinet/ip6.h>
71 #if defined(HAVE_LINUX_MROUTE6_H)
72 #include <linux/mroute6.h>
74 #include "linux/mroute6.h"
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
92 #define PIM_IPPROTO IPPROTO_IPV6
95 #ifndef PIM_SIOCGETSGCNT
96 #define PIM_SIOCGETSGCNT SIOCGETSGCNT_IN6
99 #ifndef MRT6MSG_WRMIFWHOLE
100 #define MRT6MSG_WRMIFWHOLE 4 /* For PIM processing */
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 */
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
;
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
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
127 #define MAXVIFS IF_SETSIZE
130 #define VIFF_REGISTER MIFF_REGISTER
135 Above: from <linux/mroute.h>
141 int pim_mroute_socket_enable(struct pim_instance
*pim
);
142 int pim_mroute_socket_disable(struct pim_instance
*pim
);
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
);
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
,
154 int pim_mroute_del(struct channel_oil
*c_oil
, const char *name
);
156 void pim_mroute_update_counters(struct channel_oil
*c_oil
);
157 bool pim_mroute_allow_iif_in_oil(struct channel_oil
*c_oil
,
159 int pim_mroute_msg(struct pim_instance
*pim
, const char *buf
, size_t buf_size
,
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
,
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
,
167 int pim_mroute_set(struct pim_instance
*pim
, int enable
);
168 #endif /* PIM_MROUTE_H */