]> git.proxmox.com Git - mirror_frr.git/blame - pimd/pim_mroute.h
Merge pull request #13649 from donaldsharp/unlock_the_node_or_else
[mirror_frr.git] / pimd / pim_mroute.h
CommitLineData
acddc0ed 1// SPDX-License-Identifier: GPL-2.0-or-later
12e41d03 2/*
896014f4
DL
3 * PIM for Quagga
4 * Copyright (C) 2008 Everton da Silva Marques
896014f4 5 */
12e41d03
DL
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
12e41d03
DL
20
21#define PIM_MROUTE_MIN_TTL (1)
22
a9338fa4 23#if PIM_IPV == 4
a5fa9822 24
25#include <netinet/in.h>
a724477d
DS
26#if defined(HAVE_LINUX_MROUTE_H)
27#include <linux/mroute.h>
28#else
a5fa9822 29#include "linux/mroute.h"
12e41d03 30#endif
12e41d03 31
a5fa9822 32typedef struct vifctl pim_vifctl;
33typedef struct igmpmsg kernmsg;
34typedef struct sioc_sg_req pim_sioc_sg_req;
12e41d03 35
a5fa9822 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
49fde801 43
1ce957d6 44#define msg_im_msgtype im_msgtype
a5fa9822 45#define msg_im_vif im_vif
46#define msg_im_src im_src
47#define msg_im_dst im_dst
12e41d03 48
a5fa9822 49#ifndef IGMPMSG_WRVIFWHOLE
50#define IGMPMSG_WRVIFWHOLE 4 /* For PIM processing */
12e41d03
DL
51#endif
52
1ce957d6 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
a5fa9822 60#ifndef PIM_IPPROTO
61#define PIM_IPPROTO IPPROTO_IP
62#endif
63#ifndef PIM_SIOCGETSGCNT
64#define PIM_SIOCGETSGCNT SIOCGETSGCNT
12e41d03
DL
65#endif
66
a5fa9822 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
a5fa9822 74#include "linux/mroute6.h"
75#endif
12e41d03 76
a5fa9822 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
1ce957d6 88#define MRT_TABLE MRT6_TABLE
12e41d03
DL
89#endif
90
a5fa9822 91#ifndef PIM_IPPROTO
92#define PIM_IPPROTO IPPROTO_IPV6
12e41d03
DL
93#endif
94
a5fa9822 95#ifndef PIM_SIOCGETSGCNT
96#define PIM_SIOCGETSGCNT SIOCGETSGCNT_IN6
12e41d03 97#endif
a9338fa4 98
a5fa9822 99#ifndef MRT6MSG_WRMIFWHOLE
100#define MRT6MSG_WRMIFWHOLE 4 /* For PIM processing */
101#endif
a9338fa4 102
1ce957d6 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
a5fa9822 110typedef struct mif6ctl pim_vifctl;
111typedef struct mrt6msg kernmsg;
112typedef mifi_t vifi_t;
113typedef struct sioc_sg_req6 pim_sioc_sg_req;
a9338fa4 114
a5fa9822 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
a9338fa4 120
1ce957d6 121#define msg_im_msgtype im6_msgtype
a5fa9822 122#define msg_im_vif im6_mif
123#define msg_im_src im6_src
124#define msg_im_dst im6_dst
a9338fa4 125
a5fa9822 126#ifndef MAXVIFS
a9338fa4 127#define MAXVIFS IF_SETSIZE
a724477d 128#endif
12e41d03 129
a5fa9822 130#define VIFF_REGISTER MIFF_REGISTER
87243934
DS
131#endif
132
a5fa9822 133
12e41d03
DL
134/*
135 Above: from <linux/mroute.h>
136*/
137
e34e07e6 138struct channel_oil;
993e3d8e 139struct pim_instance;
e34e07e6 140
6beed987
DS
141int pim_mroute_socket_enable(struct pim_instance *pim);
142int pim_mroute_socket_disable(struct pim_instance *pim);
12e41d03 143
a9338fa4 144int pim_mroute_add_vif(struct interface *ifp, pim_addr ifaddr,
d62a17ae 145 unsigned char flags);
ea3d967b 146int pim_mroute_del_vif(struct interface *ifp);
12e41d03 147
69e3538c 148int pim_upstream_mroute_add(struct channel_oil *c_oil, const char *name);
7984af18 149int pim_upstream_mroute_iif_update(struct channel_oil *c_oil, const char *name);
69e3538c 150int pim_static_mroute_add(struct channel_oil *c_oil, const char *name);
7984af18
AK
151void pim_static_mroute_iif_update(struct channel_oil *c_oil,
152 int input_vif_index,
153 const char *name);
6a78764e 154int pim_mroute_del(struct channel_oil *c_oil, const char *name);
12e41d03 155
d62a17ae 156void pim_mroute_update_counters(struct channel_oil *c_oil);
60eb7e6b
AK
157bool pim_mroute_allow_iif_in_oil(struct channel_oil *c_oil,
158 int oif_index);
a5fa9822 159int pim_mroute_msg(struct pim_instance *pim, const char *buf, size_t buf_size,
160 ifindex_t ifindex);
161int pim_mroute_msg_nocache(int fd, struct interface *ifp, const kernmsg *msg);
1b00ed5f
DL
162int pim_mroute_msg_wholepkt(int fd, struct interface *ifp, const char *buf,
163 size_t len);
a5fa9822 164int pim_mroute_msg_wrongvif(int fd, struct interface *ifp, const kernmsg *msg);
1b00ed5f
DL
165int pim_mroute_msg_wrvifwhole(int fd, struct interface *ifp, const char *buf,
166 size_t len);
a5fa9822 167int pim_mroute_set(struct pim_instance *pim, int enable);
12e41d03 168#endif /* PIM_MROUTE_H */