network/veth: refuse when peer and the main interface names are equivalent

This commit is contained in:
Yu Watanabe
2024-09-10 19:30:17 +09:00
parent c60cd572bd
commit 98fbb3b5b0
+4
View File
@@ -62,6 +62,10 @@ static int netdev_veth_verify(NetDev *netdev, const char *filename) {
"Veth NetDev without peer name configured in %s. Ignoring",
filename);
if (streq(v->ifname_peer, netdev->ifname))
return log_netdev_warning_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
"Veth peer name cannot be the same as the main interface name.");
return 0;
}