- if (m_rd) {
- payload.next_hop_table_id = m_rd->table_id();
- }
- if (m_interface) {
- payload.next_hop_sw_if_index = m_interface->handle().value();
- }
- } else if (special_t::DROP == m_type) {
- payload.is_drop = 1;
- } else if (special_t::UNREACH == m_type) {
- payload.is_unreach = 1;
- } else if (special_t::PROHIBIT == m_type) {
- payload.is_prohibit = 1;
- } else if (special_t::LOCAL == m_type) {
- payload.is_local = 1;
- }
- payload.next_hop_weight = m_weight;
- payload.next_hop_preference = m_preference;
- payload.next_hop_via_label = 0;
- payload.classify_table_index = 0;
+bool
+path::operator==(const path& p) const
+{
+ bool result = true;
+ if (m_rd && !p.m_rd)
+ return false;
+ if (!m_rd && p.m_rd)
+ return false;
+ if (m_rd && p.m_rd)
+ result &= (*m_rd == *p.m_rd);
+ if (m_interface && !p.m_interface)
+ return false;
+ if (!m_interface && p.m_interface)
+ return false;
+ if (m_interface && p.m_interface)
+ result &= (*m_interface == *p.m_interface);
+ return (result && (m_type == p.m_type) && (m_nh == p.m_nh) &&
+ (m_nh_proto == p.m_nh_proto) && (m_flags == p.m_flags));