diff --git a/modules/infra/api/iface.c b/modules/infra/api/iface.c index e4060ca4..e5718e26 100644 --- a/modules/infra/api/iface.c +++ b/modules/infra/api/iface.c @@ -53,8 +53,17 @@ static struct api_out iface_add(const void *request, void **response) { static struct api_out iface_del(const void *request, void ** /*response*/) { const struct gr_infra_iface_del_req *req = request; + struct iface *iface; int ret; + // Loopback interfaces are special, and are deleted + // when the last interface of a VRF is destroyed. + if ((iface = iface_from_id(req->iface_id)) == NULL) + return api_out(ENODEV, 0); + + if (iface->type_id == GR_IFACE_TYPE_LOOPBACK) + return api_out(EINVAL, 0); + ret = iface_destroy(req->iface_id); return api_out(-ret, 0);