diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-09-14 17:15:52 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-09-14 17:17:32 +0200 |
commit | 37664928bdf161dc212d61984a754464bc0b8322 (patch) | |
tree | 24e847f2c7fcd898a422f8f615079c8d415ff60c /pimd | |
parent | pimd: Add new 'debug pim nht rp' command (diff) | |
download | frr-37664928bdf161dc212d61984a754464bc0b8322.tar.xz frr-37664928bdf161dc212d61984a754464bc0b8322.zip |
pimd: Allow igmp join messages to return more detailed errors
Start the conversion of pim configuration commands to use
the ferr side channel to allow more detailed information
to be returned to cli commands.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd')
-rw-r--r-- | pimd/pim_cmd.c | 10 | ||||
-rw-r--r-- | pimd/pim_iface.c | 33 | ||||
-rw-r--r-- | pimd/pim_iface.h | 5 |
3 files changed, 17 insertions, 31 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index ab6212710..4066614f4 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -28,6 +28,7 @@ #include "hash.h" #include "nexthop.h" #include "vrf.h" +#include "ferr.h" #include "pimd.h" #include "pim_mroute.h" @@ -5839,13 +5840,8 @@ DEFUN (interface_ip_igmp_join, return CMD_WARNING_CONFIG_FAILED; } - result = pim_if_igmp_join_add(ifp, group_addr, source_addr); - if (result) { - vty_out(vty, - "%% Failure joining IGMP group %s source %s on interface %s: %d\n", - group_str, source_str, ifp->name, result); - return CMD_WARNING_CONFIG_FAILED; - } + CMD_FERR_RETURN(pim_if_igmp_join_add(ifp, group_addr, source_addr), + "Failure joining IGMP group: $ERR"); return CMD_SUCCESS; } diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c index 1afcff7cb..6cf18d08e 100644 --- a/pimd/pim_iface.c +++ b/pimd/pim_iface.c @@ -27,6 +27,7 @@ #include "linklist.h" #include "plist.h" #include "hash.h" +#include "ferr.h" #include "pimd.h" #include "pim_instance.h" @@ -1270,7 +1271,7 @@ static struct igmp_join *igmp_join_new(struct interface *ifp, return ij; } -int pim_if_igmp_join_add(struct interface *ifp, struct in_addr group_addr, +ferr_r pim_if_igmp_join_add(struct interface *ifp, struct in_addr group_addr, struct in_addr source_addr) { struct pim_interface *pim_ifp; @@ -1278,17 +1279,14 @@ int pim_if_igmp_join_add(struct interface *ifp, struct in_addr group_addr, pim_ifp = ifp->info; if (!pim_ifp) { - zlog_warn("%s: multicast not enabled on interface %s", - __PRETTY_FUNCTION__, ifp->name); - return -1; + return ferr_cfg_invalid("multicast not enabled on interface %s", + ifp->name); } if (!pim_ifp->igmp_join_list) { pim_ifp->igmp_join_list = list_new(); if (!pim_ifp->igmp_join_list) { - zlog_err("%s %s: failure: igmp_join_list=list_new()", - __FILE__, __PRETTY_FUNCTION__); - return -2; + return ferr_cfg_invalid("Insufficient memory"); } pim_ifp->igmp_join_list->del = (void (*)(void *))igmp_join_free; } @@ -1301,24 +1299,15 @@ int pim_if_igmp_join_add(struct interface *ifp, struct in_addr group_addr, sizeof(group_str)); pim_inet4_dump("<src?>", source_addr, source_str, sizeof(source_str)); - zlog_warn( - "%s: can't re-join existing IGMP group %s source %s on interface %s", - __PRETTY_FUNCTION__, group_str, source_str, ifp->name); - return -3; + return ferr_cfg_invalid( + "can't re-join existing IGMP group %s source %s on interface %s", + group_str, source_str, ifp->name); } ij = igmp_join_new(ifp, group_addr, source_addr); if (!ij) { - char group_str[INET_ADDRSTRLEN]; - char source_str[INET_ADDRSTRLEN]; - pim_inet4_dump("<grp?>", group_addr, group_str, - sizeof(group_str)); - pim_inet4_dump("<src?>", source_addr, source_str, - sizeof(source_str)); - zlog_warn( - "%s: igmp_join_new() failure for IGMP group %s source %s on interface %s", - __PRETTY_FUNCTION__, group_str, source_str, ifp->name); - return -4; + return ferr_cfg_invalid( + "Failure to create new join data structure, see log file for more information"); } if (PIM_DEBUG_IGMP_EVENTS) { @@ -1333,7 +1322,7 @@ int pim_if_igmp_join_add(struct interface *ifp, struct in_addr group_addr, __PRETTY_FUNCTION__, source_str, group_str, ifp->name); } - return 0; + return ferr_ok(); } diff --git a/pimd/pim_iface.h b/pimd/pim_iface.h index ed885ff0e..2f27a1401 100644 --- a/pimd/pim_iface.h +++ b/pimd/pim_iface.h @@ -26,6 +26,7 @@ #include "vty.h" #include "vrf.h" #include "zclient.h" +#include "ferr.h" #include "pim_igmp.h" #include "pim_upstream.h" @@ -182,8 +183,8 @@ int pim_if_t_override_msec(struct interface *ifp); struct in_addr pim_find_primary_addr(struct interface *ifp); -int pim_if_igmp_join_add(struct interface *ifp, struct in_addr group_addr, - struct in_addr source_addr); +ferr_r pim_if_igmp_join_add(struct interface *ifp, struct in_addr group_addr, + struct in_addr source_addr); int pim_if_igmp_join_del(struct interface *ifp, struct in_addr group_addr, struct in_addr source_addr); |