- struct pim_interface *pim_ifp;
- struct pim_neighbor *neigh;
- char src_str[INET_ADDRSTRLEN];
-
- zassert(ifp);
- pim_ifp = ifp->info;
- zassert(pim_ifp);
-
- neigh = XCALLOC(MTYPE_PIM_NEIGHBOR, sizeof(*neigh));
- if (!neigh) {
- zlog_err("%s: PIM XCALLOC(%zu) failure",
- __PRETTY_FUNCTION__, sizeof(*neigh));
- return 0;
- }
-
- neigh->creation = pim_time_monotonic_sec();
- neigh->source_addr = source_addr;
- neigh->hello_options = hello_options;
- neigh->propagation_delay_msec = propagation_delay;
- neigh->override_interval_msec = override_interval;
- neigh->dr_priority = dr_priority;
- neigh->generation_id = generation_id;
- neigh->prefix_list = addr_list;
- neigh->t_expire_timer = NULL;
- neigh->interface = ifp;
-
- neigh->upstream_jp_agg = list_new();
- neigh->upstream_jp_agg->cmp = pim_jp_agg_group_list_cmp;
- neigh->upstream_jp_agg->del = (void (*)(void *))pim_jp_agg_group_list_free;
- pim_neighbor_start_jp_timer(neigh);
-
- pim_neighbor_timer_reset(neigh, holdtime);
- /*
- * The pim_ifstat_hello_sent variable is used to decide if
- * we should expedite a hello out the interface. If we
- * establish a new neighbor, we unfortunately need to
- * reset the value so that we can know to hurry up and
- * hello
- */
- pim_ifp->pim_ifstat_hello_sent = 0;
-
- pim_inet4_dump("<src?>", source_addr, src_str, sizeof(src_str));
-
- if (PIM_DEBUG_PIM_EVENTS) {
- zlog_debug("%s: creating PIM neighbor %s on interface %s",
- __PRETTY_FUNCTION__,
- src_str, ifp->name);
- }
-
- zlog_info("PIM NEIGHBOR UP: neighbor %s on interface %s",
- src_str, ifp->name);
-
- if (neigh->propagation_delay_msec > pim_ifp->pim_neighbors_highest_propagation_delay_msec) {
- pim_ifp->pim_neighbors_highest_propagation_delay_msec = neigh->propagation_delay_msec;
- }
- if (neigh->override_interval_msec > pim_ifp->pim_neighbors_highest_override_interval_msec) {
- pim_ifp->pim_neighbors_highest_override_interval_msec = neigh->override_interval_msec;
- }
-
- if (!PIM_OPTION_IS_SET(neigh->hello_options,
- PIM_OPTION_MASK_LAN_PRUNE_DELAY)) {
- /* update num. of neighbors without hello option lan_delay */
- ++pim_ifp->pim_number_of_nonlandelay_neighbors;
- }
-
- if (!PIM_OPTION_IS_SET(neigh->hello_options,
- PIM_OPTION_MASK_DR_PRIORITY)) {
- /* update num. of neighbors without hello option dr_pri */
- ++pim_ifp->pim_dr_num_nondrpri_neighbors;
- }
-
- return neigh;
+ struct pim_interface *pim_ifp;
+ struct pim_neighbor *neigh;
+ char src_str[INET_ADDRSTRLEN];
+
+ zassert(ifp);
+ pim_ifp = ifp->info;
+ zassert(pim_ifp);
+
+ neigh = XCALLOC(MTYPE_PIM_NEIGHBOR, sizeof(*neigh));
+ if (!neigh) {
+ zlog_err("%s: PIM XCALLOC(%zu) failure", __PRETTY_FUNCTION__,
+ sizeof(*neigh));
+ return 0;
+ }
+
+ neigh->creation = pim_time_monotonic_sec();
+ neigh->source_addr = source_addr;
+ neigh->hello_options = hello_options;
+ neigh->propagation_delay_msec = propagation_delay;
+ neigh->override_interval_msec = override_interval;
+ neigh->dr_priority = dr_priority;
+ neigh->generation_id = generation_id;
+ neigh->prefix_list = addr_list;
+ neigh->t_expire_timer = NULL;
+ neigh->interface = ifp;
+
+ neigh->upstream_jp_agg = list_new();
+ neigh->upstream_jp_agg->cmp = pim_jp_agg_group_list_cmp;
+ neigh->upstream_jp_agg->del =
+ (void (*)(void *))pim_jp_agg_group_list_free;
+ pim_neighbor_start_jp_timer(neigh);
+
+ pim_neighbor_timer_reset(neigh, holdtime);
+ /*
+ * The pim_ifstat_hello_sent variable is used to decide if
+ * we should expedite a hello out the interface. If we
+ * establish a new neighbor, we unfortunately need to
+ * reset the value so that we can know to hurry up and
+ * hello
+ */
+ pim_ifp->pim_ifstat_hello_sent = 0;
+
+ pim_inet4_dump("<src?>", source_addr, src_str, sizeof(src_str));
+
+ if (PIM_DEBUG_PIM_EVENTS) {
+ zlog_debug("%s: creating PIM neighbor %s on interface %s",
+ __PRETTY_FUNCTION__, src_str, ifp->name);
+ }
+
+ zlog_info("PIM NEIGHBOR UP: neighbor %s on interface %s", src_str,
+ ifp->name);
+
+ if (neigh->propagation_delay_msec
+ > pim_ifp->pim_neighbors_highest_propagation_delay_msec) {
+ pim_ifp->pim_neighbors_highest_propagation_delay_msec =
+ neigh->propagation_delay_msec;
+ }
+ if (neigh->override_interval_msec
+ > pim_ifp->pim_neighbors_highest_override_interval_msec) {
+ pim_ifp->pim_neighbors_highest_override_interval_msec =
+ neigh->override_interval_msec;
+ }
+
+ if (!PIM_OPTION_IS_SET(neigh->hello_options,
+ PIM_OPTION_MASK_LAN_PRUNE_DELAY)) {
+ /* update num. of neighbors without hello option lan_delay */
+ ++pim_ifp->pim_number_of_nonlandelay_neighbors;
+ }
+
+ if (!PIM_OPTION_IS_SET(neigh->hello_options,
+ PIM_OPTION_MASK_DR_PRIORITY)) {
+ /* update num. of neighbors without hello option dr_pri */
+ ++pim_ifp->pim_dr_num_nondrpri_neighbors;
+ }
+
+ // Register PIM Neighbor with BFD
+ pim_bfd_trigger_event(pim_ifp, neigh, 1);
+
+ return neigh;