1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * Copyright (C) 2008 Everton da Silva Marques
17 enum pim_ifassert_state
{
19 PIM_IFASSERT_I_AM_WINNER
,
20 PIM_IFASSERT_I_AM_LOSER
23 struct pim_assert_metric
{
24 uint32_t rpt_bit_flag
;
25 uint32_t metric_preference
;
26 uint32_t route_metric
;
27 pim_addr ip_address
; /* neighbor router that sourced the Assert
32 RFC 4601: 4.11. Timer Values
34 Note that for historical reasons, the Assert message lacks a
35 Holdtime field. Thus, changing the Assert Time from the default
36 value is not recommended.
38 #define PIM_ASSERT_OVERRIDE_INTERVAL (3) /* seconds */
39 #define PIM_ASSERT_TIME (180) /* seconds */
41 #define PIM_ASSERT_METRIC_PREFERENCE_MAX (0xFFFFFFFF)
42 #define PIM_ASSERT_ROUTE_METRIC_MAX (0xFFFFFFFF)
44 void pim_ifassert_winner_set(struct pim_ifchannel
*ch
,
45 enum pim_ifassert_state new_state
, pim_addr winner
,
46 struct pim_assert_metric winner_metric
);
48 int pim_assert_recv(struct interface
*ifp
, struct pim_neighbor
*neigh
,
49 pim_addr src_addr
, uint8_t *buf
, int buf_size
);
51 int pim_assert_metric_better(const struct pim_assert_metric
*m1
,
52 const struct pim_assert_metric
*m2
);
53 int pim_assert_metric_match(const struct pim_assert_metric
*m1
,
54 const struct pim_assert_metric
*m2
);
56 int pim_assert_build_msg(uint8_t *pim_msg
, int buf_size
, struct interface
*ifp
,
57 pim_addr group_addr
, pim_addr source_addr
,
58 uint32_t metric_preference
, uint32_t route_metric
,
59 uint32_t rpt_bit_flag
);
61 int pim_assert_send(struct pim_ifchannel
*ch
);
63 int assert_action_a1(struct pim_ifchannel
*ch
);
64 void assert_action_a4(struct pim_ifchannel
*ch
);
65 void assert_action_a5(struct pim_ifchannel
*ch
);
67 #endif /* PIM_ASSERT_H */