network: route: read RTA_TABLE attribute to get route table
If the table of a route is larger than 255, then the value is stored in RTA_TABLE attribute. But the attribute is not supported by old kernels. So, first try to read the value from RTA_TABLE attribute, then fallback to the value in the message header.
This commit is contained in:
@@ -1723,12 +1723,16 @@ int manager_rtnl_process_route(sd_netlink *rtnl, sd_netlink_message *message, Ma
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = sd_rtnl_message_route_get_table(message, &table);
|
||||
r = sd_netlink_message_read_u32(message, RTA_TABLE, &tmp->table);
|
||||
if (r == -ENODATA) {
|
||||
r = sd_rtnl_message_route_get_table(message, &table);
|
||||
if (r >= 0)
|
||||
tmp->table = table;
|
||||
}
|
||||
if (r < 0) {
|
||||
log_link_warning_errno(link, r, "rtnl: received route message with invalid table, ignoring: %m");
|
||||
return 0;
|
||||
}
|
||||
tmp->table = table;
|
||||
|
||||
r = sd_netlink_message_read_u32(message, RTA_PRIORITY, &tmp->priority);
|
||||
if (r < 0 && r != -ENODATA) {
|
||||
|
||||
Reference in New Issue
Block a user