return 0;
}
+bool lxc_config_net_is_hwaddr(const char *line)
+{
+ unsigned index;
+ char tmp[7];
+
+ if (strncmp(line, "lxc.net", 7) != 0)
+ return false;
+
+ if (strncmp(line, "lxc.net.hwaddr", 14) == 0)
+ return true;
+
+ if (strncmp(line, "lxc.network.hwaddr", 18) == 0)
+ return true;
+
+ if (sscanf(line, "lxc.net.%u.%6s", &index, tmp) == 2 ||
+ sscanf(line, "lxc.network.%u.%6s", &index, tmp) == 2)
+ return strncmp(tmp, "hwaddr", 6) == 0;
+
+ return false;
+}
+
void rand_complete_hwaddr(char *hwaddr)
{
const char hex[] = "0123456789abcdef";
}
}
-bool lxc_config_net_hwaddr(const char *line)
-{
- unsigned index;
- char tmp[7];
-
- if (strncmp(line, "lxc.net", 7) != 0)
- return false;
-
- if (strncmp(line, "lxc.net.hwaddr", 14) == 0)
- return true;
-
- if (strncmp(line, "lxc.network.hwaddr", 18) == 0)
- return true;
-
- if (sscanf(line, "lxc.net.%u.%6s", &index, tmp) == 2 ||
- sscanf(line, "lxc.network.%u.%6s", &index, tmp) == 2)
- return strncmp(tmp, "hwaddr", 6) == 0;
-
- return false;
-}
-
/*
* If we find a lxc.net.[i].hwaddr or lxc.network.hwaddr in the original config
* file, we expand it in the unexpanded_config, so that after a save_config we
if (line[0] == '#')
return;
- if (!lxc_config_net_hwaddr(line))
+ if (!lxc_config_net_is_hwaddr(line))
return;
/* Let config_net_hwaddr raise the error. */
extern int config_ip_prefix(struct in_addr *addr);
extern int network_ifname(char *valuep, const char *value, size_t size);
extern void rand_complete_hwaddr(char *hwaddr);
-extern bool lxc_config_net_hwaddr(const char *line);
+extern bool lxc_config_net_is_hwaddr(const char *line);
extern void update_hwaddr(const char *line);
extern bool new_hwaddr(char *hwaddr);
extern int lxc_get_conf_str(char *retv, int inlen, const char *value);
}
}
-void test_lxc_config_net_hwaddr(void)
+void test_lxc_config_net_is_hwaddr(void)
{
- if (!lxc_config_net_hwaddr("lxc.net.0.hwaddr = 00:16:3e:04:65:b8\n"))
+ if (!lxc_config_net_is_hwaddr("lxc.net.0.hwaddr = 00:16:3e:04:65:b8\n"))
exit(EXIT_FAILURE);
- if (lxc_config_net_hwaddr("lxc.net"))
+ if (lxc_config_net_is_hwaddr("lxc.net"))
exit(EXIT_FAILURE);
- if (lxc_config_net_hwaddr("lxc.net."))
+ if (lxc_config_net_is_hwaddr("lxc.net."))
exit(EXIT_FAILURE);
- if (lxc_config_net_hwaddr("lxc.net.0."))
+ if (lxc_config_net_is_hwaddr("lxc.net.0."))
exit(EXIT_FAILURE);
}
test_lxc_safe_int();
test_lxc_safe_long();
test_parse_byte_size_string();
- test_lxc_config_net_hwaddr();
+ test_lxc_config_net_is_hwaddr();
test_task_blocks_signal();
exit(EXIT_SUCCESS);