mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-27 13:06:51 +00:00
Merge branch 'frr/pull/246' ("Pim command cleanup")
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
commit
8f0e091b3c
156
pimd/pim_cmd.c
156
pimd/pim_cmd.c
@ -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,
|
||||
clear_ip_mroute_cmd,
|
||||
"clear ip mroute",
|
||||
@ -2670,12 +2632,12 @@ DEFUN (show_ip_pim_state,
|
||||
if (uj)
|
||||
argc--;
|
||||
|
||||
if (argc == 5)
|
||||
if (argc == 6)
|
||||
{
|
||||
src_or_group = argv[4]->arg;
|
||||
group = argv[5]->arg;
|
||||
}
|
||||
else if (argc == 4)
|
||||
else if (argc == 5)
|
||||
src_or_group = argv[4]->arg;
|
||||
|
||||
pim_show_state(vty, src_or_group, group, uj);
|
||||
@ -2815,22 +2777,16 @@ DEFUN (show_ip_multicast,
|
||||
{
|
||||
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",
|
||||
qpim_mroute_socket_fd,
|
||||
VTY_NEWLINE);
|
||||
vty_out(vty, "Mroute socket descriptor: %d%s",
|
||||
qpim_mroute_socket_fd,
|
||||
VTY_NEWLINE);
|
||||
|
||||
pim_time_uptime(uptime, sizeof(uptime), now - qpim_mroute_socket_creation);
|
||||
vty_out(vty, "Mroute socket uptime: %s%s",
|
||||
uptime,
|
||||
VTY_NEWLINE);
|
||||
}
|
||||
else {
|
||||
vty_out(vty, "Multicast disabled%s",
|
||||
VTY_NEWLINE);
|
||||
}
|
||||
pim_time_uptime(uptime, sizeof(uptime), now - qpim_mroute_socket_creation);
|
||||
vty_out(vty, "Mroute socket uptime: %s%s",
|
||||
uptime,
|
||||
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);
|
||||
}
|
||||
|
||||
DEFUN (ip_multicast_routing,
|
||||
ip_multicast_routing_cmd,
|
||||
"ip multicast-routing",
|
||||
IP_STR
|
||||
"Enable IP multicast forwarding\n")
|
||||
DEFUN_HIDDEN (ip_multicast_routing,
|
||||
ip_multicast_routing_cmd,
|
||||
"ip multicast-routing",
|
||||
IP_STR
|
||||
"Enable IP multicast forwarding\n")
|
||||
{
|
||||
pim_mroute_socket_enable();
|
||||
pim_if_add_vif_all();
|
||||
mroute_add_all();
|
||||
static_mroute_add_all();
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (no_ip_multicast_routing,
|
||||
no_ip_multicast_routing_cmd,
|
||||
"no ip multicast-routing",
|
||||
NO_STR
|
||||
IP_STR
|
||||
"Global IP configuration subcommands\n"
|
||||
"Enable IP multicast forwarding\n")
|
||||
DEFUN_HIDDEN (no_ip_multicast_routing,
|
||||
no_ip_multicast_routing_cmd,
|
||||
"no ip multicast-routing",
|
||||
NO_STR
|
||||
IP_STR
|
||||
"Global IP configuration subcommands\n"
|
||||
"Enable IP multicast forwarding\n")
|
||||
{
|
||||
mroute_del_all();
|
||||
static_mroute_del_all();
|
||||
pim_if_del_vif_all();
|
||||
pim_mroute_socket_disable();
|
||||
vty_out (vty, "Command is Disabled and will be removed in a future version%s", VTY_NEWLINE);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
@ -3657,13 +3606,9 @@ DEFUN (no_ip_ssmpingd,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (interface_ip_igmp,
|
||||
interface_ip_igmp_cmd,
|
||||
"ip igmp",
|
||||
IP_STR
|
||||
IFACE_IGMP_STR)
|
||||
static int
|
||||
pim_cmd_igmp_start (struct vty *vty, struct interface *ifp)
|
||||
{
|
||||
VTY_DECLVAR_CONTEXT(interface, ifp);
|
||||
struct pim_interface *pim_ifp;
|
||||
|
||||
pim_ifp = ifp->info;
|
||||
@ -3686,6 +3631,17 @@ DEFUN (interface_ip_igmp,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (interface_ip_igmp,
|
||||
interface_ip_igmp_cmd,
|
||||
"ip igmp",
|
||||
IP_STR
|
||||
IFACE_IGMP_STR)
|
||||
{
|
||||
VTY_DECLVAR_CONTEXT(interface, ifp);
|
||||
|
||||
return pim_cmd_igmp_start(vty, ifp);
|
||||
}
|
||||
|
||||
DEFUN (interface_no_ip_igmp,
|
||||
interface_no_ip_igmp_cmd,
|
||||
"no ip igmp",
|
||||
@ -3949,15 +3905,15 @@ DEFUN (interface_ip_igmp_query_interval,
|
||||
struct pim_interface *pim_ifp;
|
||||
int query_interval;
|
||||
int query_interval_dsec;
|
||||
int ret;
|
||||
|
||||
pim_ifp = ifp->info;
|
||||
|
||||
if (!pim_ifp) {
|
||||
vty_out(vty,
|
||||
"IGMP not enabled on interface %s. Please enable IGMP first.%s",
|
||||
ifp->name,
|
||||
VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
ret = pim_cmd_igmp_start(vty, ifp);
|
||||
if (ret != CMD_SUCCESS)
|
||||
return ret;
|
||||
pim_ifp = ifp->info;
|
||||
}
|
||||
|
||||
query_interval = atoi(argv[3]->arg);
|
||||
@ -4038,15 +3994,15 @@ DEFUN (interface_ip_igmp_version,
|
||||
VTY_DECLVAR_CONTEXT(interface,ifp);
|
||||
struct pim_interface *pim_ifp;
|
||||
int igmp_version;
|
||||
int ret;
|
||||
|
||||
pim_ifp = ifp->info;
|
||||
|
||||
if (!pim_ifp) {
|
||||
vty_out(vty,
|
||||
"IGMP not enabled on interface %s. Please enable IGMP first.%s",
|
||||
ifp->name,
|
||||
VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
ret = pim_cmd_igmp_start(vty, ifp);
|
||||
if (ret != CMD_SUCCESS)
|
||||
return ret;
|
||||
pim_ifp = ifp->info;
|
||||
}
|
||||
|
||||
igmp_version = atoi(argv[3]->arg);
|
||||
@ -4091,15 +4047,15 @@ DEFUN (interface_ip_igmp_query_max_response_time,
|
||||
VTY_DECLVAR_CONTEXT(interface, ifp);
|
||||
struct pim_interface *pim_ifp;
|
||||
int query_max_response_time;
|
||||
int ret;
|
||||
|
||||
pim_ifp = ifp->info;
|
||||
|
||||
if (!pim_ifp) {
|
||||
vty_out(vty,
|
||||
"IGMP not enabled on interface %s. Please enable IGMP first.%s",
|
||||
ifp->name,
|
||||
VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
ret = pim_cmd_igmp_start(vty, ifp);
|
||||
if (ret != CMD_SUCCESS)
|
||||
return ret;
|
||||
pim_ifp = ifp->info;
|
||||
}
|
||||
|
||||
query_max_response_time = atoi(argv[3]->arg);
|
||||
@ -4154,15 +4110,15 @@ DEFUN_HIDDEN (interface_ip_igmp_query_max_response_time_dsec,
|
||||
struct pim_interface *pim_ifp;
|
||||
int query_max_response_time_dsec;
|
||||
int default_query_interval_dsec;
|
||||
int ret;
|
||||
|
||||
pim_ifp = ifp->info;
|
||||
|
||||
if (!pim_ifp) {
|
||||
vty_out(vty,
|
||||
"IGMP not enabled on interface %s. Please enable IGMP first.%s",
|
||||
ifp->name,
|
||||
VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
ret = pim_cmd_igmp_start(vty, ifp);
|
||||
if (ret != CMD_SUCCESS)
|
||||
return ret;
|
||||
pim_ifp = ifp->info;
|
||||
}
|
||||
|
||||
query_max_response_time_dsec = atoi(argv[4]->arg);
|
||||
|
@ -173,9 +173,7 @@ struct pim_interface *pim_if_new(struct interface *ifp, int igmp, int pim)
|
||||
|
||||
pim_sock_reset(ifp);
|
||||
|
||||
if (PIM_MROUTE_IS_ENABLED) {
|
||||
pim_if_add_vif(ifp);
|
||||
}
|
||||
pim_if_add_vif(ifp);
|
||||
|
||||
return pim_ifp;
|
||||
}
|
||||
@ -197,9 +195,7 @@ void pim_if_delete(struct interface *ifp)
|
||||
|
||||
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->pim_neighbor_list);
|
||||
@ -591,16 +587,14 @@ void pim_if_addr_add(struct connected *ifc)
|
||||
}
|
||||
} /* pim */
|
||||
|
||||
if (PIM_MROUTE_IS_ENABLED) {
|
||||
/*
|
||||
PIM or IGMP is enabled on interface, and there is at least one
|
||||
address assigned, then try to create a vif_index.
|
||||
*/
|
||||
if (pim_ifp->mroute_vif_index < 0) {
|
||||
pim_if_add_vif(ifp);
|
||||
}
|
||||
pim_ifchannel_scan_forward_start (ifp);
|
||||
if (pim_ifp->mroute_vif_index < 0) {
|
||||
pim_if_add_vif(ifp);
|
||||
}
|
||||
pim_ifchannel_scan_forward_start (ifp);
|
||||
}
|
||||
|
||||
static void pim_if_addr_del_igmp(struct connected *ifc)
|
||||
@ -730,16 +724,14 @@ void pim_if_addr_add_all(struct interface *ifp)
|
||||
}
|
||||
} /* pim */
|
||||
}
|
||||
if (PIM_MROUTE_IS_ENABLED) {
|
||||
/*
|
||||
* PIM or IGMP is enabled on interface, and there is at least one
|
||||
* address assigned, then try to create a vif_index.
|
||||
*/
|
||||
if (pim_ifp->mroute_vif_index < 0) {
|
||||
pim_if_add_vif(ifp);
|
||||
}
|
||||
pim_ifchannel_scan_forward_start (ifp);
|
||||
/*
|
||||
* PIM or IGMP is enabled on interface, and there is at least one
|
||||
* address assigned, then try to create a vif_index.
|
||||
*/
|
||||
if (pim_ifp->mroute_vif_index < 0) {
|
||||
pim_if_add_vif(ifp);
|
||||
}
|
||||
pim_ifchannel_scan_forward_start (ifp);
|
||||
|
||||
pim_rp_setup();
|
||||
pim_rp_check_on_if_add(pim_ifp);
|
||||
|
@ -608,7 +608,6 @@ static int mroute_read(struct thread *t)
|
||||
static void mroute_read_on()
|
||||
{
|
||||
zassert(!qpim_mroute_socket_reader);
|
||||
zassert(PIM_MROUTE_IS_ENABLED);
|
||||
|
||||
THREAD_READ_ON(master, qpim_mroute_socket_reader,
|
||||
mroute_read, 0, qpim_mroute_socket_fd);
|
||||
@ -623,9 +622,6 @@ int pim_mroute_socket_enable()
|
||||
{
|
||||
int fd;
|
||||
|
||||
if (PIM_MROUTE_IS_ENABLED)
|
||||
return -1;
|
||||
|
||||
if ( pimd_privs.change (ZPRIVS_RAISE) )
|
||||
zlog_err ("pim_mroute_socket_enable: could not raise privs, %s",
|
||||
safe_strerror (errno) );
|
||||
@ -659,9 +655,6 @@ int pim_mroute_socket_enable()
|
||||
|
||||
int pim_mroute_socket_disable()
|
||||
{
|
||||
if (PIM_MROUTE_IS_DISABLED)
|
||||
return -1;
|
||||
|
||||
if (pim_mroute_set(qpim_mroute_socket_fd, 0)) {
|
||||
zlog_warn("Could not disable mroute on socket fd=%d: errno=%d: %s",
|
||||
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;
|
||||
int err;
|
||||
|
||||
if (PIM_MROUTE_IS_DISABLED) {
|
||||
zlog_warn("%s: global multicast is disabled",
|
||||
__PRETTY_FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(&vc, 0, sizeof(vc));
|
||||
vc.vifc_vifi = pim_ifp->mroute_vif_index;
|
||||
#ifdef VIFF_USE_IFINDEX
|
||||
@ -740,12 +727,6 @@ int pim_mroute_del_vif(int vif_index)
|
||||
struct vifctl vc;
|
||||
int err;
|
||||
|
||||
if (PIM_MROUTE_IS_DISABLED) {
|
||||
zlog_warn("%s: global multicast is disabled",
|
||||
__PRETTY_FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (PIM_DEBUG_MROUTE)
|
||||
{
|
||||
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_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. */
|
||||
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_events;
|
||||
|
||||
if (PIM_MROUTE_IS_DISABLED) {
|
||||
zlog_warn("%s: global multicast is disabled",
|
||||
__PRETTY_FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!c_oil->installed)
|
||||
{
|
||||
if (PIM_DEBUG_MROUTE)
|
||||
|
@ -148,11 +148,6 @@ int pim_global_config_write(struct vty *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);
|
||||
|
||||
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_mroute_socket_fd = -1; /* mark mroute as disabled */
|
||||
pim_mroute_socket_enable();
|
||||
|
||||
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_MROUTE_IS_ENABLED (qpim_mroute_socket_fd >= 0)
|
||||
#define PIM_MROUTE_IS_DISABLED (qpim_mroute_socket_fd < 0)
|
||||
|
||||
/*
|
||||
* Register-Stop Timer (RST(S,G))
|
||||
* Default values
|
||||
|
Loading…
Reference in New Issue
Block a user