]> git.proxmox.com Git - mirror_frr.git/blobdiff - ripd/rip_interface.c
Merge pull request #13349 from opensourcerouting/pim6-mld-coverity-20230421
[mirror_frr.git] / ripd / rip_interface.c
index 1269f25b357958c0e7021034b5f86c0bccb2c7b1..0b92f174b1ff1301424972f6dbae25c0b5d09229 100644 (file)
@@ -1,21 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* Interface related function for RIP.
  * Copyright (C) 1997, 98 Kunihiro Ishiguro <kunihiro@zebra.org>
- *
- * 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>
@@ -29,7 +14,7 @@
 #include "table.h"
 #include "log.h"
 #include "stream.h"
-#include "thread.h"
+#include "frrevent.h"
 #include "zclient.h"
 #include "filter.h"
 #include "sockopt.h"
@@ -311,7 +296,7 @@ int if_check_address(struct rip *rip, struct in_addr addr)
        return 0;
 }
 
-/* Inteface link down message processing. */
+/* Interface link down message processing. */
 static int rip_ifp_down(struct interface *ifp)
 {
        rip_interface_sync(ifp);
@@ -327,7 +312,7 @@ static int rip_ifp_down(struct interface *ifp)
        return 0;
 }
 
-/* Inteface link up message processing */
+/* Interface link up message processing */
 static int rip_ifp_up(struct interface *ifp)
 {
        if (IS_RIP_DEBUG_ZEBRA)
@@ -351,7 +336,7 @@ static int rip_ifp_up(struct interface *ifp)
        return 0;
 }
 
-/* Inteface addition message from zebra. */
+/* Interface addition message from zebra. */
 static int rip_ifp_create(struct interface *ifp)
 {
        rip_interface_sync(ifp);
@@ -428,7 +413,7 @@ static void rip_interface_clean(struct rip_interface *ri)
        ri->enable_interface = 0;
        ri->running = 0;
 
-       thread_cancel(&ri->t_wakeup);
+       EVENT_OFF(ri->t_wakeup);
 }
 
 void rip_interfaces_clean(struct rip *rip)
@@ -487,7 +472,7 @@ int rip_if_down(struct interface *ifp)
 
        ri = ifp->info;
 
-       THREAD_OFF(ri->t_wakeup);
+       EVENT_OFF(ri->t_wakeup);
 
        rip = ri->rip;
        if (rip) {
@@ -617,7 +602,7 @@ int rip_interface_address_delete(ZAPI_CALLBACK_ARGS)
 
                        hook_call(rip_ifaddr_del, ifc);
 
-                       /* Chech wether this prefix needs to be removed */
+                       /* Chech whether this prefix needs to be removed */
                        rip_apply_address_del(ifc);
                }
 
@@ -628,7 +613,7 @@ int rip_interface_address_delete(ZAPI_CALLBACK_ARGS)
 }
 
 /* Check interface is enabled by network statement. */
-/* Check wether the interface has at least a connected prefix that
+/* Check whether the interface has at least a connected prefix that
  * is within the ripng_enable_network table. */
 static int rip_enable_network_lookup_if(struct interface *ifp)
 {
@@ -663,7 +648,7 @@ static int rip_enable_network_lookup_if(struct interface *ifp)
        return -1;
 }
 
-/* Check wether connected is within the ripng_enable_network table. */
+/* Check whether connected is within the ripng_enable_network table. */
 static int rip_enable_network_lookup2(struct connected *connected)
 {
        struct rip_interface *ri = connected->ifp->info;
@@ -789,13 +774,13 @@ int rip_enable_if_delete(struct rip *rip, const char *ifname)
 }
 
 /* Join to multicast group and send request to the interface. */
-static void rip_interface_wakeup(struct thread *t)
+static void rip_interface_wakeup(struct event *t)
 {
        struct interface *ifp;
        struct rip_interface *ri;
 
        /* Get interface. */
-       ifp = THREAD_ARG(t);
+       ifp = EVENT_ARG(t);
 
        ri = ifp->info;
 
@@ -840,7 +825,7 @@ static void rip_connect_set(struct interface *ifp, int set)
                nh.ifindex = connected->ifp->ifindex;
                nh.type = NEXTHOP_TYPE_IFINDEX;
                if (set) {
-                       /* Check once more wether this prefix is within a
+                       /* Check once more whether this prefix is within a
                         * "network IF_OR_PREF" one */
                        if ((rip_enable_if_lookup(rip, connected->ifp->name)
                             >= 0)
@@ -900,8 +885,8 @@ void rip_enable_apply(struct interface *ifp)
                        zlog_debug("turn on %s", ifp->name);
 
                /* Add interface wake up thread. */
-               thread_add_timer(master, rip_interface_wakeup, ifp, 1,
-                                &ri->t_wakeup);
+               event_add_timer(master, rip_interface_wakeup, ifp, 1,
+                               &ri->t_wakeup);
                rip_connect_set(ifp, 1);
        } else if (ri->running) {
                /* Might as well clean up the route table as well
@@ -929,7 +914,7 @@ int rip_neighbor_lookup(struct rip *rip, struct sockaddr_in *from)
        struct prefix_ipv4 p;
        struct route_node *node;
 
-       memset(&p, 0, sizeof(struct prefix_ipv4));
+       memset(&p, 0, sizeof(p));
        p.family = AF_INET;
        p.prefix = from->sin_addr;
        p.prefixlen = IPV4_MAX_BITLEN;