From e018c7cc9a7d218ce3a28b5619761c22eb060882 Mon Sep 17 00:00:00 2001 From: Sid Khot Date: Fri, 12 Aug 2016 17:09:27 -0700 Subject: [PATCH 1/3] bgpd: Reverting fix for CM-5040: BGP and OSPF should accept "router-id use-loopback" ospfd: Reverting fix for CM-5040: BGP and OSPF should accept "router-id use-loopback" This reverts commit cdb805bc9e45e355f4f034be8c89f0b7ca7894fd. Conflicts: bgpd/bgp_vty.c --- bgpd/bgp_vty.c | 83 +++++-------------------------------------- ospfd/ospf_vty.c | 92 ------------------------------------------------ 2 files changed, 8 insertions(+), 167 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 0f27069a95..9df92fea03 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -32,8 +32,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "memory.h" #include "hash.h" #include "queue.h" -#include "if.h" -#include "vrf.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_advertise.h" @@ -835,10 +833,6 @@ DEFUN (no_bgp_router_id, int ret; struct in_addr id; struct bgp *bgp; - struct interface *ifp; - struct listnode *node; - struct connected *ifc; - struct prefix *p; bgp = vty->index; @@ -846,28 +840,16 @@ DEFUN (no_bgp_router_id, { ret = inet_aton (argv[0], &id); if (! ret) - { - ifp = if_lookup_by_name_vrf(argv[0], bgp->vrf_id); - if (!ifp) { - vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); - return CMD_WARNING; - } - for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, ifc)) - { - p = ifc->address; - if (p && (p->family == AF_INET)) - { - id = p->u.prefix4; - break; - } - } - } + { + vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); + return CMD_WARNING; + } if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) - { - vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); - return CMD_WARNING; - } + { + vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); + return CMD_WARNING; + } } id.s_addr = 0; @@ -884,53 +866,6 @@ ALIAS (no_bgp_router_id, "Override configured router identifier\n" "Manually configured router identifier\n") -DEFUN (bgp_router_id_interface, - bgp_router_id_interface_cmd, - "bgp router-id IFNAME", - BGP_STR - "Override configured router identifier\n" - "Interface name\n") -{ - struct bgp *bgp; - struct interface *ifp; - struct connected *ifc; - struct listnode *node; - struct prefix *p; - struct vrf *vrf; - - bgp = vty->index; - p = NULL; - - ifp = if_lookup_by_name_vrf(argv[0], bgp->vrf_id); - if (!ifp) - { - vrf = vrf_lookup(bgp->vrf_id); - vty_out (vty, "%% Couldnt find interface %s in VRF %s%s", argv[0], vrf? vrf->name:"", VTY_NEWLINE); - return CMD_WARNING; - } - - for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, ifc)) - { - p = ifc->address; - - if (p && (p->family == AF_INET)) - { - bgp_router_id_static_set(bgp, p->u.prefix4); - return CMD_SUCCESS; - } - } - vty_out (vty, "%% Couldnt assign the router-id%s", VTY_NEWLINE); - return CMD_WARNING; -} - -ALIAS (no_bgp_router_id, - no_bgp_router_id_interface_cmd, - "no bgp router-id IFNAME", - NO_STR - BGP_STR - "Override configured router identifier\n" - "Interface name\n") - /* BGP Cluster ID. */ DEFUN (bgp_cluster_id, @@ -14477,8 +14412,6 @@ bgp_vty_init (void) install_element (BGP_NODE, &bgp_router_id_cmd); install_element (BGP_NODE, &no_bgp_router_id_cmd); install_element (BGP_NODE, &no_bgp_router_id_val_cmd); - install_element (BGP_NODE, &bgp_router_id_interface_cmd); - install_element (BGP_NODE, &no_bgp_router_id_interface_cmd); /* "bgp cluster-id" commands. */ install_element (BGP_NODE, &bgp_cluster_id_cmd); diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index beda0caa11..16fab68c99 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -271,43 +271,10 @@ DEFUN (no_ospf_router_id, struct ospf *ospf = vty->index; struct listnode *node; struct ospf_area *area; - struct in_addr id; - struct interface *ifp; - struct connected *ifc; - struct prefix *p; - int ret; if (!ospf) return CMD_SUCCESS; - if (argc == 1) - { - ret = inet_aton (argv[0], &id); - if (! ret) - { - ifp = if_lookup_by_name(argv[0]); - if (!ifp) { - vty_out (vty, "%% Malformed OSPF router identifier%s", VTY_NEWLINE); - return CMD_WARNING; - } - for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, ifc)) - { - p = ifc->address; - if (p && (p->family == AF_INET)) - { - id = p->u.prefix4; - break; - } - } - } - - if (! IPV4_ADDR_SAME (&ospf->router_id_static, &id)) - { - vty_out (vty, "%% OSPF router-id doesn't match%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - ospf->router_id_static.s_addr = 0; for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) @@ -331,63 +298,6 @@ ALIAS (no_ospf_router_id, "router-id for the OSPF process\n" "OSPF router-id in IP address format\n") -DEFUN (ospf_router_id_interface, - ospf_router_id_interface_cmd, - "ospf router-id IFNAME", - "OSPF specific commands\n" - "router-id for the OSPF process\n" - "Interface name\n") -{ - struct ospf *ospf = vty->index; - struct listnode *node; - struct ospf_area *area; - struct interface *ifp; - struct connected *ifc; - struct prefix *p; - - if (!ospf) - return CMD_SUCCESS; - - p = NULL; - ifp = if_lookup_by_name(argv[0]); - if (!ifp) - { - vty_out (vty, "%% Couldnt find interface %s%s", argv[0], VTY_NEWLINE); - return CMD_WARNING; - } - - for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, ifc)) - { - p = ifc->address; - - if (p && (p->family == AF_INET)) - { - if (IPV4_ADDR_SAME (&ospf->router_id_static, &p->u.prefix4)) - return CMD_SUCCESS; - ospf->router_id_static = p->u.prefix4; - for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) - if (area->full_nbrs) - { - vty_out (vty, "For this router-id change to take effect," - " save config and restart ospfd%s", VTY_NEWLINE); - return CMD_SUCCESS; - } - ospf_router_id_update (ospf); - return CMD_SUCCESS; - } - } - vty_out (vty, "%% Couldnt assign the router-id%s", VTY_NEWLINE); - return CMD_WARNING; -} - -ALIAS (no_ospf_router_id, - no_ospf_router_id_interface_cmd, - "no ospf router-id IFNAME", - NO_STR - "OSPF specific commands\n" - "router-id for the OSPF process\n" - "Interface name\n") - static void ospf_passive_interface_default (struct ospf *ospf, u_char newval) { @@ -10421,10 +10331,8 @@ ospf_vty_init (void) /* "ospf router-id" commands. */ install_element (OSPF_NODE, &ospf_router_id_cmd); install_element (OSPF_NODE, &ospf_router_id_old_cmd); - install_element (OSPF_NODE, &ospf_router_id_interface_cmd); install_element (OSPF_NODE, &no_ospf_router_id_cmd); install_element (OSPF_NODE, &no_ospf_router_id_val_cmd); - install_element (OSPF_NODE, &no_ospf_router_id_interface_cmd); /* "passive-interface" commands. */ install_element (OSPF_NODE, &ospf_passive_interface_addr_cmd); From f04605f4e5518ca161ee4088895988c4ae050b57 Mon Sep 17 00:00:00 2001 From: Dinesh G Dutt Date: Sat, 13 Aug 2016 00:41:21 -0700 Subject: [PATCH 2/3] Remove individual daemon conf files and replace with Quagga.conf Ticket: CM-11777 Reviewed By: CCR-5096 Testing Done: The recommended, and in many ways the only supported, model for the configuration file of quagga is to use a single Quagga.conf configuration file. However, we weren't shipping with this model, which led to some confusion amongst users. This patch fixes this by removing all individual daemon configuration files and replacing it with the single Quagga.conf file. --- cumulus/etc/quagga/Quagga.conf | 3 +++ cumulus/etc/quagga/bgpd.conf | 3 --- cumulus/etc/quagga/ospf6d.conf | 3 --- cumulus/etc/quagga/ospfd.conf | 3 --- cumulus/etc/quagga/pimd.conf | 5 ----- cumulus/etc/quagga/zebra.conf | 2 -- 6 files changed, 3 insertions(+), 16 deletions(-) create mode 100644 cumulus/etc/quagga/Quagga.conf delete mode 100644 cumulus/etc/quagga/bgpd.conf delete mode 100644 cumulus/etc/quagga/ospf6d.conf delete mode 100644 cumulus/etc/quagga/ospfd.conf delete mode 100644 cumulus/etc/quagga/pimd.conf delete mode 100644 cumulus/etc/quagga/zebra.conf diff --git a/cumulus/etc/quagga/Quagga.conf b/cumulus/etc/quagga/Quagga.conf new file mode 100644 index 0000000000..a0b3ee0cfb --- /dev/null +++ b/cumulus/etc/quagga/Quagga.conf @@ -0,0 +1,3 @@ +log file /var/log/quagga/quagga.log +log timestamp precision 6 + diff --git a/cumulus/etc/quagga/bgpd.conf b/cumulus/etc/quagga/bgpd.conf deleted file mode 100644 index 7c9c5ae286..0000000000 --- a/cumulus/etc/quagga/bgpd.conf +++ /dev/null @@ -1,3 +0,0 @@ -hostname bgpd -log timestamp precision 6 -log file /var/log/quagga/bgpd.log diff --git a/cumulus/etc/quagga/ospf6d.conf b/cumulus/etc/quagga/ospf6d.conf deleted file mode 100644 index 408ca1af1e..0000000000 --- a/cumulus/etc/quagga/ospf6d.conf +++ /dev/null @@ -1,3 +0,0 @@ -hostname ospfd -log timestamp precision 6 -log file /var/log/quagga/ospf6d.log diff --git a/cumulus/etc/quagga/ospfd.conf b/cumulus/etc/quagga/ospfd.conf deleted file mode 100644 index 8f2e53e030..0000000000 --- a/cumulus/etc/quagga/ospfd.conf +++ /dev/null @@ -1,3 +0,0 @@ -hostname ospfd -log timestamp precision 6 -log file /var/log/quagga/ospfd.log diff --git a/cumulus/etc/quagga/pimd.conf b/cumulus/etc/quagga/pimd.conf deleted file mode 100644 index 8aa1e7f5f0..0000000000 --- a/cumulus/etc/quagga/pimd.conf +++ /dev/null @@ -1,5 +0,0 @@ -hostname pimd -password cn321 -enable password cn321 -log timestamp precision 6 -log file /var/log/quagga/pimd.log diff --git a/cumulus/etc/quagga/zebra.conf b/cumulus/etc/quagga/zebra.conf deleted file mode 100644 index 67e4799413..0000000000 --- a/cumulus/etc/quagga/zebra.conf +++ /dev/null @@ -1,2 +0,0 @@ -hostname zebra -log file /var/log/quagga/zebra.log From 911ad1e2f9044191a1d05d384212078d6011ac35 Mon Sep 17 00:00:00 2001 From: vivek Date: Sat, 13 Aug 2016 13:25:56 -0700 Subject: [PATCH 3/3] zebra: Fix interface lookup for RA statistics Ensure we lookup interface across VRFs, not just in the default VRF. Signed-off-by: Vivek Venkatraman Reviewed-by: Dinesh Dutt Ticket: CM-12357 Reviewed By: CCR-5097 Testing Done: Manual, bgp-min --- zebra/rtadv.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 750502aa23..f3f1cee14b 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -69,22 +69,25 @@ static void rtadv_event (struct zebra_ns *, enum rtadv_event, int); static int if_join_all_router (int, struct interface *); static int if_leave_all_router (int, struct interface *); -static int rtadv_increment_received(unsigned int *ifindex) { +static int +rtadv_increment_received(struct zebra_ns *zns, unsigned int *ifindex) +{ int ret = -1; struct interface *iface; struct zebra_if *zif; - iface = if_lookup_by_index_vrf(*ifindex, VRF_DEFAULT); - if (iface && iface->info) { - zif = iface->info; - zif->ra_rcvd++; - ret = 0; - } + iface = if_lookup_by_index_per_ns (zns, *ifindex); + if (iface && iface->info) + { + zif = iface->info; + zif->ra_rcvd++; + ret = 0; + } return ret; } static int -rtadv_recv_packet (int sock, u_char *buf, int buflen, +rtadv_recv_packet (struct zebra_ns *zns, int sock, u_char *buf, int buflen, struct sockaddr_in6 *from, unsigned int *ifindex, int *hoplimit) { @@ -134,10 +137,7 @@ rtadv_recv_packet (int sock, u_char *buf, int buflen, } } - if(rtadv_increment_received(ifindex) < 0) - zlog_err("%s: could not increment RA received counter on ifindex %d", - __func__, *ifindex); - + rtadv_increment_received(zns, ifindex); return ret; } @@ -619,7 +619,7 @@ rtadv_read (struct thread *thread) /* Register myself. */ rtadv_event (zns, RTADV_READ, sock); - len = rtadv_recv_packet (sock, buf, BUFSIZ, &from, &ifindex, &hoplimit); + len = rtadv_recv_packet (zns, sock, buf, BUFSIZ, &from, &ifindex, &hoplimit); if (len < 0) {