/*
- 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>
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);
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);
}
memset(&sg, 0, sizeof(struct prefix_sg));
sg.src = source_addr;
sg.grp = group_addr;
- ch = pim_ifchannel_add(ifp, &sg, 0);
- if (!ch) {
- zlog_warn(
- "%s: (S,G)=%s failure creating channel on interface %s",
- __PRETTY_FUNCTION__, pim_str_sg_dump(&sg), ifp->name);
- return -1;
- }
+ ch = pim_ifchannel_add(ifp, &sg, 0, 0);
switch (ch->ifassert_state) {
case PIM_IFASSERT_NOINFO:
int offset;
uint8_t *curr;
int curr_size;
+ struct pim_interface *pim_ifp = NULL;
on_trace(__PRETTY_FUNCTION__, ifp, src_addr);
curr += offset;
curr_size -= offset;
- if (curr_size != 8) {
+ if (curr_size < 8) {
char src_str[INET_ADDRSTRLEN];
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
zlog_warn(
- "%s: preference/metric size is not 8: size=%d from %s on interface %s",
+ "%s: preference/metric size is less than 8 bytes: size=%d from %s on interface %s",
__PRETTY_FUNCTION__, curr_size, src_str, ifp->name);
return -3;
}
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);
}
Add PIM header
*/
pim_msg_size = pim_msg_curr - pim_msg;
- pim_msg_build_header(pim_msg, pim_msg_size, PIM_MSG_TYPE_ASSERT);
+ pim_msg_build_header(pim_msg, pim_msg_size, PIM_MSG_TYPE_ASSERT, false);
return pim_msg_size;
}
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,
ch->interface->name);
}
- THREAD_TIMER_ON(master, ch->t_ifassert_timer, on_assert_timer, ch,
- interval);
+ thread_add_timer(router->master, on_assert_timer, ch, interval,
+ &ch->t_ifassert_timer);
}
static void pim_assert_timer_reset(struct pim_ifchannel *ch)
winner metric as AssertWinnerMetric(S,G,I).
Set Assert Timer to Assert_Time.
If (I is RPF_interface(S)) AND (UpstreamJPState(S,G) == true)
- set SPTbit(S,G) to TRUE.
+ set SPTbit(S,G) to true.
*/
static void assert_action_a6(struct pim_ifchannel *ch,
struct pim_assert_metric winner_metric)
/*
If (I is RPF_interface(S)) AND (UpstreamJPState(S,G) == true) set
- SPTbit(S,G) to TRUE.
+ SPTbit(S,G) to true.
*/
if (ch->upstream->rpf.source_nexthop.interface == ch->interface)
if (ch->upstream->join_state == PIM_UPSTREAM_JOINED)