summaryrefslogtreecommitdiffstats
path: root/extras/vom/vom/neighbour.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'extras/vom/vom/neighbour.cpp')
-rw-r--r--extras/vom/vom/neighbour.cpp47
1 files changed, 31 insertions, 16 deletions
diff --git a/extras/vom/vom/neighbour.cpp b/extras/vom/vom/neighbour.cpp
index cbcebd69f7d..a97892d7cdb 100644
--- a/extras/vom/vom/neighbour.cpp
+++ b/extras/vom/vom/neighbour.cpp
@@ -22,21 +22,33 @@ namespace VOM {
singular_db<neighbour::key_t, neighbour> neighbour::m_db;
neighbour::event_handler neighbour::m_evh;
+const neighbour::flags_t neighbour::flags_t::NONE(0, "");
+const neighbour::flags_t neighbour::flags_t::STATIC(1, "static");
+const neighbour::flags_t neighbour::flags_t::NO_FIB_ENTRY(2, "no-fib-entry");
+
+neighbour::flags_t::flags_t(int v, const std::string s)
+ : enum_base(v, s)
+{
+}
+
neighbour::neighbour(const interface& itf,
const boost::asio::ip::address& ip_addr,
- const mac_address_t& mac)
+ const mac_address_t& mac,
+ const flags_t flags)
: m_hw(false)
, m_itf(itf.singular())
, m_ip_addr(ip_addr)
, m_mac(mac)
+ , m_flags(flags)
{
}
-neighbour::neighbour(const neighbour& bde)
- : m_hw(bde.m_hw)
- , m_itf(bde.m_itf)
- , m_ip_addr(bde.m_ip_addr)
- , m_mac(bde.m_mac)
+neighbour::neighbour(const neighbour& n)
+ : m_hw(n.m_hw)
+ , m_itf(n.m_itf)
+ , m_ip_addr(n.m_ip_addr)
+ , m_mac(n.m_mac)
+ , m_flags(n.m_flags)
{
}
@@ -64,8 +76,8 @@ void
neighbour::sweep()
{
if (m_hw) {
- HW::enqueue(
- new neighbour_cmds::delete_cmd(m_hw, m_itf->handle(), m_mac, m_ip_addr));
+ HW::enqueue(new neighbour_cmds::delete_cmd(m_hw, m_itf->handle(), m_mac,
+ m_ip_addr, m_flags));
}
HW::write();
}
@@ -74,8 +86,8 @@ void
neighbour::replay()
{
if (m_hw) {
- HW::enqueue(
- new neighbour_cmds::create_cmd(m_hw, m_itf->handle(), m_mac, m_ip_addr));
+ HW::enqueue(new neighbour_cmds::create_cmd(m_hw, m_itf->handle(), m_mac,
+ m_ip_addr, m_flags));
}
}
@@ -84,7 +96,7 @@ neighbour::to_string() const
{
std::ostringstream s;
s << "neighbour:[" << m_itf->to_string() << ", " << m_mac.to_string() << ", "
- << m_ip_addr.to_string() << "]";
+ << m_ip_addr.to_string() << " " << m_flags.to_string() << "]";
return (s.str());
}
@@ -96,8 +108,8 @@ neighbour::update(const neighbour& r)
* create the table if it is not yet created
*/
if (rc_t::OK != m_hw.rc()) {
- HW::enqueue(
- new neighbour_cmds::create_cmd(m_hw, m_itf->handle(), m_mac, m_ip_addr));
+ HW::enqueue(new neighbour_cmds::create_cmd(m_hw, m_itf->handle(), m_mac,
+ m_ip_addr, m_flags));
}
}
@@ -168,10 +180,13 @@ neighbour::populate_i(const client_db::key_t& key,
mac_address_t mac = from_api(payload.neighbor.mac_address);
boost::asio::ip::address ip_addr = from_api(payload.neighbor.ip_address);
- neighbour n(*itf, ip_addr, mac);
+ neighbour::flags_t f = from_api(payload.neighbor.flags);
+ neighbour n(*itf, ip_addr, mac, f);
+ ;
- VOM_LOG(log_level_t::DEBUG) << "neighbour-dump: " << itf->to_string()
- << mac.to_string() << ip_addr.to_string();
+ VOM_LOG(log_level_t::DEBUG) << "neighbour-dump: " << itf->to_string() << " "
+ << mac.to_string() << " " << ip_addr.to_string()
+ << " " << f.to_string();
/*
* Write each of the discovered interfaces into the OM,