summaryrefslogtreecommitdiffstats
path: root/ripd/rip_interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'ripd/rip_interface.c')
-rw-r--r--ripd/rip_interface.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c
index 505290e..486d7b0 100644
--- a/ripd/rip_interface.c
+++ b/ripd/rip_interface.c
@@ -128,14 +128,12 @@ static void rip_request_interface_send(struct interface *ifp, uint8_t version)
/* RIPv1 and non multicast interface. */
if (if_is_pointopoint(ifp) || if_is_broadcast(ifp)) {
- struct listnode *cnode, *cnnode;
struct connected *connected;
if (IS_RIP_DEBUG_EVENT)
zlog_debug("broadcast request to %s", ifp->name);
- for (ALL_LIST_ELEMENTS(ifp->connected, cnode, cnnode,
- connected)) {
+ frr_each (if_connected, ifp->connected, connected) {
if (connected->address->family != AF_INET)
continue;
@@ -197,14 +195,13 @@ static void rip_request_interface(struct interface *ifp)
/* Multicast packet receive socket. */
static int rip_multicast_join(struct interface *ifp, int sock)
{
- struct listnode *cnode;
struct connected *ifc;
if (if_is_operative(ifp) && if_is_multicast(ifp)) {
if (IS_RIP_DEBUG_EVENT)
zlog_debug("multicast join at %s", ifp->name);
- for (ALL_LIST_ELEMENTS_RO(ifp->connected, cnode, ifc)) {
+ frr_each (if_connected, ifp->connected, ifc) {
struct prefix_ipv4 *p;
struct in_addr group;
@@ -228,14 +225,13 @@ static int rip_multicast_join(struct interface *ifp, int sock)
/* Leave from multicast group. */
static void rip_multicast_leave(struct interface *ifp, int sock)
{
- struct listnode *cnode;
struct connected *connected;
if (if_is_up(ifp) && if_is_multicast(ifp)) {
if (IS_RIP_DEBUG_EVENT)
zlog_debug("multicast leave from %s", ifp->name);
- for (ALL_LIST_ELEMENTS_RO(ifp->connected, cnode, connected)) {
+ frr_each (if_connected, ifp->connected, connected) {
struct prefix_ipv4 *p;
struct in_addr group;
@@ -256,11 +252,10 @@ static void rip_multicast_leave(struct interface *ifp, int sock)
/* Is there and address on interface that I could use ? */
static int rip_if_ipv4_address_check(struct interface *ifp)
{
- struct listnode *nn;
struct connected *connected;
int count = 0;
- for (ALL_LIST_ELEMENTS_RO(ifp->connected, nn, connected)) {
+ frr_each (if_connected, ifp->connected, connected) {
struct prefix *p;
p = connected->address;
@@ -279,10 +274,9 @@ int if_check_address(struct rip *rip, struct in_addr addr)
struct interface *ifp;
FOR_ALL_INTERFACES (rip->vrf, ifp) {
- struct listnode *cnode;
struct connected *connected;
- for (ALL_LIST_ELEMENTS_RO(ifp->connected, cnode, connected)) {
+ frr_each (if_connected, ifp->connected, connected) {
struct prefix_ipv4 *p;
p = (struct prefix_ipv4 *)connected->address;
@@ -596,14 +590,13 @@ static int rip_enable_network_lookup_if(struct interface *ifp)
{
struct rip_interface *ri = ifp->info;
struct rip *rip = ri->rip;
- struct listnode *node, *nnode;
struct connected *connected;
struct prefix_ipv4 address;
if (!rip)
return -1;
- for (ALL_LIST_ELEMENTS(ifp->connected, node, nnode, connected)) {
+ frr_each (if_connected, ifp->connected, connected) {
struct prefix *p;
struct route_node *n;
@@ -780,14 +773,13 @@ static void rip_connect_set(struct interface *ifp, int set)
{
struct rip_interface *ri = ifp->info;
struct rip *rip = ri->rip;
- struct listnode *node, *nnode;
struct connected *connected;
struct prefix_ipv4 address;
struct nexthop nh;
memset(&nh, 0, sizeof(nh));
- for (ALL_LIST_ELEMENTS(ifp->connected, node, nnode, connected)) {
+ frr_each (if_connected, ifp->connected, connected) {
struct prefix *p;
p = connected->address;
@@ -1117,7 +1109,8 @@ void rip_if_init(void)
hook_register_prio(if_del, 0, rip_interface_delete_hook);
/* Install interface node. */
- if_cmd_init_default();
- if_zapi_callbacks(rip_ifp_create, rip_ifp_up,
- rip_ifp_down, rip_ifp_destroy);
+ hook_register_prio(if_real, 0, rip_ifp_create);
+ hook_register_prio(if_up, 0, rip_ifp_up);
+ hook_register_prio(if_down, 0, rip_ifp_down);
+ hook_register_prio(if_unreal, 0, rip_ifp_destroy);
}