summaryrefslogtreecommitdiff
path: root/ripd/rip_interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'ripd/rip_interface.c')
-rw-r--r--ripd/rip_interface.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c
index 1b2cbb61c3..9282896c28 100644
--- a/ripd/rip_interface.c
+++ b/ripd/rip_interface.c
@@ -336,10 +336,10 @@ static int rip_if_ipv4_address_check(struct interface *ifp)
/* Does this address belongs to me ? */
int if_check_address(struct in_addr addr)
{
- struct listnode *node;
+ struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
struct interface *ifp;
- for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp)) {
+ FOR_ALL_INTERFACES (vrf, ifp) {
struct listnode *cnode;
struct connected *connected;
@@ -471,7 +471,7 @@ int rip_interface_delete(int command, struct zclient *zclient,
/* To support pseudo interface do not free interface structure. */
/* if_delete(ifp); */
- ifp->ifindex = IFINDEX_DELETED;
+ if_set_index(ifp, IFINDEX_INTERNAL);
return 0;
}
@@ -490,10 +490,10 @@ static void rip_interface_clean(struct rip_interface *ri)
void rip_interfaces_clean(void)
{
- struct listnode *node;
+ struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
struct interface *ifp;
- for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp))
+ FOR_ALL_INTERFACES (vrf, ifp)
rip_interface_clean(ifp->info);
}
@@ -542,10 +542,10 @@ static void rip_interface_reset(struct rip_interface *ri)
void rip_interfaces_reset(void)
{
- struct listnode *node;
+ struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
struct interface *ifp;
- for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp))
+ FOR_ALL_INTERFACES (vrf, ifp)
rip_interface_reset(ifp->info);
}
@@ -583,10 +583,10 @@ int rip_if_down(struct interface *ifp)
/* Needed for stop RIP process. */
void rip_if_down_all()
{
+ struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
struct interface *ifp;
- struct listnode *node, *nnode;
- for (ALL_LIST_ELEMENTS(vrf_iflist(VRF_DEFAULT), node, nnode, ifp))
+ FOR_ALL_INTERFACES (vrf, ifp)
rip_if_down(ifp);
}
@@ -977,11 +977,11 @@ void rip_enable_apply(struct interface *ifp)
/* Apply network configuration to all interface. */
void rip_enable_apply_all()
{
+ struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
struct interface *ifp;
- struct listnode *node, *nnode;
/* Check each interface. */
- for (ALL_LIST_ELEMENTS(vrf_iflist(VRF_DEFAULT), node, nnode, ifp))
+ FOR_ALL_INTERFACES (vrf, ifp)
rip_enable_apply(ifp);
}
@@ -1091,10 +1091,10 @@ void rip_passive_interface_apply(struct interface *ifp)
static void rip_passive_interface_apply_all(void)
{
+ struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
struct interface *ifp;
- struct listnode *node, *nnode;
- for (ALL_LIST_ELEMENTS(vrf_iflist(VRF_DEFAULT), node, nnode, ifp))
+ FOR_ALL_INTERFACES (vrf, ifp)
rip_passive_interface_apply(ifp);
}
@@ -1728,15 +1728,12 @@ DEFUN (no_rip_passive_interface,
/* Write rip configuration of each interface. */
static int rip_interface_config_write(struct vty *vty)
{
- struct listnode *node;
+ struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
struct interface *ifp;
- for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp)) {
+ FOR_ALL_INTERFACES (vrf, ifp) {
struct rip_interface *ri;
- if (ifp->ifindex == IFINDEX_DELETED)
- continue;
-
ri = ifp->info;
/* Do not display the interface if there is no