summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-08-25 10:22:11 +0200
committerThomas Haller <thaller@redhat.com>2018-09-05 11:41:40 +0200
commitfce49867f1a10d68fcedb09ace1fbf996e83e31a (patch)
treef87ee6e7a7f1e590b3c7d6b1501fd212fc5e2cc6
parent445cb55dddac48ad9e3cb4c39652d948a97f3dfb (diff)
downloadNetworkManager-fce49867f1a10d68fcedb09ace1fbf996e83e31a.tar.gz
settings/ifupdown: refactor parsing loop in plugin's initialize()
-rw-r--r--src/settings/plugins/ifupdown/nms-ifupdown-plugin.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/settings/plugins/ifupdown/nms-ifupdown-plugin.c b/src/settings/plugins/ifupdown/nms-ifupdown-plugin.c
index 564cb83aa9..d6e50dcbb0 100644
--- a/src/settings/plugins/ifupdown/nms-ifupdown-plugin.c
+++ b/src/settings/plugins/ifupdown/nms-ifupdown-plugin.c
@@ -322,13 +322,16 @@ initialize (NMSettingsPlugin *config)
/* Read in all the interfaces */
ifparser_init (ENI_INTERFACES_FILE, 0);
- block = ifparser_getfirst ();
- while (block) {
+ for (block = ifparser_getfirst (); block; block = block->next) {
+
if (NM_IN_STRSET (block->type, "auto", "allow-hotplug")) {
if (!auto_ifaces)
auto_ifaces = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, NULL);
g_hash_table_add (auto_ifaces, g_strdup (block->name));
- } else if (nm_streq (block->type, "iface")) {
+ continue;
+ }
+
+ if (nm_streq (block->type, "iface")) {
NMIfupdownConnection *exported;
/* Bridge configuration */
@@ -367,12 +370,12 @@ initialize (NMSettingsPlugin *config)
}
g_strfreev (port_ifaces);
}
- goto next;
+ continue;
}
/* Skip loopback configuration */
if (nm_streq (block->name, "lo"))
- goto next;
+ continue;
/* Remove any connection for this block that was previously found */
exported = g_hash_table_lookup (priv->connections, block->name);
@@ -390,12 +393,16 @@ initialize (NMSettingsPlugin *config)
}
nm_log_info (LOGD_SETTINGS, "adding iface %s to eni_ifaces", block->name);
g_hash_table_add (priv->eni_ifaces, g_strdup (block->name));
- } else if (nm_streq (block->type, "mapping")) {
+ continue;
+ }
+
+ if (nm_streq (block->type, "mapping")) {
g_hash_table_add (priv->eni_ifaces, g_strdup (block->name));
nm_log_info (LOGD_SETTINGS, "adding mapping %s to eni_ifaces", block->name);
+ continue;
}
- next:
- block = block->next;
+
+ /* unhandled. */
}
/* Make 'auto' interfaces autoconnect=TRUE */