Skip to content

Commit

Permalink
issue: 1214066 Update some unsigned char -> uint32_t for table_id
Browse files Browse the repository at this point in the history
  • Loading branch information
jdrouhard authored and AlexanderGrissik committed Dec 28, 2023
1 parent 70161db commit a0c94d0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/vma/proto/route_table_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ void route_table_mgr::rt_mgr_update_source_ip()
if (p_val->get_gw_addr() && !p_val->get_src_addr()) {
route_val* p_val_dst;
in_addr_t in_addr = p_val->get_gw_addr();
unsigned char table_id = p_val->get_table_id();
uint32_t table_id = p_val->get_table_id();
if (find_route_val(in_addr, table_id, p_val_dst)) {
if (p_val_dst->get_src_addr()) {
p_val->set_src_addr(p_val_dst->get_src_addr());
Expand Down Expand Up @@ -318,7 +318,7 @@ void route_table_mgr::parse_attr(struct rtattr *rt_attribute, route_val *p_val)
}
}

bool route_table_mgr::find_route_val(in_addr_t &dst, unsigned char table_id, route_val* &p_val)
bool route_table_mgr::find_route_val(in_addr_t &dst, uint32_t table_id, route_val* &p_val)
{
ip_address dst_addr = dst;
rt_mgr_logfunc("dst addr '%s'", dst_addr.to_str().c_str());
Expand Down Expand Up @@ -357,12 +357,12 @@ bool route_table_mgr::route_resolve(IN route_rule_table_key key, OUT route_resul
rt_mgr_logdbg("dst addr '%s'", dst_addr.to_str().c_str());

route_val *p_val = NULL;
std::deque<unsigned char> table_id_list;
std::deque<uint32_t> table_id_list;

g_p_rule_table_mgr->rule_resolve(key, table_id_list);

auto_unlocker lock(m_lock);
std::deque<unsigned char>::iterator table_id_iter = table_id_list.begin();
std::deque<uint32_t>::iterator table_id_iter = table_id_list.begin();
for (; table_id_iter != table_id_list.end(); table_id_iter++) {
if (find_route_val(dst, *table_id_iter, p_val)) {
res.p_src = p_val->get_src_addr();
Expand Down Expand Up @@ -392,7 +392,7 @@ void route_table_mgr::update_entry(INOUT route_entry* p_ent, bool b_register_to_
if (p_rr_entry && p_rr_entry->get_val(p_rr_val)) {
route_val* p_val = NULL;
in_addr_t peer_ip = p_ent->get_key().get_dst_ip();
unsigned char table_id;
uint32_t table_id;
for (std::deque<rule_val*>::iterator p_rule_val = p_rr_val->begin(); p_rule_val != p_rr_val->end(); p_rule_val++) {
table_id = (*p_rule_val)->get_table_id();
if (find_route_val(peer_ip, table_id, p_val)) {
Expand Down
2 changes: 1 addition & 1 deletion src/vma/proto/route_table_mgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class route_table_mgr : public netlink_socket_mgr<route_val>, public cache_table
// in constructor creates route_entry for each net_dev, to receive events in case there are no other route_entrys
in_addr_route_entry_map_t m_rte_list_for_each_net_dev;

bool find_route_val(in_addr_t &dst_addr, unsigned char table_id, route_val* &p_val);
bool find_route_val(in_addr_t &dst_addr, uint32_t table_id, route_val* &p_val);

// save current main rt table
void update_tbl();
Expand Down
2 changes: 1 addition & 1 deletion src/vma/proto/rule_table_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ bool rule_table_mgr::is_matching_rule(route_rule_table_key key, rule_val* p_val)
// key : key object that contain information about destination.
// table_id_list : list that will contain table ID for all rule that match destination info
// Returns true if at least one rule match destination info, false otherwise.
bool rule_table_mgr::rule_resolve(route_rule_table_key key, std::deque<unsigned char> &table_id_list)
bool rule_table_mgr::rule_resolve(route_rule_table_key key, std::deque<uint32_t> &table_id_list)
{
rr_mgr_logdbg("dst info: '%s'", key.to_str().c_str());

Expand Down
2 changes: 1 addition & 1 deletion src/vma/proto/rule_table_mgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class rule_table_mgr : public netlink_socket_mgr<rule_val>, public cache_table_m

rule_entry* create_new_entry(route_rule_table_key key, const observer *obs);
void update_entry(rule_entry* p_ent);
bool rule_resolve(route_rule_table_key key, std::deque<unsigned char> &table_id_list);
bool rule_resolve(route_rule_table_key key, std::deque<uint32_t> &table_id_list);

protected:
virtual bool parse_enrty(nlmsghdr *nl_header, rule_val *p_val);
Expand Down

0 comments on commit a0c94d0

Please sign in to comment.