summaryrefslogtreecommitdiff
path: root/ripd/rip_interface.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2016-10-17 23:36:21 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2016-10-17 23:36:21 +0000
commite52702f29d003585dcfbb4914b2a52d77a177739 (patch)
tree3e130ded38c48316796bfb602dc6fe6d119129d2 /ripd/rip_interface.c
parent6fbde29dafeaf7c6aab9789d3eaf0234e99eefb6 (diff)
parent3d3c3cbd115a3c38b490d656002af777d002743c (diff)
Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com> Conflicts: bgpd/bgp_route.c bgpd/bgp_routemap.c bgpd/bgp_vty.c isisd/isis_redist.c isisd/isis_routemap.c isisd/isis_vty.c isisd/isisd.c lib/command.c lib/distribute.c lib/if.c lib/keychain.c lib/routemap.c lib/routemap.h ospf6d/ospf6_asbr.c ospf6d/ospf6_interface.c ospf6d/ospf6_neighbor.c ospf6d/ospf6_top.c ospf6d/ospf6_zebra.c ospf6d/ospf6d.c ospfd/ospf_routemap.c ospfd/ospf_vty.c ripd/rip_routemap.c ripngd/ripng_routemap.c vtysh/extract.pl.in vtysh/vtysh.c zebra/interface.c zebra/irdp_interface.c zebra/rt_netlink.c zebra/rtadv.c zebra/test_main.c zebra/zebra_routemap.c zebra/zebra_vty.c
Diffstat (limited to 'ripd/rip_interface.c')
-rw-r--r--ripd/rip_interface.c77
1 files changed, 35 insertions, 42 deletions
diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c
index 6df219628c..8c5092d787 100644
--- a/ripd/rip_interface.c
+++ b/ripd/rip_interface.c
@@ -112,6 +112,8 @@ ipv4_multicast_leave (int sock,
return ret;
}
+static void rip_interface_reset (struct rip_interface *);
+
/* Allocate new RIP's interface configuration. */
static struct rip_interface *
rip_interface_new (void)
@@ -120,17 +122,7 @@ rip_interface_new (void)
ri = XCALLOC (MTYPE_RIP_INTERFACE, sizeof (struct rip_interface));
- /* Default authentication type is simple password for Cisco
- compatibility. */
- ri->auth_type = RIP_NO_AUTH;
- ri->md5_auth_len = RIP_AUTH_MD5_COMPAT_SIZE;
-
- /* Set default split-horizon behavior. If the interface is Frame
- Relay or SMDS is enabled, the default value for split-horizon is
- off. But currently Zebra does detect Frame Relay or SMDS
- interface. So all interface is set to split horizon. */
- ri->split_horizon_default = RIP_SPLIT_HORIZON;
- ri->split_horizon = ri->split_horizon_default;
+ rip_interface_reset (ri);
return ri;
}
@@ -503,17 +495,9 @@ rip_interface_delete (int command, struct zclient *zclient,
return 0;
}
-void
-rip_interface_clean (void)
-{
- struct listnode *node;
- struct interface *ifp;
- struct rip_interface *ri;
-
- for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
+static void
+rip_interface_clean (struct rip_interface *ri)
{
- ri = ifp->info;
-
ri->enable_network = 0;
ri->enable_interface = 0;
ri->running = 0;
@@ -524,28 +508,35 @@ rip_interface_clean (void)
ri->t_wakeup = NULL;
}
}
-}
void
-rip_interface_reset (void)
+rip_interfaces_clean (void)
{
struct listnode *node;
struct interface *ifp;
- struct rip_interface *ri;
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
+ rip_interface_clean (ifp->info);
+}
+
+static void
+rip_interface_reset (struct rip_interface *ri)
{
- ri = ifp->info;
+ /* Default authentication type is simple password for Cisco
+ compatibility. */
+ ri->auth_type = RIP_NO_AUTH;
+ ri->md5_auth_len = RIP_AUTH_MD5_COMPAT_SIZE;
- ri->enable_network = 0;
- ri->enable_interface = 0;
- ri->running = 0;
+ /* Set default split-horizon behavior. If the interface is Frame
+ Relay or SMDS is enabled, the default value for split-horizon is
+ off. But currently Zebra does detect Frame Relay or SMDS
+ interface. So all interface is set to split horizon. */
+ ri->split_horizon_default = RIP_SPLIT_HORIZON;
+ ri->split_horizon = ri->split_horizon_default;
ri->ri_send = RI_RIP_UNSPEC;
ri->ri_receive = RI_RIP_UNSPEC;
- ri->auth_type = RIP_NO_AUTH;
-
if (ri->auth_str)
{
free (ri->auth_str);
@@ -557,27 +548,29 @@ rip_interface_reset (void)
ri->key_chain = NULL;
}
- ri->split_horizon = RIP_NO_SPLIT_HORIZON;
- ri->split_horizon_default = RIP_NO_SPLIT_HORIZON;
-
ri->list[RIP_FILTER_IN] = NULL;
ri->list[RIP_FILTER_OUT] = NULL;
ri->prefix[RIP_FILTER_IN] = NULL;
ri->prefix[RIP_FILTER_OUT] = NULL;
- if (ri->t_wakeup)
- {
- thread_cancel (ri->t_wakeup);
- ri->t_wakeup = NULL;
- }
-
ri->recv_badpackets = 0;
ri->recv_badroutes = 0;
ri->sent_updates = 0;
ri->passive = 0;
+
+ rip_interface_clean (ri);
}
+
+void
+rip_interfaces_reset (void)
+{
+ struct listnode *node;
+ struct interface *ifp;
+
+ for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
+ rip_interface_reset (ifp->info);
}
int
@@ -647,7 +640,7 @@ rip_apply_address_add (struct connected *ifc)
if ((rip_enable_if_lookup(ifc->ifp->name) >= 0) ||
(rip_enable_network_lookup2(ifc) >= 0))
rip_redistribute_add(ZEBRA_ROUTE_CONNECT, RIP_ROUTE_INTERFACE,
- &address, ifc->ifp->ifindex, NULL, 0, 0);
+ &address, ifc->ifp->ifindex, NULL, 0, 0, 0);
}
@@ -958,7 +951,7 @@ rip_connect_set (struct interface *ifp, int set)
(rip_enable_network_lookup2(connected) >= 0))
rip_redistribute_add (ZEBRA_ROUTE_CONNECT, RIP_ROUTE_INTERFACE,
&address, connected->ifp->ifindex,
- NULL, 0, 0);
+ NULL, 0, 0, 0);
} else
{
rip_redistribute_delete (ZEBRA_ROUTE_CONNECT, RIP_ROUTE_INTERFACE,
@@ -966,7 +959,7 @@ rip_connect_set (struct interface *ifp, int set)
if (rip_redistribute_check (ZEBRA_ROUTE_CONNECT))
rip_redistribute_add (ZEBRA_ROUTE_CONNECT, RIP_ROUTE_REDISTRIBUTE,
&address, connected->ifp->ifindex,
- NULL, 0, 0);
+ NULL, 0, 0, 0);
}
}
}