summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau2025-10-20 17:43:14 +0000
committerFelix Fietkau2025-10-20 17:44:20 +0000
commitdf2f5c9a30f8faadf8dee962cc17d315e967d70a (patch)
tree5c4eb453886a4eb3ad7d6d31c50d7fcf66b49eb5
parent649028013a3c8f6ed53fc97ca997d2528d06b5d9 (diff)
downloadnetifd-df2f5c9a30f8faadf8dee962cc17d315e967d70a.tar.gz
veth: delete device before creation to handle stale state
When a veth device already exists in the kernel (from a previous failed cleanup or external creation), attempting to create it again with NLM_F_EXCL fails with -EEXIST. This leaves the device in a broken state where netifd marks it as present but cannot bring it up. Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r--veth.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/veth.c b/veth.c
index 46b6eff..2f03456 100644
--- a/veth.c
+++ b/veth.c
@@ -68,6 +68,8 @@ veth_set_up(struct veth *veth)
{
int ret;
+ system_veth_del(&veth->dev);
+
ret = system_veth_add(&veth->dev, &veth->config);
if (ret < 0)
return ret;