diff --git a/src/network/generator/test-network-generator.c b/src/network/generator/test-network-generator.c index e658d893335..bcd4b1d9e41 100644 --- a/src/network/generator/test-network-generator.c +++ b/src/network/generator/test-network-generator.c @@ -49,14 +49,14 @@ static void test_netdev_one(const char *ifname, const char *key, const char *val assert_se(streq(output, expected)); } -static void test_link_one(const char *ifname, const char *key, const char *value, const char *expected) { +static void test_link_one(const char *filename, const char *key, const char *value, const char *expected) { _cleanup_(context_clear) Context context = {}; _cleanup_free_ char *output = NULL; Link *link; printf("# %s=%s\n", key, value); assert_se(parse_cmdline_item(key, value, &context) >= 0); - assert_se(link = link_get(&context, ifname)); + assert_se(link = link_get(&context, filename)); assert_se(link_format(link, &output) >= 0); puts(output); assert_se(streq(output, expected)); @@ -334,6 +334,22 @@ int main(int argc, char *argv[]) { "Name=hogehoge\n" ); + test_link_one("001122334455", "net.ifname-policy", "keep,kernel,database,onboard,slot,path,mac,00:11:22:33:44:55", + "[Match]\n" + "MACAddress=00:11:22:33:44:55\n" + "\n[Link]\n" + "NamePolicy=keep kernel database onboard slot path mac\n" + "AlternativeNamesPolicy=database onboard slot path mac\n" + ); + + test_link_one("default", "net.ifname-policy", "keep,kernel,database,onboard,slot,path,mac", + "[Match]\n" + "OriginalName=*\n" + "\n[Link]\n" + "NamePolicy=keep kernel database onboard slot path mac\n" + "AlternativeNamesPolicy=database onboard slot path mac\n" + ); + test_network_two("eth0", "ip", "192.168.0.10:192.168.0.2:192.168.0.1:255.255.255.0:hogehoge:eth0:on:10.10.10.10:10.10.10.11", "rd.route", "10.1.2.3/16:10.0.2.3",