summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
Diffstat (limited to 'zebra')
-rw-r--r--zebra/Makefile.am6
-rw-r--r--zebra/client_main.c8
-rw-r--r--zebra/connected.c7
-rw-r--r--zebra/connected.h7
-rw-r--r--zebra/debug.c7
-rw-r--r--zebra/debug.h7
-rw-r--r--zebra/if_ioctl.c7
-rw-r--r--zebra/if_ioctl_solaris.c7
-rw-r--r--zebra/if_netlink.c8
-rw-r--r--zebra/if_netlink.h7
-rw-r--r--zebra/if_null.c7
-rw-r--r--zebra/if_sysctl.c7
-rw-r--r--zebra/interface.c13
-rw-r--r--zebra/interface.h7
-rw-r--r--zebra/ioctl.c7
-rw-r--r--zebra/ioctl.h7
-rw-r--r--zebra/ioctl_null.c7
-rw-r--r--zebra/ioctl_solaris.c7
-rw-r--r--zebra/ioctl_solaris.h7
-rw-r--r--zebra/ipforward.h7
-rw-r--r--zebra/ipforward_proc.c7
-rw-r--r--zebra/ipforward_solaris.c7
-rw-r--r--zebra/ipforward_sysctl.c7
-rw-r--r--zebra/irdp.h7
-rw-r--r--zebra/irdp_interface.c7
-rw-r--r--zebra/irdp_main.c7
-rw-r--r--zebra/irdp_packet.c7
-rw-r--r--zebra/kernel_netlink.c9
-rw-r--r--zebra/kernel_netlink.h7
-rw-r--r--zebra/kernel_null.c12
-rw-r--r--zebra/kernel_socket.c7
-rw-r--r--zebra/kernel_socket.h7
-rw-r--r--zebra/label_manager.c140
-rw-r--r--zebra/label_manager.h9
-rw-r--r--zebra/main.c7
-rw-r--r--zebra/misc_null.c7
-rw-r--r--zebra/redistribute.c73
-rw-r--r--zebra/redistribute.h7
-rw-r--r--zebra/redistribute_null.c7
-rw-r--r--zebra/rib.h7
-rw-r--r--zebra/router-id.c7
-rw-r--r--zebra/router-id.h7
-rw-r--r--zebra/rt.h7
-rw-r--r--zebra/rt_netlink.c167
-rw-r--r--zebra/rt_netlink.h8
-rw-r--r--zebra/rt_socket.c7
-rw-r--r--zebra/rtadv.c7
-rw-r--r--zebra/rtadv.h7
-rw-r--r--zebra/rtadv_null.c7
-rw-r--r--zebra/rtread_getmsg.c7
-rw-r--r--zebra/rtread_netlink.c7
-rw-r--r--zebra/rtread_sysctl.c7
-rw-r--r--zebra/test_main.c7
-rw-r--r--zebra/zebra_fpm.c7
-rw-r--r--zebra/zebra_fpm_dt.c7
-rw-r--r--zebra/zebra_fpm_netlink.c7
-rw-r--r--zebra/zebra_fpm_private.h7
-rw-r--r--zebra/zebra_fpm_protobuf.c7
-rw-r--r--zebra/zebra_memory.c7
-rw-r--r--zebra/zebra_memory.h7
-rw-r--r--zebra/zebra_mpls.c23
-rw-r--r--zebra/zebra_mpls.h7
-rw-r--r--zebra/zebra_mpls_netlink.c7
-rw-r--r--zebra/zebra_mpls_null.c213
-rw-r--r--zebra/zebra_mpls_openbsd.c7
-rw-r--r--zebra/zebra_mpls_vty.c7
-rw-r--r--zebra/zebra_mroute.c7
-rw-r--r--zebra/zebra_mroute.h7
-rw-r--r--zebra/zebra_ns.c7
-rw-r--r--zebra/zebra_ns.h7
-rw-r--r--zebra/zebra_ptm.c9
-rw-r--r--zebra/zebra_ptm.h7
-rw-r--r--zebra/zebra_ptm_null.c7
-rw-r--r--zebra/zebra_ptm_redistribute.c14
-rw-r--r--zebra/zebra_ptm_redistribute.h7
-rw-r--r--zebra/zebra_rib.c11
-rw-r--r--zebra/zebra_rnh.c9
-rw-r--r--zebra/zebra_rnh.h7
-rw-r--r--zebra/zebra_rnh_null.c7
-rw-r--r--zebra/zebra_routemap.c7
-rw-r--r--zebra/zebra_routemap.h7
-rw-r--r--zebra/zebra_snmp.c7
-rw-r--r--zebra/zebra_static.c7
-rw-r--r--zebra/zebra_static.h7
-rw-r--r--zebra/zebra_vrf.c16
-rw-r--r--zebra/zebra_vrf.h14
-rw-r--r--zebra/zebra_vty.c1425
-rw-r--r--zebra/zserv.c80
-rw-r--r--zebra/zserv.h7
-rw-r--r--zebra/zserv_null.c14
90 files changed, 837 insertions, 1920 deletions
diff --git a/zebra/Makefile.am b/zebra/Makefile.am
index 6c5e06906..3e0de3b46 100644
--- a/zebra/Makefile.am
+++ b/zebra/Makefile.am
@@ -31,7 +31,7 @@ zebra_SOURCES = \
redistribute.c debug.c rtadv.c zebra_vty.c \
irdp_main.c irdp_interface.c irdp_packet.c router-id.c \
zebra_ptm.c zebra_rnh.c zebra_ptm_redistribute.c \
- zebra_ns.c zebra_vrf.c zebra_static.c zebra_mpls_vty.c \
+ zebra_ns.c zebra_vrf.c zebra_static.c zebra_mpls.c zebra_mpls_vty.c \
zebra_mroute.c \
label_manager.c \
# end
@@ -40,7 +40,7 @@ testzebra_SOURCES = test_main.c zebra_rib.c interface.c connected.c debug.c \
zebra_vty.c zebra_ptm.c zebra_routemap.c zebra_ns.c zebra_vrf.c \
kernel_null.c redistribute_null.c ioctl_null.c misc_null.c zebra_rnh_null.c \
zebra_ptm_null.c rtadv_null.c if_null.c zserv_null.c zebra_static.c \
- zebra_memory.c zebra_mpls_vty.c zebra_mpls_null.c
+ zebra_memory.c zebra_mpls.c zebra_mpls_vty.c zebra_mpls_null.c
noinst_HEADERS = \
zebra_memory.h \
@@ -88,7 +88,7 @@ EXTRA_DIST = if_ioctl.c if_ioctl_solaris.c if_netlink.c \
rt_socket.c rtread_netlink.c rtread_sysctl.c \
rtread_getmsg.c kernel_socket.c kernel_netlink.c \
ioctl.c ioctl_solaris.c \
- zebra_mpls_netlink.c zebra_mpls_openbsd.c zebra_mpls.c \
+ zebra_mpls_netlink.c zebra_mpls_openbsd.c \
GNOME-SMI GNOME-PRODUCT-ZEBRA-MIB
client : client_main.o ../lib/libfrr.la
diff --git a/zebra/client_main.c b/zebra/client_main.c
index 178184d46..c9d738bb0 100644
--- a/zebra/client_main.c
+++ b/zebra/client_main.c
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
@@ -116,6 +115,7 @@ struct zebra_info
{ "ospf6", ZEBRA_ROUTE_OSPF6 },
{ "bgp", ZEBRA_ROUTE_BGP },
{ "nhrp", ZEBRA_ROUTE_NHRP },
+ { "pim", ZEBRA_ROUTE_PIM },
{ NULL, 0 }
};
diff --git a/zebra/connected.c b/zebra/connected.c
index 0ceaddc8e..4d8fe9f6d 100644
--- a/zebra/connected.c
+++ b/zebra/connected.c
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/connected.h b/zebra/connected.h
index bdcf6085e..3e3734685 100644
--- a/zebra/connected.h
+++ b/zebra/connected.h
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#ifndef _ZEBRA_CONNECTED_H
diff --git a/zebra/debug.c b/zebra/debug.c
index cb1ed359a..98770371d 100644
--- a/zebra/debug.c
+++ b/zebra/debug.c
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/debug.h b/zebra/debug.h
index f8ebf3d61..0a50da817 100644
--- a/zebra/debug.h
+++ b/zebra/debug.h
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * 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
*/
#ifndef _ZEBRA_DEBUG_H
diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c
index 5333f0331..73da04965 100644
--- a/zebra/if_ioctl.c
+++ b/zebra/if_ioctl.c
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/if_ioctl_solaris.c b/zebra/if_ioctl_solaris.c
index dbc410991..08af2aa35 100644
--- a/zebra/if_ioctl_solaris.c
+++ b/zebra/if_ioctl_solaris.c
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c
index 006fcf16f..edfb564a6 100644
--- a/zebra/if_netlink.c
+++ b/zebra/if_netlink.c
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
@@ -38,6 +37,7 @@
#include "privs.h"
#include "nexthop.h"
#include "vrf.h"
+#include "vrf_int.h"
#include "mpls.h"
#include "vty.h"
diff --git a/zebra/if_netlink.h b/zebra/if_netlink.h
index 6fa39ccab..0c1b488fb 100644
--- a/zebra/if_netlink.h
+++ b/zebra/if_netlink.h
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#ifndef _ZEBRA_IF_NETLINK_H
diff --git a/zebra/if_null.c b/zebra/if_null.c
index 2ccea56c8..7cba0a4ee 100644
--- a/zebra/if_null.c
+++ b/zebra/if_null.c
@@ -14,10 +14,9 @@
* 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 Quagga; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/if_sysctl.c b/zebra/if_sysctl.c
index c62d9926a..dbf5abd12 100644
--- a/zebra/if_sysctl.c
+++ b/zebra/if_sysctl.c
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/interface.c b/zebra/interface.c
index 42e7c7bb1..c60cb8dcb 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
@@ -710,6 +709,10 @@ if_delete_update (struct interface *ifp)
interface deletion message. */
ifp->ifindex = IFINDEX_INTERNAL;
ifp->node = NULL;
+
+ /* if the ifp is in a vrf, move it to default so vrf can be deleted if desired */
+ if (ifp->vrf_id)
+ if_handle_vrf_change (ifp, VRF_DEFAULT);
}
/* VRF change for an interface */
@@ -771,6 +774,7 @@ if_nbr_ipv6ll_to_ipv4ll_neigh_update (struct interface *ifp,
struct in6_addr *address,
int add)
{
+ struct zebra_vrf *zvrf = vrf_info_lookup(ifp->vrf_id);
char buf[16] = "169.254.0.1";
struct in_addr ipv4_ll;
char mac[6];
@@ -779,6 +783,7 @@ if_nbr_ipv6ll_to_ipv4ll_neigh_update (struct interface *ifp,
ipv6_ll_address_to_mac(address, (u_char *)mac);
kernel_neigh_update (add, ifp->ifindex, ipv4_ll.s_addr, mac, 6);
+ zvrf->neigh_updates++;
}
static void
diff --git a/zebra/interface.h b/zebra/interface.h
index 9f108760d..b276edc35 100644
--- a/zebra/interface.h
+++ b/zebra/interface.h
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#ifndef _ZEBRA_INTERFACE_H
diff --git a/zebra/ioctl.c b/zebra/ioctl.c
index dfd69300f..25aeea18f 100644
--- a/zebra/ioctl.c
+++ b/zebra/ioctl.c
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/ioctl.h b/zebra/ioctl.h
index 9e3fd5b3f..b11a90f19 100644
--- a/zebra/ioctl.h
+++ b/zebra/ioctl.h
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#ifndef _ZEBRA_IOCTL_H
diff --git a/zebra/ioctl_null.c b/zebra/ioctl_null.c
index c2060e90a..9cc2daedb 100644
--- a/zebra/ioctl_null.c
+++ b/zebra/ioctl_null.c
@@ -13,10 +13,9 @@
* 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 Quagga; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/ioctl_solaris.c b/zebra/ioctl_solaris.c
index 78796a8a2..4bdbdaa58 100644
--- a/zebra/ioctl_solaris.c
+++ b/zebra/ioctl_solaris.c
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/ioctl_solaris.h b/zebra/ioctl_solaris.h
index 188986be1..dbf93bdca 100644
--- a/zebra/ioctl_solaris.h
+++ b/zebra/ioctl_solaris.h
@@ -14,10 +14,9 @@
* 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 Quagga; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#ifndef _ZEBRA_IF_IOCTL_SOLARIS_H
diff --git a/zebra/ipforward.h b/zebra/ipforward.h
index a75073cb3..5401ed08a 100644
--- a/zebra/ipforward.h
+++ b/zebra/ipforward.h
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * 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
*/
#ifndef _ZEBRA_IPFORWARD_H
diff --git a/zebra/ipforward_proc.c b/zebra/ipforward_proc.c
index 910fd61d0..200c50c0a 100644
--- a/zebra/ipforward_proc.c
+++ b/zebra/ipforward_proc.c
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/ipforward_solaris.c b/zebra/ipforward_solaris.c
index 8eccfe133..09f145e81 100644
--- a/zebra/ipforward_solaris.c
+++ b/zebra/ipforward_solaris.c
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/ipforward_sysctl.c b/zebra/ipforward_sysctl.c
index 28894f4e0..a381eb2d7 100644
--- a/zebra/ipforward_sysctl.c
+++ b/zebra/ipforward_sysctl.c
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/irdp.h b/zebra/irdp.h
index 9ce55e587..975e378b7 100644
--- a/zebra/irdp.h
+++ b/zebra/irdp.h
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
/*
diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c
index 21f8beadf..d3c471e75 100644
--- a/zebra/irdp_interface.c
+++ b/zebra/irdp_interface.c
@@ -15,10 +15,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
/*
diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c
index 5c17570f0..8e4ebfda6 100644
--- a/zebra/irdp_main.c
+++ b/zebra/irdp_main.c
@@ -15,10 +15,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
/*
diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c
index 269d4c044..20982b31a 100644
--- a/zebra/irdp_packet.c
+++ b/zebra/irdp_packet.c
@@ -15,10 +15,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
/*
diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c
index 27beaf0c8..e23801169 100644
--- a/zebra/kernel_netlink.c
+++ b/zebra/kernel_netlink.c
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
@@ -818,6 +817,8 @@ kernel_init (struct zebra_ns *zns)
thread_add_read(zebrad.master, kernel_read, zns, zns->netlink.sock,
&zns->t_netlink);
}
+
+ rt_netlink_init ();
}
void
diff --git a/zebra/kernel_netlink.h b/zebra/kernel_netlink.h
index adbcf71f6..36ab5c325 100644
--- a/zebra/kernel_netlink.h
+++ b/zebra/kernel_netlink.h
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#ifndef _ZEBRA_KERNEL_NETLINK_H
diff --git a/zebra/kernel_null.c b/zebra/kernel_null.c
index fea79ffe8..ad96ce41c 100644
--- a/zebra/kernel_null.c
+++ b/zebra/kernel_null.c
@@ -1,6 +1,5 @@
-/* NULL kernel methods for testing. */
-
-/*
+/*
+ * NULL kernel methods for testing.
* Copyright (C) 2006 Sun Microsystems, Inc.
*
* This file is part of Quagga.
@@ -15,10 +14,9 @@
* 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 Quagga; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c
index 0e15153e1..25c11e578 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/kernel_socket.h b/zebra/kernel_socket.h
index 04e305431..26cd6127f 100644
--- a/zebra/kernel_socket.h
+++ b/zebra/kernel_socket.h
@@ -14,10 +14,9 @@
* 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 Quagga; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#ifndef __ZEBRA_KERNEL_SOCKET_H
diff --git a/zebra/label_manager.c b/zebra/label_manager.c
index e60f7a4a6..fbe4cea46 100644
--- a/zebra/label_manager.c
+++ b/zebra/label_manager.c
@@ -16,10 +16,9 @@
* 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 FRR; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <stdio.h>
@@ -56,6 +55,80 @@ static void delete_label_chunk(void *val)
XFREE(MTYPE_LM_CHUNK, val);
}
+static int relay_response_back(struct zserv *zserv)
+{
+ int ret = 0;
+ struct stream *src, *dst;
+ u_int16_t size = 0;
+ u_char marker;
+ u_char version;
+ vrf_id_t vrf_id;
+ u_int16_t resp_cmd;
+
+ src = zclient->ibuf;
+ dst = zserv->obuf;
+
+ stream_reset(src);
+
+ ret = zclient_read_header(src, zclient->sock, &size, &marker, &version,
+ &vrf_id, &resp_cmd);
+ if (ret < 0 && errno != EAGAIN) {
+ zlog_err("%s: Error reading Label Manager response: %s", __func__,
+ strerror(errno));
+ return -1;
+ }
+ zlog_debug("%s: Label Manager response received, %d bytes", __func__,
+ size);
+ if (size == 0)
+ return -1;
+
+ /* send response back */
+ stream_copy(dst, src);
+ ret = writen(zserv->sock, dst->data, stream_get_endp(dst));
+ if (ret <= 0) {
+ zlog_err("%s: Error sending Label Manager response back: %s",
+ __func__, strerror(errno));
+ return -1;
+ }
+ zlog_debug("%s: Label Manager response (%d bytes) sent back", __func__,
+ ret);
+
+ return 0;
+}
+
+static int lm_zclient_read(struct thread *t)
+{
+ struct zserv *zserv;
+ int ret;
+
+ /* Get socket to zebra. */
+ zserv = THREAD_ARG(t);
+ zclient->t_read = NULL;
+
+ /* read response and send it back */
+ ret = relay_response_back(zserv);
+
+ return ret;
+}
+
+static int reply_error (int cmd, struct zserv *zserv, vrf_id_t vrf_id)
+{
+ struct stream *s;
+
+ s = zserv->obuf;
+ stream_reset (s);
+
+ zserv_create_header (s, cmd, vrf_id);
+
+ /* result */
+ stream_putc (s, 1);
+
+ /* Write packet size. */
+ stream_putw_at (s, 0, stream_get_endp (s));
+
+ return writen (zserv->sock, s->data, stream_get_endp (s));
+
+}
/**
* Receive a request to get or release a label chunk and forward it to external
* label manager.
@@ -64,19 +137,25 @@ static void delete_label_chunk(void *val)
* proxy.
*
* @param cmd Type of request (connect, get or release)
- * @param src Input buffer from zserv
+ * @param zserv
* @return 0 on success, -1 otherwise
*/
-int zread_relay_label_manager_request(int cmd, struct zserv *zserv)
+int zread_relay_label_manager_request(int cmd, struct zserv *zserv, vrf_id_t vrf_id)
{
struct stream *src, *dst;
- int ret;
+ int ret = 0;
if (zclient->sock < 0) {
zlog_err("%s: Error relaying label chunk request: no zclient socket",
__func__);
+ reply_error (cmd, zserv, vrf_id);
return -1;
}
+
+ /* in case there's any incoming message enqueued, read and forward it */
+ while (ret == 0)
+ ret = relay_response_back(zserv);
+
/* Send request to external label manager */
src = zserv->ibuf;
dst = zclient->obuf;
@@ -87,6 +166,7 @@ int zread_relay_label_manager_request(int cmd, struct zserv *zserv)
if (ret <= 0) {
zlog_err("%s: Error relaying label chunk request: %s", __func__,
strerror(errno));
+ reply_error (cmd, zserv, vrf_id);
return -1;
}
zlog_debug("%s: Label chunk request relayed. %d bytes sent", __func__,
@@ -96,43 +176,15 @@ int zread_relay_label_manager_request(int cmd, struct zserv *zserv)
if (cmd == ZEBRA_RELEASE_LABEL_CHUNK)
return 0;
- /* read response */
- src = zclient->ibuf;
- dst = zserv->obuf;
-
- stream_reset(src);
-
- u_int16_t size;
- u_char marker;
- u_char version;
- vrf_id_t vrf_id;
- u_int16_t resp_cmd;
- ret = zclient_read_header(src, zclient->sock, &size, &marker, &version,
- &vrf_id, &resp_cmd);
- if (ret < 0) {
- zlog_err("%s: Error reading label chunk response: %s", __func__,
- strerror(errno));
- return -1;
- }
- zlog_debug("%s: Label chunk response received, %d bytes", __func__,
- size);
-
- /* send response back */
- stream_copy(dst, src);
- stream_copy(zserv->obuf, zclient->ibuf);
- ret = writen(zserv->sock, dst->data, stream_get_endp(dst));
- if (ret <= 0) {
- zlog_err("%s: Error sending label chunk response back: %s",
- __func__, strerror(errno));
- return -1;
- }
- zlog_debug("%s: Label chunk response (%d bytes) sent back", __func__,
- ret);
+ /* make sure we listen to the response */
+ if (!zclient->t_read)
+ thread_add_read(zclient->master, lm_zclient_read, zserv,
+ zclient->sock, &zclient->t_read);
return 0;
}
-static int zclient_connect(struct thread *t)
+static int lm_zclient_connect(struct thread *t)
{
zclient->t_connect = NULL;
@@ -141,11 +193,15 @@ static int zclient_connect(struct thread *t)
if (zclient_socket_connect(zclient) < 0) {
zlog_err("Error connecting synchronous zclient!");
- thread_add_timer(zebrad.master, zclient_connect, zclient,
+ thread_add_timer(zebrad.master, lm_zclient_connect, zclient,
CONNECTION_DELAY, &zclient->t_connect);
return -1;
}
+ /* make socket non-blocking */
+ if (set_nonblocking(zclient->sock) < 0)
+ zlog_warn("%s: set_nonblocking(%d) failed", __func__, zclient->sock);
+
return 0;
}
@@ -164,7 +220,7 @@ static void lm_zclient_init(char *lm_zserv_path)
zclient = zclient_new(zebrad.master);
zclient->sock = -1;
zclient->t_connect = NULL;
- zclient_connect (NULL);
+ lm_zclient_connect(NULL);
}
/**
diff --git a/zebra/label_manager.h b/zebra/label_manager.h
index 0c6a5ebc7..b7d6118a0 100644
--- a/zebra/label_manager.h
+++ b/zebra/label_manager.h
@@ -16,10 +16,9 @@
* 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 FRR; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#ifndef _LABEL_MANAGER_H
@@ -62,7 +61,7 @@ struct label_manager {
bool lm_is_external;
-int zread_relay_label_manager_request(int cmd, struct zserv *zserv);
+int zread_relay_label_manager_request(int cmd, struct zserv *zserv, vrf_id_t vrf_id);
void label_manager_init(char *lm_zserv_path);
struct label_manager_chunk *assign_label_chunk(u_char proto, u_short instance,
u_char keep, uint32_t size);
diff --git a/zebra/main.c b/zebra/main.c
index 459e6148d..b136f8ae9 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/misc_null.c b/zebra/misc_null.c
index 49cb92bd7..b125becdc 100644
--- a/zebra/misc_null.c
+++ b/zebra/misc_null.c
@@ -13,10 +13,9 @@
* 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 Quagga; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/redistribute.c b/zebra/redistribute.c
index 23cce0a1b..1493bd9cb 100644
--- a/zebra/redistribute.c
+++ b/zebra/redistribute.c
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
@@ -107,45 +106,41 @@ zebra_redistribute_default (struct zserv *client, vrf_id_t vrf_id)
/* Redistribute routes. */
static void
-zebra_redistribute (struct zserv *client, int type, u_short instance, vrf_id_t vrf_id)
+zebra_redistribute (struct zserv *client, int type, u_short instance, vrf_id_t vrf_id, int afi)
{
struct rib *newrib;
struct route_table *table;
struct route_node *rn;
- int afi;
- for (afi = AFI_IP; afi <= AFI_IP6; afi++)
- {
- table = zebra_vrf_table (afi, SAFI_UNICAST, vrf_id);
- if (! table)
- continue;
+ table = zebra_vrf_table (afi, SAFI_UNICAST, vrf_id);
+ if (! table)
+ return;
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, newrib)
- {
- struct prefix *dst_p, *src_p;
- srcdest_rnode_prefixes(rn, &dst_p, &src_p);
-
- if (IS_ZEBRA_DEBUG_EVENT)
- zlog_debug("%s: checking: selected=%d, type=%d, distance=%d, "
- "zebra_check_addr=%d", __func__,
- CHECK_FLAG (newrib->flags, ZEBRA_FLAG_SELECTED),
- newrib->type, newrib->distance,
- zebra_check_addr (dst_p));
-
- if (! CHECK_FLAG (newrib->flags, ZEBRA_FLAG_SELECTED))
- continue;
- if ((type != ZEBRA_ROUTE_ALL &&
- (newrib->type != type || newrib->instance != instance)))
- continue;
- if (newrib->distance == DISTANCE_INFINITY)
- continue;
- if (! zebra_check_addr (dst_p))
- continue;
-
- zsend_redistribute_route (1, client, dst_p, src_p, newrib);
- }
- }
+ for (rn = route_top (table); rn; rn = route_next (rn))
+ RNODE_FOREACH_RIB (rn, newrib)
+ {
+ struct prefix *dst_p, *src_p;
+ srcdest_rnode_prefixes(rn, &dst_p, &src_p);
+
+ if (IS_ZEBRA_DEBUG_EVENT)
+ zlog_debug("%s: checking: selected=%d, type=%d, distance=%d, "
+ "zebra_check_addr=%d", __func__,
+ CHECK_FLAG (newrib->flags, ZEBRA_FLAG_SELECTED),
+ newrib->type, newrib->distance,
+ zebra_check_addr (dst_p));
+
+ if (! CHECK_FLAG (newrib->flags, ZEBRA_FLAG_SELECTED))
+ continue;
+ if ((type != ZEBRA_ROUTE_ALL &&
+ (newrib->type != type || newrib->instance != instance)))
+ continue;
+ if (newrib->distance == DISTANCE_INFINITY)
+ continue;
+ if (! zebra_check_addr (dst_p))
+ continue;
+
+ zsend_redistribute_route (1, client, dst_p, src_p, newrib);
+ }
}
/* Either advertise a route for redistribution to registered clients or */
@@ -265,13 +260,13 @@ zebra_redistribute_add (int command, struct zserv *client, int length,
if (! redist_check_instance (&client->mi_redist[afi][type], instance))
{
redist_add_instance (&client->mi_redist[afi][type], instance);
- zebra_redistribute (client, type, instance, zvrf_id (zvrf));
+ zebra_redistribute (client, type, instance, zvrf_id (zvrf), afi);
}
} else {
if (! vrf_bitmap_check (client->redist[afi][type], zvrf_id (zvrf)))
{
vrf_bitmap_set (client->redist[afi][type], zvrf_id (zvrf));
- zebra_redistribute (client, type, 0, zvrf_id (zvrf));
+ zebra_redistribute (client, type, 0, zvrf_id (zvrf), afi);
}
}
}
diff --git a/zebra/redistribute.h b/zebra/redistribute.h
index 06afc726d..8a7857498 100644
--- a/zebra/redistribute.h
+++ b/zebra/redistribute.h
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#ifndef _ZEBRA_REDISTRIBUTE_H
diff --git a/zebra/redistribute_null.c b/zebra/redistribute_null.c
index ffde8ed77..7f40c2178 100644
--- a/zebra/redistribute_null.c
+++ b/zebra/redistribute_null.c
@@ -13,10 +13,9 @@
* 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 Quagga; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/rib.h b/zebra/rib.h
index 8f6cff0d8..7bcbf56bd 100644
--- a/zebra/rib.h
+++ b/zebra/rib.h
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#ifndef _ZEBRA_RIB_H
diff --git a/zebra/router-id.c b/zebra/router-id.c
index b1e786d0c..318986c1b 100644
--- a/zebra/router-id.c
+++ b/zebra/router-id.c
@@ -15,10 +15,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/router-id.h b/zebra/router-id.h
index 46d300eea..6b15159fd 100644
--- a/zebra/router-id.h
+++ b/zebra/router-id.h
@@ -15,10 +15,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#ifndef _ROUTER_ID_H_
diff --git a/zebra/rt.h b/zebra/rt.h
index 75d234ce8..5f2441a9c 100644
--- a/zebra/rt.h
+++ b/zebra/rt.h
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#ifndef _ZEBRA_RT_H
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 77f03a2c6..f22f4acb0 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
@@ -103,6 +102,21 @@ struct gw_family_t
union g_addr gate;
};
+char ipv4_ll_buf[16] = "169.254.0.1";
+struct in_addr ipv4_ll;
+
+/*
+ * The ipv4_ll data structure is used for all 5549
+ * additions to the kernel. Let's figure out the
+ * correct value one time instead for every
+ * install/remove of a 5549 type route
+ */
+void
+rt_netlink_init (void)
+{
+ inet_pton (AF_INET, ipv4_ll_buf, &ipv4_ll);
+}
+
static inline int is_selfroute(int proto)
{
if ((proto == RTPROT_BGP) || (proto == RTPROT_OSPF) ||
@@ -675,32 +689,12 @@ _netlink_route_build_singlepath(
mpls_lse_t out_lse[MPLS_MAX_LABELS];
char label_buf[100];
- if (rtmsg->rtm_family == AF_INET &&
- (nexthop->type == NEXTHOP_TYPE_IPV6
- || nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX))
- {
- char buf[16] = "169.254.0.1";
- struct in_addr ipv4_ll;
-
- inet_pton (AF_INET, buf, &ipv4_ll);
- rtmsg->rtm_flags |= RTNH_F_ONLINK;
- addattr_l (nlmsg, req_size, RTA_GATEWAY, &ipv4_ll, 4);
- addattr32 (nlmsg, req_size, RTA_OIF, nexthop->ifindex);
-
- if (nexthop->rmap_src.ipv4.s_addr && (cmd == RTM_NEWROUTE))
- addattr_l (nlmsg, req_size, RTA_PREFSRC,
- &nexthop->rmap_src.ipv4, bytelen);
- else if (nexthop->src.ipv4.s_addr && (cmd == RTM_NEWROUTE))
- addattr_l (nlmsg, req_size, RTA_PREFSRC,
- &nexthop->src.ipv4, bytelen);
-
- if (IS_ZEBRA_DEBUG_KERNEL)
- zlog_debug(" 5549: _netlink_route_build_singlepath() (%s): "
- "nexthop via %s if %u",
- routedesc, buf, nexthop->ifindex);
- return;
- }
-
+ /*
+ * label_buf is *only* currently used within debugging.
+ * As such when we assign it we are guarding it inside
+ * a debug test. If you want to change this make sure
+ * you fix this assumption
+ */
label_buf[0] = '\0';
/* outgoing label - either as NEWDST (in the case of LSR) or as ENCAP
* (in the case of LER)
@@ -724,13 +718,16 @@ _netlink_route_build_singlepath(
{
bos = ((i == (nh_label->num_labels - 1)) ? 1 : 0);
out_lse[i] = mpls_lse_encode (nh_label->label[i], 0, 0, bos);
- if (!num_labels)
- sprintf (label_buf, "label %d", nh_label->label[i]);
- else
- {
- sprintf (label_buf1, "/%d", nh_label->label[i]);
- strcat (label_buf, label_buf1);
- }
+ if (IS_ZEBRA_DEBUG_KERNEL)
+ {
+ if (!num_labels)
+ sprintf (label_buf, "label %d", nh_label->label[i]);
+ else
+ {
+ sprintf (label_buf1, "/%d", nh_label->label[i]);
+ strcat (label_buf, label_buf1);
+ }
+ }
num_labels++;
}
}
@@ -757,6 +754,28 @@ _netlink_route_build_singlepath(
if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ONLINK))
rtmsg->rtm_flags |= RTNH_F_ONLINK;
+ if (rtmsg->rtm_family == AF_INET &&
+ (nexthop->type == NEXTHOP_TYPE_IPV6
+ || nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX))
+ {
+ rtmsg->rtm_flags |= RTNH_F_ONLINK;
+ addattr_l (nlmsg, req_size, RTA_GATEWAY, &ipv4_ll, 4);
+ addattr32 (nlmsg, req_size, RTA_OIF, nexthop->ifindex);
+
+ if (nexthop->rmap_src.ipv4.s_addr && (cmd == RTM_NEWROUTE))
+ addattr_l (nlmsg, req_size, RTA_PREFSRC,
+ &nexthop->rmap_src.ipv4, bytelen);
+ else if (nexthop->src.ipv4.s_addr && (cmd == RTM_NEWROUTE))
+ addattr_l (nlmsg, req_size, RTA_PREFSRC,
+ &nexthop->src.ipv4, bytelen);
+
+ if (IS_ZEBRA_DEBUG_KERNEL)
+ zlog_debug(" 5549: _netlink_route_build_singlepath() (%s): "
+ "nexthop via %s %s if %u",
+ routedesc, ipv4_ll_buf, label_buf, nexthop->ifindex);
+ return;
+ }
+
if (nexthop->type == NEXTHOP_TYPE_IPV4
|| nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX)
{
@@ -782,6 +801,7 @@ _netlink_route_build_singlepath(
inet_ntoa (nexthop->gate.ipv4),
label_buf, nexthop->ifindex);
}
+
if (nexthop->type == NEXTHOP_TYPE_IPV6
|| nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX)
{
@@ -880,33 +900,12 @@ _netlink_route_build_multipath(
rtnh->rtnh_hops = 0;
rta->rta_len += rtnh->rtnh_len;
- if (rtmsg->rtm_family == AF_INET &&
- (nexthop->type == NEXTHOP_TYPE_IPV6
- || nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX))
- {
- char buf[16] = "169.254.0.1";
- struct in_addr ipv4_ll;
-
- inet_pton (AF_INET, buf, &ipv4_ll);
- bytelen = 4;
- rtnh->rtnh_flags |= RTNH_F_ONLINK;
- rta_addattr_l (rta, NL_PKT_BUF_SIZE, RTA_GATEWAY,
- &ipv4_ll, bytelen);
- rtnh->rtnh_len += sizeof (struct rtattr) + bytelen;
- rtnh->rtnh_ifindex = nexthop->ifindex;
-
- if (nexthop->rmap_src.ipv4.s_addr)
- *src = &nexthop->rmap_src;
- else if (nexthop->src.ipv4.s_addr)
- *src = &nexthop->src;
-
- if (IS_ZEBRA_DEBUG_KERNEL)
- zlog_debug(" 5549: netlink_route_build_multipath() (%s): "
- "nexthop via %s if %u",
- routedesc, buf, nexthop->ifindex);
- return;
- }
-
+ /*
+ * label_buf is *only* currently used within debugging.
+ * As such when we assign it we are guarding it inside
+ * a debug test. If you want to change this make sure
+ * you fix this assumption
+ */
label_buf[0] = '\0';
/* outgoing label - either as NEWDST (in the case of LSR) or as ENCAP
* (in the case of LER)
@@ -930,13 +929,16 @@ _netlink_route_build_multipath(
{
bos = ((i == (nh_label->num_labels - 1)) ? 1 : 0);
out_lse[i] = mpls_lse_encode (nh_label->label[i], 0, 0, bos);
- if (!num_labels)
- sprintf (label_buf, "label %d", nh_label->label[i]);
- else
- {
- sprintf (label_buf1, "/%d", nh_label->label[i]);
- strcat (label_buf, label_buf1);
- }
+ if (IS_ZEBRA_DEBUG_KERNEL)
+ {
+ if (!num_labels)
+ sprintf (label_buf, "label %d", nh_label->label[i]);
+ else
+ {
+ sprintf (label_buf1, "/%d", nh_label->label[i]);
+ strcat (label_buf, label_buf1);
+ }
+ }
num_labels++;
}
}
@@ -968,6 +970,29 @@ _netlink_route_build_multipath(
if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ONLINK))
rtnh->rtnh_flags |= RTNH_F_ONLINK;
+ if (rtmsg->rtm_family == AF_INET &&
+ (nexthop->type == NEXTHOP_TYPE_IPV6
+ || nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX))
+ {
+ bytelen = 4;
+ rtnh->rtnh_flags |= RTNH_F_ONLINK;
+ rta_addattr_l (rta, NL_PKT_BUF_SIZE, RTA_GATEWAY,
+ &ipv4_ll, bytelen);
+ rtnh->rtnh_len += sizeof (struct rtattr) + bytelen;
+ rtnh->rtnh_ifindex = nexthop->ifindex;
+
+ if (nexthop->rmap_src.ipv4.s_addr)
+ *src = &nexthop->rmap_src;
+ else if (nexthop->src.ipv4.s_addr)
+ *src = &nexthop->src;
+
+ if (IS_ZEBRA_DEBUG_KERNEL)
+ zlog_debug(" 5549: netlink_route_build_multipath() (%s): "
+ "nexthop via %s %s if %u",
+ routedesc, ipv4_ll_buf, label_buf, nexthop->ifindex);
+ return;
+ }
+
if (nexthop->type == NEXTHOP_TYPE_IPV4
|| nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX)
{
diff --git a/zebra/rt_netlink.h b/zebra/rt_netlink.h
index af58a0f0d..4ec5f1853 100644
--- a/zebra/rt_netlink.h
+++ b/zebra/rt_netlink.h
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#ifndef _ZEBRA_RT_NETLINK_H
@@ -35,6 +34,7 @@
#define RTPROT_RIP 189
#define RTPROT_RIPNG 190
+void rt_netlink_init (void);
extern void
clear_nhlfe_installed (zebra_lsp_t *lsp);
diff --git a/zebra/rt_socket.c b/zebra/rt_socket.c
index de8cc69a8..3e4833016 100644
--- a/zebra/rt_socket.c
+++ b/zebra/rt_socket.c
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/rtadv.c b/zebra/rtadv.c
index 03b7ace9b..7f46066a6 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -15,10 +15,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/rtadv.h b/zebra/rtadv.h
index e4c2c6b36..5f389b30a 100644
--- a/zebra/rtadv.h
+++ b/zebra/rtadv.h
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#ifndef _ZEBRA_RTADV_H
diff --git a/zebra/rtadv_null.c b/zebra/rtadv_null.c
index ee6eda6bd..ccb1a39e0 100644
--- a/zebra/rtadv_null.c
+++ b/zebra/rtadv_null.c
@@ -13,10 +13,9 @@
* 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 Quagga; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/rtread_getmsg.c b/zebra/rtread_getmsg.c
index 4d491f320..1fb2984dd 100644
--- a/zebra/rtread_getmsg.c
+++ b/zebra/rtread_getmsg.c
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/rtread_netlink.c b/zebra/rtread_netlink.c
index 1d41861bb..d59883445 100644
--- a/zebra/rtread_netlink.c
+++ b/zebra/rtread_netlink.c
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/rtread_sysctl.c b/zebra/rtread_sysctl.c
index b68e1cb74..cabb1f771 100644
--- a/zebra/rtread_sysctl.c
+++ b/zebra/rtread_sysctl.c
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/test_main.c b/zebra/test_main.c
index f3ef3df96..83c1ebb17 100644
--- a/zebra/test_main.c
+++ b/zebra/test_main.c
@@ -11,10 +11,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c
index cf8f78afe..2a23ff102 100644
--- a/zebra/zebra_fpm.c
+++ b/zebra/zebra_fpm.c
@@ -16,10 +16,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/zebra_fpm_dt.c b/zebra/zebra_fpm_dt.c
index 7b4e1b90d..db28b6f0e 100644
--- a/zebra/zebra_fpm_dt.c
+++ b/zebra/zebra_fpm_dt.c
@@ -17,10 +17,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
/*
diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c
index 92ab5df2c..4ca7b5972 100644
--- a/zebra/zebra_fpm_netlink.c
+++ b/zebra/zebra_fpm_netlink.c
@@ -17,10 +17,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/zebra_fpm_private.h b/zebra/zebra_fpm_private.h
index 1c4fd4c22..49650541e 100644
--- a/zebra/zebra_fpm_private.h
+++ b/zebra/zebra_fpm_private.h
@@ -16,10 +16,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * 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
*/
#ifndef _ZEBRA_FPM_PRIVATE_H
diff --git a/zebra/zebra_fpm_protobuf.c b/zebra/zebra_fpm_protobuf.c
index 11869d8a2..312d4cd3e 100644
--- a/zebra/zebra_fpm_protobuf.c
+++ b/zebra/zebra_fpm_protobuf.c
@@ -17,10 +17,9 @@
* 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 Quagga; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/zebra_memory.c b/zebra/zebra_memory.c
index 728051c34..51c240ae2 100644
--- a/zebra/zebra_memory.c
+++ b/zebra/zebra_memory.c
@@ -14,10 +14,9 @@
* 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 Quagga; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#ifdef HAVE_CONFIG_H
diff --git a/zebra/zebra_memory.h b/zebra/zebra_memory.h
index c1ac4fe95..35d70d81e 100644
--- a/zebra/zebra_memory.h
+++ b/zebra/zebra_memory.h
@@ -14,10 +14,9 @@
* 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 Quagga; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#ifndef _QUAGGA_ZEBRA_MEMORY_H
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c
index 65e7f9ab9..b547c6256 100644
--- a/zebra/zebra_mpls.c
+++ b/zebra/zebra_mpls.c
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
@@ -928,6 +927,7 @@ lsp_process (struct work_queue *wq, void *data)
zebra_lsp_t *lsp;
zebra_nhlfe_t *oldbest, *newbest;
char buf[BUFSIZ], buf2[BUFSIZ];
+ struct zebra_vrf *zvrf = vrf_info_lookup (VRF_DEFAULT);
lsp = (zebra_lsp_t *)data;
if (!lsp) // unexpected
@@ -956,15 +956,24 @@ lsp_process (struct work_queue *wq, void *data)
{
/* Not already installed */
if (newbest)
- kernel_add_lsp (lsp);
+ {
+ kernel_add_lsp (lsp);
+ zvrf->lsp_installs++;
+ }
}
else
{
/* Installed, may need an update and/or delete. */
if (!newbest)
- kernel_del_lsp (lsp);
+ {
+ kernel_del_lsp (lsp);
+ zvrf->lsp_removals++;
+ }
else if (CHECK_FLAG (lsp->flags, LSP_FLAG_CHANGED))
- kernel_upd_lsp (lsp);
+ {
+ kernel_upd_lsp (lsp);
+ zvrf->lsp_installs++;
+ }
}
return WQ_SUCCESS;
diff --git a/zebra/zebra_mpls.h b/zebra/zebra_mpls.h
index b5a8f3173..1f17de67a 100644
--- a/zebra/zebra_mpls.h
+++ b/zebra/zebra_mpls.h
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#ifndef _ZEBRA_MPLS_H
diff --git a/zebra/zebra_mpls_netlink.c b/zebra/zebra_mpls_netlink.c
index 045bee2b9..d0c4acb37 100644
--- a/zebra/zebra_mpls_netlink.c
+++ b/zebra/zebra_mpls_netlink.c
@@ -13,10 +13,9 @@
* 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 Quagga; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/zebra_mpls_null.c b/zebra/zebra_mpls_null.c
index 0333b6e6b..a8acdb19f 100644
--- a/zebra/zebra_mpls_null.c
+++ b/zebra/zebra_mpls_null.c
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
@@ -27,209 +26,3 @@ int kernel_add_lsp (zebra_lsp_t *lsp) { return 0; }
int kernel_upd_lsp (zebra_lsp_t *lsp) { return 0; }
int kernel_del_lsp (zebra_lsp_t *lsp) { return 0; }
int mpls_kernel_init (void) { return -1; };
-
-int mpls_enabled;
-
-char *
-mpls_label2str (u_int8_t num_labels, mpls_label_t *labels,
- char *buf, int len, int pretty)
-{
- return NULL;
-}
-
-int
-mpls_str2label (const char *label_str, u_int8_t *num_labels,
- mpls_label_t *labels)
-{
- return 0;
-}
-
-int
-zebra_mpls_label_block_add (struct zebra_vrf *vrf, u_int32_t start_label,
- u_int32_t end_label)
-{
- return 0;
-}
-
-int
-zebra_mpls_label_block_del (struct zebra_vrf *zvrf)
-{
- return 0;
-}
-
-int
-zebra_mpls_write_label_block_config (struct vty *vty, struct zebra_vrf *zvrf)
-{
- return 0;
-}
-
-int
-zebra_mpls_lsp_install (struct zebra_vrf *zvrf, struct route_node *rn, struct rib *rib)
-{
- return 0;
-}
-
-int
-zebra_mpls_lsp_uninstall (struct zebra_vrf *zvrf, struct route_node *rn, struct rib *rib)
-{
- return 0;
-}
-
-void
-zebra_mpls_init_tables (struct zebra_vrf *zvrf)
-{
-}
-
-void
-zebra_mpls_print_lsp (struct vty *vty, struct zebra_vrf *zvrf, mpls_label_t label,
- u_char use_json)
-{
-}
-
-void
-zebra_mpls_print_lsp_table (struct vty *vty, struct zebra_vrf *zvrf,
- u_char use_json)
-{
-}
-
-int
-zebra_mpls_write_lsp_config (struct vty *vty, struct zebra_vrf *zvrf)
-{
- return 0;
-}
-
-#ifdef HAVE_CUMULUS
-int
-zebra_mpls_lsp_label_consistent (struct zebra_vrf *zvrf, mpls_label_t in_label,
- mpls_label_t out_label, enum nexthop_types_t gtype,
- union g_addr *gate, ifindex_t ifindex)
-{
- return 0;
-}
-#endif
-
-int
-zebra_mpls_static_lsp_add (struct zebra_vrf *zvrf, mpls_label_t in_label,
- mpls_label_t out_label, enum nexthop_types_t gtype,
- union g_addr *gate, ifindex_t ifindex)
-{
- return 0;
-}
-
-int
-zebra_mpls_static_lsp_del (struct zebra_vrf *zvrf, mpls_label_t in_label,
- enum nexthop_types_t gtype, union g_addr *gate,
- ifindex_t ifindex)
-{
- return 0;
-}
-
-void
-zebra_mpls_lsp_schedule (struct zebra_vrf *zvrf)
-{
-}
-
-void
-zebra_mpls_close_tables (struct zebra_vrf *zvrf)
-{
-}
-
-zebra_fec_t *
-zebra_mpls_fec_for_label (struct zebra_vrf *zvrf, mpls_label_t label)
-{
- return NULL;
-}
-
-int
-zebra_mpls_label_already_bound (struct zebra_vrf *zvrf, mpls_label_t label)
-{
- return 0;
-}
-
-int
-zebra_mpls_static_fec_add (struct zebra_vrf *zvrf, struct prefix *p,
- mpls_label_t in_label)
-{
- return 0;
-}
-
-int
-zebra_mpls_static_fec_del (struct zebra_vrf *zvrf, struct prefix *p)
-{
- return 0;
-}
-
-int
-zebra_mpls_write_fec_config (struct vty *vty, struct zebra_vrf *zvrf)
-{
- return 0;
-}
-
-void
-zebra_mpls_print_fec_table (struct vty *vty, struct zebra_vrf *zvrf)
-{
-}
-
-void
-zebra_mpls_print_fec (struct vty *vty, struct zebra_vrf *zvrf, struct prefix *p)
-{
-}
-
-int
-zebra_mpls_fec_register (struct zebra_vrf *zvrf, struct prefix *p,
- u_int32_t label_index, struct zserv *client)
-{
- return 0;
-}
-
-int
-zebra_mpls_fec_unregister (struct zebra_vrf *zvrf, struct prefix *p,
- struct zserv *client)
-{
- return 0;
-}
-
-int
-zebra_mpls_cleanup_fecs_for_client (struct zebra_vrf *zvrf, struct zserv *client)
-{
- return 0;
-}
-
-void mpls_ldp_lsp_uninstall_all (struct hash_backet *backet, void *ctxt)
-{
- return;
-}
-
-void mpls_ldp_ftn_uninstall_all (struct zebra_vrf *zvrf, int afi)
-{
- return;
-}
-
-void zebra_mpls_init (void)
-{
- return;
-}
-
-int mpls_lsp_install (struct zebra_vrf *zvrf, enum lsp_types_t type,
- mpls_label_t in_label, mpls_label_t out_label,
- enum nexthop_types_t gtype, union g_addr *gate,
- ifindex_t ifindex)
-{
- return 0;
-}
-
-int mpls_lsp_uninstall (struct zebra_vrf *zvrf, enum lsp_types_t type,
- mpls_label_t in_label, enum nexthop_types_t gtype,
- union g_addr *gate, ifindex_t ifindex)
-{
- return 0;
-}
-
-int mpls_ftn_update (int add, struct zebra_vrf *zvrf, enum lsp_types_t type,
- struct prefix *prefix, enum nexthop_types_t gtype,
- union g_addr *gate, ifindex_t ifindex, u_int8_t distance,
- mpls_label_t out_label)
-{
- return 0;
-}
-
diff --git a/zebra/zebra_mpls_openbsd.c b/zebra/zebra_mpls_openbsd.c
index eaa80ac55..bca73898c 100644
--- a/zebra/zebra_mpls_openbsd.c
+++ b/zebra/zebra_mpls_openbsd.c
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/zebra_mpls_vty.c b/zebra/zebra_mpls_vty.c
index 7662cf416..3010a3bd8 100644
--- a/zebra/zebra_mpls_vty.c
+++ b/zebra/zebra_mpls_vty.c
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/zebra_mroute.c b/zebra/zebra_mroute.c
index 86356104b..82c7f404b 100644
--- a/zebra/zebra_mroute.c
+++ b/zebra/zebra_mroute.c
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/zebra_mroute.h b/zebra/zebra_mroute.h
index c0bac43a8..eeaf9caf1 100644
--- a/zebra/zebra_mroute.h
+++ b/zebra/zebra_mroute.h
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#ifndef __ZEBRA_MROUTE_H__
diff --git a/zebra/zebra_ns.c b/zebra/zebra_ns.c
index 642d2700a..a5869585d 100644
--- a/zebra/zebra_ns.c
+++ b/zebra/zebra_ns.c
@@ -14,10 +14,9 @@
* 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 Quagga; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include "zebra.h"
diff --git a/zebra/zebra_ns.h b/zebra/zebra_ns.h
index c50f9249d..721b6c818 100644
--- a/zebra/zebra_ns.h
+++ b/zebra/zebra_ns.h
@@ -15,10 +15,9 @@
* 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 Quagga; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#if !defined(__ZEBRA_NS_H__)
#define __ZEBRA_NS_H__
diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c
index 4141cdd90..e49347638 100644
--- a/zebra/zebra_ptm.c
+++ b/zebra/zebra_ptm.c
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
@@ -1027,7 +1026,7 @@ zebra_ptm_bfd_client_deregister (int proto)
int data_len = ZEBRA_PTM_SEND_MAX_SOCKBUF;
if (proto != ZEBRA_ROUTE_OSPF && proto != ZEBRA_ROUTE_BGP
- && proto != ZEBRA_ROUTE_OSPF6)
+ && proto != ZEBRA_ROUTE_OSPF6 && proto != ZEBRA_ROUTE_PIM)
return;
if (IS_ZEBRA_DEBUG_EVENT)
diff --git a/zebra/zebra_ptm.h b/zebra/zebra_ptm.h
index 71c85d909..28fe9c1de 100644
--- a/zebra/zebra_ptm.h
+++ b/zebra/zebra_ptm.h
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#ifndef _ZEBRA_PTM_H
diff --git a/zebra/zebra_ptm_null.c b/zebra/zebra_ptm_null.c
index 4afa2ce52..576ea1732 100644
--- a/zebra/zebra_ptm_null.c
+++ b/zebra/zebra_ptm_null.c
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
#include "prefix.h"
diff --git a/zebra/zebra_ptm_redistribute.c b/zebra/zebra_ptm_redistribute.c
index 396857bc1..d6902142a 100644
--- a/zebra/zebra_ptm_redistribute.c
+++ b/zebra/zebra_ptm_redistribute.c
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
@@ -79,9 +78,9 @@ zebra_interface_bfd_update (struct interface *ifp, struct prefix *dp,
for (ALL_LIST_ELEMENTS (zebrad.client_list, node, nnode, client))
{
- /* Supporting for OSPF and BGP */
+ /* Supporting for OSPF, BGP and PIM */
if (client->proto != ZEBRA_ROUTE_OSPF && client->proto != ZEBRA_ROUTE_BGP
- && client->proto != ZEBRA_ROUTE_OSPF6)
+ && client->proto != ZEBRA_ROUTE_OSPF6 && client->proto != ZEBRA_ROUTE_PIM)
continue;
/* Notify to the protocol daemons. */
@@ -118,7 +117,8 @@ zebra_bfd_peer_replay_req (void)
/* Supporting for BGP */
if ((client->proto != ZEBRA_ROUTE_BGP) &&
(client->proto != ZEBRA_ROUTE_OSPF) &&
- (client->proto != ZEBRA_ROUTE_OSPF6))
+ (client->proto != ZEBRA_ROUTE_OSPF6) &&
+ (client->proto != ZEBRA_ROUTE_PIM))
continue;
/* Notify to the protocol daemons. */
diff --git a/zebra/zebra_ptm_redistribute.h b/zebra/zebra_ptm_redistribute.h
index d5aa37d5f..ac3873f24 100644
--- a/zebra/zebra_ptm_redistribute.h
+++ b/zebra/zebra_ptm_redistribute.h
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 07b19155e..5f457a6fc 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
@@ -1115,6 +1114,7 @@ rib_install_kernel (struct route_node *rn, struct rib *rib, struct rib *old)
rib_table_info_t *info = srcdest_rnode_table_info(rn);
int recursing;
struct prefix *p, *src_p;
+ struct zebra_vrf *zvrf = vrf_info_lookup (rib->vrf_id);
srcdest_rnode_prefixes (rn, &p, &src_p);
@@ -1131,6 +1131,7 @@ rib_install_kernel (struct route_node *rn, struct rib *rib, struct rib *old)
*/
hook_call(rib_update, rn, "installing in kernel");
ret = kernel_route_rib (p, src_p, old, rib);
+ zvrf->installs++;
/* If install succeeds, update FIB flag for nexthops. */
if (!ret)
@@ -1159,6 +1160,7 @@ rib_uninstall_kernel (struct route_node *rn, struct rib *rib)
rib_table_info_t *info = srcdest_rnode_table_info(rn);
int recursing;
struct prefix *p, *src_p;
+ struct zebra_vrf *zvrf = vrf_info_lookup (rib->vrf_id);
srcdest_rnode_prefixes (rn, &p, &src_p);
@@ -1175,6 +1177,7 @@ rib_uninstall_kernel (struct route_node *rn, struct rib *rib)
*/
hook_call(rib_update, rn, "uninstalling from kernel");
ret = kernel_route_rib (p, src_p, rib, NULL);
+ zvrf->removals++;
for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB);
diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c
index 67859fd46..16c157e30 100644
--- a/zebra/zebra_rnh.c
+++ b/zebra/zebra_rnh.c
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
@@ -555,7 +554,7 @@ zebra_rnh_process_static_routes (vrf_id_t vrfid, int family,
{
RNODE_FOREACH_RIB(static_rn, srib)
{
- if (srib->type == ZEBRA_ROUTE_STATIC)
+ if (srib->type != ZEBRA_ROUTE_STATIC)
continue;
/* Set the filter flag for the correct nexthop - static route may
diff --git a/zebra/zebra_rnh.h b/zebra/zebra_rnh.h
index 4394fde4f..a75674d0c 100644
--- a/zebra/zebra_rnh.h
+++ b/zebra/zebra_rnh.h
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#ifndef _ZEBRA_RNH_H
diff --git a/zebra/zebra_rnh_null.c b/zebra/zebra_rnh_null.c
index 286290a52..0a3620bbe 100644
--- a/zebra/zebra_rnh_null.c
+++ b/zebra/zebra_rnh_null.c
@@ -13,10 +13,9 @@
* 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 Quagga; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
#include "vty.h"
diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c
index 1738b0b05..4a81cb635 100644
--- a/zebra/zebra_routemap.c
+++ b/zebra/zebra_routemap.c
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/zebra_routemap.h b/zebra/zebra_routemap.h
index bf418ccac..94981a3cd 100644
--- a/zebra/zebra_routemap.h
+++ b/zebra/zebra_routemap.h
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#ifndef __ZEBRA_ROUTEMAP_H__
diff --git a/zebra/zebra_snmp.c b/zebra/zebra_snmp.c
index 8adb8873d..7c2e6697c 100644
--- a/zebra/zebra_snmp.c
+++ b/zebra/zebra_snmp.c
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
/*
diff --git a/zebra/zebra_static.c b/zebra/zebra_static.c
index 4628d1109..b218eb521 100644
--- a/zebra/zebra_static.c
+++ b/zebra/zebra_static.c
@@ -15,10 +15,9 @@
* 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 Quagga; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
diff --git a/zebra/zebra_static.h b/zebra/zebra_static.h
index adc2efff5..9f76ab5f5 100644
--- a/zebra/zebra_static.h
+++ b/zebra/zebra_static.h
@@ -15,10 +15,9 @@
* 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 Quagga; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#ifndef __ZEBRA_STATIC_H__
#define __ZEBRA_STATIC_H__
diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c
index 6b3689105..94e250618 100644
--- a/zebra/zebra_vrf.c
+++ b/zebra/zebra_vrf.c
@@ -14,10 +14,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
@@ -536,11 +535,10 @@ vrf_config_write (struct vty *vty)
void
zebra_vrf_init (void)
{
- vrf_add_hook (VRF_NEW_HOOK, zebra_vrf_new);
- vrf_add_hook (VRF_ENABLE_HOOK, zebra_vrf_enable);
- vrf_add_hook (VRF_DISABLE_HOOK, zebra_vrf_disable);
- vrf_add_hook (VRF_DELETE_HOOK, zebra_vrf_delete);
+ vrf_init (zebra_vrf_new,
+ zebra_vrf_enable,
+ zebra_vrf_disable,
+ zebra_vrf_delete);
- vrf_init ();
vrf_cmd_init (vrf_config_write);
}
diff --git a/zebra/zebra_vrf.h b/zebra/zebra_vrf.h
index 74c2a5217..790e2e53d 100644
--- a/zebra/zebra_vrf.h
+++ b/zebra/zebra_vrf.h
@@ -15,10 +15,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#if !defined(__ZEBRA_RIB_H__)
#define __ZEBRA_RIB_H__
@@ -95,6 +94,13 @@ struct zebra_vrf
/* MPLS processing flags */
u_int16_t mpls_flags;
#define MPLS_FLAG_SCHEDULE_LSPS (1 << 0)
+
+ /* Route Installs */
+ uint64_t installs;
+ uint64_t removals;
+ uint64_t neigh_updates;
+ uint64_t lsp_installs;
+ uint64_t lsp_removals;
};
static inline vrf_id_t
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index c5c462c8d..d0d761af9 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
@@ -46,7 +45,9 @@
extern int allow_delete;
static int do_show_ip_route(struct vty *vty, const char *vrf_name,
- safi_t safi, bool use_fib, u_char use_json);
+ afi_t afi, safi_t safi, bool use_fib, u_char use_json,
+ route_tag_t tag, struct prefix *longer_prefix_p,
+ bool supernets_only, int type, u_short ospf_instance_id);
static void vty_show_ip_route_detail (struct vty *vty, struct route_node *rn,
int mcast);
@@ -299,12 +300,14 @@ DEFUN (no_ip_multicast_mode,
DEFUN (show_ip_rpf,
show_ip_rpf_cmd,
- "show ip rpf",
+ "show ip rpf [json]",
SHOW_STR
IP_STR
- "Display RPF information for multicast source\n")
+ "Display RPF information for multicast source\n"
+ JSON_STR)
{
- return do_show_ip_route(vty, VRF_DEFAULT_NAME, SAFI_MULTICAST, false, 0);
+ int uj = use_json(argc, argv);
+ return do_show_ip_route (vty, VRF_DEFAULT_NAME, AFI_IP, SAFI_MULTICAST, false, uj, 0, NULL, false, -1, 0);
}
DEFUN (show_ip_rpf_addr,
@@ -1086,22 +1089,11 @@ use_fib (struct cmd_token *token)
return strncmp(token->arg, "route", strlen(token->arg));
}
-DEFUN (show_ip_route,
- show_ip_route_cmd,
- "show ip <fib|route> [json]",
- SHOW_STR
- IP_STR
- "IP forwarding table\n"
- "IP routing table\n"
- JSON_STR)
-{
- return do_show_ip_route (vty, VRF_DEFAULT_NAME, SAFI_UNICAST,
- use_fib(argv[2]), use_json(argc, argv));
-}
-
static int
-do_show_ip_route (struct vty *vty, const char *vrf_name, safi_t safi,
- bool use_fib, u_char use_json)
+do_show_ip_route (struct vty *vty, const char *vrf_name, afi_t afi, safi_t safi,
+ bool use_fib, u_char use_json, route_tag_t tag,
+ struct prefix *longer_prefix_p, bool supernets_only,
+ int type, u_short ospf_instance_id)
{
struct route_table *table;
struct route_node *rn;
@@ -1111,6 +1103,7 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, safi_t safi,
char buf[BUFSIZ];
json_object *json = NULL;
json_object *json_prefix = NULL;
+ u_int32_t addr;
if (!(zvrf = zebra_vrf_lookup_by_name (vrf_name)))
{
@@ -1130,7 +1123,7 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, safi_t safi,
return CMD_SUCCESS;
}
- table = zebra_vrf_table (AFI_IP, safi, zvrf_id (zvrf));
+ table = zebra_vrf_table (afi, safi, zvrf_id (zvrf));
if (! table)
{
if (use_json)
@@ -1139,69 +1132,82 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, safi_t safi,
}
if (use_json)
- {
json = json_object_new_object();
- /* Show all IPv4 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
+ /* Show all routes. */
+ for (rn = route_top (table); rn; rn = route_next (rn))
+ {
+ RNODE_FOREACH_RIB (rn, rib)
{
- RNODE_FOREACH_RIB (rn, rib)
+ if (use_fib && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
+
+ if (tag && rib->tag != tag)
+ continue;
+
+ if (longer_prefix_p && ! prefix_match (longer_prefix_p, &rn->p))
+ continue;
+
+ /* This can only be true when the afi is IPv4 */
+ if (supernets_only)
{
- if (use_fib && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ addr = ntohl (rn->p.u.prefix4.s_addr);
+
+ if (IN_CLASSC (addr) && rn->p.prefixlen >= 24)
+ continue;
+
+ if (IN_CLASSB (addr) && rn->p.prefixlen >= 16)
+ continue;
+
+ if (IN_CLASSA (addr) && rn->p.prefixlen >= 8)
continue;
- if (!json_prefix)
- json_prefix = json_object_new_array();
- vty_show_ip_route (vty, rn, rib, json_prefix);
}
- if (json_prefix)
+ if (type && rib->type != type)
+ continue;
+
+ if (ospf_instance_id && (rib->type != ZEBRA_ROUTE_OSPF || rib->instance != ospf_instance_id))
+ continue;
+
+ if (use_json)
{
- prefix2str (&rn->p, buf, sizeof buf);
- json_object_object_add(json, buf, json_prefix);
- json_prefix = NULL;
+ if (!json_prefix)
+ json_prefix = json_object_new_array();
}
- }
-
- vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
- json_object_free(json);
- }
- else
- {
- /* Show all IPv4 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- {
- RNODE_FOREACH_RIB (rn, rib)
+ else
{
- if (use_fib && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- continue;
if (first)
{
- vty_out (vty, SHOW_ROUTE_V4_HEADER);
+ if (afi == AFI_IP)
+ vty_out (vty, SHOW_ROUTE_V4_HEADER);
+ else
+ vty_out (vty, SHOW_ROUTE_V6_HEADER);
+
+ if (zvrf_id (zvrf) != VRF_DEFAULT)
+ vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
+
first = 0;
}
- vty_show_ip_route (vty, rn, rib, NULL);
}
+
+ vty_show_ip_route (vty, rn, rib, json_prefix);
}
- }
- return CMD_SUCCESS;
-}
+ if (json_prefix)
+ {
+ prefix2str (&rn->p, buf, sizeof buf);
+ json_object_object_add(json, buf, json_prefix);
+ json_prefix = NULL;
+ }
+ }
-DEFUN (show_ip_route_vrf,
- show_ip_route_vrf_cmd,
- "show ip <fib|route> vrf NAME [json]",
- SHOW_STR
- IP_STR
- "IP forwarding table\n"
- "IP routing table\n"
- VRF_CMD_HELP_STR
- JSON_STR)
-{
- int idx_vrf = 4;
- bool uf = use_fib(argv[2]);
- u_char uj = use_json(argc, argv);
+ if (use_json)
+ {
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
+ json_object_free(json);
+ }
- return do_show_ip_route (vty, argv[idx_vrf]->arg, SAFI_UNICAST, uf, uj);
+ return CMD_SUCCESS;
}
DEFUN (show_ip_nht,
@@ -1346,258 +1352,115 @@ DEFUN (no_ipv6_nht_default_route,
return CMD_SUCCESS;
}
-DEFUN (show_ip_route_tag,
- show_ip_route_tag_cmd,
- "show ip <fib|route> [vrf NAME] tag (1-4294967295)",
+// dwalton one "show ip route" to rule them all
+DEFUN (show_ip_route,
+ show_ip_route_cmd,
+ "show ip <fib|route> [vrf NAME] [tag (1-4294967295)|A.B.C.D/M longer-prefixes|supernets-only|" FRR_IP_REDIST_STR_ZEBRA "|ospf (1-65535)] [json]",
SHOW_STR
IP_STR
"IP forwarding table\n"
"IP routing table\n"
VRF_CMD_HELP_STR
"Show only routes with tag\n"
- "Tag value\n")
+ "Tag value\n"
+ "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
+ "Show route matching the specified Network/Mask pair only\n"
+ "Show supernet entries only\n"
+ FRR_IP_REDIST_HELP_STR_ZEBRA
+ "Open Shortest Path First (OSPFv2)\n"
+ "Instance ID\n"
+ JSON_STR)
{
bool uf = use_fib(argv[2]);
- int idx_vrf = 3;
- int idx_name = 4;
- int idx_tag = 6;
struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- int first = 1;
+ int vrf_all = 0;
route_tag_t tag = 0;
vrf_id_t vrf_id = VRF_DEFAULT;
+ struct vrf *vrf;
+ struct zebra_vrf *zvrf;
+ int uj = use_json(argc, argv);
+ int idx = 0;
+ struct prefix p;
+ bool longer_prefixes = false;
+ bool supernets_only = false;
+ int type = 0;
+ u_short ospf_instance_id = 0;
- if (strmatch(argv[idx_vrf]->text, "vrf"))
- {
- VRF_GET_ID (vrf_id, argv[idx_name]->arg);
- VTY_GET_INTEGER_RANGE("tag", tag, argv[idx_tag]->arg, 0, 4294967295);
- }
- else
+ if (argv_find (argv, argc, "vrf", &idx))
{
- idx_tag -= 2;
- VTY_GET_INTEGER_RANGE("tag", tag, argv[idx_tag]->arg, 0, 4294967295);
+ if (strmatch(argv[idx+1]->arg, "all"))
+ vrf_all = 1;
+ else
+ VRF_GET_ID (vrf_id, argv[idx+1]->arg);
}
- table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
- if (! table)
- return CMD_SUCCESS;
-
- /* Show all IPv4 routes with matching tag value. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- {
- if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- continue;
- if (rib->tag != tag)
- continue;
-
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V4_HEADER);
- first = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- return CMD_SUCCESS;
-}
-
-DEFUN (show_ip_route_prefix_longer,
- show_ip_route_prefix_longer_cmd,
- "show ip <fib|route> [vrf NAME] A.B.C.D/M longer-prefixes",
- SHOW_STR
- IP_STR
- "IP forwarding table\n"
- "IP routing table\n"
- VRF_CMD_HELP_STR
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Show route matching the specified Network/Mask pair only\n")
-{
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- struct prefix p;
- int ret;
- int first = 1;
- bool uf = use_fib(argv[2]);
- vrf_id_t vrf_id = VRF_DEFAULT;
+ if (argv_find (argv, argc, "tag", &idx))
+ VTY_GET_INTEGER_RANGE("tag", tag, argv[idx+1]->arg, 0, 4294967295);
- if (strmatch(argv[3]->text, "vrf"))
+ else if (argv_find (argv, argc, "A.B.C.D/M", &idx))
{
- VRF_GET_ID (vrf_id, argv[4]->arg);
- ret = str2prefix (argv[5]->arg, &p);
+ str2prefix (argv[idx]->arg, &p);
+ longer_prefixes = true;
}
+
+ else if (argv_find (argv, argc, "supernets_only", &idx))
+ supernets_only = true;
+
else
{
- ret = str2prefix (argv[3]->arg, &p);
+ if (argv_find (argv, argc, "kernel", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+ else if (argv_find (argv, argc, "connected", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+ else if (argv_find (argv, argc, "static", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+ else if (argv_find (argv, argc, "rip", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+ else if (argv_find (argv, argc, "ospf", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+ else if (argv_find (argv, argc, "isis", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+ else if (argv_find (argv, argc, "bgp", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+ else if (argv_find (argv, argc, "pim", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+ else if (argv_find (argv, argc, "eigrp", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+ else if (argv_find (argv, argc, "nhrp", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+ else if (argv_find (argv, argc, "table", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+ else if (argv_find (argv, argc, "vnc", &idx))
+ type = proto_redistnum (AFI_IP, argv[idx]->text);
+
+ if (argv_find (argv, argc, "(1-65535)", &idx))
+ VTY_GET_INTEGER ("Instance", ospf_instance_id, argv[idx]->arg);
+
+ if (type < 0)
+ {
+ vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
}
- if (! ret)
+ if (vrf_all)
{
- vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
- if (! table)
- return CMD_SUCCESS;
-
- /* Show matched type IPv4 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- if (prefix_match (&p, &rn->p))
- {
- if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- continue;
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V4_HEADER);
- first = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- return CMD_SUCCESS;
-}
-
-DEFUN (show_ip_route_supernets,
- show_ip_route_supernets_cmd,
- "show ip <fib|route> [vrf NAME] supernets-only",
- SHOW_STR
- IP_STR
- "IP forwarding table\n"
- "IP routing table\n"
- VRF_CMD_HELP_STR
- "Show supernet entries only\n")
-{
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- u_int32_t addr;
- int first = 1;
- vrf_id_t vrf_id = VRF_DEFAULT;
- bool uf = use_fib(argv[2]);
-
- if (strmatch(argv[3]->text, "vrf"))
- VRF_GET_ID (vrf_id, argv[4]->arg);
-
- table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
- if (! table)
- return CMD_SUCCESS;
-
- /* Show matched type IPv4 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- {
- if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- continue;
- addr = ntohl (rn->p.u.prefix4.s_addr);
-
- if ((IN_CLASSC (addr) && rn->p.prefixlen < 24)
- || (IN_CLASSB (addr) && rn->p.prefixlen < 16)
- || (IN_CLASSA (addr) && rn->p.prefixlen < 8))
- {
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V4_HEADER);
- first = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- }
- return CMD_SUCCESS;
-}
-
-DEFUN (show_ip_route_protocol,
- show_ip_route_protocol_cmd,
- "show ip <fib|route> [vrf NAME] " FRR_IP_REDIST_STR_ZEBRA,
- SHOW_STR
- IP_STR
- "IP forwarding table\n"
- "IP routing table\n"
- VRF_CMD_HELP_STR
- FRR_IP_REDIST_HELP_STR_ZEBRA)
-{
- int type;
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- int first = 1;
- vrf_id_t vrf_id = VRF_DEFAULT;
- bool uf = use_fib(argv[2]);
-
- int idx = 0;
- if (argv_find (argv, argc, "NAME", &idx))
- VRF_GET_ID (vrf_id, argv[idx]->arg);
-
- char *proto = argv[argc - 1]->text;
- type = proto_redistnum (AFI_IP, proto);
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+ {
+ if ((zvrf = vrf->info) == NULL ||
+ (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
+ continue;
- if (type < 0)
+ do_show_ip_route (vty, zvrf_name (zvrf), AFI_IP, SAFI_UNICAST, uf, uj, tag,
+ longer_prefixes ? &p : NULL, supernets_only, type, ospf_instance_id);
+ }
+ }
+ else
{
- vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
- return CMD_WARNING;
+ vrf = vrf_lookup_by_id (vrf_id);
+ do_show_ip_route (vty, vrf->name, AFI_IP, SAFI_UNICAST, uf, uj, tag,
+ longer_prefixes ? &p : NULL, supernets_only, type, ospf_instance_id);
}
-
- table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
- if (! table)
- return CMD_SUCCESS;
-
- /* Show matched type IPv4 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- if (rib->type == type)
- {
- if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- continue;
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V4_HEADER);
- first = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- return CMD_SUCCESS;
-}
-
-
-DEFUN (show_ip_route_ospf_instance,
- show_ip_route_ospf_instance_cmd,
- "show ip <fib|route> ospf (1-65535)",
- SHOW_STR
- IP_STR
- "IP forwarding table\n"
- "IP routing table\n"
- "Open Shortest Path First (OSPFv2)\n"
- "Instance ID\n")
-{
- int idx_number = 4;
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- int first = 1;
- u_short instance = 0;
- bool uf = use_fib(argv[2]);
-
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
-
- table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, VRF_DEFAULT);
- if (! table)
- return CMD_SUCCESS;
-
- /* Show matched type IPv4 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- if (rib->type == ZEBRA_ROUTE_OSPF && rib->instance == instance)
- {
- if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- continue;
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V4_HEADER);
- first = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
return CMD_SUCCESS;
}
@@ -1901,294 +1764,6 @@ DEFUN (show_ip_route_summary_prefix,
}
-DEFUN (show_ip_route_vrf_all,
- show_ip_route_vrf_all_cmd,
- "show ip <fib|route> vrf all",
- SHOW_STR
- IP_STR
- "IP forwarding table\n"
- "IP routing table\n"
- VRF_ALL_CMD_HELP_STR)
-{
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- struct vrf *vrf;
- struct zebra_vrf *zvrf;
- int first = 1;
- int vrf_header = 1;
- bool uf = use_fib(argv[2]);
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- {
- if ((zvrf = vrf->info) == NULL ||
- (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
- continue;
-
- /* Show all IPv4 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- {
- if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- continue;
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V4_HEADER);
- first = 0;
- }
-
- if (vrf_header)
- {
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
- vrf_header = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- vrf_header = 1;
- }
-
- return CMD_SUCCESS;
-}
-
-DEFUN (show_ip_route_vrf_all_tag,
- show_ip_route_vrf_all_tag_cmd,
- "show ip <fib|route> vrf all tag (1-4294967295)",
- SHOW_STR
- IP_STR
- "IP forwarding table\n"
- "IP routing table\n"
- VRF_ALL_CMD_HELP_STR
- "Show only routes with tag\n"
- "Tag value\n")
-{
- int idx_number = 6;
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- struct vrf *vrf;
- struct zebra_vrf *zvrf;
- int first = 1;
- int vrf_header = 1;
- route_tag_t tag = 0;
- bool uf = use_fib(argv[2]);
-
- if (argv[idx_number]->arg)
- VTY_GET_INTEGER_RANGE("tag", tag, argv[idx_number]->arg, 0, 4294967295);
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- {
- if ((zvrf = vrf->info) == NULL ||
- (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
- continue;
-
- /* Show all IPv4 routes with matching tag value. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- {
- if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- continue;
- if (rib->tag != tag)
- continue;
-
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V4_HEADER);
- first = 0;
- }
-
- if (vrf_header)
- {
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
- vrf_header = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- vrf_header = 1;
- }
- return CMD_SUCCESS;
-}
-
-DEFUN (show_ip_route_vrf_all_prefix_longer,
- show_ip_route_vrf_all_prefix_longer_cmd,
- "show ip <fib|route> vrf all A.B.C.D/M longer-prefixes",
- SHOW_STR
- IP_STR
- "IP forwarding table\n"
- "IP routing table\n"
- VRF_ALL_CMD_HELP_STR
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Show route matching the specified Network/Mask pair only\n")
-{
- int idx_ipv4_prefixlen = 5;
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- struct prefix p;
- struct vrf *vrf;
- struct zebra_vrf *zvrf;
- int ret;
- int first = 1;
- int vrf_header = 1;
- bool uf = use_fib(argv[2]);
-
- ret = str2prefix (argv[idx_ipv4_prefixlen]->arg, &p);
- if (! ret)
- {
- vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- {
- if ((zvrf = vrf->info) == NULL ||
- (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
- continue;
-
- /* Show matched type IPv4 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- if (prefix_match (&p, &rn->p))
- {
- if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- continue;
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V4_HEADER);
- first = 0;
- }
-
- if (vrf_header)
- {
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
- vrf_header = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- vrf_header = 1;
- }
-
- return CMD_SUCCESS;
-}
-
-DEFUN (show_ip_route_vrf_all_supernets,
- show_ip_route_vrf_all_supernets_cmd,
- "show ip <fib|route> vrf all supernets-only",
- SHOW_STR
- IP_STR
- "IP forwarding table\n"
- "IP routing table\n"
- VRF_ALL_CMD_HELP_STR
- "Show supernet entries only\n")
-{
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- struct vrf *vrf;
- struct zebra_vrf *zvrf;
- u_int32_t addr;
- int first = 1;
- int vrf_header = 1;
- bool uf = use_fib(argv[2]);
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- {
- if ((zvrf = vrf->info) == NULL ||
- (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
- continue;
-
- /* Show matched type IPv4 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- {
- if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- continue;
-
- addr = ntohl (rn->p.u.prefix4.s_addr);
-
- if ((IN_CLASSC (addr) && rn->p.prefixlen < 24)
- || (IN_CLASSB (addr) && rn->p.prefixlen < 16)
- || (IN_CLASSA (addr) && rn->p.prefixlen < 8))
- {
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V4_HEADER);
- first = 0;
- }
- if (vrf_header)
- {
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
- vrf_header = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- }
- vrf_header = 1;
- }
-
- return CMD_SUCCESS;
-}
-
-DEFUN (show_ip_route_vrf_all_protocol,
- show_ip_route_vrf_all_protocol_cmd,
- "show ip <fib|route> vrf all " FRR_IP_REDIST_STR_ZEBRA,
- SHOW_STR
- IP_STR
- "IP forwarding table\n"
- "IP routing table\n"
- VRF_ALL_CMD_HELP_STR
- FRR_IP_REDIST_HELP_STR_ZEBRA"\n")
-{
- int type;
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- struct vrf *vrf;
- struct zebra_vrf *zvrf;
- int first = 1;
- int vrf_header = 1;
- bool uf = use_fib(argv[2]);
-
- char *proto = argv[argc - 1]->text;
- type = proto_redistnum (AFI_IP, proto);
-
- if (type < 0)
- {
- vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- {
- if ((zvrf = vrf->info) == NULL ||
- (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
- continue;
-
- /* Show matched type IPv4 routes. */
- for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- if (rib->type == type)
- {
- if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- continue;
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V4_HEADER);
- first = 0;
- }
-
- if (vrf_header)
- {
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
- vrf_header = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- vrf_header = 1;
- }
-
- return CMD_SUCCESS;
-}
-
DEFUN (show_ip_route_vrf_all_addr,
show_ip_route_vrf_all_addr_cmd,
"show ip route vrf all A.B.C.D",
@@ -2317,49 +1892,49 @@ DEFUN (show_ip_route_vrf_all_summary_prefix,
return CMD_SUCCESS;
}
-/* Write IPv4 static route configuration. */
+/* Write static route configuration. */
static int
-static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd)
+static_config (struct vty *vty, afi_t afi, safi_t safi, const char *cmd)
{
struct route_node *rn;
struct static_route *si;
struct route_table *stable;
struct vrf *vrf;
struct zebra_vrf *zvrf;
- char buf[BUFSIZ];
+ char buf[SRCDEST2STR_BUFFER];
int write =0;
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
{
if (!(zvrf = vrf->info))
continue;
- if ((stable = zvrf->stable[AFI_IP][safi]) == NULL)
+ if ((stable = zvrf->stable[afi][safi]) == NULL)
continue;
- for (rn = route_top (stable); rn; rn = route_next (rn))
+ for (rn = route_top (stable); rn; rn = srcdest_route_next (rn))
for (si = rn->info; si; si = si->next)
{
- vty_out (vty, "%s %s", cmd, prefix2str (&rn->p, buf, sizeof buf));
+ vty_out (vty, "%s %s", cmd, srcdest_rnode2str (rn, buf, sizeof buf));
switch (si->type)
{
case STATIC_IPV4_GATEWAY:
vty_out (vty, " %s", inet_ntoa (si->addr.ipv4));
break;
+ case STATIC_IPV6_GATEWAY:
+ vty_out (vty, " %s", inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ));
+ break;
case STATIC_IFINDEX:
vty_out (vty, " %s", si->ifname);
break;
case STATIC_BLACKHOLE:
vty_out (vty, " Null0");
break;
- case STATIC_IPV6_GATEWAY:
- vty_out (vty, " %s", inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ));
- break;
- case STATIC_IPV6_GATEWAY_IFINDEX:
- vty_out (vty, " %s %s",
- inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ),
- ifindex2ifname (si->ifindex, si->vrf_id));
- break;
+ case STATIC_IPV6_GATEWAY_IFINDEX:
+ vty_out (vty, " %s %s",
+ inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ),
+ ifindex2ifname (si->ifindex, si->vrf_id));
+ break;
}
/* flags are incompatible with STATIC_BLACKHOLE */
@@ -2379,7 +1954,7 @@ static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd)
vty_out (vty, " %d", si->distance);
if (si->vrf_id != VRF_DEFAULT)
- vty_out (vty, " vrf %s", zvrf ? zvrf_name (zvrf) : "");
+ vty_out (vty, " vrf %s", zvrf_name (zvrf));
/* Label information */
if (si->snh_label.num_labels)
@@ -2979,278 +2554,101 @@ DEFUN (no_ipv6_route_ifname_flags,
tag, distance, vrf, NULL);
}
+// dwalton duplicate to here
DEFUN (show_ipv6_route,
show_ipv6_route_cmd,
- "show ipv6 <fib|route> [vrf NAME] [json]",
+ "show ipv6 <fib|route> [vrf NAME] [tag (1-4294967295)|X:X::X:X/M longer-prefixes|" FRR_IP6_REDIST_STR_ZEBRA "] [json]",
SHOW_STR
IP_STR
- "IPv6 forwarding table\n"
- "IPv6 routing table\n"
+ "IP forwarding table\n"
+ "IP routing table\n"
VRF_CMD_HELP_STR
- "Output JSON\n")
+ "Show only routes with tag\n"
+ "Tag value\n"
+ "IPv6 prefix\n"
+ "Show route matching the specified Network/Mask pair only\n"
+ FRR_IP6_REDIST_HELP_STR_ZEBRA
+ JSON_STR)
{
+ bool uf = use_fib(argv[2]);
struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- int first = 1;
+ int vrf_all = 0;
+ route_tag_t tag = 0;
vrf_id_t vrf_id = VRF_DEFAULT;
- struct zebra_vrf *zvrf = NULL;
- char buf[SRCDEST2STR_BUFFER];
- json_object *json = NULL;
- json_object *json_prefix = NULL;
- bool uf = use_fib(argv[2]);
-
- int vrf = (argc > 3 && strmatch (argv[3]->text, "vrf"));
- int uj = vrf ? argc == 6 : argc == 4;
- char *vrfname = vrf ? argv[4]->arg : NULL;
-
- if (vrf)
- {
- if (!(zvrf = zebra_vrf_lookup_by_name (vrfname)))
- {
- if (uj)
- vty_out (vty, "{}%s", VTY_NEWLINE);
- else
- vty_out (vty, "vrf %s not defined%s", vrfname, VTY_NEWLINE);
- return CMD_SUCCESS;
- }
-
- if (zvrf_id (zvrf) == VRF_UNKNOWN)
- {
- if (uj)
- vty_out (vty, "{}%s", VTY_NEWLINE);
- else
- vty_out (vty, "vrf %s inactive%s", vrfname, VTY_NEWLINE);
- return CMD_SUCCESS;
- }
- else
- vrf_id = zvrf_id (zvrf);
- }
+ struct vrf *vrf;
+ struct zebra_vrf *zvrf;
+ int uj = use_json(argc, argv);
+ int idx = 0;
+ struct prefix p;
+ bool longer_prefixes = false;
+ bool supernets_only = false;
+ int type = 0;
- table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
- if (!table)
+ if (argv_find (argv, argc, "vrf", &idx))
{
- if (uj)
- vty_out (vty, "{}%s", VTY_NEWLINE);
- return CMD_SUCCESS;
+ if (strmatch(argv[idx+1]->arg, "all"))
+ vrf_all = 1;
+ else
+ VRF_GET_ID (vrf_id, argv[idx+1]->arg);
}
- if (uj)
- {
- json = json_object_new_object();
+ if (argv_find (argv, argc, "tag", &idx))
+ VTY_GET_INTEGER_RANGE("tag", tag, argv[idx+1]->arg, 0, 4294967295);
- /* Show all IPv6 route. */
- for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
- {
- RNODE_FOREACH_RIB (rn, rib)
- {
- if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- continue;
- if (!json_prefix)
- json_prefix = json_object_new_array();
- vty_show_ip_route (vty, rn, rib, json_prefix);
- }
-
- if (json_prefix)
- {
- srcdest_rnode2str (rn, buf, sizeof buf);
- json_object_object_add(json, buf, json_prefix);
- json_prefix = NULL;
- }
- }
-
- vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
- json_object_free(json);
+ else if (argv_find (argv, argc, "X:X::X:X/M", &idx))
+ {
+ str2prefix (argv[idx]->arg, &p);
+ longer_prefixes = true;
}
+
else
{
- /* Show all IPv6 route. */
- for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
+ if (argv_find (argv, argc, "kernel", &idx))
+ type = proto_redistnum (AFI_IP6, argv[idx]->text);
+ else if (argv_find (argv, argc, "connected", &idx))
+ type = proto_redistnum (AFI_IP6, argv[idx]->text);
+ else if (argv_find (argv, argc, "static", &idx))
+ type = proto_redistnum (AFI_IP6, argv[idx]->text);
+ else if (argv_find (argv, argc, "ripng", &idx))
+ type = proto_redistnum (AFI_IP6, argv[idx]->text);
+ else if (argv_find (argv, argc, "ospf6", &idx))
+ type = proto_redistnum (AFI_IP6, argv[idx]->text);
+ else if (argv_find (argv, argc, "isis", &idx))
+ type = proto_redistnum (AFI_IP6, argv[idx]->text);
+ else if (argv_find (argv, argc, "bgp", &idx))
+ type = proto_redistnum (AFI_IP6, argv[idx]->text);
+ else if (argv_find (argv, argc, "nhrp", &idx))
+ type = proto_redistnum (AFI_IP6, argv[idx]->text);
+ else if (argv_find (argv, argc, "table", &idx))
+ type = proto_redistnum (AFI_IP6, argv[idx]->text);
+ else if (argv_find (argv, argc, "vnc", &idx))
+ type = proto_redistnum (AFI_IP6, argv[idx]->text);
+
+ if (type < 0)
{
- RNODE_FOREACH_RIB (rn, rib)
- {
- if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- continue;
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V6_HEADER);
- first = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
+ vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
+ return CMD_WARNING;
}
}
- return CMD_SUCCESS;
-}
-
-DEFUN (show_ipv6_route_tag,
- show_ipv6_route_tag_cmd,
- "show ipv6 <fib|route> [vrf NAME] tag (1-4294967295)",
- SHOW_STR
- IP_STR
- "IPv6 forwarding table\n"
- "IPv6 routing table\n"
- VRF_CMD_HELP_STR
- "Show only routes with tag\n"
- "Tag value\n")
-{
- int idx_vrf = 3;
- int idx_name = 4;
- int idx_tag = 6;
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- int first = 1;
- route_tag_t tag = 0;
- vrf_id_t vrf_id = VRF_DEFAULT;
- bool uf = use_fib(argv[2]);
-
- if (strmatch(argv[idx_vrf]->text, "vrf"))
- {
- VRF_GET_ID (vrf_id, argv[idx_name]->arg);
- VTY_GET_INTEGER_RANGE("tag", tag, argv[idx_tag]->arg, 0, 4294967295);
- }
- else
+ if (vrf_all)
{
- idx_tag -= 2;
- VTY_GET_INTEGER_RANGE("tag", tag, argv[idx_tag]->arg, 0, 4294967295);
- }
-
- table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
- if (! table)
- return CMD_SUCCESS;
-
- /* Show all IPv6 routes with matching tag value. */
- for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- {
- if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- continue;
- if (rib->tag != tag)
- continue;
-
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V6_HEADER);
- first = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- return CMD_SUCCESS;
-}
-
-DEFUN (show_ipv6_route_prefix_longer,
- show_ipv6_route_prefix_longer_cmd,
- "show ipv6 <fib|route> [vrf NAME] X:X::X:X/M longer-prefixes",
- SHOW_STR
- IP_STR
- "IPv6 forwarding table\n"
- "IPv6 routing table\n"
- VRF_CMD_HELP_STR
- "IPv6 prefix\n"
- "Show route matching the specified Network/Mask pair only\n")
-{
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- struct prefix p;
- int ret;
- int first = 1;
- vrf_id_t vrf_id = VRF_DEFAULT;
- bool uf = use_fib(argv[2]);
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+ {
+ if ((zvrf = vrf->info) == NULL ||
+ (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
+ continue;
- if (strmatch(argv[3]->text, "vrf"))
- {
- VRF_GET_ID (vrf_id, argv[4]->arg);
- ret = str2prefix (argv[5]->arg, &p);
+ do_show_ip_route (vty, zvrf_name (zvrf), AFI_IP6, SAFI_UNICAST, uf, uj, tag,
+ longer_prefixes ? &p : NULL, supernets_only, type, 0);
+ }
}
else
{
- ret = str2prefix (argv[3]->arg, &p);
+ vrf = vrf_lookup_by_id (vrf_id);
+ do_show_ip_route (vty, vrf->name, AFI_IP6, SAFI_UNICAST, uf, uj, tag,
+ longer_prefixes ? &p : NULL, supernets_only, type, 0);
}
-
- if (! ret)
- {
- vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
- if (! table)
- return CMD_SUCCESS;
-
- /* Show matched type IPv6 routes. */
- for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- {
- struct prefix *p, *src_p;
- srcdest_rnode_prefixes(rn, &p, &src_p);
-
- if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- continue;
- if (prefix_match (p, &rn->p))
- {
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V6_HEADER);
- first = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- }
- return CMD_SUCCESS;
-}
-
-DEFUN (show_ipv6_route_protocol,
- show_ipv6_route_protocol_cmd,
- "show ipv6 <fib|route> [vrf NAME] " FRR_IP6_REDIST_STR_ZEBRA,
- SHOW_STR
- IP_STR
- "IPv6 forwarding table\n"
- "IPv6 routing table\n"
- VRF_CMD_HELP_STR
- FRR_IP6_REDIST_HELP_STR_ZEBRA)
-{
- int type;
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- int first = 1;
- vrf_id_t vrf_id = VRF_DEFAULT;
- bool uf = use_fib(argv[2]);
-
- int idx = 0;
- if (argv_find (argv, argc, "NAME", &idx))
- VRF_GET_ID (vrf_id, argv[idx]->arg);
-
- char *proto = argv[argc - 1]->text;
- type = proto_redistnum (AFI_IP6, proto);
-
- if (type < 0)
- {
- vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
- if (! table)
- return CMD_SUCCESS;
-
- /* Show matched type IPv6 routes. */
- for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- if (rib->type == type)
- {
- if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- continue;
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V6_HEADER);
- first = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
return CMD_SUCCESS;
}
@@ -3443,242 +2841,6 @@ DEFUN (show_ipv6_mroute,
return CMD_SUCCESS;
}
-
-DEFUN (show_ipv6_route_vrf_all,
- show_ipv6_route_vrf_all_cmd,
- "show ipv6 <fib|route> vrf all",
- SHOW_STR
- IP_STR
- "IPv6 forwarding table\n"
- "IPv6 routing table\n"
- VRF_ALL_CMD_HELP_STR)
-{
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- struct vrf *vrf;
- struct zebra_vrf *zvrf;
- int first = 1;
- int vrf_header = 1;
- bool uf = use_fib(argv[2]);
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- {
- if ((zvrf = vrf->info) == NULL ||
- (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
- continue;
-
- /* Show all IPv6 route. */
- for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- {
- if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- continue;
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V6_HEADER);
- first = 0;
- }
-
- if (vrf_header)
- {
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
- vrf_header = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- vrf_header = 1;
- }
-
- return CMD_SUCCESS;
-}
-
-DEFUN (show_ipv6_route_vrf_all_tag,
- show_ipv6_route_vrf_all_tag_cmd,
- "show ipv6 <fib|route> vrf all tag (1-4294967295)",
- SHOW_STR
- IP_STR
- "IPv6 forwarding table\n"
- "IPv6 routing table\n"
- VRF_ALL_CMD_HELP_STR
- "Show only routes with tag\n"
- "Tag value\n")
-{
- int idx_number = 6;
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- struct vrf *vrf;
- struct zebra_vrf *zvrf;
- int first = 1;
- int vrf_header = 1;
- route_tag_t tag = 0;
- bool uf = use_fib(argv[2]);
-
- if (argv[idx_number]->arg)
- VTY_GET_INTEGER_RANGE("tag", tag, argv[idx_number]->arg, 0, 4294967295);
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- {
- if ((zvrf = vrf->info) == NULL ||
- (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
- continue;
-
- /* Show all IPv6 routes with matching tag value. */
- for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- {
- if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- continue;
- if (rib->tag != tag)
- continue;
-
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V6_HEADER);
- first = 0;
- }
-
- if (vrf_header)
- {
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
- vrf_header = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- vrf_header = 1;
- }
-
- return CMD_SUCCESS;
-}
-
-DEFUN (show_ipv6_route_vrf_all_prefix_longer,
- show_ipv6_route_vrf_all_prefix_longer_cmd,
- "show ipv6 <fib|route> vrf all X:X::X:X/M longer-prefixes",
- SHOW_STR
- IP_STR
- "IPv6 forwarding table\n"
- "IPv6 routing table\n"
- VRF_ALL_CMD_HELP_STR
- "IPv6 prefix\n"
- "Show route matching the specified Network/Mask pair only\n")
-{
- int idx_ipv6_prefixlen = 5;
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- struct prefix p;
- struct vrf *vrf;
- struct zebra_vrf *zvrf;
- int ret;
- int first = 1;
- int vrf_header = 1;
- bool uf = use_fib(argv[2]);
-
- ret = str2prefix (argv[idx_ipv6_prefixlen]->arg, &p);
- if (! ret)
- {
- vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- {
- if ((zvrf = vrf->info) == NULL ||
- (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
- continue;
-
- /* Show matched type IPv6 routes. */
- for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- {
- struct prefix *p, *src_p;
- srcdest_rnode_prefixes(rn, &p, &src_p);
- if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- continue;
- if (prefix_match (p, &rn->p))
- {
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V6_HEADER);
- first = 0;
- }
-
- if (vrf_header)
- {
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
- vrf_header = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- }
- vrf_header = 1;
- }
-
- return CMD_SUCCESS;
-}
-
-DEFUN (show_ipv6_route_vrf_all_protocol,
- show_ipv6_route_vrf_all_protocol_cmd,
- "show ipv6 <fib|route> vrf all " FRR_IP6_REDIST_STR_ZEBRA,
- SHOW_STR
- IP_STR
- "IPv6 forwarding table\n"
- "IPv6 routing table\n"
- VRF_ALL_CMD_HELP_STR
- FRR_IP6_REDIST_HELP_STR_ZEBRA)
-{
- int type;
- struct route_table *table;
- struct route_node *rn;
- struct rib *rib;
- struct vrf *vrf;
- struct zebra_vrf *zvrf;
- int first = 1;
- int vrf_header = 1;
- bool uf = use_fib(argv[2]);
-
- char *proto = argv[argc - 1]->text;
- type = proto_redistnum (AFI_IP6, proto);
-
- if (type < 0)
- {
- vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- {
- if ((zvrf = vrf->info) == NULL ||
- (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
- continue;
-
- /* Show matched type IPv6 routes. */
- for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
- if (rib->type == type)
- {
- if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- continue;
- if (first)
- {
- vty_out (vty, SHOW_ROUTE_V6_HEADER);
- first = 0;
- }
-
- if (vrf_header)
- {
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
- vrf_header = 0;
- }
- vty_show_ip_route (vty, rn, rib, NULL);
- }
- vrf_header = 1;
- }
-
- return CMD_SUCCESS;
-}
-
DEFUN (show_ipv6_route_vrf_all_addr,
show_ipv6_route_vrf_all_addr_cmd,
"show ipv6 route vrf all X:X::X:X",
@@ -3843,85 +3005,6 @@ DEFUN (show_ipv6_route_vrf_all_summary_prefix,
return CMD_SUCCESS;
}
-/* Write IPv6 static route configuration. */
-static int
-static_config_ipv6 (struct vty *vty)
-{
- struct route_node *rn;
- struct static_route *si;
- int write = 0;
- char buf[SRCDEST2STR_BUFFER];
- struct route_table *stable;
- struct vrf *vrf;
- struct zebra_vrf *zvrf;
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- {
- if (!(zvrf = vrf->info))
- continue;
- if ((stable = zvrf->stable[AFI_IP6][SAFI_UNICAST]) == NULL)
- continue;
-
- for (rn = route_top (stable); rn; rn = srcdest_route_next (rn))
- for (si = rn->info; si; si = si->next)
- {
- vty_out (vty, "ipv6 route %s", srcdest_rnode2str (rn, buf, sizeof buf));
-
- switch (si->type)
- {
- case STATIC_IPV4_GATEWAY:
- vty_out (vty, " %s", inet_ntoa (si->addr.ipv4));
- break;
- case STATIC_IPV6_GATEWAY:
- vty_out (vty, " %s", inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ));
- break;
- case STATIC_IFINDEX:
- vty_out (vty, " %s", si->ifname);
- break;
- case STATIC_BLACKHOLE:
- vty_out (vty, " Null0" );
- break;
- case STATIC_IPV6_GATEWAY_IFINDEX:
- vty_out (vty, " %s %s",
- inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ),
- ifindex2ifname (si->ifindex, si->vrf_id));
- break;
- }
-
- /* flags are incompatible with STATIC_BLACKHOLE */
- if (si->type != STATIC_BLACKHOLE)
- {
- if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT))
- vty_out (vty, " %s", "reject");
- if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE))
- vty_out (vty, " %s", "blackhole");
- }
-
- if (si->tag)
- vty_out (vty, " tag %"ROUTE_TAG_PRI, si->tag);
-
- if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT)
- vty_out (vty, " %d", si->distance);
-
- if (si->vrf_id != VRF_DEFAULT)
- {
- vty_out (vty, " vrf %s", zvrf_name (zvrf));
- }
-
- /* Label information */
- if (si->snh_label.num_labels)
- vty_out (vty, " label %s",
- mpls_label2str (si->snh_label.num_labels,
- si->snh_label.label, buf, sizeof buf, 0));
-
- vty_out (vty, "%s", VTY_NEWLINE);
-
- write = 1;
- }
- }
- return write;
-}
-
DEFUN (allow_external_route_update,
allow_external_route_update_cmd,
"allow-external-route-update",
@@ -3978,9 +3061,9 @@ zebra_ip_config (struct vty *vty)
{
int write = 0;
- write += static_config_ipv4 (vty, SAFI_UNICAST, "ip route");
- write += static_config_ipv4 (vty, SAFI_MULTICAST, "ip mroute");
- write += static_config_ipv6 (vty);
+ write += static_config (vty, AFI_IP, SAFI_UNICAST, "ip route");
+ write += static_config (vty, AFI_IP, SAFI_MULTICAST, "ip mroute");
+ write += static_config (vty, AFI_IP6, SAFI_UNICAST, "ipv6 route");
write += zebra_import_table_config (vty);
return write;
@@ -4114,17 +3197,12 @@ zebra_vty_init (void)
install_element (VIEW_NODE, &show_vrf_cmd);
install_element (VIEW_NODE, &show_ip_route_cmd);
- install_element (VIEW_NODE, &show_ip_route_ospf_instance_cmd);
- install_element (VIEW_NODE, &show_ip_route_tag_cmd);
install_element (VIEW_NODE, &show_ip_nht_cmd);
install_element (VIEW_NODE, &show_ip_nht_vrf_all_cmd);
install_element (VIEW_NODE, &show_ipv6_nht_cmd);
install_element (VIEW_NODE, &show_ipv6_nht_vrf_all_cmd);
install_element (VIEW_NODE, &show_ip_route_addr_cmd);
install_element (VIEW_NODE, &show_ip_route_prefix_cmd);
- install_element (VIEW_NODE, &show_ip_route_prefix_longer_cmd);
- install_element (VIEW_NODE, &show_ip_route_protocol_cmd);
- install_element (VIEW_NODE, &show_ip_route_supernets_cmd);
install_element (VIEW_NODE, &show_ip_route_summary_cmd);
install_element (VIEW_NODE, &show_ip_route_summary_prefix_cmd);
@@ -4136,15 +3214,8 @@ zebra_vty_init (void)
install_element (CONFIG_NODE, &no_ip_route_flags_cmd);
install_element (CONFIG_NODE, &no_ip_route_mask_flags_cmd);
- install_element (VIEW_NODE, &show_ip_route_vrf_cmd);
-
- install_element (VIEW_NODE, &show_ip_route_vrf_all_cmd);
- install_element (VIEW_NODE, &show_ip_route_vrf_all_tag_cmd);
install_element (VIEW_NODE, &show_ip_route_vrf_all_addr_cmd);
install_element (VIEW_NODE, &show_ip_route_vrf_all_prefix_cmd);
- install_element (VIEW_NODE, &show_ip_route_vrf_all_prefix_longer_cmd);
- install_element (VIEW_NODE, &show_ip_route_vrf_all_protocol_cmd);
- install_element (VIEW_NODE, &show_ip_route_vrf_all_supernets_cmd);
install_element (VIEW_NODE, &show_ip_route_vrf_all_summary_cmd);
install_element (VIEW_NODE, &show_ip_route_vrf_all_summary_prefix_cmd);
@@ -4161,25 +3232,17 @@ zebra_vty_init (void)
install_element (CONFIG_NODE, &ipv6_nht_default_route_cmd);
install_element (CONFIG_NODE, &no_ipv6_nht_default_route_cmd);
install_element (VIEW_NODE, &show_ipv6_route_cmd);
- install_element (VIEW_NODE, &show_ipv6_route_tag_cmd);
install_element (VIEW_NODE, &show_ipv6_route_summary_cmd);
install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_cmd);
- install_element (VIEW_NODE, &show_ipv6_route_protocol_cmd);
install_element (VIEW_NODE, &show_ipv6_route_addr_cmd);
install_element (VIEW_NODE, &show_ipv6_route_prefix_cmd);
- install_element (VIEW_NODE, &show_ipv6_route_prefix_longer_cmd);
-
install_element (VIEW_NODE, &show_ipv6_mroute_cmd);
/* Commands for VRF */
- install_element (VIEW_NODE, &show_ipv6_route_vrf_all_cmd);
- install_element (VIEW_NODE, &show_ipv6_route_vrf_all_tag_cmd);
install_element (VIEW_NODE, &show_ipv6_route_vrf_all_summary_cmd);
install_element (VIEW_NODE, &show_ipv6_route_vrf_all_summary_prefix_cmd);
- install_element (VIEW_NODE, &show_ipv6_route_vrf_all_protocol_cmd);
install_element (VIEW_NODE, &show_ipv6_route_vrf_all_addr_cmd);
install_element (VIEW_NODE, &show_ipv6_route_vrf_all_prefix_cmd);
- install_element (VIEW_NODE, &show_ipv6_route_vrf_all_prefix_longer_cmd);
install_element (VIEW_NODE, &show_ipv6_mroute_vrf_all_cmd);
}
diff --git a/zebra/zserv.c b/zebra/zserv.c
index aa08ddc04..e93299d62 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
@@ -1398,7 +1397,7 @@ zread_ipv4_route_ipv6_nexthop_add (struct zserv *client, u_short length, struct
{
unsigned int i;
struct stream *s;
- struct in6_addr nexthop;
+ struct in6_addr nhop_addr;
struct rib *rib;
u_char message;
u_char nexthop_num;
@@ -1408,11 +1407,14 @@ zread_ipv4_route_ipv6_nexthop_add (struct zserv *client, u_short length, struct
static struct in6_addr nexthops[MULTIPATH_NUM];
static unsigned int ifindices[MULTIPATH_NUM];
int ret;
+ static mpls_label_t labels[MULTIPATH_NUM];
+ mpls_label_t label;
+ struct nexthop *nexthop;
/* Get input stream. */
s = client->ibuf;
- memset (&nexthop, 0, sizeof (struct in6_addr));
+ memset (&nhop_addr, 0, sizeof (struct in6_addr));
/* Allocate new rib. */
rib = XCALLOC (MTYPE_RIB, sizeof (struct rib));
@@ -1453,11 +1455,19 @@ zread_ipv4_route_ipv6_nexthop_add (struct zserv *client, u_short length, struct
switch (nexthop_type)
{
case NEXTHOP_TYPE_IPV6:
- stream_get (&nexthop, s, 16);
- if (nh_count < multipath_num) {
- nexthops[nh_count++] = nexthop;
- }
- break;
+ stream_get (&nhop_addr, s, 16);
+ if (nh_count < MULTIPATH_NUM)
+ {
+ /* For labeled-unicast, each nexthop is followed by label. */
+ if (CHECK_FLAG (message, ZAPI_MESSAGE_LABEL))
+ {
+ label = (mpls_label_t)stream_getl (s);
+ labels[nh_count] = label;
+ }
+ nexthops[nh_count] = nhop_addr;
+ nh_count++;
+ }
+ break;
case NEXTHOP_TYPE_IFINDEX:
if (if_count < multipath_num) {
ifindices[if_count++] = stream_getl (s);
@@ -1473,18 +1483,18 @@ zread_ipv4_route_ipv6_nexthop_add (struct zserv *client, u_short length, struct
for (i = 0; i < max_nh_if; i++)
{
if ((i < nh_count) && !IN6_IS_ADDR_UNSPECIFIED (&nexthops[i])) {
- if ((i < if_count) && ifindices[i]) {
- rib_nexthop_ipv6_ifindex_add (rib, &nexthops[i], ifindices[i]);
- }
- else {
- rib_nexthop_ipv6_add (rib, &nexthops[i]);
- }
+ if ((i < if_count) && ifindices[i])
+ nexthop = rib_nexthop_ipv6_ifindex_add (rib, &nexthops[i], ifindices[i]);
+ else
+ nexthop = rib_nexthop_ipv6_add (rib, &nexthops[i]);
+
+ if (CHECK_FLAG (message, ZAPI_MESSAGE_LABEL))
+ nexthop_add_labels (nexthop, nexthop->nh_label_type, 1, &labels[i]);
}
else {
- if ((i < if_count) && ifindices[i]) {
+ if ((i < if_count) && ifindices[i])
rib_nexthop_ifindex_add (rib, ifindices[i]);
- }
- }
+ }
}
}
@@ -1599,7 +1609,7 @@ zread_ipv6_add (struct zserv *client, u_short length, struct zebra_vrf *zvrf)
if (CHECK_FLAG (message, ZAPI_MESSAGE_LABEL))
{
label = (mpls_label_t)stream_getl (s);
- labels[nh_count++] = label;
+ labels[nh_count] = label;
}
nexthops[nh_count++] = nhop_addr;
}
@@ -2046,10 +2056,7 @@ zread_label_manager_request (int cmd, struct zserv *client, vrf_id_t vrf_id)
/* external label manager */
if (lm_is_external)
- {
- if (zread_relay_label_manager_request (cmd, client) != 0)
- zsend_label_manager_connect_response (client, vrf_id, 1);
- }
+ zread_relay_label_manager_request (cmd, client, vrf_id);
/* this is a label manager */
else
{
@@ -2821,6 +2828,28 @@ DEFUN (no_ip_forwarding,
return CMD_SUCCESS;
}
+DEFUN (show_zebra,
+ show_zebra_cmd,
+ "show zebra",
+ SHOW_STR
+ "Zebra information\n")
+{
+ struct vrf *vrf;
+
+ vty_out (vty, " Route Route Neighbor LSP LSP%s", VTY_NEWLINE);
+ vty_out (vty, "VRF Installs Removals Updates Installs Removals%s", VTY_NEWLINE);
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+ {
+ struct zebra_vrf *zvrf = vrf->info;
+ vty_out (vty,"%-25s %10" PRIu64 " %10" PRIu64 " %10" PRIu64 " %10" PRIu64 " %10" PRIu64 "%s",
+ vrf->name, zvrf->installs, zvrf->removals,
+ zvrf->neigh_updates, zvrf->lsp_installs, zvrf->lsp_removals,
+ VTY_NEWLINE);
+ }
+
+ return CMD_SUCCESS;
+}
+
/* This command is for debugging purpose. */
DEFUN (show_zebra_client,
show_zebra_client_cmd,
@@ -3009,6 +3038,7 @@ zebra_init (void)
install_element (VIEW_NODE, &show_ip_forwarding_cmd);
install_element (CONFIG_NODE, &ip_forwarding_cmd);
install_element (CONFIG_NODE, &no_ip_forwarding_cmd);
+ install_element (ENABLE_NODE, &show_zebra_cmd);
install_element (ENABLE_NODE, &show_zebra_client_cmd);
install_element (ENABLE_NODE, &show_zebra_client_summary_cmd);
diff --git a/zebra/zserv.h b/zebra/zserv.h
index cd1948373..2fafd040c 100644
--- a/zebra/zserv.h
+++ b/zebra/zserv.h
@@ -13,10 +13,9 @@
* 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 GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#ifndef _ZEBRA_ZSERV_H
diff --git a/zebra/zserv_null.c b/zebra/zserv_null.c
index 4b52abb22..47518f477 100644
--- a/zebra/zserv_null.c
+++ b/zebra/zserv_null.c
@@ -14,10 +14,9 @@
* 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 Quagga; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 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
*/
#include <zebra.h>
@@ -30,6 +29,13 @@
#include <zebra_vrf.h>
#include <router-id.h>
+int
+zebra_server_send_message(struct zserv *client)
+{ return 0; }
+
+void zserv_create_header (struct stream *s, uint16_t cmd, vrf_id_t vrf_id)
+{ return; }
+
int zsend_vrf_delete (struct zserv *zserv, struct zebra_vrf *zvrf)
{ return 0; }