forked from Mirror/frr
pimd: Hide 'ip multicast-routing' command
Automatically turn on pim if the daemon is turned on. Hide the 'ip multicast-routing' command Disable the 'no ip multicast-routing' command Do not display the 'ip multicast-routing' command. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
21419f5932
commit
b8d16be287
|
@ -2342,44 +2342,6 @@ static void mroute_del_all()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void static_mroute_add_all()
|
|
||||||
{
|
|
||||||
struct listnode *node;
|
|
||||||
struct static_route *s_route;
|
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list, node, s_route)) {
|
|
||||||
if (pim_mroute_add(&s_route->c_oil, __PRETTY_FUNCTION__)) {
|
|
||||||
/* just log warning */
|
|
||||||
char source_str[INET_ADDRSTRLEN];
|
|
||||||
char group_str[INET_ADDRSTRLEN];
|
|
||||||
pim_inet4_dump("<source?>", s_route->c_oil.oil.mfcc_origin, source_str, sizeof(source_str));
|
|
||||||
pim_inet4_dump("<group?>", s_route->c_oil.oil.mfcc_mcastgrp, group_str, sizeof(group_str));
|
|
||||||
zlog_warn("%s %s: (S,G)=(%s,%s) failure writing MFC",
|
|
||||||
__FILE__, __PRETTY_FUNCTION__,
|
|
||||||
source_str, group_str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void static_mroute_del_all()
|
|
||||||
{
|
|
||||||
struct listnode *node;
|
|
||||||
struct static_route *s_route;
|
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list, node, s_route)) {
|
|
||||||
if (pim_mroute_del(&s_route->c_oil, __PRETTY_FUNCTION__)) {
|
|
||||||
/* just log warning */
|
|
||||||
char source_str[INET_ADDRSTRLEN];
|
|
||||||
char group_str[INET_ADDRSTRLEN];
|
|
||||||
pim_inet4_dump("<source?>", s_route->c_oil.oil.mfcc_origin, source_str, sizeof(source_str));
|
|
||||||
pim_inet4_dump("<group?>", s_route->c_oil.oil.mfcc_mcastgrp, group_str, sizeof(group_str));
|
|
||||||
zlog_warn("%s %s: (S,G)=(%s,%s) failure clearing MFC",
|
|
||||||
__FILE__, __PRETTY_FUNCTION__,
|
|
||||||
source_str, group_str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN (clear_ip_mroute,
|
DEFUN (clear_ip_mroute,
|
||||||
clear_ip_mroute_cmd,
|
clear_ip_mroute_cmd,
|
||||||
"clear ip mroute",
|
"clear ip mroute",
|
||||||
|
@ -2815,22 +2777,16 @@ DEFUN (show_ip_multicast,
|
||||||
{
|
{
|
||||||
time_t now = pim_time_monotonic_sec();
|
time_t now = pim_time_monotonic_sec();
|
||||||
|
|
||||||
if (PIM_MROUTE_IS_ENABLED) {
|
char uptime[10];
|
||||||
char uptime[10];
|
|
||||||
|
|
||||||
vty_out(vty, "Mroute socket descriptor: %d%s",
|
vty_out(vty, "Mroute socket descriptor: %d%s",
|
||||||
qpim_mroute_socket_fd,
|
qpim_mroute_socket_fd,
|
||||||
VTY_NEWLINE);
|
VTY_NEWLINE);
|
||||||
|
|
||||||
pim_time_uptime(uptime, sizeof(uptime), now - qpim_mroute_socket_creation);
|
pim_time_uptime(uptime, sizeof(uptime), now - qpim_mroute_socket_creation);
|
||||||
vty_out(vty, "Mroute socket uptime: %s%s",
|
vty_out(vty, "Mroute socket uptime: %s%s",
|
||||||
uptime,
|
uptime,
|
||||||
VTY_NEWLINE);
|
VTY_NEWLINE);
|
||||||
}
|
|
||||||
else {
|
|
||||||
vty_out(vty, "Multicast disabled%s",
|
|
||||||
VTY_NEWLINE);
|
|
||||||
}
|
|
||||||
|
|
||||||
vty_out(vty, "%s", VTY_NEWLINE);
|
vty_out(vty, "%s", VTY_NEWLINE);
|
||||||
|
|
||||||
|
@ -3570,31 +3526,24 @@ DEFUN (no_ip_pim_rp_prefix_list,
|
||||||
return pim_no_rp_cmd_worker (vty, argv[4]->arg, NULL, argv[6]->arg);
|
return pim_no_rp_cmd_worker (vty, argv[4]->arg, NULL, argv[6]->arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (ip_multicast_routing,
|
DEFUN_HIDDEN (ip_multicast_routing,
|
||||||
ip_multicast_routing_cmd,
|
ip_multicast_routing_cmd,
|
||||||
"ip multicast-routing",
|
"ip multicast-routing",
|
||||||
IP_STR
|
IP_STR
|
||||||
"Enable IP multicast forwarding\n")
|
"Enable IP multicast forwarding\n")
|
||||||
{
|
{
|
||||||
pim_mroute_socket_enable();
|
|
||||||
pim_if_add_vif_all();
|
|
||||||
mroute_add_all();
|
|
||||||
static_mroute_add_all();
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (no_ip_multicast_routing,
|
DEFUN_HIDDEN (no_ip_multicast_routing,
|
||||||
no_ip_multicast_routing_cmd,
|
no_ip_multicast_routing_cmd,
|
||||||
"no ip multicast-routing",
|
"no ip multicast-routing",
|
||||||
NO_STR
|
NO_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
"Global IP configuration subcommands\n"
|
"Global IP configuration subcommands\n"
|
||||||
"Enable IP multicast forwarding\n")
|
"Enable IP multicast forwarding\n")
|
||||||
{
|
{
|
||||||
mroute_del_all();
|
vty_out (vty, "Command is Disabled and will be removed in a future version%s", VTY_NEWLINE);
|
||||||
static_mroute_del_all();
|
|
||||||
pim_if_del_vif_all();
|
|
||||||
pim_mroute_socket_disable();
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,9 +173,7 @@ struct pim_interface *pim_if_new(struct interface *ifp, int igmp, int pim)
|
||||||
|
|
||||||
pim_sock_reset(ifp);
|
pim_sock_reset(ifp);
|
||||||
|
|
||||||
if (PIM_MROUTE_IS_ENABLED) {
|
pim_if_add_vif(ifp);
|
||||||
pim_if_add_vif(ifp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pim_ifp;
|
return pim_ifp;
|
||||||
}
|
}
|
||||||
|
@ -197,9 +195,7 @@ void pim_if_delete(struct interface *ifp)
|
||||||
|
|
||||||
pim_neighbor_delete_all (ifp, "Interface removed from configuration");
|
pim_neighbor_delete_all (ifp, "Interface removed from configuration");
|
||||||
|
|
||||||
if (PIM_MROUTE_IS_ENABLED) {
|
pim_if_del_vif(ifp);
|
||||||
pim_if_del_vif(ifp);
|
|
||||||
}
|
|
||||||
|
|
||||||
list_delete(pim_ifp->igmp_socket_list);
|
list_delete(pim_ifp->igmp_socket_list);
|
||||||
list_delete(pim_ifp->pim_neighbor_list);
|
list_delete(pim_ifp->pim_neighbor_list);
|
||||||
|
@ -591,16 +587,14 @@ void pim_if_addr_add(struct connected *ifc)
|
||||||
}
|
}
|
||||||
} /* pim */
|
} /* pim */
|
||||||
|
|
||||||
if (PIM_MROUTE_IS_ENABLED) {
|
|
||||||
/*
|
/*
|
||||||
PIM or IGMP is enabled on interface, and there is at least one
|
PIM or IGMP is enabled on interface, and there is at least one
|
||||||
address assigned, then try to create a vif_index.
|
address assigned, then try to create a vif_index.
|
||||||
*/
|
*/
|
||||||
if (pim_ifp->mroute_vif_index < 0) {
|
if (pim_ifp->mroute_vif_index < 0) {
|
||||||
pim_if_add_vif(ifp);
|
pim_if_add_vif(ifp);
|
||||||
}
|
|
||||||
pim_ifchannel_scan_forward_start (ifp);
|
|
||||||
}
|
}
|
||||||
|
pim_ifchannel_scan_forward_start (ifp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pim_if_addr_del_igmp(struct connected *ifc)
|
static void pim_if_addr_del_igmp(struct connected *ifc)
|
||||||
|
@ -730,16 +724,14 @@ void pim_if_addr_add_all(struct interface *ifp)
|
||||||
}
|
}
|
||||||
} /* pim */
|
} /* pim */
|
||||||
}
|
}
|
||||||
if (PIM_MROUTE_IS_ENABLED) {
|
/*
|
||||||
/*
|
* PIM or IGMP is enabled on interface, and there is at least one
|
||||||
* PIM or IGMP is enabled on interface, and there is at least one
|
* address assigned, then try to create a vif_index.
|
||||||
* address assigned, then try to create a vif_index.
|
*/
|
||||||
*/
|
if (pim_ifp->mroute_vif_index < 0) {
|
||||||
if (pim_ifp->mroute_vif_index < 0) {
|
pim_if_add_vif(ifp);
|
||||||
pim_if_add_vif(ifp);
|
|
||||||
}
|
|
||||||
pim_ifchannel_scan_forward_start (ifp);
|
|
||||||
}
|
}
|
||||||
|
pim_ifchannel_scan_forward_start (ifp);
|
||||||
|
|
||||||
pim_rp_setup();
|
pim_rp_setup();
|
||||||
pim_rp_check_on_if_add(pim_ifp);
|
pim_rp_check_on_if_add(pim_ifp);
|
||||||
|
|
|
@ -608,7 +608,6 @@ static int mroute_read(struct thread *t)
|
||||||
static void mroute_read_on()
|
static void mroute_read_on()
|
||||||
{
|
{
|
||||||
zassert(!qpim_mroute_socket_reader);
|
zassert(!qpim_mroute_socket_reader);
|
||||||
zassert(PIM_MROUTE_IS_ENABLED);
|
|
||||||
|
|
||||||
THREAD_READ_ON(master, qpim_mroute_socket_reader,
|
THREAD_READ_ON(master, qpim_mroute_socket_reader,
|
||||||
mroute_read, 0, qpim_mroute_socket_fd);
|
mroute_read, 0, qpim_mroute_socket_fd);
|
||||||
|
@ -623,9 +622,6 @@ int pim_mroute_socket_enable()
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
if (PIM_MROUTE_IS_ENABLED)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if ( pimd_privs.change (ZPRIVS_RAISE) )
|
if ( pimd_privs.change (ZPRIVS_RAISE) )
|
||||||
zlog_err ("pim_mroute_socket_enable: could not raise privs, %s",
|
zlog_err ("pim_mroute_socket_enable: could not raise privs, %s",
|
||||||
safe_strerror (errno) );
|
safe_strerror (errno) );
|
||||||
|
@ -659,9 +655,6 @@ int pim_mroute_socket_enable()
|
||||||
|
|
||||||
int pim_mroute_socket_disable()
|
int pim_mroute_socket_disable()
|
||||||
{
|
{
|
||||||
if (PIM_MROUTE_IS_DISABLED)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (pim_mroute_set(qpim_mroute_socket_fd, 0)) {
|
if (pim_mroute_set(qpim_mroute_socket_fd, 0)) {
|
||||||
zlog_warn("Could not disable mroute on socket fd=%d: errno=%d: %s",
|
zlog_warn("Could not disable mroute on socket fd=%d: errno=%d: %s",
|
||||||
qpim_mroute_socket_fd, errno, safe_strerror(errno));
|
qpim_mroute_socket_fd, errno, safe_strerror(errno));
|
||||||
|
@ -691,12 +684,6 @@ int pim_mroute_add_vif(struct interface *ifp, struct in_addr ifaddr, unsigned ch
|
||||||
struct vifctl vc;
|
struct vifctl vc;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (PIM_MROUTE_IS_DISABLED) {
|
|
||||||
zlog_warn("%s: global multicast is disabled",
|
|
||||||
__PRETTY_FUNCTION__);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(&vc, 0, sizeof(vc));
|
memset(&vc, 0, sizeof(vc));
|
||||||
vc.vifc_vifi = pim_ifp->mroute_vif_index;
|
vc.vifc_vifi = pim_ifp->mroute_vif_index;
|
||||||
#ifdef VIFF_USE_IFINDEX
|
#ifdef VIFF_USE_IFINDEX
|
||||||
|
@ -740,12 +727,6 @@ int pim_mroute_del_vif(int vif_index)
|
||||||
struct vifctl vc;
|
struct vifctl vc;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (PIM_MROUTE_IS_DISABLED) {
|
|
||||||
zlog_warn("%s: global multicast is disabled",
|
|
||||||
__PRETTY_FUNCTION__);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PIM_DEBUG_MROUTE)
|
if (PIM_DEBUG_MROUTE)
|
||||||
{
|
{
|
||||||
struct interface *ifp = pim_if_find_by_vif_index (vif_index);
|
struct interface *ifp = pim_if_find_by_vif_index (vif_index);
|
||||||
|
@ -777,11 +758,6 @@ int pim_mroute_add(struct channel_oil *c_oil, const char *name)
|
||||||
qpim_mroute_add_last = pim_time_monotonic_sec();
|
qpim_mroute_add_last = pim_time_monotonic_sec();
|
||||||
++qpim_mroute_add_events;
|
++qpim_mroute_add_events;
|
||||||
|
|
||||||
if (PIM_MROUTE_IS_DISABLED) {
|
|
||||||
zlog_warn("%s: global multicast is disabled",
|
|
||||||
__PRETTY_FUNCTION__);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
/* Do not install route if incoming interface is undefined. */
|
/* Do not install route if incoming interface is undefined. */
|
||||||
if (c_oil->oil.mfcc_parent == MAXVIFS)
|
if (c_oil->oil.mfcc_parent == MAXVIFS)
|
||||||
{
|
{
|
||||||
|
@ -858,12 +834,6 @@ int pim_mroute_del (struct channel_oil *c_oil, const char *name)
|
||||||
qpim_mroute_del_last = pim_time_monotonic_sec();
|
qpim_mroute_del_last = pim_time_monotonic_sec();
|
||||||
++qpim_mroute_del_events;
|
++qpim_mroute_del_events;
|
||||||
|
|
||||||
if (PIM_MROUTE_IS_DISABLED) {
|
|
||||||
zlog_warn("%s: global multicast is disabled",
|
|
||||||
__PRETTY_FUNCTION__);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!c_oil->installed)
|
if (!c_oil->installed)
|
||||||
{
|
{
|
||||||
if (PIM_DEBUG_MROUTE)
|
if (PIM_DEBUG_MROUTE)
|
||||||
|
|
|
@ -148,11 +148,6 @@ int pim_global_config_write(struct vty *vty)
|
||||||
|
|
||||||
writes += pim_msdp_config_write (vty);
|
writes += pim_msdp_config_write (vty);
|
||||||
|
|
||||||
if (PIM_MROUTE_IS_ENABLED) {
|
|
||||||
vty_out(vty, "ip multicast-routing%s", VTY_NEWLINE);
|
|
||||||
++writes;
|
|
||||||
}
|
|
||||||
|
|
||||||
writes += pim_rp_config_write (vty);
|
writes += pim_rp_config_write (vty);
|
||||||
|
|
||||||
if (qpim_register_suppress_time != PIM_REGISTER_SUPPRESSION_TIME_DEFAULT)
|
if (qpim_register_suppress_time != PIM_REGISTER_SUPPRESSION_TIME_DEFAULT)
|
||||||
|
|
|
@ -124,7 +124,7 @@ void pim_init()
|
||||||
}
|
}
|
||||||
qpim_static_route_list->del = (void (*)(void *)) pim_static_route_free;
|
qpim_static_route_list->del = (void (*)(void *)) pim_static_route_free;
|
||||||
|
|
||||||
qpim_mroute_socket_fd = -1; /* mark mroute as disabled */
|
pim_mroute_socket_enable();
|
||||||
|
|
||||||
qpim_inaddr_any.s_addr = PIM_NET_INADDR_ANY;
|
qpim_inaddr_any.s_addr = PIM_NET_INADDR_ANY;
|
||||||
|
|
||||||
|
|
|
@ -154,9 +154,6 @@ extern int qpim_packet_process;
|
||||||
|
|
||||||
#define PIM_JP_HOLDTIME (qpim_t_periodic * 7 / 2)
|
#define PIM_JP_HOLDTIME (qpim_t_periodic * 7 / 2)
|
||||||
|
|
||||||
#define PIM_MROUTE_IS_ENABLED (qpim_mroute_socket_fd >= 0)
|
|
||||||
#define PIM_MROUTE_IS_DISABLED (qpim_mroute_socket_fd < 0)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Register-Stop Timer (RST(S,G))
|
* Register-Stop Timer (RST(S,G))
|
||||||
* Default values
|
* Default values
|
||||||
|
|
Loading…
Reference in a new issue