Commit 81ebcb2a authored by Masatake YAMATO's avatar Masatake YAMATO Committed by Stephen Hemminger

iproute2: use named constants instead of number literals to fill rtnl_rttable_hash

Signed-off-by: default avatarMasatake YAMATO <yamato@redhat.com>
parent 58ed50ee
......@@ -314,21 +314,27 @@ int rtnl_rtrealm_a2n(__u32 *id, const char *arg)
}
static struct rtnl_hash_entry dflt_table_entry = { .id = 253, .name = "default" };
static struct rtnl_hash_entry main_table_entry = { .id = 254, .name = "main" };
static struct rtnl_hash_entry local_table_entry = { .id = 255, .name = "local" };
static struct rtnl_hash_entry dflt_table_entry = { .name = "default" };
static struct rtnl_hash_entry main_table_entry = { .name = "main" };
static struct rtnl_hash_entry local_table_entry = { .name = "local" };
static struct rtnl_hash_entry * rtnl_rttable_hash[256] = {
[253] = &dflt_table_entry,
[254] = &main_table_entry,
[255] = &local_table_entry,
[RT_TABLE_DEFAULT] = &dflt_table_entry,
[RT_TABLE_MAIN] = &main_table_entry,
[RT_TABLE_LOCAL] = &local_table_entry,
};
static int rtnl_rttable_init;
static void rtnl_rttable_initialize(void)
{
int i;
rtnl_rttable_init = 1;
for (i = 0; i < 256; i++) {
if (rtnl_rttable_hash[i])
rtnl_rttable_hash[i]->id = i;
}
rtnl_hash_initialize(CONFDIR "/rt_tables",
rtnl_rttable_hash, 256);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment