summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2017-06-15 16:22:42 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2017-06-15 16:22:42 +0200
commitf43cd318b26a3dc57a0e6f40bcccdd5ce1886432 (patch)
treeeed2449282c488b77e1dc45b0e10c7d2ab34c45b
parentffef22509f2a0aafcfecd56f00d75917e9139dc5 (diff)
parent68fc8f1f26e44aaaac9b39421519863e5b18bc7a (diff)
Merge pull request #711 ("Coverity munging")
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
-rw-r--r--bgpd/bgp_routemap.c9
-rw-r--r--eigrpd/eigrp_topology.c2
-rw-r--r--eigrpd/eigrpd.c2
-rw-r--r--ospfclient/ospf_apiclient.c5
-rw-r--r--ospfclient/ospfclient.c22
-rw-r--r--ospfd/ospf_ri.c7
-rw-r--r--pimd/pim_cmd.c61
-rw-r--r--zebra/.gitignore1
-rw-r--r--zebra/Makefile.am11
-rw-r--r--zebra/client_main.c7
-rw-r--r--zebra/if_null.c31
-rw-r--r--zebra/ioctl_null.c62
-rw-r--r--zebra/kernel_null.c63
-rw-r--r--zebra/misc_null.c37
-rw-r--r--zebra/redistribute_null.c91
-rw-r--r--zebra/rtadv_null.c34
-rw-r--r--zebra/test_main.c339
-rw-r--r--zebra/zebra_ptm_null.c30
-rw-r--r--zebra/zebra_rnh_null.c49
-rw-r--r--zebra/zserv_null.c46
20 files changed, 61 insertions, 848 deletions
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index 6c6b622626..3cf0d84684 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -2151,13 +2151,18 @@ route_set_aggregator_as_compile (const char *arg)
struct aggregator *aggregator;
char as[10];
char address[20];
+ int ret;
aggregator = XCALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct aggregator));
sscanf (arg, "%s %s", as, address);
aggregator->as = strtoul (as, NULL, 10);
- inet_aton (address, &aggregator->address);
-
+ ret = inet_aton (address, &aggregator->address);
+ if (ret == 0)
+ {
+ XFREE (MTYPE_ROUTE_MAP_COMPILED, aggregator);
+ return NULL;
+ }
return aggregator;
}
diff --git a/eigrpd/eigrp_topology.c b/eigrpd/eigrp_topology.c
index 245b6adce8..675031b754 100644
--- a/eigrpd/eigrp_topology.c
+++ b/eigrpd/eigrp_topology.c
@@ -473,7 +473,7 @@ eigrp_topology_update_node_flags(struct eigrp_prefix_entry *dest)
for (ALL_LIST_ELEMENTS_RO(dest->entries, node, entry))
{
- if ((entry->distance <= (uint64_t)(dest->distance*eigrp->variance)) &&
+ if (((uint64_t)entry->distance <= (uint64_t)(dest->distance*eigrp->variance)) &&
entry->distance != EIGRP_MAX_METRIC) // is successor
{
entry->flags |= EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG;
diff --git a/eigrpd/eigrpd.c b/eigrpd/eigrpd.c
index 93a69b776b..a0ead05224 100644
--- a/eigrpd/eigrpd.c
+++ b/eigrpd/eigrpd.c
@@ -186,7 +186,7 @@ eigrp_new (const char *AS)
eigrp->topology_table = eigrp_topology_new();
eigrp->neighbor_self = eigrp_nbr_new(NULL);
- inet_aton("0.0.0.0", &eigrp->neighbor_self->src);
+ eigrp->neighbor_self->src.s_addr = INADDR_ANY;
eigrp->variance = EIGRP_VARIANCE_DEFAULT;
eigrp->max_paths = EIGRP_MAX_PATHS_DEFAULT;
diff --git a/ospfclient/ospf_apiclient.c b/ospfclient/ospf_apiclient.c
index 0ebae087e3..3f3b5511a2 100644
--- a/ospfclient/ospf_apiclient.c
+++ b/ospfclient/ospf_apiclient.c
@@ -183,6 +183,7 @@ ospf_apiclient_connect (char *host, int syncport)
fd1 = socket (AF_INET, SOCK_STREAM, 0);
if (fd1 < 0)
{
+ close (async_server_sock);
fprintf (stderr,
"ospf_apiclient_connect: creating sync socket failed\n");
return NULL;
@@ -196,6 +197,7 @@ ospf_apiclient_connect (char *host, int syncport)
{
fprintf (stderr, "ospf_apiclient_connect: SO_REUSEADDR failed\n");
close (fd1);
+ close (async_server_sock);
return NULL;
}
@@ -206,6 +208,7 @@ ospf_apiclient_connect (char *host, int syncport)
{
fprintf (stderr, "ospf_apiclient_connect: SO_REUSEPORT failed\n");
close (fd1);
+ close (async_server_sock);
return NULL;
}
#endif /* SO_REUSEPORT */
@@ -227,6 +230,7 @@ ospf_apiclient_connect (char *host, int syncport)
{
fprintf (stderr, "ospf_apiclient_connect: bind sync socket failed\n");
close (fd1);
+ close (async_server_sock);
return NULL;
}
@@ -260,6 +264,7 @@ ospf_apiclient_connect (char *host, int syncport)
fprintf (stderr, "ospf_apiclient_connect: accept async failed\n");
close (async_server_sock);
close (fd1);
+ close (fd2);
return NULL;
}
diff --git a/ospfclient/ospfclient.c b/ospfclient/ospfclient.c
index 195fd5b5a0..d8d0fe8d47 100644
--- a/ospfclient/ospfclient.c
+++ b/ospfclient/ospfclient.c
@@ -94,7 +94,12 @@ lsa_delete (struct thread *t)
oclient = THREAD_ARG (t);
- inet_aton (args[6], &area_id);
+ rc = inet_aton (args[6], &area_id);
+ if (rc <= 0)
+ {
+ printf("Address Specified: %s is invalid\n", args[6]);
+ return rc;
+ }
printf ("Deleting LSA... ");
rc = ospf_apiclient_lsa_delete (oclient,
@@ -123,8 +128,19 @@ lsa_inject (struct thread *t)
cl = THREAD_ARG (t);
- inet_aton (args[5], &ifaddr);
- inet_aton (args[6], &area_id);
+ rc = inet_aton (args[5], &ifaddr);
+ if (rc <= 0)
+ {
+ printf ("Ifaddr specified %s is invalid\n", args[5]);
+ return rc;
+ }
+
+ rc = inet_aton (args[6], &area_id);
+ if (rc <= 0)
+ {
+ printf( "Area ID specified %s is invalid\n", args[6]);
+ return rc;
+ }
lsa_type = atoi (args[2]);
opaque_type = atoi (args[3]);
opaque_id = atoi (args[4]);
diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c
index 4723f4a919..6912bc156f 100644
--- a/ospfd/ospf_ri.c
+++ b/ospfd/ospf_ri.c
@@ -1192,7 +1192,12 @@ DEFUN (router_info,
/* Check and get Area value if present */
if (area)
{
- inet_aton (area, &OspfRI.area_id);
+ if (!inet_aton (area, &OspfRI.area_id))
+ {
+ vty_out (vty, "%% specified Area ID %s is invalid%s",
+ area, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
scope = OSPF_OPAQUE_AREA_LSA;
}
else
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 59f2c33ceb..1a78e0b570 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -4411,9 +4411,8 @@ DEFUN (interface_no_ip_igmp,
IFACE_IGMP_STR)
{
VTY_DECLVAR_CONTEXT(interface, ifp);
- struct pim_interface *pim_ifp;
+ struct pim_interface *pim_ifp = ifp->info;
- pim_ifp = ifp->info;
if (!pim_ifp)
return CMD_SUCCESS;
@@ -4663,13 +4662,11 @@ DEFUN (interface_ip_igmp_query_interval,
"Query interval in seconds\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
- struct pim_interface *pim_ifp;
+ struct pim_interface *pim_ifp = ifp->info;
int query_interval;
int query_interval_dsec;
int ret;
- pim_ifp = ifp->info;
-
if (!pim_ifp) {
ret = pim_cmd_igmp_start(vty, ifp);
if (ret != CMD_SUCCESS)
@@ -4721,11 +4718,9 @@ DEFUN (interface_no_ip_igmp_query_interval,
IFACE_IGMP_QUERY_INTERVAL_STR)
{
VTY_DECLVAR_CONTEXT(interface, ifp);
- struct pim_interface *pim_ifp;
+ struct pim_interface *pim_ifp = ifp->info;
int default_query_interval_dsec;
- pim_ifp = ifp->info;
-
if (!pim_ifp)
return CMD_SUCCESS;
@@ -4753,12 +4748,10 @@ DEFUN (interface_ip_igmp_version,
"IGMP version number\n")
{
VTY_DECLVAR_CONTEXT(interface,ifp);
- struct pim_interface *pim_ifp = NULL;
+ struct pim_interface *pim_ifp = ifp->info;
int igmp_version, old_version = 0;
int ret;
- pim_ifp = ifp->info;
-
if (!pim_ifp)
{
ret = pim_cmd_igmp_start(vty, ifp);
@@ -4797,9 +4790,7 @@ DEFUN (interface_no_ip_igmp_version,
"IGMP version number\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
- struct pim_interface *pim_ifp;
-
- pim_ifp = ifp->info;
+ struct pim_interface *pim_ifp = ifp->info;
if (!pim_ifp)
return CMD_SUCCESS;
@@ -4821,12 +4812,10 @@ DEFUN (interface_ip_igmp_query_max_response_time,
"Query response value in deci-seconds\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
- struct pim_interface *pim_ifp;
+ struct pim_interface *pim_ifp = ifp->info;
int query_max_response_time;
int ret;
- pim_ifp = ifp->info;
-
if (!pim_ifp) {
ret = pim_cmd_igmp_start(vty, ifp);
if (ret != CMD_SUCCESS)
@@ -4859,9 +4848,7 @@ DEFUN (interface_no_ip_igmp_query_max_response_time,
"Time for response in deci-seconds\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
- struct pim_interface *pim_ifp;
-
- pim_ifp = ifp->info;
+ struct pim_interface *pim_ifp = ifp->info;
if (!pim_ifp)
return CMD_SUCCESS;
@@ -4883,13 +4870,11 @@ DEFUN_HIDDEN (interface_ip_igmp_query_max_response_time_dsec,
"Query response value in deciseconds\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
- struct pim_interface *pim_ifp;
+ struct pim_interface *pim_ifp = ifp->info;
int query_max_response_time_dsec;
int default_query_interval_dsec;
int ret;
- pim_ifp = ifp->info;
-
if (!pim_ifp) {
ret = pim_cmd_igmp_start(vty, ifp);
if (ret != CMD_SUCCESS)
@@ -4923,9 +4908,7 @@ DEFUN_HIDDEN (interface_no_ip_igmp_query_max_response_time_dsec,
IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR)
{
VTY_DECLVAR_CONTEXT(interface, ifp);
- struct pim_interface *pim_ifp;
-
- pim_ifp = ifp->info;
+ struct pim_interface *pim_ifp = ifp->info;
if (!pim_ifp)
return CMD_SUCCESS;
@@ -4945,11 +4928,9 @@ DEFUN (interface_ip_pim_drprio,
{
VTY_DECLVAR_CONTEXT(interface, ifp);
int idx_number = 3;
- struct pim_interface *pim_ifp;
+ struct pim_interface *pim_ifp = ifp->info;
uint32_t old_dr_prio;
- pim_ifp = ifp->info;
-
if (!pim_ifp) {
vty_out(vty, "Please enable PIM on interface, first%s", VTY_NEWLINE);
return CMD_WARNING;
@@ -4977,9 +4958,7 @@ DEFUN (interface_no_ip_pim_drprio,
"Old Value of the Priority\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
- struct pim_interface *pim_ifp;
-
- pim_ifp = ifp->info;
+ struct pim_interface *pim_ifp = ifp->info;
if (!pim_ifp) {
vty_out(vty, "Pim not enabled on this interface%s", VTY_NEWLINE);
@@ -5319,9 +5298,7 @@ DEFUN (interface_ip_pim_hello,
VTY_DECLVAR_CONTEXT(interface, ifp);
int idx_time = 3;
int idx_hold = 4;
- struct pim_interface *pim_ifp;
-
- pim_ifp = ifp->info;
+ struct pim_interface *pim_ifp = ifp->info;
if (!pim_ifp)
{
@@ -5354,9 +5331,7 @@ DEFUN (interface_no_ip_pim_hello,
IFACE_PIM_HELLO_HOLD_STR)
{
VTY_DECLVAR_CONTEXT(interface, ifp);
- struct pim_interface *pim_ifp;
-
- pim_ifp = ifp->info;
+ struct pim_interface *pim_ifp = ifp->info;
if (!pim_ifp) {
vty_out(vty, "Pim not enabled on this interface%s", VTY_NEWLINE);
@@ -5943,12 +5918,9 @@ DEFUN (ip_pim_bfd,
"Enables BFD support\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
- struct pim_interface *pim_ifp = NULL;
+ struct pim_interface *pim_ifp = ifp->info;
struct bfd_info *bfd_info = NULL;
- if (!ifp)
- return CMD_SUCCESS;
- pim_ifp = ifp->info;
if (!pim_ifp)
return CMD_SUCCESS;
bfd_info = pim_ifp->bfd_info;
@@ -5969,11 +5941,8 @@ DEFUN (no_ip_pim_bfd,
"Disables BFD support\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
- struct pim_interface *pim_ifp = NULL;
-
- assert (ifp);
+ struct pim_interface *pim_ifp = ifp->info;
- pim_ifp = ifp->info;
if (!pim_ifp)
return CMD_SUCCESS;
diff --git a/zebra/.gitignore b/zebra/.gitignore
index df703b67f8..145df05689 100644
--- a/zebra/.gitignore
+++ b/zebra/.gitignore
@@ -4,7 +4,6 @@ Makefile.in
zebra
zebra.conf
client
-testzebra
tags
TAGS
.deps
diff --git a/zebra/Makefile.am b/zebra/Makefile.am
index 3e0de3b463..0b66e905c7 100644
--- a/zebra/Makefile.am
+++ b/zebra/Makefile.am
@@ -22,7 +22,6 @@ otherobj = $(ioctl_method) $(ipforward) $(if_method) \
AM_CFLAGS = $(WERROR)
sbin_PROGRAMS = zebra
-noinst_PROGRAMS = testzebra
module_LTLIBRARIES =
zebra_SOURCES = \
@@ -36,12 +35,6 @@ zebra_SOURCES = \
label_manager.c \
# end
-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.c zebra_mpls_vty.c zebra_mpls_null.c
-
noinst_HEADERS = \
zebra_memory.h \
connected.h ioctl.h rib.h rt.h zserv.h redistribute.h debug.h rtadv.h \
@@ -53,8 +46,6 @@ noinst_HEADERS = \
zebra_LDADD = $(otherobj) ../lib/libfrr.la $(LIBCAP)
-testzebra_LDADD = ../lib/libfrr.la $(LIBCAP)
-
zebra_DEPENDENCIES = $(otherobj)
if SNMP
@@ -88,7 +79,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_netlink.c zebra_mpls_openbsd.c zebra_mpls_null.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 c9d738bb08..0e77ea4aec 100644
--- a/zebra/client_main.c
+++ b/zebra/client_main.c
@@ -48,7 +48,12 @@ zebra_test_ipv4 (int command, int type, char *prefix, char *gateway,
struct in_addr *gpnt;
str2prefix_ipv4 (prefix, &p);
- inet_aton (gateway, &gate);
+ if (!inet_aton (gateway, &gate))
+ {
+ printf("Gateway specified: %s is illegal\n", gateway);
+ return;
+ }
+
gpnt = &gate;
api.vrf_id = VRF_DEFAULT;
diff --git a/zebra/if_null.c b/zebra/if_null.c
deleted file mode 100644
index 7cba0a4ee2..0000000000
--- a/zebra/if_null.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2015 Cumulus Networks, Inc.
- * Donald Sharp
- *
- * This file is part of Quagga.
- *
- * Quagga is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * Quagga is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * 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 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 <vrf.h>
-#include <prefix.h>
-
-#include <rtadv.h>
-#include <zebra_ns.h>
-
-void interface_list (struct zebra_ns *zns)
-{ return; }
diff --git a/zebra/ioctl_null.c b/zebra/ioctl_null.c
deleted file mode 100644
index 9cc2daedbe..0000000000
--- a/zebra/ioctl_null.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2006 Sun Microsystems, Inc.
- *
- * This file is part of Quagga.
- *
- * Quagga is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * Quagga is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * 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 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 "zebra/rib.h"
-#include "zebra/rt.h"
-#include "zebra/ioctl.h"
-
-void ifreq_set_name (struct ifreq *a, struct interface *b) { return; }
-
-int if_set_prefix (struct interface *a, struct connected *b)
-{
- kernel_address_add_ipv4 (a, b);
- return 0;
-}
-
-int if_unset_prefix (struct interface *a, struct connected *b)
-{
- kernel_address_delete_ipv4 (a, b);
- return 0;
-}
-
-int if_prefix_add_ipv6 (struct interface *a, struct connected *b) { return 0; }
-int if_prefix_delete_ipv6 (struct interface *a, struct connected *b) { return 0; }
-
-int if_ioctl (u_long a, caddr_t b) { return 0; }
-
-int if_set_flags (struct interface *a, uint64_t b) { return 0; }
-int if_unset_flags (struct interface *a, uint64_t b) { return 0; }
-
-void if_get_flags (struct interface *a) { return; }
-
-#ifdef SOLARIS_IPV6
-#pragma weak if_ioctl_ipv6 = if_ioctl
-struct connected *if_lookup_linklocal(struct interface *a) { return 0; }
-
-#define AF_IOCTL(af, request, buffer) \
- ((af) == AF_INET? if_ioctl(request, buffer) : \
- if_ioctl_ipv6(request, buffer))
-#else /* SOLARIS_IPV6 */
-
-#define AF_IOCTL(af, request, buffer) if_ioctl(request, buffer)
-
-#endif /* SOLARIS_IPV6 */
diff --git a/zebra/kernel_null.c b/zebra/kernel_null.c
deleted file mode 100644
index 5f1a054bdc..0000000000
--- a/zebra/kernel_null.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * NULL kernel methods for testing.
- * Copyright (C) 2006 Sun Microsystems, Inc.
- *
- * This file is part of Quagga.
- *
- * Quagga is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * Quagga is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * 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 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 <log.h>
-
-#include "vty.h"
-#include "zebra/zserv.h"
-#include "zebra/rt.h"
-#include "zebra/redistribute.h"
-#include "zebra/connected.h"
-#include "zebra/rt_netlink.h"
-#include "zebra/rib.h"
-
-int kernel_route_rib (struct prefix *a, struct prefix *b,
- struct route_entry *old, struct route_entry *new) { return 0; }
-
-int kernel_address_add_ipv4 (struct interface *a, struct connected *b)
-{
- zlog_debug ("%s", __func__);
- SET_FLAG (b->conf, ZEBRA_IFC_REAL);
- connected_add_ipv4 (a, 0, &b->address->u.prefix4, b->address->prefixlen,
- (b->destination ? &b->destination->u.prefix4 : NULL),
- NULL);
- return 0;
-}
-
-int kernel_address_delete_ipv4 (struct interface *a, struct connected *b)
-{
- zlog_debug ("%s", __func__);
- connected_delete_ipv4 (a, 0, &b->address->u.prefix4, b->address->prefixlen,
- (b->destination ? &b->destination->u.prefix4 : NULL));
- return 0;
-}
-
-int kernel_neigh_update (int a, int b, uint32_t c, char *d, int e)
-{
- return 0;
-}
-
-void kernel_init (struct zebra_ns *zns) { return; }
-void kernel_terminate (struct zebra_ns *zns) { return; }
-void route_read (struct zebra_ns *zns) { return; }
-
-int kernel_get_ipmr_sg_stats (void *m) { return 0; }
diff --git a/zebra/misc_null.c b/zebra/misc_null.c
deleted file mode 100644
index f58eb628b0..0000000000
--- a/zebra/misc_null.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2006 Sun Microsystems, Inc.
- *
- * This file is part of Quagga.
- *
- * Quagga is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * Quagga is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * 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 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"
-#include "zebra/rtadv.h"
-#include "zebra/irdp.h"
-#include "zebra/interface.h"
-
-#if defined (HAVE_RTADV)
-void rtadv_config_write (struct vty *vty, struct interface *ifp) { return; }
-#endif
-void irdp_config_write (struct vty *vty, struct interface *ifp) { return; }
-#ifdef HAVE_PROC_NET_DEV
-void ifstat_update_proc (void) { return; }
-#endif
-#ifdef HAVE_NET_RT_IFLIST
-void ifstat_update_sysctl (void) { return; }
-#endif
diff --git a/zebra/redistribute_null.c b/zebra/redistribute_null.c
deleted file mode 100644
index 3b83a6b6ae..0000000000
--- a/zebra/redistribute_null.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2006 Sun Microsystems, Inc.
- *
- * This file is part of Quagga.
- *
- * Quagga is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * Quagga is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * 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 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"
-#include "zebra/rib.h"
-#include "zebra/zserv.h"
-
-#include "zebra/redistribute.h"
-
-void zebra_redistribute_add (int a, struct zserv *b, int c,
- struct zebra_vrf *zvrf)
-{ return; }
-void zebra_redistribute_delete (int a, struct zserv *b, int c,
- struct zebra_vrf *zvrf)
-{ return; }
-void zebra_redistribute_default_add (int a, struct zserv *b, int c,
- struct zebra_vrf *zvrf)
-{ return; }
-void zebra_redistribute_default_delete (int a, struct zserv *b, int c,
- struct zebra_vrf *zvrf)
-{ return; }
-
-void redistribute_update (struct prefix *a, struct prefix *b,
- struct route_entry *c, struct route_entry *d)
-{ return; }
-void redistribute_delete (struct prefix *a, struct prefix *b, struct route_entry *c)
-{ return; }
-
-void zebra_interface_up_update (struct interface *a)
-{ return; }
-void zebra_interface_down_update (struct interface *a)
-{ return; }
-void zebra_interface_add_update (struct interface *a)
-{ return; }
-void zebra_interface_delete_update (struct interface *a)
-{ return; }
-
-
-void zebra_interface_address_add_update (struct interface *a,
- struct connected *b)
-{ return; }
-void zebra_interface_address_delete_update (struct interface *a,
- struct connected *b)
-{ return; }
-
-/* Interface parameters update */
-void zebra_interface_parameters_update (struct interface *ifp)
-{ return; };
-
-void zebra_interface_vrf_update_del (struct interface *a, vrf_id_t new_vrf_id)
-{ return; }
-
-void zebra_interface_vrf_update_add (struct interface *a, vrf_id_t old_vrf_id)
-{ return; }
-
-int zebra_import_table (afi_t afi, u_int32_t table_id, u_int32_t distance,
- const char *rmap_name, int add)
-{ return 0; }
-
-int zebra_add_import_table_entry (struct route_node *rn, struct route_entry *re, const char *rmap_name)
-{ return 0; }
-
-int zebra_del_import_table_entry (struct route_node *rn, struct route_entry *re)
-{ return 0; }
-
-int is_zebra_import_table_enabled(afi_t afi, u_int32_t table_id)
-{ return 0; }
-
-int zebra_import_table_config(struct vty *vty)
-{ return 0; }
-
-void zebra_import_table_rm_update()
-{ return; }
diff --git a/zebra/rtadv_null.c b/zebra/rtadv_null.c
deleted file mode 100644
index ccb1a39e02..0000000000
--- a/zebra/rtadv_null.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2015 Cumulus Networks, Inc.
- *
- * This file is part of Quagga.
- *
- * Quagga is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * Quagga is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * 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 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 <lib/prefix.h>
-#include <rtadv.h>
-#include <zebra_ns.h>
-
-void zebra_interface_radv_set (struct zserv *client, int sock, u_short length,
- struct zebra_vrf *zvrf, int enable)
-{ return; }
-
-void rtadv_init (struct zebra_ns *zns)
-{ return; }
-
-void rtadv_terminate (struct zebra_ns *zns)
-{ return; }
diff --git a/zebra/test_main.c b/zebra/test_main.c
deleted file mode 100644
index 83c1ebb178..0000000000
--- a/zebra/test_main.c
+++ /dev/null
@@ -1,339 +0,0 @@
-/* main routine.
- * Copyright (C) 1997, 98 Kunihiro Ishiguro
- *
- * GNU Zebra is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * GNU Zebra is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * 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 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 <lib/version.h>
-#include "getopt.h"
-#include "command.h"
-#include "thread.h"
-#include "filter.h"
-#include "memory.h"
-#include "zebra_memory.h"
-#include "memory_vty.h"
-#include "prefix.h"
-#include "log.h"
-#include "privs.h"
-#include "sigevent.h"
-#include "vrf.h"
-
-#include "zebra/rib.h"
-#include "zebra/zebra_ns.h"
-#include "zebra/zserv.h"
-#include "zebra/zebra_vrf.h"
-#include "zebra/debug.h"
-#include "zebra/router-id.h"
-#include "zebra/interface.h"
-
-/* Zebra instance */
-struct zebra_t zebrad =
-{
- .rtm_table_default = 0,
-};
-
-/* process id. */
-pid_t pid;
-
-/* Allow non-quagga entities to delete quagga routes */
-int allow_delete = 0;
-
-/* zebra_rib's workqueue hold time. Private export for use by test code only */
-extern int rib_process_hold_time;
-
-/* Pacify zclient.o in libfrr, which expects this variable. */
-struct thread_master *master;
-
-/* Command line options. */
-struct option longopts[] =
-{
- { "batch", no_argument, NULL, 'b'},
- { "daemon", no_argument, NULL, 'd'},
- { "allow_delete", no_argument, NULL, 'a'},
- { "config_file", required_argument, NULL, 'f'},
- { "help", no_argument, NULL, 'h'},
- { "vty_addr", required_argument, NULL, 'A'},
- { "vty_port", required_argument, NULL, 'P'},
- { "version", no_argument, NULL, 'v'},
- { "rib_hold", required_argument, NULL, 'r'},
- { 0 }
-};
-
-zebra_capabilities_t _caps_p [] =
-{
- ZCAP_NET_ADMIN,
- ZCAP_SYS_ADMIN,
- ZCAP_NET_RAW,
-};
-
-/* Default configuration file path. */
-char config_default[] = SYSCONFDIR DEFAULT_CONFIG_FILE;
-
-/* Process ID saved for use by init system */
-const char *pid_file = "testzebra.pid";
-
-/* Help information display. */
-static void
-usage (char *progname, int status)
-{
- if (status != 0)
- fprintf (stderr, "Try `%s --help' for more information.\n", progname);
- else
- {
- printf ("Usage : %s [OPTION...]\n\n"\
- "Daemon which manages kernel routing table management and "\
- "redistribution between different routing protocols.\n\n"\
- "-b, --batch Runs in batch mode\n"\
- "-d, --daemon Runs in daemon mode\n"\
- "-a, --allow_delete Allow other processes to delete zebra routes\n" \
- "-f, --config_file Set configuration file name\n"\
- "-A, --vty_addr Set vty's bind address\n"\
- "-P, --vty_port Set vty's port number\n"\
- "-r, --rib_hold Set rib-queue hold time\n"\
- "-v, --version Print program version\n"\
- "-h, --help Display this help and exit\n"\
- "\n"\
- "Report bugs to %s\n", progname, FRR_BUG_ADDRESS);
- }
-
- exit (status);
-}
-
-static ifindex_t test_ifindex = 0;
-
-/* testrib commands */
-DEFUN (test_interface_state,
- test_interface_state_cmd,
- "state <up|down>",
- "configure interface\n"
- "up\n"
- "down\n")
-{
- int idx_up_down = 1;
- VTY_DECLVAR_CONTEXT (interface, ifp);
-
- if (ifp->ifindex == IFINDEX_INTERNAL)
- {
- ifp->ifindex = ++test_ifindex;
- ifp->mtu = 1500;
- ifp->flags = IFF_BROADCAST|IFF_MULTICAST;
- }
-
- switch (argv[idx_up_down]->arg[0])
- {
- case 'u':
- SET_FLAG (ifp->flags, IFF_UP);
- if_add_update (ifp);
- printf ("up\n");
- break;
- case 'd':
- UNSET_FLAG (ifp->flags, IFF_UP);
- if_delete_update (ifp);
- printf ("down\n");
- break;
- default:
- return CMD_WARNING;
- }
- return CMD_SUCCESS;
-}
-
-static void
-test_cmd_init (void)
-{
- install_element (INTERFACE_NODE, &test_interface_state_cmd);
-}
-
-/* SIGHUP handler. */
-static void
-sighup (void)
-{
- zlog_info ("SIGHUP received");
-
- /* Reload of config file. */
- ;
-}
-
-/* SIGINT handler. */
-static void
-sigint (void)
-{
- zlog_notice ("Terminating on signal");
-
- exit (0);
-}
-
-/* SIGUSR1 handler. */
-static void
-sigusr1 (void)
-{
- zlog_rotate();
-}
-
-struct quagga_signal_t zebra_signals[] =
-{
- {
- .signal = SIGHUP,
- .handler = &sighup,
- },
- {
- .signal = SIGUSR1,
- .handler = &sigusr1,
- },
- {
- .signal = SIGINT,
- .handler = &sigint,
- },
- {
- .signal = SIGTERM,
- .handler = &sigint,
- },
-};
-/* Main startup routine. */
-int
-main (int argc, char **argv)
-{
- char *p;
- char *vty_addr = NULL;
- int vty_port = 0;
- int batch_mode = 0;
- int daemon_mode = 0;
- char *config_file = NULL;
- char *progname;
- struct thread thread;
-
- /* Set umask before anything for security */
- umask (0027);
-
- /* preserve my name */
- progname = ((p = strrchr (argv[0], '/')) ? ++p : argv[0]);
-
- openzlog(progname, "ZEBRA", 0, LOG_CONS | LOG_NDELAY | LOG_PID, LOG_DAEMON);
-
- while (1)
- {
- int opt;
-
- opt = getopt_long (argc, argv, "bdaf:hA:P:r:v", longopts, 0);
-
- if (opt == EOF)
- break;
-
- switch (opt)
- {
- case 0:
- break;
- case 'b':
- batch_mode = 1;
- case 'd':
- daemon_mode = 1;
- break;
- case 'a':
- allow_delete =1;
- break;
- case 'f':
- config_file = optarg;
- break;
- case 'A':
- vty_addr = optarg;
- break;
- case 'P':
- /* Deal with atoi() returning 0 on failure, and zebra not
- listening on zebra port... */
- if (strcmp(optarg, "0") == 0)
- {
- vty_port = 0;
- break;
- }
- vty_port = atoi (optarg);
- break;
- case 'r':
- rib_process_hold_time = atoi(optarg);
- break;
- case 'v':
- print_version (progname);
- exit (0);
- break;
- case 'h':
- usage (progname, 0);
- break;
- default:
- usage (progname, 1);
- break;
- }
- }
-
- /* port and conf file mandatory */
- if (!vty_port || !config_file)
- {
- fprintf (stderr, "Error: --vty_port and --config_file arguments"
- " are both required\n");
- usage (progname, 1);
- }
-
- /* Make master thread emulator. */
- zebrad.master = thread_master_create ();
-
- /* Vty related initialize. */
- signal_init (zebrad.master, array_size(zebra_signals), zebra_signals);
- cmd_init (1);
- vty_config_lockless ();
- vty_init (zebrad.master);
- memory_init ();
- zebra_debug_init ();
- zebra_if_init ();
- test_cmd_init ();
-
- /* Zebra related initialize. */
- rib_init ();
- access_list_init ();
-
- /* Make kernel routing socket. */
- zebra_vrf_init ();
- zebra_vty_init();
-
- /* Configuration file read*/
- vty_read_config (config_file, config_default);
-
- /* Clean up rib. */
- rib_weed_tables ();
-
- /* Exit when zebra is working in batch mode. */
- if (batch_mode)
- exit (0);
-
- /* Daemonize. */
- if (daemon_mode && daemon (0, 0) < 0)
- {
- perror("daemon start failed");
- exit (1);
- }
-
- /* Needed for BSD routing socket. */
- pid = getpid ();
-
- /* Make vty server socket. */
- vty_serv_sock (vty_addr, vty_port, "/tmp/test_zebra");
-
- /* Print banner. */
- zlog_notice ("Zebra %s starting: vty@%d", FRR_VERSION, vty_port);
-
- while (thread_fetch (zebrad.master, &thread))
- thread_call (&thread);
-
- /* Not reached... */
- return 0;
-}
diff --git a/zebra/zebra_ptm_null.c b/zebra/zebra_ptm_null.c
deleted file mode 100644
index 576ea17327..0000000000
--- a/zebra/zebra_ptm_null.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * @copyright Copyright (C) 2015 Cumulus Networks, Inc.
- *
- * This file is part of GNU Zebra.
- *
- * GNU Zebra is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * GNU Zebra is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * 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 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"
-#include "if.h"
-#include "zebra_ptm_redistribute.h"
-
-void zebra_interface_bfd_update (struct interface *a, struct prefix *dp,
- struct prefix *sp, int status, vrf_id_t vrf_id)
-{ return; }
-
-void zebra_bfd_peer_replay_req (void)
-{ return; }
diff --git a/zebra/zebra_rnh_null.c b/zebra/zebra_rnh_null.c
deleted file mode 100644
index 0a3620bbe8..0000000000
--- a/zebra/zebra_rnh_null.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Zebra next hop tracking code
- * Copyright (C) 2013 Cumulus Networks, Inc.
- *
- * This file is part of Quagga.
- *
- * Quagga is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * Quagga is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * 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 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"
-#include "zebra/rib.h"
-#include "zebra/zserv.h"
-#include "zebra/zebra_rnh.h"
-
-int zebra_rnh_ip_default_route = 0;
-int zebra_rnh_ipv6_default_route = 0;
-
-void
-zebra_free_rnh (struct rnh *rnh)
-{}
-
-void zebra_evaluate_rnh (vrf_id_t vrfid, int family, int force, rnh_type_t type,
- struct prefix *p)
-{}
-
-void zebra_print_rnh_table (vrf_id_t vrfid, int family, struct vty *vty,
- rnh_type_t type)
-{}
-
-void zebra_register_rnh_static_nh(vrf_id_t vrfid, struct prefix *p, struct route_node *rn)
-{}
-
-void zebra_deregister_rnh_static_nh(vrf_id_t vrfid, struct prefix *p, struct route_node *rn)
-{}
-
-void zebra_deregister_rnh_static_nexthops (vrf_id_t vrfid, struct nexthop *nexthop,
- struct route_node *rn)
-{}
diff --git a/zebra/zserv_null.c b/zebra/zserv_null.c
deleted file mode 100644
index 47518f477f..0000000000
--- a/zebra/zserv_null.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2015 Cumulus Networks, Inc.
- * Donald Sharp
- *
- * This file is part of Quagga.
- *
- * Quagga is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * Quagga is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * 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 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 <vrf.h>
-#include <vty.h>
-
-#include <zserv.h>
-#include <zebra_ns.h>
-#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; }
-
-int zsend_vrf_add (struct zserv *zserv, struct zebra_vrf *zvrf)
-{ return 0; }
-
-void router_id_init (struct zebra_vrf *zvrf)
-{ return; }