]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/veth: refuse when peer and the main interface names are equivalent
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 9 Sep 2024 18:00:09 +0000 (03:00 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 10 Sep 2024 10:30:17 +0000 (19:30 +0900)
src/network/netdev/veth.c

index 78555286d1a4cc86a4765e8908b5ef8c080caeb6..c9831b21b90f4da924309224eecd31f8755da4e5 100644 (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;
 }