]> git.proxmox.com Git - mirror_frr.git/blobdiff - pimd/pim_assert.c
zebra: Convert socket interface to use `union sockunion`
[mirror_frr.git] / pimd / pim_assert.c
index 4a60afd891e304945fc9bc704d90b807e76f640e..3f863ebeca80e575f8ef797eceb3590a5be7eed4 100644 (file)
@@ -1,22 +1,21 @@
 /*
-  PIM for Quagga
-  Copyright (C) 2008  Everton da Silva Marques
-
-  This program 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 of the License, or
-  (at your option) any later version.
-
-  This program 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
-*/
+ * PIM for Quagga
+ * Copyright (C) 2008  Everton da Silva Marques
+ *
+ * This program 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 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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>
 
@@ -48,6 +47,7 @@ void pim_ifassert_winner_set(struct pim_ifchannel *ch,
                             struct in_addr winner,
                             struct pim_assert_metric winner_metric)
 {
+       struct pim_interface *pim_ifp = ch->interface->info;
        int winner_changed = (ch->ifassert_winner.s_addr != winner.s_addr);
        int metric_changed = !pim_assert_metric_match(
                &ch->ifassert_winner_metric, &winner_metric);
@@ -82,7 +82,7 @@ void pim_ifassert_winner_set(struct pim_ifchannel *ch,
        ch->ifassert_creation = pim_time_monotonic_sec();
 
        if (winner_changed || metric_changed) {
-               pim_upstream_update_join_desired(ch->upstream);
+               pim_upstream_update_join_desired(pim_ifp->pim, ch->upstream);
                pim_ifchannel_update_could_assert(ch);
                pim_ifchannel_update_assert_tracking_desired(ch);
        }
@@ -147,7 +147,7 @@ static int dispatch_assert(struct interface *ifp, struct in_addr source_addr,
        memset(&sg, 0, sizeof(struct prefix_sg));
        sg.src = source_addr;
        sg.grp = group_addr;
-       ch = pim_ifchannel_add(ifp, &sg, 0);
+       ch = pim_ifchannel_add(ifp, &sg, 0, 0);
        if (!ch) {
                zlog_warn(
                        "%s: (S,G)=%s failure creating channel on interface %s",
@@ -229,6 +229,7 @@ int pim_assert_recv(struct interface *ifp, struct pim_neighbor *neigh,
        int offset;
        uint8_t *curr;
        int curr_size;
+       struct pim_interface *pim_ifp = NULL;
 
        on_trace(__PRETTY_FUNCTION__, ifp, src_addr);
 
@@ -310,6 +311,10 @@ int pim_assert_recv(struct interface *ifp, struct pim_neighbor *neigh,
 
        msg_metric.ip_address = src_addr;
 
+       pim_ifp = ifp->info;
+       zassert(pim_ifp);
+       ++pim_ifp->pim_ifstat_assert_recv;
+
        return dispatch_assert(ifp, msg_source_addr.u.prefix4, sg.grp,
                               msg_metric);
 }
@@ -470,6 +475,7 @@ static int pim_assert_do(struct pim_ifchannel *ch,
                           metric.metric_preference, metric.route_metric,
                           PIM_FORCE_BOOLEAN(metric.rpt_bit_flag));
        }
+       ++pim_ifp->pim_ifstat_assert_send;
 
        if (pim_msg_send(pim_ifp->pim_sock_fd, pim_ifp->primary_address,
                         qpim_all_pim_routers_addr, pim_msg, pim_msg_size,
@@ -563,8 +569,8 @@ static void pim_assert_timer_set(struct pim_ifchannel *ch, int interval)
                           ch->interface->name);
        }
 
-       THREAD_TIMER_ON(master, ch->t_ifassert_timer, on_assert_timer, ch,
-                       interval);
+       thread_add_timer(master, on_assert_timer, ch, interval,
+                        &ch->t_ifassert_timer);
 }
 
 static void pim_assert_timer_reset(struct pim_ifchannel *ch)