2015-02-04 07:01:14 +01:00
|
|
|
/*
|
2017-05-13 10:25:29 +02:00
|
|
|
* PIM for Quagga
|
|
|
|
* Copyright (C) 2008 Everton da Silva Marques
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; see the file COPYING; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
2015-02-04 07:01:14 +01:00
|
|
|
|
|
|
|
#ifndef PIM_MROUTE_H
|
|
|
|
#define PIM_MROUTE_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
For msghdr.msg_control in Solaris 10
|
|
|
|
*/
|
|
|
|
#ifndef _XPG4_2
|
|
|
|
#define _XPG4_2
|
|
|
|
#endif
|
|
|
|
#ifndef __EXTENSIONS__
|
|
|
|
#define __EXTENSIONS__
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#define PIM_MROUTE_MIN_TTL (1)
|
|
|
|
|
2022-01-18 14:33:04 +01:00
|
|
|
#if PIM_IPV == 4
|
2022-03-03 17:25:50 +01:00
|
|
|
|
|
|
|
#include <netinet/in.h>
|
2015-06-05 21:15:44 +02:00
|
|
|
#if defined(HAVE_LINUX_MROUTE_H)
|
|
|
|
#include <linux/mroute.h>
|
|
|
|
#else
|
2022-03-03 17:25:50 +01:00
|
|
|
#ifndef VTYSH_EXTRACT_PL
|
|
|
|
#include "linux/mroute.h"
|
2015-02-04 07:01:14 +01:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2022-03-03 17:25:50 +01:00
|
|
|
typedef struct vifctl pim_vifctl;
|
|
|
|
typedef struct igmpmsg kernmsg;
|
|
|
|
typedef struct sioc_sg_req pim_sioc_sg_req;
|
2015-02-04 07:01:14 +01:00
|
|
|
|
2022-03-03 17:25:50 +01:00
|
|
|
#define vc_vifi vifc_vifi
|
|
|
|
#define vc_flags vifc_flags
|
|
|
|
#define vc_threshold vifc_threshold
|
|
|
|
#define vc_rate_limit vifc_rate_limit
|
|
|
|
#define vc_lcl_addr vifc_lcl_addr
|
|
|
|
#define vc_lcl_ifindex vifc_lcl_ifindex
|
|
|
|
#define vc_rmt_addr vifc_rmt_addr
|
2017-07-11 20:15:23 +02:00
|
|
|
|
2022-03-03 17:25:50 +01:00
|
|
|
#define msg_im_vif im_vif
|
|
|
|
#define msg_im_src im_src
|
|
|
|
#define msg_im_dst im_dst
|
2015-02-04 07:01:14 +01:00
|
|
|
|
2022-03-03 17:25:50 +01:00
|
|
|
#ifndef IGMPMSG_WRVIFWHOLE
|
|
|
|
#define IGMPMSG_WRVIFWHOLE 4 /* For PIM processing */
|
2015-02-04 07:01:14 +01:00
|
|
|
#endif
|
|
|
|
|
2022-03-03 17:25:50 +01:00
|
|
|
#ifndef PIM_IPPROTO
|
|
|
|
#define PIM_IPPROTO IPPROTO_IP
|
|
|
|
#endif
|
|
|
|
#ifndef PIM_SIOCGETSGCNT
|
|
|
|
#define PIM_SIOCGETSGCNT SIOCGETSGCNT
|
2015-02-04 07:01:14 +01:00
|
|
|
#endif
|
|
|
|
|
2022-03-03 17:25:50 +01:00
|
|
|
#else /* PIM_IPV != 4 */
|
|
|
|
|
|
|
|
#include <netinet/ip6.h>
|
|
|
|
|
|
|
|
#if defined(HAVE_LINUX_MROUTE6_H)
|
|
|
|
#include <linux/mroute6.h>
|
|
|
|
#else
|
|
|
|
#ifndef VTYSH_EXTRACT_PL
|
|
|
|
#include "linux/mroute6.h"
|
|
|
|
#endif
|
2015-02-04 07:01:14 +01:00
|
|
|
#endif
|
|
|
|
|
2022-03-03 17:25:50 +01:00
|
|
|
#ifndef MRT_INIT
|
|
|
|
#define MRT_BASE MRT6_BASE
|
|
|
|
#define MRT_INIT MRT6_INIT
|
|
|
|
#define MRT_DONE MRT6_DONE
|
|
|
|
#define MRT_ADD_VIF MRT6_ADD_MIF
|
|
|
|
#define MRT_DEL_VIF MRT6_DEL_MIF
|
|
|
|
#define MRT_ADD_MFC MRT6_ADD_MFC
|
|
|
|
#define MRT_DEL_MFC MRT6_DEL_MFC
|
|
|
|
#define MRT_VERSION MRT6_VERSION
|
|
|
|
#define MRT_ASSERT MRT6_ASSERT
|
|
|
|
#define MRT_PIM MRT6_PIM
|
2015-02-04 07:01:14 +01:00
|
|
|
#endif
|
|
|
|
|
2022-03-03 17:25:50 +01:00
|
|
|
#ifndef PIM_IPPROTO
|
|
|
|
#define PIM_IPPROTO IPPROTO_IPV6
|
2015-02-04 07:01:14 +01:00
|
|
|
#endif
|
|
|
|
|
2022-03-03 17:25:50 +01:00
|
|
|
#ifndef PIM_SIOCGETSGCNT
|
|
|
|
#define PIM_SIOCGETSGCNT SIOCGETSGCNT_IN6
|
2015-02-04 07:01:14 +01:00
|
|
|
#endif
|
2022-01-18 14:33:04 +01:00
|
|
|
|
2022-03-03 17:25:50 +01:00
|
|
|
#ifndef MRT6MSG_WRMIFWHOLE
|
|
|
|
#define MRT6MSG_WRMIFWHOLE 4 /* For PIM processing */
|
|
|
|
#endif
|
2022-01-18 14:33:04 +01:00
|
|
|
|
2022-03-03 17:25:50 +01:00
|
|
|
typedef struct mif6ctl pim_vifctl;
|
|
|
|
typedef struct mrt6msg kernmsg;
|
|
|
|
typedef mifi_t vifi_t;
|
|
|
|
typedef struct sioc_sg_req6 pim_sioc_sg_req;
|
2022-01-18 14:33:04 +01:00
|
|
|
|
2022-03-03 17:25:50 +01:00
|
|
|
#define vc_vifi mif6c_mifi
|
|
|
|
#define vc_flags mif6c_flags
|
|
|
|
#define vc_threshold vifc_threshold
|
|
|
|
#define vc_pifi mif6c_pifi
|
|
|
|
#define vc_rate_limit vifc_rate_limit
|
2022-01-18 14:33:04 +01:00
|
|
|
|
2022-03-03 17:25:50 +01:00
|
|
|
#define msg_im_vif im6_mif
|
|
|
|
#define msg_im_src im6_src
|
|
|
|
#define msg_im_dst im6_dst
|
2022-01-18 14:33:04 +01:00
|
|
|
|
2022-03-03 17:25:50 +01:00
|
|
|
#ifndef MAXVIFS
|
2022-01-18 14:33:04 +01:00
|
|
|
#define MAXVIFS IF_SETSIZE
|
2015-06-05 21:15:44 +02:00
|
|
|
#endif
|
2015-02-04 07:01:14 +01:00
|
|
|
|
2022-03-03 17:25:50 +01:00
|
|
|
#define VIFF_REGISTER MIFF_REGISTER
|
2016-08-04 17:09:30 +02:00
|
|
|
#endif
|
|
|
|
|
2022-03-03 17:25:50 +01:00
|
|
|
|
2015-02-04 07:01:14 +01:00
|
|
|
/*
|
|
|
|
Above: from <linux/mroute.h>
|
|
|
|
*/
|
|
|
|
|
2021-08-19 11:36:16 +02:00
|
|
|
struct channel_oil;
|
2022-05-06 12:36:51 +02:00
|
|
|
struct pim_instance;
|
2021-08-19 11:36:16 +02:00
|
|
|
|
2017-05-10 14:45:25 +02:00
|
|
|
int pim_mroute_socket_enable(struct pim_instance *pim);
|
|
|
|
int pim_mroute_socket_disable(struct pim_instance *pim);
|
2015-02-04 07:01:14 +01:00
|
|
|
|
2022-01-18 14:33:04 +01:00
|
|
|
int pim_mroute_add_vif(struct interface *ifp, pim_addr ifaddr,
|
2016-06-18 02:43:21 +02:00
|
|
|
unsigned char flags);
|
2017-05-14 20:33:53 +02:00
|
|
|
int pim_mroute_del_vif(struct interface *ifp);
|
2015-02-04 07:01:14 +01:00
|
|
|
|
2019-11-15 19:40:00 +01:00
|
|
|
int pim_upstream_mroute_add(struct channel_oil *c_oil, const char *name);
|
2019-11-15 20:09:13 +01:00
|
|
|
int pim_upstream_mroute_iif_update(struct channel_oil *c_oil, const char *name);
|
2019-11-15 19:40:00 +01:00
|
|
|
int pim_static_mroute_add(struct channel_oil *c_oil, const char *name);
|
2019-11-15 20:09:13 +01:00
|
|
|
void pim_static_mroute_iif_update(struct channel_oil *c_oil,
|
|
|
|
int input_vif_index,
|
|
|
|
const char *name);
|
2016-12-06 16:08:09 +01:00
|
|
|
int pim_mroute_del(struct channel_oil *c_oil, const char *name);
|
2015-02-04 07:01:14 +01:00
|
|
|
|
2016-07-13 17:41:41 +02:00
|
|
|
void pim_mroute_update_counters(struct channel_oil *c_oil);
|
2019-11-15 20:46:04 +01:00
|
|
|
bool pim_mroute_allow_iif_in_oil(struct channel_oil *c_oil,
|
|
|
|
int oif_index);
|
2022-03-03 17:25:50 +01:00
|
|
|
int pim_mroute_msg(struct pim_instance *pim, const char *buf, size_t buf_size,
|
|
|
|
ifindex_t ifindex);
|
|
|
|
int pim_mroute_msg_nocache(int fd, struct interface *ifp, const kernmsg *msg);
|
2022-05-03 15:49:26 +02:00
|
|
|
int pim_mroute_msg_wholepkt(int fd, struct interface *ifp, const char *buf,
|
|
|
|
size_t len);
|
2022-03-03 17:25:50 +01:00
|
|
|
int pim_mroute_msg_wrongvif(int fd, struct interface *ifp, const kernmsg *msg);
|
2022-05-03 15:49:26 +02:00
|
|
|
int pim_mroute_msg_wrvifwhole(int fd, struct interface *ifp, const char *buf,
|
|
|
|
size_t len);
|
2022-03-03 17:25:50 +01:00
|
|
|
int pim_mroute_set(struct pim_instance *pim, int enable);
|
2015-02-04 07:01:14 +01:00
|
|
|
#endif /* PIM_MROUTE_H */
|