Fix wrong unit displayed when using "--use-bit" option
This commit is contained in:
parent
5cecc86856
commit
51a24c315b
@ -774,6 +774,17 @@ static void netlink_shutdown(void)
|
|||||||
nl_socket_free(sock);
|
nl_socket_free(sock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void netlink_use_bit(struct attr_map *map, const int size)
|
||||||
|
{
|
||||||
|
if(cfg_getbool(cfg, "use_bit")) {
|
||||||
|
for(int i = 0; i < size; ++i) {
|
||||||
|
if(!strcmp(map[i].description, "Bytes")) {
|
||||||
|
map[i].description = "Bits";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int netlink_do_init(void)
|
static int netlink_do_init(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
@ -798,6 +809,8 @@ static int netlink_do_init(void)
|
|||||||
goto disable;
|
goto disable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
netlink_use_bit(link_attrs, ARRAY_SIZE(link_attrs));
|
||||||
|
netlink_use_bit(tc_attrs, ARRAY_SIZE(tc_attrs));
|
||||||
if (attr_map_load(link_attrs, ARRAY_SIZE(link_attrs)) ||
|
if (attr_map_load(link_attrs, ARRAY_SIZE(link_attrs)) ||
|
||||||
attr_map_load(tc_attrs, ARRAY_SIZE(tc_attrs)))
|
attr_map_load(tc_attrs, ARRAY_SIZE(tc_attrs)))
|
||||||
BUG();
|
BUG();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user