From 661da869b3419c0761296caaf12002e2eba25f48 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 1 Sep 2021 19:23:46 +0200 Subject: [PATCH] cloud-setup: limit number of supported interfaces to avoid overlapping table numbers The table number is chosen as 30400 + iface_idx. That is, the range is limited and we shouldn't handle more than 100 devices. Add a check for that and error out. (cherry picked from commit b68d694b78fd9b4b63b0592a2518f387aaa35f87) (cherry picked from commit 292233e16ed1f60499c2676611d59c271352e2c3) --- clients/cloud-setup/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/clients/cloud-setup/main.c b/clients/cloud-setup/main.c index cbea266813..9fa4cd3c84 100644 --- a/clients/cloud-setup/main.c +++ b/clients/cloud-setup/main.c @@ -434,6 +434,14 @@ _config_one(GCancellable * sigterm_cancellable, return FALSE; } + if (config_data->iface_idx >= 100) { + /* since we use the iface_idx to select a table number, the range is limited from + * 0 to 99. Note that the providers are required to provide increasing numbers, + * so this means we bail out after the first 100 devices. */ + _LOGD("config device %s: skip because number of supported interfaces reached", hwaddr); + return FALSE; + } + _LOGD("config device %s: configuring \"%s\" (%s)...", hwaddr, nm_device_get_iface(device) ?: "/unknown/",