diff options
Diffstat (limited to 'src')
179 files changed, 6121 insertions, 6121 deletions
diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c index 1346d60f52..0fe55ec946 100644 --- a/src/NetworkManagerUtils.c +++ b/src/NetworkManagerUtils.c @@ -96,15 +96,15 @@ get_new_connection_name(NMConnection *const *existing_connections, return g_strdup(preferred); /* Otherwise, find the next available unique connection name using the given - * connection name template. - */ + * connection name template. + */ for (i = 1; TRUE; i++) { char *temp; /* TRANSLATORS: the first %s is a prefix for the connection id, such - * as "Wired Connection" or "VPN Connection". The %d is a number - * that is combined with the first argument to create a unique - * connection id. */ + * as "Wired Connection" or "VPN Connection". The %d is a number + * that is combined with the first argument to create a unique + * connection id. */ temp = g_strdup_printf(C_("connection id fallback", "%s %u"), fallback_prefix, i); if (nm_utils_strv_find_first((char **) existing_names, existing_len, temp) < 0) @@ -332,11 +332,11 @@ check_ip6_method(NMConnection *orig, NMConnection *candidate, GHashTable *settin && nm_streq(candidate_ip6_method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) && (!candidate_ip6 || nm_setting_ip_config_get_may_fail(candidate_ip6))) { /* If the generated connection is 'link-local' and the candidate is both 'auto' - * and may-fail=TRUE, then the candidate is OK to use. may-fail is included - * in the decision because if the candidate is 'auto' but may-fail=FALSE, then - * the connection could not possibly have been previously activated on the - * device if the device has no non-link-local IPv6 address. - */ + * and may-fail=TRUE, then the candidate is OK to use. may-fail is included + * in the decision because if the candidate is 'auto' but may-fail=FALSE, then + * the connection could not possibly have been previously activated on the + * device if the device has no non-link-local IPv6 address. + */ allow = TRUE; } else if (NM_IN_STRSET(orig_ip6_method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL, @@ -344,9 +344,9 @@ check_ip6_method(NMConnection *orig, NMConnection *candidate, GHashTable *settin NM_SETTING_IP6_CONFIG_METHOD_AUTO) && nm_streq0(candidate_ip6_method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) { /* If the generated connection method is 'link-local', disabled' or 'auto' and - * the candidate method is 'ignore' we can take the connection, because NM didn't - * simply take care of IPv6. - */ + * the candidate method is 'ignore' we can take the connection, because NM didn't + * simply take care of IPv6. + */ allow = TRUE; } @@ -456,13 +456,13 @@ check_ip_routes(NMConnection *orig, } /* if @orig (@routes1) contains /32 routes that are missing in @candidate, - * we accept that. - * - * A /32 may have been added automatically, as a direct-route to the gateway. - * The generated connection (@orig) would contain that route, so we shall ignore - * it. - * - * Likeweise for /128 for IPv6. */ + * we accept that. + * + * A /32 may have been added automatically, as a direct-route to the gateway. + * The generated connection (@orig) would contain that route, so we shall ignore + * it. + * + * Likeweise for /128 for IPv6. */ if (nm_ip_route_get_prefix(routes1[i1]) == PLEN) continue; @@ -504,10 +504,10 @@ check_ip4_method(NMConnection *orig, && (!candidate_ip4 || nm_setting_ip_config_get_may_fail(candidate_ip4)) && !device_has_carrier) { /* If the generated connection is 'disabled' (device had no IP addresses) - * but it has no carrier, that most likely means that IP addressing could - * not complete and thus no IP addresses were assigned. In that case, allow - * matching to the "auto" method. - */ + * but it has no carrier, that most likely means that IP addressing could + * not complete and thus no IP addresses were assigned. In that case, allow + * matching to the "auto" method. + */ remove_from_hash(settings, props, NM_SETTING_IP4_CONFIG_SETTING_NAME, @@ -671,8 +671,8 @@ check_connection_s390_props(NMConnection *orig, NMConnection *candidate, GHashTa return TRUE; /* If the generated connection did not contain wired setting, - * allow it to match to a connection with a wired setting, - * but default (empty) s390-* properties */ + * allow it to match to a connection with a wired setting, + * but default (empty) s390-* properties */ s_wired_orig = nm_connection_get_setting_wired(orig); s_wired_cand = nm_connection_get_setting_wired(candidate); if (!s_wired_orig && s_wired_cand) { @@ -800,8 +800,8 @@ nm_utils_match_connection(NMConnection *const * connections, s_cand = nm_connection_get_setting_connection(candidate); /* It is indicated that this connection matches. Assume we have - * a match, but check for particular differences that let us - * reject the candidate. */ + * a match, but check for particular differences that let us + * reject the candidate. */ if (!nm_streq0(nm_setting_connection_get_connection_type(s_orig), nm_setting_connection_get_connection_type(s_cand))) continue; @@ -875,10 +875,10 @@ nm_match_spec_device_by_pllink(const NMPlatformLink *pllink, NMMatchSpecMatchType m; /* we can only match by certain properties that are available on the - * platform link (and even @pllink might be missing. - * - * It's still useful because of specs like "*" and "except:interface-name:eth0", - * which match even in that case. */ + * platform link (and even @pllink might be missing. + * + * It's still useful because of specs like "*" and "except:interface-name:eth0", + * which match even in that case. */ m = nm_match_spec_device(specs, pllink ? pllink->name : NULL, match_device_type, @@ -964,7 +964,7 @@ _shutdown_waitobj_unregister(NMShutdownWaitObjHandle *handle) g_slice_free(NMShutdownWaitObjHandle, handle); /* FIXME(shutdown): check whether the object list is empty, and - * signal shutdown-complete */ + * signal shutdown-complete */ } static void @@ -1041,8 +1041,8 @@ nm_shutdown_wait_obj_register_full(gpointer watched_obj, handle = g_slice_new(NMShutdownWaitObjHandle); *handle = (NMShutdownWaitObjHandle){ /* depending on @free_msg_reason, we take ownership of @msg_reason. - * In either case, we just reference the string without cloning - * it. */ + * In either case, we just reference the string without cloning + * it. */ .watched_obj = watched_obj, .msg_reason = msg_reason, .free_msg_reason = free_msg_reason, @@ -1114,12 +1114,12 @@ nm_utils_file_is_in_path(const char *abs_filename, const char *abs_path) nm_assert(path <= &abs_filename[strlen(abs_filename)]); /* we require a non-empty remainder with no slashes. That is, only a filename. - * - * Note this will reject "/var/run/" as not being in "/var", - * while "/var/run" would pass. The function searches for files - * only, so a trailing slash (indicating a directory) is not allowed). - * This is despite that the function cannot determine whether "/var/run" - * is itself a file or a directory. "*/ + * + * Note this will reject "/var/run/" as not being in "/var", + * while "/var/run" would pass. The function searches for files + * only, so a trailing slash (indicating a directory) is not allowed). + * This is despite that the function cannot determine whether "/var/run" + * is itself a file or a directory. "*/ return path[0] && !strchr(path, '/') ? path : NULL; } @@ -1602,7 +1602,7 @@ nm_utils_ip_routes_to_dbus(int addr_family, if (out_routes) { /* legacy versions of nm_ip[46]_route_set_prefix() in libnm-util assert that the - * plen is positive. Skip the default routes not to break older clients. */ + * plen is positive. Skip the default routes not to break older clients. */ if (!nm_platform_route_table_is_main(r->rx.table_coerced) || NM_PLATFORM_IP_ROUTE_IS_DEFAULT(r)) continue; diff --git a/src/NetworkManagerUtils.h b/src/NetworkManagerUtils.h index b21e42d410..699c78dade 100644 --- a/src/NetworkManagerUtils.h +++ b/src/NetworkManagerUtils.h @@ -74,16 +74,16 @@ NMPlatformRoutingRule *nm_ip_routing_rule_to_platform(const NMIPRoutingRule *rul typedef enum { /* There is no watched_obj argument, and the shutdown is delayed until the user - * explicitly calls unregister on the returned handle. */ + * explicitly calls unregister on the returned handle. */ NM_SHUTDOWN_WAIT_TYPE_HANDLE, /* The watched_obj argument is a GObject, and shutdown is delayed until the object - * gets destroyed (or unregistered). */ + * gets destroyed (or unregistered). */ NM_SHUTDOWN_WAIT_TYPE_OBJECT, /* The watched_obj argument is a GCancellable, and shutdown is delayed until the object - * gets destroyed (or unregistered). Note that after NM_SHUTDOWN_TIMEOUT_MS, the - * cancellable will be cancelled to notify listeners about the shutdown. */ + * gets destroyed (or unregistered). Note that after NM_SHUTDOWN_TIMEOUT_MS, the + * cancellable will be cancelled to notify listeners about the shutdown. */ NM_SHUTDOWN_WAIT_TYPE_CANCELLABLE, } NMShutdownWaitType; @@ -184,10 +184,10 @@ static inline NMDhcpLease * nm_dhcp_lease_new_from_options(GHashTable *options_take) { /* a NMDhcpLease is really just a GHashTable. But it's also supposed to be *immutable*. - * - * Hence, the API here takes over ownership of the reference to @options_take, that - * is to emphasize that we acquire ownership of the hash, and it should not be modified - * anymore. */ + * + * Hence, the API here takes over ownership of the reference to @options_take, that + * is to emphasize that we acquire ownership of the hash, and it should not be modified + * anymore. */ return (NMDhcpLease *) options_take; } diff --git a/src/devices/adsl/nm-atm-manager.c b/src/devices/adsl/nm-atm-manager.c index 308844940a..186164bbf3 100644 --- a/src/devices/adsl/nm-atm-manager.c +++ b/src/devices/adsl/nm-atm-manager.c @@ -162,8 +162,8 @@ adsl_remove(NMAtmManager *self, struct udev_device *udev_device) NMDevice *device = iter->data; /* Match 'iface' not 'ip_iface' to the ATM device instead of the - * NAS bridge interface or PPPoE interface. - */ + * NAS bridge interface or PPPoE interface. + */ if (g_strcmp0(nm_device_get_iface(device), iface) != 0) continue; diff --git a/src/devices/adsl/nm-device-adsl.c b/src/devices/adsl/nm-device-adsl.c index d2990a53e1..c39306297a 100644 --- a/src/devices/adsl/nm-device-adsl.c +++ b/src/devices/adsl/nm-device-adsl.c @@ -102,9 +102,9 @@ complete_connection(NMDevice * device, NMSettingAdsl *s_adsl; /* - * We can't telepathically figure out the username, so if - * it wasn't given, we can't complete the connection. - */ + * We can't telepathically figure out the username, so if + * it wasn't given, we can't complete the connection. + */ s_adsl = nm_connection_get_setting_adsl(connection); if (s_adsl && !nm_setting_verify(NM_SETTING(s_adsl), NULL, error)) return FALSE; @@ -338,10 +338,10 @@ br2684_create_iface(NMDeviceAdsl *self) ni.mtu = 1500; /* Loop attempting to create an interface that doesn't exist yet. The - * kernel can create one for us automatically, but due to API issues it - * cannot return that name to us. Since we want to know the name right - * away, just brute-force it. - */ + * kernel can create one for us automatically, but due to API issues it + * cannot return that name to us. Since we want to know the name right + * away, just brute-force it. + */ while (TRUE) { memset(&ni.ifname, 0, sizeof(ni.ifname)); g_snprintf(ni.ifname, sizeof(ni.ifname), "nas%u", num++); @@ -552,9 +552,9 @@ adsl_cleanup(NMDeviceAdsl *self) nm_clear_g_source(&priv->nas_update_id); /* FIXME: kernel has no way of explicitly deleting the 'nasX' interface yet, - * so it gets leaked. It does get destroyed when it's no longer in use, - * but we have no control over that. - */ + * so it gets leaked. It does get destroyed when it's no longer in use, + * but we have no control over that. + */ priv->nas_ifindex = 0; nm_clear_g_free(&priv->nas_ifname); } diff --git a/src/devices/bluetooth/nm-bluez-manager.c b/src/devices/bluetooth/nm-bluez-manager.c index d79c457e8d..ccfee7438c 100644 --- a/src/devices/bluetooth/nm-bluez-manager.c +++ b/src/devices/bluetooth/nm-bluez-manager.c @@ -73,9 +73,9 @@ typedef struct { NMBluezManager *self; /* Fields name with "d_" prefix are purely cached values from BlueZ's - * ObjectManager D-Bus interface. There is no logic whatsoever about - * them. - */ + * ObjectManager D-Bus interface. There is no logic whatsoever about + * them. + */ CList process_change_lst; @@ -133,7 +133,7 @@ typedef struct { bool x_device_panu_connection_allow_create : 1; /* flag to remember last time when we checked wether the object - * was a suitable adapter that is usable to a device. */ + * was a suitable adapter that is usable to a device. */ bool was_usable_adapter_for_device_before : 1; char _object_path_intern[]; @@ -259,12 +259,12 @@ static void _dbus_call_complete_cb_nop(GObject *source_object, GAsyncResult *res, gpointer user_data) { /* we don't do anything at all. The only reason to register this - * callback is so that GDBusConnection keeps the cancellable alive - * long enough until the call completes. - * - * Note that this cancellable in turn is registered via - * nm_shutdown_wait_obj_register_*(), to block shutdown until - * we are done. */ + * callback is so that GDBusConnection keeps the cancellable alive + * long enough until the call completes. + * + * Note that this cancellable in turn is registered via + * nm_shutdown_wait_obj_register_*(), to block shutdown until + * we are done. */ } /*****************************************************************************/ @@ -693,7 +693,7 @@ _bzobjs_device_is_usable(const BzDBusObj *bzobj, usable_nap = TRUE; else if (bzobj->x_device_panu_connection_allow_create) { /* We didn't yet try to create a connection. Presume we are going to create - * it when the time comes... */ + * it when the time comes... */ usable_nap = TRUE; create_panu_connection = TRUE; } @@ -704,8 +704,8 @@ _bzobjs_device_is_usable(const BzDBusObj *bzobj, && nm_device_get_state(NM_DEVICE(bzobj->x_device.device_bt)) > NM_DEVICE_STATE_DISCONNECTED) { /* The device is still activated... the absence of a profile does not - * render it unusable (yet). But since there is no more profile, the - * device is probably about to disconnect. */ + * render it unusable (yet). But since there is no more profile, the + * device is probably about to disconnect. */ } else goto out_unusable; } @@ -732,9 +732,9 @@ _bzobjs_device_is_connected(const BzDBusObj *bzobj) return TRUE; if (bzobj->x_device.connect_dun_context) { /* As long as we have a dun-context, we consider it connected. - * - * We require NMDeviceBt to try to connect to the modem, and if that fails, - * it will disconnect. */ + * + * We require NMDeviceBt to try to connect to the modem, and if that fails, + * it will disconnect. */ return TRUE; } return FALSE; @@ -1128,8 +1128,8 @@ _network_server_vt_register_bridge(const NMBtVTableNetworkServer *vtable, bzobj = _network_server_find_available(priv, addr, NULL); if (!bzobj) { /* The device checked that a network server is available, before - * starting the activation, but for some reason it no longer is. - * Indicate that the activation should not proceed. */ + * starting the activation, but for some reason it no longer is. + * Indicate that the activation should not proceed. */ if (addr) { nm_utils_error_set(error, NM_UTILS_ERROR_UNKNOWN, @@ -1424,14 +1424,14 @@ _device_process_change(BzDBusObj *bzobj) && NM_FLAGS_HAS(bzobj->d_device_capabilities, NM_BT_CAPABILITY_NAP) && _conn_track_find_head(self, NM_BT_CAPABILITY_NAP, bzobj->d_device.address)) { /* We have a useable device and also a panu-connection. We block future attemps - * to generate a connection. */ + * to generate a connection. */ bzobj->x_device_panu_connection_allow_create = FALSE; } if (bzobj->x_device.panu_connection) { if (!NM_FLAGS_HAS(nm_settings_connection_get_flags(bzobj->x_device.panu_connection), NM_SETTINGS_CONNECTION_INT_FLAGS_NM_GENERATED)) { /* the connection that we generated earlier still exists, but it's not longer the same - * as it was when we created it. Forget about it, so that we don't delete the profile later... */ + * as it was when we created it. Forget about it, so that we don't delete the profile later... */ bzobj->x_device.panu_connection = NULL; } else { if (!device_is_usable @@ -1604,11 +1604,11 @@ _dbus_process_changes(NMBluezManager *self, BzDBusObj *bzobj, const char *log_re adapter_is_usable_for_device = _bzobjs_adapter_is_usable_for_device(bzobj); if (adapter_is_usable_for_device != bzobj->was_usable_adapter_for_device_before) { /* this function does not modify bzobj in any other cases except here. - * Usually changes are processed delayed, in the idle handler. - * - * But the bzobj->was_usable_adapter_for_device_before only exists to know whether - * we need to re-check device availability. It is correct to set the flag - * here, right before we checked. */ + * Usually changes are processed delayed, in the idle handler. + * + * But the bzobj->was_usable_adapter_for_device_before only exists to know whether + * we need to re-check device availability. It is correct to set the flag + * here, right before we checked. */ bzobj->was_usable_adapter_for_device_before = adapter_is_usable_for_device; recheck_devices_for_adapter = TRUE; changes = TRUE; @@ -1634,7 +1634,7 @@ _dbus_process_changes(NMBluezManager *self, BzDBusObj *bzobj, const char *log_re BzDBusObj * bzobj2; /* we got a change to the availability of an adapter. We might need to recheck - * all devices that use this adapter... */ + * all devices that use this adapter... */ g_hash_table_iter_init(&iter, priv->bzobjs); while (g_hash_table_iter_next(&iter, (gpointer *) &bzobj2, NULL)) { if (bzobj2 == bzobj) @@ -2432,11 +2432,11 @@ _connect_returned(NMBluezManager * self, device_name); /* we already have another over-all timer running. But after we connected the device, - * we still need to wait for bluez to acknowledge the connected state (via D-Bus, for NAP). - * For DUN profiles we likely are already fully connected by now. - * - * Anyway, schedule another timeout that is possibly shorter than the overall, original - * timeout. Now this should go down fast. */ + * we still need to wait for bluez to acknowledge the connected state (via D-Bus, for NAP). + * For DUN profiles we likely are already fully connected by now. + * + * Anyway, schedule another timeout that is possibly shorter than the overall, original + * timeout. Now this should go down fast. */ bzobj->x_device.c_req_data->timeout_wait_connect_id = g_timeout_add(5000, _connect_timeout_wait_connected_cb, bzobj), bzobj->x_device.c_req_data->device_name = g_strdup(device_name); @@ -2471,11 +2471,11 @@ _connect_dun_step2_cb(NMBluez5DunContext *context, if (rfcomm_dev) { /* We want to early notify about the rfcomm path. That is because we might still delay - * to signal full activation longer (asynchronously). But the earliest time the callback - * is invoked with the rfcomm path, we just created the device synchronously. - * - * By already notifying the caller about the path early, it avoids a race where ModemManager - * would find the modem before the bluetooth code considers the profile fully activated. */ + * to signal full activation longer (asynchronously). But the earliest time the callback + * is invoked with the rfcomm path, we just created the device synchronously. + * + * By already notifying the caller about the path early, it avoids a race where ModemManager + * would find the modem before the bluetooth code considers the profile fully activated. */ nm_assert(!error); nm_assert(bzobj->x_device.c_req_data); @@ -2489,7 +2489,7 @@ _connect_dun_step2_cb(NMBluez5DunContext *context, if (!context) { /* No context set. This means, we just got notified about the rfcomm path and need to wait - * longer, for the next callback. */ + * longer, for the next callback. */ return; } } @@ -2618,12 +2618,12 @@ _connect_disconnect(NMBluezManager *self, BzDBusObj *bzobj, const char *reason) if (bt_type == NM_BT_CAPABILITY_DUN) { /* For DUN devices, we also called org.bluez.Device1.Connect() (because in order - * for nm_bluez5_dun_connect() to succeed, we need to be already connected *why??). - * - * But upon disconnect we don't call Disconnect() because we don't know whether somebody - * else also uses the bluetooth device for other purposes. During disconnect we only - * terminate the DUN connection, but don't disconnect entirely. I think that's the - * best we can do. */ + * for nm_bluez5_dun_connect() to succeed, we need to be already connected *why??). + * + * But upon disconnect we don't call Disconnect() because we don't know whether somebody + * else also uses the bluetooth device for other purposes. During disconnect we only + * terminate the DUN connection, but don't disconnect entirely. I think that's the + * best we can do. */ #if WITH_BLUEZ5_DUN nm_clear_pointer(&bzobj->x_device.connect_dun_context, nm_bluez5_dun_disconnect); #else @@ -2858,8 +2858,8 @@ dispose(GObject *object) NMBluezManagerPrivate *priv = NM_BLUEZ_MANAGER_GET_PRIVATE(self); /* FIXME(shutdown): we need a nm_device_factory_stop() hook to first unregister all - * BzDBusObj instances and do necessary cleanup actions (like disconnecting devices - * or deleting panu_connection). */ + * BzDBusObj instances and do necessary cleanup actions (like disconnecting devices + * or deleting panu_connection). */ nm_assert(c_list_is_empty(&priv->network_server_lst_head)); nm_assert(c_list_is_empty(&priv->process_change_lst_head)); diff --git a/src/devices/bluetooth/nm-bluez5-dun.c b/src/devices/bluetooth/nm-bluez5-dun.c index 4b90f9cd82..caa4f73616 100644 --- a/src/devices/bluetooth/nm-bluez5-dun.c +++ b/src/devices/bluetooth/nm-bluez5-dun.c @@ -229,11 +229,11 @@ _connect_create_rfcomm(NMBluez5DunContext *context) errsv = NM_ERRNO_NATIVE(errno); if (errsv == EBADFD) { /* hm. We use a non-blocking socket to connect. Above getsockopt(SOL_SOCKET,SO_ERROR) indicated - * success, but still now we fail with EBADFD. I think that is a bug and we should get the - * failure during connect(). - * - * Anyway, craft a less confusing error message than - * "failed to create rfcomm device: File descriptor in bad state (77)". */ + * success, but still now we fail with EBADFD. I think that is a bug and we should get the + * failure during connect(). + * + * Anyway, craft a less confusing error message than + * "failed to create rfcomm device: File descriptor in bad state (77)". */ g_set_error(&error, NM_BT_ERROR, NM_BT_ERROR_DUN_CONNECT_FAILED, @@ -256,12 +256,12 @@ _connect_create_rfcomm(NMBluez5DunContext *context) r = _connect_open_tty(context); if (r < 0) { /* we created the rfcomm device, but cannot yet open it. That means, we are - * not yet fully connected. However, we notify the caller about "what we learned - * so far". Note that this happens synchronously. - * - * The purpose is that once we proceed synchronously, modem-manager races with - * the detection of the modem. We want to notify the caller first about the - * device name. */ + * not yet fully connected. However, we notify the caller about "what we learned + * so far". Note that this happens synchronously. + * + * The purpose is that once we proceed synchronously, modem-manager races with + * the detection of the modem. We want to notify the caller first about the + * device name. */ context->cdat->callback(NULL, context->rfcomm_tty_path, NULL, diff --git a/src/devices/bluetooth/nm-device-bt.c b/src/devices/bluetooth/nm-device-bt.c index fac18d4c7b..e5949d5671 100644 --- a/src/devices/bluetooth/nm-device-bt.c +++ b/src/devices/bluetooth/nm-device-bt.c @@ -472,8 +472,8 @@ modem_auth_requested(NMModem *modem, gpointer user_data) NMDevice *device = NM_DEVICE(user_data); /* Auth requests (PIN, PAP/CHAP passwords, etc) only get handled - * during activation. - */ + * during activation. + */ if (!nm_device_is_activating(device)) return; @@ -514,9 +514,9 @@ modem_prepare_result(NMModem *modem, gboolean success, guint i_reason, gpointer if (!success) { if (nm_device_state_reason_check(reason) == NM_DEVICE_STATE_REASON_SIM_PIN_INCORRECT) { /* If the connect failed because the SIM PIN was wrong don't allow - * the device to be auto-activated anymore, which would risk locking - * the SIM if the incorrect PIN continues to be used. - */ + * the device to be auto-activated anymore, which would risk locking + * the SIM if the incorrect PIN continues to be used. + */ nm_device_autoconnect_blocked_set(NM_DEVICE(self), NM_DEVICE_AUTOCONNECT_BLOCKED_WRONG_PIN); } @@ -541,9 +541,9 @@ device_state_changed(NMDevice * device, nm_modem_device_state_changed(priv->modem, new_state, old_state); /* Need to recheck available connections whenever MM appears or disappears, - * since the device could be both DUN and NAP capable and thus may not - * change state (which rechecks available connections) when MM comes and goes. - */ + * since the device could be both DUN and NAP capable and thus may not + * change state (which rechecks available connections) when MM comes and goes. + */ if (priv->mm_running && NM_FLAGS_HAS(priv->capabilities, NM_BT_CAPABILITY_DUN)) nm_device_recheck_available_connections(device); } @@ -611,8 +611,8 @@ modem_state_cb(NMModem *modem, int new_state_i, int old_state_i, gpointer user_d if (new_state <= NM_MODEM_STATE_DISABLING && old_state > NM_MODEM_STATE_DISABLING) { /* Will be called whenever something external to NM disables the - * modem directly through ModemManager. - */ + * modem directly through ModemManager. + */ if (nm_device_is_activating(device) || dev_state == NM_DEVICE_STATE_ACTIVATED) { nm_device_state_changed(device, NM_DEVICE_STATE_DISCONNECTED, @@ -624,7 +624,7 @@ modem_state_cb(NMModem *modem, int new_state_i, int old_state_i, gpointer user_d if (new_state < NM_MODEM_STATE_CONNECTING && old_state >= NM_MODEM_STATE_CONNECTING && dev_state >= NM_DEVICE_STATE_NEED_AUTH && dev_state <= NM_DEVICE_STATE_ACTIVATED) { /* Fail the device if the modem disconnects unexpectedly while the - * device is activating/activated. */ + * device is activating/activated. */ nm_device_state_changed(device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_MODEM_NO_CARRIER); @@ -673,8 +673,8 @@ modem_try_claim(NMDeviceBt *self, NMModem *modem) return FALSE; /* Can only accept the modem in stage1, but since the interface matched - * what we were expecting, don't let anything else claim the modem either. - */ + * what we were expecting, don't let anything else claim the modem either. + */ state = nm_device_get_state(NM_DEVICE(self)); if (state != NM_DEVICE_STATE_PREPARE) { _LOGD(LOGD_BT | LOGD_MB, @@ -779,8 +779,8 @@ connect_watch_link_cb(NMPlatform * platform, NMDeviceBtPrivate * priv; /* bluez doesn't notify us when the connection disconnects. - * Neither does NMManager (or NMDevice) tell us when the ip-ifindex goes away. - * This is horrible, and should be improved. For now, watch the link ourself... */ + * Neither does NMManager (or NMDevice) tell us when the ip-ifindex goes away. + * This is horrible, and should be improved. For now, watch the link ourself... */ if (NM_IN_SET(change_type, NM_PLATFORM_SIGNAL_CHANGED, NM_PLATFORM_SIGNAL_REMOVED)) { priv = NM_DEVICE_BT_GET_PRIVATE(self); @@ -796,7 +796,7 @@ connect_wait_modem_timeout(gpointer user_data) NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE(self); /* since this timeout is longer than the connect timeout, we must have already - * hit the connect-timeout first or being connected. */ + * hit the connect-timeout first or being connected. */ nm_assert(priv->stage1_bt_state == NM_DEVICE_STAGE_STATE_COMPLETED); priv->connect_wait_modem_id = 0; @@ -892,7 +892,7 @@ connect_bz_cb(NMBluezManager *bz_mgr, if (!priv->is_connected) { /* we got the callback from NMBluezManager with success. We actually should be - * connected and this line shouldn't be reached. */ + * connected and this line shouldn't be reached. */ nm_assert_not_reached(); _LOGE(LOGD_BT, "bluetooth is unexpectedly not in connected state"); nm_device_state_changed(NM_DEVICE(self), @@ -1043,8 +1043,8 @@ deactivate(NMDevice *device) nm_modem_deactivate(priv->modem, device); /* Since we're killing the Modem object before it'll get the - * state change signal, simulate the state change here. - */ + * state change signal, simulate the state change here. + */ nm_modem_device_state_changed(priv->modem, NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_ACTIVATED); diff --git a/src/devices/nm-acd-manager.c b/src/devices/nm-acd-manager.c index 59042ad7f3..c4389131e1 100644 --- a/src/devices/nm-acd-manager.c +++ b/src/devices/nm-acd-manager.c @@ -132,8 +132,8 @@ acd_error_to_nmerr(int error, gboolean always_fail) } /* so, @error is either zero (indicating success) or one - * of the special status codes like N_ACD_E_*. In both cases, - * return the positive value here. */ + * of the special status codes like N_ACD_E_*. In both cases, + * return the positive value here. */ if (NM_IN_SET(error, _N_ACD_E_SUCCESS, N_ACD_E_PREEMPTED, N_ACD_E_INVALID_ARGUMENT)) return error; @@ -404,8 +404,8 @@ nm_acd_manager_announce_addresses(NMAcdManager *self) if (self->state == STATE_INIT) { /* n-acd can't announce without probing, therefore let's - * start a fake probe with zero timeout and then perform - * the announcement. */ + * start a fake probe with zero timeout and then perform + * the announcement. */ g_hash_table_iter_init(&iter, self->addresses); while (g_hash_table_iter_next(&iter, NULL, (gpointer *) &info)) { if (!acd_probe_add(self, info, 0)) diff --git a/src/devices/nm-device-6lowpan.c b/src/devices/nm-device-6lowpan.c index db2c24a0cb..a71a2c9b0c 100644 --- a/src/devices/nm-device-6lowpan.c +++ b/src/devices/nm-device-6lowpan.c @@ -68,8 +68,8 @@ parent_changed_notify(NMDevice *device, ->parent_changed_notify(device, old_ifindex, old_parent, new_ifindex, new_parent); /* note that @self doesn't have to clear @parent_state_id on dispose, - * because NMDevice's dispose() will unset the parent, which in turn calls - * parent_changed_notify(). */ + * because NMDevice's dispose() will unset the parent, which in turn calls + * parent_changed_notify(). */ nm_clear_g_signal_handler(old_parent, &priv->parent_state_id); if (new_parent) { @@ -202,8 +202,8 @@ complete_connection(NMDevice * device, } /* If there's no 6LoWPAN interface, no parent, and no hardware address in the - * settings, then there's not enough information to complete the setting. - */ + * settings, then there's not enough information to complete the setting. + */ if (!nm_setting_6lowpan_get_parent(s_6lowpan) && !nm_device_match_parent_hwaddr(device, connection, TRUE)) { g_set_error_literal( diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c index b73a8f6fe9..7d95fbb939 100644 --- a/src/devices/nm-device-bond.c +++ b/src/devices/nm-device-bond.c @@ -135,10 +135,10 @@ ignore_option(NMSettingBond *s_bond, const char *option, const char *value) if (nm_streq0(option, NM_SETTING_BOND_OPTION_MIIMON)) { /* The default value for miimon, when missing in the setting, is - * 0 if arp_interval is != 0, and 100 otherwise. So, let's ignore - * miimon=0 (which means that miimon is disabled) and accept any - * other value. Adding miimon=100 does not cause any harm. - */ + * 0 if arp_interval is != 0, and 100 otherwise. So, let's ignore + * miimon=0 (which means that miimon is disabled) and accept any + * other value. Adding miimon=100 does not cause any harm. + */ defvalue = "0"; } else defvalue = nm_setting_bond_get_option_default(s_bond, option); @@ -336,8 +336,8 @@ apply_bonding_config(NMDeviceBond *self) g_return_val_if_fail(mode != NM_BOND_MODE_UNKNOWN, FALSE); /* Set mode first, as some other options (e.g. arp_interval) are valid - * only for certain modes. - */ + * only for certain modes. + */ set_bond_attr_or_default(device, s_bond, NM_SETTING_BOND_OPTION_MODE); set_bond_arp_ip_targets(device, s_bond); @@ -415,8 +415,8 @@ release_slave(NMDevice *device, NMDevice *slave, gboolean configure) if (configure) { /* When the last slave is released the bond MAC will be set to a random - * value by kernel; remember the current one and restore it afterwards. - */ + * value by kernel; remember the current one and restore it afterwards. + */ address = g_strdup(nm_device_get_hw_address(device)); if (ifindex_slave > 0) { @@ -436,9 +436,9 @@ release_slave(NMDevice *device, NMDevice *slave, gboolean configure) nm_device_hw_addr_set(device, address, "restore", FALSE); /* Kernel bonding code "closes" the slave when releasing it, (which clears - * IFF_UP), so we must bring it back up here to ensure carrier changes and - * other state is noticed by the now-released slave. - */ + * IFF_UP), so we must bring it back up here to ensure carrier changes and + * other state is noticed by the now-released slave. + */ if (ifindex_slave > 0) { if (!nm_device_bring_up(slave, TRUE, NULL)) _LOGW(LOGD_BOND, "released bond slave could not be brought up."); @@ -545,7 +545,7 @@ reapply_connection(NMDevice *device, NMConnection *con_old, NMConnection *con_ne g_return_if_fail(mode != NM_BOND_MODE_UNKNOWN); /* Below we set only the bond options that kernel allows to modify - * while keeping the bond interface up */ + * while keeping the bond interface up */ set_bond_arp_ip_targets(device, s_bond); diff --git a/src/devices/nm-device-bridge.c b/src/devices/nm-device-bridge.c index 6ee0cfd6c9..a00c009d38 100644 --- a/src/devices/nm-device-bridge.c +++ b/src/devices/nm-device-bridge.c @@ -112,8 +112,8 @@ check_connection_compatible(NMDevice *device, NMConnection *connection, GError * } /* a bluetooth NAP connection is handled by the bridge. - * - * Proceed... */ + * + * Proceed... */ } else { s_bridge = _nm_connection_check_main_setting(connection, NM_SETTING_BRIDGE_SETTING_NAME, error); @@ -472,8 +472,8 @@ commit_option(NMDevice *device, NMSetting *setting, const Option *option, gboole uval = (guint) g_value_get_uint(&val); /* zero means "unspecified" for some NM properties but isn't in the - * allowed kernel range, so reset the property to the default value. - */ + * allowed kernel range, so reset the property to the default value. + */ if (option->default_if_zero && uval == 0) { if (pspec->value_type == G_TYPE_UINT64) uval = NM_G_PARAM_SPEC_GET_DEFAULT_UINT64(pspec); @@ -482,10 +482,10 @@ commit_option(NMDevice *device, NMSetting *setting, const Option *option, gboole } /* Linux kernel bridge interfaces use 'centiseconds' for time-based values. - * In reality it's not centiseconds, but depends on HZ and USER_HZ, which - * is almost always works out to be a multiplier of 100, so we can assume - * centiseconds. See clock_t_to_jiffies(). - */ + * In reality it's not centiseconds, but depends on HZ and USER_HZ, which + * is almost always works out to be a multiplier of 100, so we can assume + * centiseconds. See clock_t_to_jiffies(). + */ if (option->user_hz_compensate) uval *= 100; @@ -762,7 +762,7 @@ bridge_set_vlan_options(NMDevice *device, NMSettingBridge *s_bridge) g_return_val_if_fail(length == ETH_ALEN, FALSE); if (nm_utils_hwaddr_matches(hwaddr, ETH_ALEN, nm_ip_addr_zero.addr_eth, ETH_ALEN)) { /* We need a non-zero MAC address to set the default pvid. - * Retry later. */ + * Retry later. */ return TRUE; } @@ -773,7 +773,7 @@ bridge_set_vlan_options(NMDevice *device, NMSettingBridge *s_bridge) return FALSE; /* Clear the default PVID so that we later can force the re-creation of - * default PVID VLANs by writing the option again. */ + * default PVID VLANs by writing the option again. */ if (!nm_platform_sysctl_master_set_option(plat, ifindex, "default_pvid", "0")) return FALSE; @@ -782,7 +782,7 @@ bridge_set_vlan_options(NMDevice *device, NMSettingBridge *s_bridge) return FALSE; /* Now set the default PVID. After this point the kernel creates - * a PVID VLAN on each port, including the bridge itself. */ + * a PVID VLAN on each port, including the bridge itself. */ pvid = nm_setting_bridge_get_vlan_default_pvid(s_bridge); if (pvid) { char value[32]; @@ -793,7 +793,7 @@ bridge_set_vlan_options(NMDevice *device, NMSettingBridge *s_bridge) } /* Create VLANs only after setting the default PVID, so that - * any PVID VLAN overrides the bridge's default PVID. */ + * any PVID VLAN overrides the bridge's default PVID. */ g_object_get(s_bridge, NM_SETTING_BRIDGE_VLANS, &vlans, NULL); plat_vlans = setting_vlans_to_platform(vlans); if (plat_vlans && !nm_platform_link_set_bridge_vlans(plat, ifindex, FALSE, plat_vlans)) @@ -964,7 +964,7 @@ enslave_slave(NMDevice *device, NMDevice *slave, NMConnection *connection, gbool plat_vlans = setting_vlans_to_platform(vlans); /* Since the link was just enslaved, there are no existing VLANs - * (except for the default one) and so there's no need to flush. */ + * (except for the default one) and so there's no need to flush. */ if (plat_vlans && !nm_platform_link_set_bridge_vlans(nm_device_get_platform(slave), @@ -1044,10 +1044,10 @@ create_and_realize(NMDevice * device, if (!hwaddr && nm_device_hw_addr_get_cloned(device, connection, FALSE, &hwaddr_cloned, NULL, NULL)) { /* FIXME: we set the MAC address when creating the interface, while the - * NMDevice is still unrealized. As we afterwards realize the device, it - * forgets the parameters for the cloned MAC address, and in stage 1 - * it might create a different MAC address. That should be fixed by - * better handling device realization. */ + * NMDevice is still unrealized. As we afterwards realize the device, it + * forgets the parameters for the cloned MAC address, and in stage 1 + * it might create a different MAC address. That should be fixed by + * better handling device realization. */ hwaddr = hwaddr_cloned; } @@ -1212,8 +1212,8 @@ match_connection(NMDeviceFactory *factory, NMConnection *connection) if (!g_type_from_name("NMBluezManager")) { /* bluetooth NAP connections are handled by bridge factory. However, - * it needs help from the bluetooth plugin, so if the plugin is not loaded, - * we claim not to support it. */ + * it needs help from the bluetooth plugin, so if the plugin is not loaded, + * we claim not to support it. */ return FALSE; } diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c index bd7c020743..ce593f620f 100644 --- a/src/devices/nm-device-ethernet.c +++ b/src/devices/nm-device-ethernet.c @@ -155,10 +155,10 @@ _update_s390_subchannels(NMDeviceEthernet *self) if (priv->subchannels) { /* only read the subchannels once. For one, we don't expect them to change - * on multiple invocations. Second, we didn't implement proper reloading. - * Proper reloading might also be complicated, because the subchannels are - * used to match on devices based on a device-spec. Thus, it's not clear - * what it means to change afterwards. */ + * on multiple invocations. Second, we didn't implement proper reloading. + * Proper reloading might also be complicated, because the subchannels are + * used to match on devices based on a device-spec. Thus, it's not clear + * what it means to change afterwards. */ return; } @@ -570,9 +570,9 @@ supplicant_lnk_timeout_cb(gpointer user_data) } /* Disconnect event during initial authentication and credentials - * ARE checked - we are likely to have wrong key. Ask the user for - * another one. - */ + * ARE checked - we are likely to have wrong key. Ask the user for + * another one. + */ if (nm_device_get_state(device) != NM_DEVICE_STATE_CONFIG) goto time_out; @@ -640,8 +640,8 @@ supplicant_iface_state_is_completed(NMDeviceEthernet *self, NMSupplicantInterfac nm_clear_g_source(&priv->supplicant.con_timeout_id); /* If this is the initial association during device activation, - * schedule the next activation stage. - */ + * schedule the next activation stage. + */ if (nm_device_get_state(NM_DEVICE(self)) == NM_DEVICE_STATE_CONFIG) { _LOGI(LOGD_DEVICE | LOGD_ETHER, "Activation: (ethernet) Stage 2 of 5 (Device Configure) successful."); @@ -764,9 +764,9 @@ handle_auth_or_fail(NMDeviceEthernet *self, NMActRequest *req, gboolean new_secr _LOGI(LOGD_DEVICE | LOGD_ETHER, "Activation: (ethernet) asking for new secrets"); /* Don't tear down supplicant if the authentication is optional - * because in case of a failure in getting new secrets we want to - * keep the supplicant alive. - */ + * because in case of a failure in getting new secrets we want to + * keep the supplicant alive. + */ if (!wired_auth_is_optional(self)) supplicant_interface_release(self); @@ -792,17 +792,17 @@ supplicant_connection_timeout_cb(gpointer user_data) priv->supplicant.con_timeout_id = 0; /* Authentication failed; either driver problems, the encryption key is - * wrong, the passwords or certificates were wrong or the Ethernet switch's - * port is not configured for 802.1x. */ + * wrong, the passwords or certificates were wrong or the Ethernet switch's + * port is not configured for 802.1x. */ _LOGW(LOGD_DEVICE | LOGD_ETHER, "Activation: (ethernet) association took too long."); req = nm_device_get_act_request(device); connection = nm_act_request_get_settings_connection(req); /* Ask for new secrets only if we've never activated this connection - * before. If we've connected before, don't bother the user with dialogs, - * just retry or fail, and if we never connect the user can fix the - * password somewhere else. */ + * before. If we've connected before, don't bother the user with dialogs, + * just retry or fail, and if we never connect the user can fix the + * password somewhere else. */ if (nm_settings_connection_get_timestamp(connection, ×tamp)) new_secrets = !timestamp; @@ -977,8 +977,8 @@ act_stage1_prepare(NMDevice *device, NMDeviceStateReason *out_failure_reason) NMSettingWired *s_wired; /* During restart of NetworkManager service we forget the original auto - * negotiation settings. When taking over a device, remember to reset - * the "default" during deactivate. */ + * negotiation settings. When taking over a device, remember to reset + * the "default" during deactivate. */ s_wired = nm_device_get_applied_setting(device, NM_TYPE_SETTING_WIRED); if (s_wired && (nm_setting_wired_get_auto_negotiate(s_wired) @@ -996,14 +996,14 @@ act_stage1_prepare(NMDevice *device, NMDeviceStateReason *out_failure_reason) link_negotiation_set(device); /* If we're re-activating a PPPoE connection a short while after - * a previous PPPoE connection was torn down, wait a bit to allow the - * remote side to handle the disconnection. Otherwise, the peer may - * get confused and fail to negotiate the new connection. (rh #1023503) - * - * FIXME(shutdown): when exiting, we also need to wait before quitting, - * at least for additional NM_SHUTDOWN_TIMEOUT_MS seconds because - * otherwise after restart the device won't work for the first seconds. - */ + * a previous PPPoE connection was torn down, wait a bit to allow the + * remote side to handle the disconnection. Otherwise, the peer may + * get confused and fail to negotiate the new connection. (rh #1023503) + * + * FIXME(shutdown): when exiting, we also need to wait before quitting, + * at least for additional NM_SHUTDOWN_TIMEOUT_MS seconds because + * otherwise after restart the device won't work for the first seconds. + */ if (priv->last_pppoe_time != 0) { gint32 delay = nm_utils_get_monotonic_timestamp_sec() - priv->last_pppoe_time; @@ -1238,8 +1238,8 @@ dcb_configure(NMDevice *device) } /* Pause again just in case the device takes the carrier down when - * setting specific DCB attributes. - */ + * setting specific DCB attributes. + */ _LOGD(LOGD_DCB, "waiting for carrier (postconfig down)"); priv->dcb_wait = DCB_WAIT_CARRIER_POSTCONFIG_DOWN; priv->dcb_timeout_id = g_timeout_add_seconds(3, dcb_carrier_timeout, device); @@ -1261,12 +1261,12 @@ dcb_enable(NMDevice *device) } /* Pause for 3 seconds after enabling DCB to let the card reconfigure - * itself. Drivers will often re-initialize internal settings which - * takes the carrier down for 2 or more seconds. During this time, - * lldpad will refuse to do anything else with the card since the carrier - * is down. But NM might get the carrier-down signal long after calling - * "dcbtool dcb on", so we have to first wait for the carrier to go down. - */ + * itself. Drivers will often re-initialize internal settings which + * takes the carrier down for 2 or more seconds. During this time, + * lldpad will refuse to do anything else with the card since the carrier + * is down. But NM might get the carrier-down signal long after calling + * "dcbtool dcb on", so we have to first wait for the carrier to go down. + */ _LOGD(LOGD_DCB, "waiting for carrier (preconfig down)"); priv->dcb_wait = DCB_WAIT_CARRIER_PRECONFIG_DOWN; priv->dcb_timeout_id = g_timeout_add_seconds(3, dcb_carrier_timeout, device); @@ -1409,8 +1409,8 @@ act_stage2_config(NMDevice *device, NMDeviceStateReason *out_failure_reason) priv->dcb_handle_carrier_changes = FALSE; /* 802.1x has to run before any IP configuration since the 802.1x auth - * process opens the port up for normal traffic. - */ + * process opens the port up for normal traffic. + */ connection_type = nm_setting_connection_get_connection_type(s_con); if (nm_streq(connection_type, NM_SETTING_WIRED_SETTING_NAME)) { NMSetting8021x *security; @@ -1585,8 +1585,8 @@ complete_connection(NMDevice * device, s_pppoe = nm_connection_get_setting_pppoe(connection); /* We can't telepathically figure out the service name or username, so if - * those weren't given, we can't complete the connection. - */ + * those weren't given, we can't complete the connection. + */ if (s_pppoe && !nm_setting_verify(NM_SETTING(s_pppoe), NULL, error)) return FALSE; @@ -1597,8 +1597,8 @@ complete_connection(NMDevice * device, } /* Default to an ethernet-only connection, but if a PPPoE setting was given - * then PPPoE should be our connection type. - */ + * then PPPoE should be our connection type. + */ nm_utils_complete_generic( nm_device_get_platform(device), connection, @@ -1646,7 +1646,7 @@ new_default_connection(NMDevice *self) return NULL; /* Create a stable UUID. The UUID is also the Network_ID for stable-privacy addr-gen-mode, - * thus when it changes we will also generate different IPv6 addresses. */ + * thus when it changes we will also generate different IPv6 addresses. */ uuid = _nm_utils_uuid_generate_from_strings("default-wired", nm_utils_machine_id_str(), defname, @@ -1729,8 +1729,8 @@ update_connection(NMDevice *device, NMConnection *connection) NULL); /* If the device reports a permanent address, use that for the MAC address - * and the current MAC, if different, is the cloned MAC. - */ + * and the current MAC, if different, is the cloned MAC. + */ perm_hw_addr = nm_device_get_permanent_hw_address_full(device, TRUE, &perm_hw_addr_is_fake); if (perm_hw_addr && !perm_hw_addr_is_fake) { g_object_set(s_wired, NM_SETTING_WIRED_MAC_ADDRESS, perm_hw_addr, NULL); diff --git a/src/devices/nm-device-factory.c b/src/devices/nm-device-factory.c index 2a2da7a506..7649bc0355 100644 --- a/src/devices/nm-device-factory.c +++ b/src/devices/nm-device-factory.c @@ -349,7 +349,7 @@ load_factories_from_dir(const char * dirname, } /* after loading glib types from the plugin, we cannot unload the library anymore. - * Make it resident. */ + * Make it resident. */ g_module_make_resident(plugin); factory = create_func(&error); diff --git a/src/devices/nm-device-factory.h b/src/devices/nm-device-factory.h index 6780ec9fec..4125d3f4cc 100644 --- a/src/devices/nm-device-factory.h +++ b/src/devices/nm-device-factory.h @@ -35,83 +35,83 @@ typedef struct { GObjectClass parent; /** - * get_supported_types: - * @factory: the #NMDeviceFactory - * @out_link_types: on return, a %NM_LINK_TYPE_NONE terminated - * list of #NMLinkType that the plugin supports - * @out_setting_types: on return, a %NULL terminated list of - * base-type #NMSetting names that the plugin can create devices for - * - * Returns the #NMLinkType and #NMSetting names that this plugin - * supports. This function MUST be implemented. - */ + * get_supported_types: + * @factory: the #NMDeviceFactory + * @out_link_types: on return, a %NM_LINK_TYPE_NONE terminated + * list of #NMLinkType that the plugin supports + * @out_setting_types: on return, a %NULL terminated list of + * base-type #NMSetting names that the plugin can create devices for + * + * Returns the #NMLinkType and #NMSetting names that this plugin + * supports. This function MUST be implemented. + */ void (*get_supported_types)(NMDeviceFactory * factory, const NMLinkType ** out_link_types, const char *const **out_setting_types); /** - * start: - * @factory: the #NMDeviceFactory - * - * Start the factory and discover any existing devices that the factory - * can manage. - */ + * start: + * @factory: the #NMDeviceFactory + * + * Start the factory and discover any existing devices that the factory + * can manage. + */ void (*start)(NMDeviceFactory *factory); /** - * match_connection: - * @connection: the #NMConnection - * - * Check if the factory supports the given connection. - */ + * match_connection: + * @connection: the #NMConnection + * + * Check if the factory supports the given connection. + */ gboolean (*match_connection)(NMDeviceFactory *factory, NMConnection *connection); /** - * get_connection_parent: - * @factory: the #NMDeviceFactory - * @connection: the #NMConnection to return the parent name for, if supported - * - * Given a connection, returns the parent interface name, parent connection - * UUID, or parent device permanent hardware address for @connection. - * - * Returns: the parent interface name, parent connection UUID, parent - * device permanent hardware address, or %NULL - */ + * get_connection_parent: + * @factory: the #NMDeviceFactory + * @connection: the #NMConnection to return the parent name for, if supported + * + * Given a connection, returns the parent interface name, parent connection + * UUID, or parent device permanent hardware address for @connection. + * + * Returns: the parent interface name, parent connection UUID, parent + * device permanent hardware address, or %NULL + */ const char *(*get_connection_parent)(NMDeviceFactory *factory, NMConnection *connection); /** - * get_connection_iface: - * @factory: the #NMDeviceFactory - * @connection: the #NMConnection to return the interface name for - * @parent_iface: optional parent interface name for virtual devices - * - * Given a connection, returns the interface name that a device activating - * that connection would have. - * - * Returns: the interface name, or %NULL - */ + * get_connection_iface: + * @factory: the #NMDeviceFactory + * @connection: the #NMConnection to return the interface name for + * @parent_iface: optional parent interface name for virtual devices + * + * Given a connection, returns the interface name that a device activating + * that connection would have. + * + * Returns: the interface name, or %NULL + */ char *(*get_connection_iface)(NMDeviceFactory *factory, NMConnection * connection, const char * parent_iface); /** - * create_device: - * @factory: the #NMDeviceFactory - * @iface: the interface name of the device - * @plink: the #NMPlatformLink if backed by a kernel device - * @connection: the #NMConnection if not backed by a kernel device - * @out_ignore: on return, %TRUE if the link should be ignored - * - * The plugin should create a new unrealized device using the details given - * by @iface and @plink or @connection. If both @iface and @plink are given, - * they are guaranteed to match. If both @iface and @connection are given, - * @iface is guaranteed to be the interface name that @connection specifies. - * - * If the plugin cannot create a #NMDevice for the link and wants the - * core to ignore it, set @out_ignore to %TRUE and return %NULL. - * - * Returns: the new unrealized #NMDevice, or %NULL - */ + * create_device: + * @factory: the #NMDeviceFactory + * @iface: the interface name of the device + * @plink: the #NMPlatformLink if backed by a kernel device + * @connection: the #NMConnection if not backed by a kernel device + * @out_ignore: on return, %TRUE if the link should be ignored + * + * The plugin should create a new unrealized device using the details given + * by @iface and @plink or @connection. If both @iface and @plink are given, + * they are guaranteed to match. If both @iface and @connection are given, + * @iface is guaranteed to be the interface name that @connection specifies. + * + * If the plugin cannot create a #NMDevice for the link and wants the + * core to ignore it, set @out_ignore to %TRUE and return %NULL. + * + * Returns: the new unrealized #NMDevice, or %NULL + */ NMDevice *(*create_device)(NMDeviceFactory * factory, const char * iface, const NMPlatformLink *plink, diff --git a/src/devices/nm-device-ip-tunnel.c b/src/devices/nm-device-ip-tunnel.c index 629c6fba49..071375a347 100644 --- a/src/devices/nm-device-ip-tunnel.c +++ b/src/devices/nm-device-ip-tunnel.c @@ -82,8 +82,8 @@ ip6tnl_flags_setting_to_plat(NMIPTunnelFlags flags) G_STATIC_ASSERT(NM_IP_TUNNEL_FLAG_IP6_USE_ORIG_FWMARK == IP6_TNL_F_USE_ORIG_FWMARK); /* NOTE: "accidentally", the numeric values correspond. - * For flags added in the future, that might no longer - * be the case. */ + * For flags added in the future, that might no longer + * be the case. */ return flags & _NM_IP_TUNNEL_FLAG_ALL_IP6TNL; } @@ -673,10 +673,10 @@ create_and_realize(NMDevice * device, if (_nm_ip_tunnel_mode_is_layer2(mode) && nm_device_hw_addr_get_cloned(device, connection, FALSE, &hwaddr, NULL, NULL) && hwaddr) { /* FIXME: we set the MAC address when creating the interface, while the - * NMDevice is still unrealized. As we afterwards realize the device, it - * forgets the parameters for the cloned MAC address, and in stage 1 - * it might create a different MAC address. That should be fixed by - * better handling device realization. */ + * NMDevice is still unrealized. As we afterwards realize the device, it + * forgets the parameters for the cloned MAC address, and in stage 1 + * it might create a different MAC address. That should be fixed by + * better handling device realization. */ if (!nm_utils_hwaddr_aton(hwaddr, mac_address, ETH_ALEN)) { g_set_error(error, NM_DEVICE_ERROR, diff --git a/src/devices/nm-device-macsec.c b/src/devices/nm-device-macsec.c index cb09c8219d..05fc599099 100644 --- a/src/devices/nm-device-macsec.c +++ b/src/devices/nm-device-macsec.c @@ -112,8 +112,8 @@ static void parent_mtu_maybe_changed(NMDevice *parent, GParamSpec *pspec, gpointer user_data) { /* the MTU of a MACsec device is limited by the parent's MTU. - * - * When the parent's MTU changes, try to re-set the MTU. */ + * + * When the parent's MTU changes, try to re-set the MTU. */ nm_device_commit_mtu(user_data); } @@ -131,8 +131,8 @@ parent_changed_notify(NMDevice *device, ->parent_changed_notify(device, old_ifindex, old_parent, new_ifindex, new_parent); /* note that @self doesn't have to clear @parent_state_id on dispose, - * because NMDevice's dispose() will unset the parent, which in turn calls - * parent_changed_notify(). */ + * because NMDevice's dispose() will unset the parent, which in turn calls + * parent_changed_notify(). */ nm_clear_g_signal_handler(old_parent, &priv->parent_state_id); nm_clear_g_signal_handler(old_parent, &priv->parent_mtu_id); @@ -358,9 +358,9 @@ supplicant_lnk_timeout_cb(gpointer user_data) } /* Disconnect event during initial authentication and credentials - * ARE checked - we are likely to have wrong key. Ask the user for - * another one. - */ + * ARE checked - we are likely to have wrong key. Ask the user for + * another one. + */ if (nm_device_get_state(dev) != NM_DEVICE_STATE_CONFIG) goto time_out; @@ -403,8 +403,8 @@ supplicant_iface_state_is_completed(NMDeviceMacsec *self, NMSupplicantInterfaceS nm_device_bring_up(NM_DEVICE(self), TRUE, NULL); /* If this is the initial association during device activation, - * schedule the next activation stage. - */ + * schedule the next activation stage. + */ if (nm_device_get_state(NM_DEVICE(self)) == NM_DEVICE_STATE_CONFIG) { _LOGI(LOGD_DEVICE, "Activation: Stage 2 of 5 (Device Configure) successful."); nm_device_activate_schedule_stage3_ip_config_start(NM_DEVICE(self)); @@ -545,8 +545,8 @@ supplicant_connection_timeout_cb(gpointer user_data) priv->supplicant.con_timeout_id = 0; /* Authentication failed; either driver problems, the encryption key is - * wrong, the passwords or certificates were wrong or the Ethernet switch's - * port is not configured for 802.1x. */ + * wrong, the passwords or certificates were wrong or the Ethernet switch's + * port is not configured for 802.1x. */ _LOGW(LOGD_DEVICE, "Activation: (macsec) association took too long."); supplicant_interface_release(self); @@ -556,9 +556,9 @@ supplicant_connection_timeout_cb(gpointer user_data) g_return_val_if_fail(connection, G_SOURCE_REMOVE); /* Ask for new secrets only if we've never activated this connection - * before. If we've connected before, don't bother the user with dialogs, - * just retry or fail, and if we never connect the user can fix the - * password somewhere else. */ + * before. If we've connected before, don't bother the user with dialogs, + * just retry or fail, and if we never connect the user can fix the + * password somewhere else. */ if (nm_settings_connection_get_timestamp(connection, ×tamp)) new_secrets = !timestamp; diff --git a/src/devices/nm-device-macvlan.c b/src/devices/nm-device-macvlan.c index 2bbbc28376..834278fbfc 100644 --- a/src/devices/nm-device-macvlan.c +++ b/src/devices/nm-device-macvlan.c @@ -125,8 +125,8 @@ static void parent_mtu_maybe_changed(NMDevice *parent, GParamSpec *pspec, gpointer user_data) { /* the MTU of a macvlan/macvtap device is limited by the parent's MTU. - * - * When the parent's MTU changes, try to re-set the MTU. */ + * + * When the parent's MTU changes, try to re-set the MTU. */ nm_device_commit_mtu(user_data); } @@ -144,8 +144,8 @@ parent_changed_notify(NMDevice *device, ->parent_changed_notify(device, old_ifindex, old_parent, new_ifindex, new_parent); /* note that @self doesn't have to clear @parent_state_id on dispose, - * because NMDevice's dispose() will unset the parent, which in turn calls - * parent_changed_notify(). */ + * because NMDevice's dispose() will unset the parent, which in turn calls + * parent_changed_notify(). */ nm_clear_g_signal_handler(old_parent, &priv->parent_state_id); nm_clear_g_signal_handler(old_parent, &priv->parent_mtu_id); @@ -401,8 +401,8 @@ complete_connection(NMDevice * device, } /* If there's no MACVLAN interface, no parent, and no hardware address in the - * settings, then there's not enough information to complete the setting. - */ + * settings, then there's not enough information to complete the setting. + */ if (!nm_setting_macvlan_get_parent(s_macvlan) && !nm_device_match_parent_hwaddr(device, connection, TRUE)) { g_set_error_literal( diff --git a/src/devices/nm-device-tun.c b/src/devices/nm-device-tun.c index 25b013db34..70f8cbfec1 100644 --- a/src/devices/nm-device-tun.c +++ b/src/devices/nm-device-tun.c @@ -169,9 +169,9 @@ update_connection(NMDevice *device, NMConnection *connection) const char * str; /* Note: since we read tun properties from sysctl for older kernels, - * we don't get proper change notifications. Make sure that all our - * tun properties are up to date at this point. We should not do this, - * if we would entirely rely on netlink events. */ + * we don't get proper change notifications. Make sure that all our + * tun properties are up to date at this point. We should not do this, + * if we would entirely rely on netlink events. */ update_properties(NM_DEVICE_TUN(device)); switch (priv->props.type) { diff --git a/src/devices/nm-device-veth.c b/src/devices/nm-device-veth.c index 1af3f0062e..de0668646a 100644 --- a/src/devices/nm-device-veth.c +++ b/src/devices/nm-device-veth.c @@ -58,9 +58,9 @@ static gboolean can_unmanaged_external_down(NMDevice *self) { /* Unless running in a container, an udev rule causes these to be - * unmanaged. If there's no udev then we're probably in a container - * and should IFF_UP and configure the veth ourselves even if we - * didn't create it. */ + * unmanaged. If there's no udev then we're probably in a container + * and should IFF_UP and configure the veth ourselves even if we + * didn't create it. */ return FALSE; } diff --git a/src/devices/nm-device-vlan.c b/src/devices/nm-device-vlan.c index c04826472b..a17e706ed9 100644 --- a/src/devices/nm-device-vlan.c +++ b/src/devices/nm-device-vlan.c @@ -75,8 +75,8 @@ static void parent_mtu_maybe_changed(NMDevice *parent, GParamSpec *pspec, gpointer user_data) { /* the MTU of a VLAN device is limited by the parent's MTU. - * - * When the parent's MTU changes, try to re-set the MTU. */ + * + * When the parent's MTU changes, try to re-set the MTU. */ nm_device_commit_mtu(user_data); } @@ -113,8 +113,8 @@ parent_hwaddr_maybe_changed(NMDevice *parent, GParamSpec *pspec, gpointer user_d nm_device_hw_addr_set(device, new_mac, "vlan-parent", TRUE); nm_device_arp_announce(device); /* When changing the hw address the interface is taken down, - * removing the IPv6 configuration; reapply it. - */ + * removing the IPv6 configuration; reapply it. + */ s_ip6 = nm_connection_get_setting_ip6_config(connection); if (s_ip6) nm_device_reactivate_ip6_config(device, s_ip6, s_ip6); @@ -135,8 +135,8 @@ parent_changed_notify(NMDevice *device, ->parent_changed_notify(device, old_ifindex, old_parent, new_ifindex, new_parent); /* note that @self doesn't have to clear @parent_state_id on dispose, - * because NMDevice's dispose() will unset the parent, which in turn calls - * parent_changed_notify(). */ + * because NMDevice's dispose() will unset the parent, which in turn calls + * parent_changed_notify(). */ nm_clear_g_signal_handler(old_parent, &priv->parent_state_id); nm_clear_g_signal_handler(old_parent, &priv->parent_hwaddr_id); nm_clear_g_signal_handler(old_parent, &priv->parent_mtu_id); @@ -412,8 +412,8 @@ complete_connection(NMDevice * device, } /* If there's no VLAN interface, no parent, and no hardware address in the - * settings, then there's not enough information to complete the setting. - */ + * settings, then there's not enough information to complete the setting. + */ if (!nm_setting_vlan_get_parent(s_vlan) && !nm_device_match_parent_hwaddr(device, connection, TRUE)) { g_set_error_literal( @@ -671,9 +671,9 @@ get_connection_iface(NMDeviceFactory *factory, NMConnection *connection, const c return g_strdup(ifname); /* If the connection doesn't specify the interface name for the VLAN - * device, we create one for it using the VLAN ID and the parent - * interface's name. - */ + * device, we create one for it using the VLAN ID and the parent + * interface's name. + */ return nm_utils_new_vlan_name(parent_iface, nm_setting_vlan_get_id(s_vlan)); } diff --git a/src/devices/nm-device-wireguard.c b/src/devices/nm-device-wireguard.c index 1da6a6f2e8..31016ac762 100644 --- a/src/devices/nm-device-wireguard.c +++ b/src/devices/nm-device-wireguard.c @@ -81,14 +81,14 @@ typedef struct { NMSockAddrUnion sockaddr; /* the timestamp (in nm_utils_get_monotonic_timestamp_nsec() scale) when we want - * to retry resolving the endpoint (again). - * - * It may be set to %NEXT_TRY_AT_NSEC_ASAP to indicate to re-resolve as soon as possible. - * - * A @sockaddr is either fixed or it has - * - @cancellable set to indicate an ongoing request - * - @next_try_at_nsec set to a positive value, indicating when - * we ought to retry. */ + * to retry resolving the endpoint (again). + * + * It may be set to %NEXT_TRY_AT_NSEC_ASAP to indicate to re-resolve as soon as possible. + * + * A @sockaddr is either fixed or it has + * - @cancellable set to indicate an ongoing request + * - @next_try_at_nsec set to a positive value, indicating when + * we ought to retry. */ gint64 next_try_at_nsec; guint resolv_fail_count; @@ -249,14 +249,14 @@ _auto_default_route_get_auto_fwmark(const char *uuid) guint64 rnd_seed; /* we use the generated number as fwmark but also as routing table for - * the default-route. - * - * We pick a number - * - * - based on the connection's UUID (as stable seed). - * - larger than 51820u (arbitrarily) - * - one out of AUTO_RANDOM_RANGE - */ + * the default-route. + * + * We pick a number + * + * - based on the connection's UUID (as stable seed). + * - larger than 51820u (arbitrarily) + * - one out of AUTO_RANDOM_RANGE + */ rnd_seed = c_siphash_hash(NM_HASH_SEED_16(0xb9, 0x39, @@ -289,12 +289,12 @@ _auto_default_route_get_auto_priority(const char *uuid) guint64 rnd_seed; /* we pick a priority for the routing rules as follows: - * - * - use the connection's UUID as stable seed for the "random" number. - * - have it smaller than RANGE_TOP (32766u - 1000u), where 32766u is the priority of the default - * rules - * - we add 2 rules (PRIO_WIDTH). Hence only pick even priorities. - * - pick one out of AUTO_RANDOM_RANGE. */ + * + * - use the connection's UUID as stable seed for the "random" number. + * - have it smaller than RANGE_TOP (32766u - 1000u), where 32766u is the priority of the default + * rules + * - we add 2 rules (PRIO_WIDTH). Hence only pick even priorities. + * - pick one out of AUTO_RANDOM_RANGE. */ rnd_seed = c_siphash_hash(NM_HASH_SEED_16(0x99, 0x22, @@ -573,9 +573,9 @@ _peers_resolve_retry_timeout(gpointer user_data) if (peer_data->ep_resolv.cancellable) { /* we are currently resolving a name. We don't need the global - * watchdog to guard this peer. No need to adjust @next for - * this one, when the currently ongoing resolving completes, we - * may reschedule. Skip. */ + * watchdog to guard this peer. No need to adjust @next for + * this one, when the currently ongoing resolving completes, we + * may reschedule. Skip. */ continue; } @@ -583,7 +583,7 @@ _peers_resolve_retry_timeout(gpointer user_data) || now >= peer_data->ep_resolv.next_try_at_nsec) { _peers_resolve_start(self, peer_data); /* same here. Now we are resolving. We don't need the global - * watchdog. Skip w.r.t. finding @next. */ + * watchdog. Skip w.r.t. finding @next. */ continue; } @@ -608,16 +608,16 @@ _peers_resolve_retry_reschedule(NMDeviceWireGuard *self, gint64 new_next_try_at_ if (priv->resolve_next_try_id && priv->resolve_next_try_at <= new_next_try_at_nsec) { /* we already have an earlier timeout scheduled (possibly for - * another peer that expires sooner). Don't reschedule now. - * Even if the scheduled timeout expires too early, we will - * compute the right next-timeout and reschedule then. */ + * another peer that expires sooner). Don't reschedule now. + * Even if the scheduled timeout expires too early, we will + * compute the right next-timeout and reschedule then. */ return; } now = nm_utils_get_monotonic_timestamp_nsec(); /* schedule at most one day ahead. No problem if we expire earlier - * than expected. Also, rate-limit to 500 msec. */ + * than expected. Also, rate-limit to 500 msec. */ interval_ms = NM_CLAMP((new_next_try_at_nsec - now) / NM_UTILS_NSEC_PER_MSEC, (gint64) 500, (gint64)(24 * 60 * 60 * 1000)); @@ -761,11 +761,11 @@ _peers_resolve_cb(GObject *source_object, GAsyncResult *res, gpointer user_data) if (sockaddr.sa.sa_family == AF_UNSPEC) { /* we failed to resolve the name. There is no need to reset the previous - * sockaddr. Either it was already AF_UNSPEC, or we had a good name - * from resolving before. In that case, we don't want to throw away - * a possibly good IP address, since WireGuard supports automatic roaming - * anyway. Either the IP address is still good (and we would wrongly - * reject it), or it isn't -- in which case it does not hurt much. */ + * sockaddr. Either it was already AF_UNSPEC, or we had a good name + * from resolving before. In that case, we don't want to throw away + * a possibly good IP address, since WireGuard supports automatic roaming + * anyway. Either the IP address is still good (and we would wrongly + * reject it), or it isn't -- in which case it does not hurt much. */ } else { if (nm_sock_addr_union_cmp(&peer_data->ep_resolv.sockaddr, &sockaddr) != 0) changed = TRUE; @@ -774,7 +774,7 @@ _peers_resolve_cb(GObject *source_object, GAsyncResult *res, gpointer user_data) if (resolv_error || peer_data->ep_resolv.sockaddr.sa.sa_family == AF_UNSPEC) { /* while it technically did not fail, something is probably odd. Retry frequently to - * resolve the name, like we would do for normal failures. */ + * resolve the name, like we would do for normal failures. */ retry_in_msec = _peers_retry_in_msec(peer_data, TRUE); _LOGT(LOGD_DEVICE, "wireguard-peer[%s]: no %sresults for endpoint \"%s\" (retry %s)", @@ -800,7 +800,7 @@ _peers_resolve_cb(GObject *source_object, GAsyncResult *res, gpointer user_data) NMDeviceWireGuardPrivate *priv = NM_DEVICE_WIREGUARD_GET_PRIVATE(self); /* schedule the job in the background, to give multiple resolve events time - * to complete. */ + * to complete. */ nm_clear_g_source(&priv->link_config_delayed_id); priv->link_config_delayed_id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE + 1, link_config_delayed_resolver_cb, @@ -822,10 +822,10 @@ _peers_resolve_start(NMDeviceWireGuard *self, PeerData *peer_data) peer_data->ep_resolv.cancellable = g_cancellable_new(); /* set a special next-try timestamp. It is positive, and indicates - * that we are in the process of trying. - * This timestamp however already lies in the past, but that is correct, - * because we are currently in the process of trying. We will determine - * a next-try timestamp once the try completes. */ + * that we are in the process of trying. + * This timestamp however already lies in the past, but that is correct, + * because we are currently in the process of trying. We will determine + * a next-try timestamp once the try completes. */ peer_data->ep_resolv.next_try_at_nsec = NEXT_TRY_AT_NSEC_PAST; host = nm_sock_addr_endpoint_get_host(_nm_wireguard_peer_get_endpoint(peer_data->peer)); @@ -907,7 +907,7 @@ _peers_update(NMDeviceWireGuard *self, if (endpoint && nm_sock_addr_endpoint_get_host(endpoint)) { if (!nm_sock_addr_endpoint_get_fixed_sockaddr(endpoint, &sockaddr)) { /* we have an endpoint, but it's not a static IP address. We need to resolve - * the names. */ + * the names. */ sockaddr_fixed = FALSE; } } @@ -1044,8 +1044,8 @@ _peers_get_platform_list(NMDeviceWireGuardPrivate * priv, *plf |= NM_PLATFORM_WIREGUARD_CHANGE_PEER_FLAG_HAS_KEEPALIVE_INTERVAL; /* if the peer has an endpoint but it is not yet resolved (not ready), - * we still configure it and leave the endpoint unspecified. Later, - * when we can resolve the endpoint, we will update. */ + * we still configure it and leave the endpoint unspecified. Later, + * when we can resolve the endpoint, we will update. */ plp->endpoint = peer_data->ep_resolv.sockaddr; if (plp->endpoint.sa.sa_family == AF_UNSPEC) { /* we don't actually ever clear endpoints, if we don't have better information. */ @@ -1089,7 +1089,7 @@ _peers_get_platform_list(NMDeviceWireGuardPrivate * priv, &addrbin, &prefix)) { /* the address is really not expected to be invalid, because then - * the connection would not verify. Anyway, silently skip it. */ + * the connection would not verify. Anyway, silently skip it. */ continue; } @@ -1338,9 +1338,9 @@ static void _dns_config_changed(NMDnsManager *dns_manager, NMDeviceWireGuard *self) { /* when the DNS configuration changes, we re-resolve the peer addresses. - * - * Possibly, we should also do that when the default-route changes, but it's - * hard to figure out when that happens. */ + * + * Possibly, we should also do that when the default-route changes, but it's + * hard to figure out when that happens. */ _peers_resolve_reresolve_all(self); } @@ -1483,7 +1483,7 @@ link_config_delayed(NMDeviceWireGuard *self, const char *reason) now = nm_utils_get_monotonic_timestamp_nsec(); if (now < priv->link_config_last_at + LINK_CONFIG_RATE_LIMIT_NSEC) { /* we ratelimit calls to link_config(), because we call this whenever a resolver - * completes. */ + * completes. */ _LOGT(LOGD_DEVICE, "wireguard link config (%s) (postponed)", reason); priv->link_config_delayed_id = g_timeout_add(NM_MAX((priv->link_config_last_at + LINK_CONFIG_RATE_LIMIT_NSEC - now) @@ -1568,27 +1568,27 @@ _get_dev2_ip_config(NMDeviceWireGuard *self, int addr_family) s_wg = NM_SETTING_WIREGUARD(nm_connection_get_setting(connection, NM_TYPE_SETTING_WIREGUARD)); /* Differences to `wg-quick`. - * - * `wg-quick` supports the "Table" setting with 3 modes: - * - * a1) "off": this is what we do with "peer-routes" disabled. - * - * a2) an explicit routing table. This is our behavior with "peer-routes" on. In this case - * we honor the "ipv4.route-table" and "ipv6.route-table" settings. One difference is that - * `wg-quick` would resolve table names from /etc/iproute2/rt_tables. Our connection profiles - * only contain table numbers, so that conversion from name to table must have happened - * before already. - * - * a3) "auto" (the default). In this case, `wg-quick` would only add the route to the - * main table, if the AllowedIP range is not yet reachable on the link. With "peer-routes" - * enabled, we don't check for that and always add the routes to the main-table - * (with 'ipv4.route-table' and 'ipv6.route-table' set to zero or RT_TABLE_MAIN (254)). - * - * Also, in "auto" mode, `wg-quick` would add special handling for /0 routes and pick - * an empty table to configure policy routing to avoid routing loops. This handling - * of routing-loops via policy routing is not yet done, and requires a separate solution - * from constructing the peer-routes here. - */ + * + * `wg-quick` supports the "Table" setting with 3 modes: + * + * a1) "off": this is what we do with "peer-routes" disabled. + * + * a2) an explicit routing table. This is our behavior with "peer-routes" on. In this case + * we honor the "ipv4.route-table" and "ipv6.route-table" settings. One difference is that + * `wg-quick` would resolve table names from /etc/iproute2/rt_tables. Our connection profiles + * only contain table numbers, so that conversion from name to table must have happened + * before already. + * + * a3) "auto" (the default). In this case, `wg-quick` would only add the route to the + * main table, if the AllowedIP range is not yet reachable on the link. With "peer-routes" + * enabled, we don't check for that and always add the routes to the main-table + * (with 'ipv4.route-table' and 'ipv6.route-table' set to zero or RT_TABLE_MAIN (254)). + * + * Also, in "auto" mode, `wg-quick` would add special handling for /0 routes and pick + * an empty table to configure policy routing to avoid routing loops. This handling + * of routing-loops via policy routing is not yet done, and requires a separate solution + * from constructing the peer-routes here. + */ if (!nm_setting_wireguard_get_peer_routes(s_wg)) return NULL; @@ -1650,9 +1650,9 @@ _get_dev2_ip_config(NMDeviceWireGuard *self, int addr_family) if (prefix == 0 && auto_default_route_enabled) { /* In auto-default-route mode, we place the default route in a table that - * has the same number as the fwmark. wg-quick does that too. If you don't - * like that, configure the rules and the default-route explicitly in the - * connection profile. */ + * has the same number as the fwmark. wg-quick does that too. If you don't + * like that, configure the rules and the default-route explicitly in the + * connection profile. */ rtable_coerced = nm_platform_route_table_coerce(priv->auto_default_route_fwmark); } @@ -1703,25 +1703,25 @@ static guint32 get_configured_mtu(NMDevice *device, NMDeviceMtuSource *out_source, gboolean *out_force) { /* When "MTU" for `wg-quick up` is unset, it calls `ip route get` for - * each configured endpoint, to determine the suitable MTU how to reach - * each endpoint. - * For `wg-quick` this works very well, because whenever the script runs it - * determines the best setting at that point in time. It's simply not concerned - * with what happens later (and it's not around anyway). - * - * NetworkManager sticks around, so the right MTU would need to be re-determined - * whenever anything relevant changes. Which basically means, to re-evaluate whenever - * something related to addresses or routing changes (which happens all the time). - * - * The correct MTU indeed depends on the MTU setting of other interfaces (or routes). - * But it's still odd, that activating/deactivating a seemingly unrelated interface - * would trigger an MTU change. It's odd to explain/document and odd to implemented - * -- despite this being the reality. - * - * For now, only support configuring an explicit MTU, or leave the setting untouched. - * The same limitation also applies to other "ip-tunnel" types, where we could use - * similar smarts for autodetecting the MTU. - */ + * each configured endpoint, to determine the suitable MTU how to reach + * each endpoint. + * For `wg-quick` this works very well, because whenever the script runs it + * determines the best setting at that point in time. It's simply not concerned + * with what happens later (and it's not around anyway). + * + * NetworkManager sticks around, so the right MTU would need to be re-determined + * whenever anything relevant changes. Which basically means, to re-evaluate whenever + * something related to addresses or routing changes (which happens all the time). + * + * The correct MTU indeed depends on the MTU setting of other interfaces (or routes). + * But it's still odd, that activating/deactivating a seemingly unrelated interface + * would trigger an MTU change. It's odd to explain/document and odd to implemented + * -- despite this being the reality. + * + * For now, only support configuring an explicit MTU, or leave the setting untouched. + * The same limitation also applies to other "ip-tunnel" types, where we could use + * similar smarts for autodetecting the MTU. + */ return nm_device_get_configured_mtu_from_connection(device, NM_TYPE_SETTING_WIREGUARD, out_source); @@ -1764,8 +1764,8 @@ can_reapply_change(NMDevice * device, { if (nm_streq(setting_name, NM_SETTING_WIREGUARD_SETTING_NAME)) { /* Most, but not all WireGuard settings can be reapplied. Whitelist. - * - * MTU cannot be reapplied. */ + * + * MTU cannot be reapplied. */ return nm_device_hash_check_invalid_keys(diffs, NM_SETTING_WIREGUARD_SETTING_NAME, error, diff --git a/src/devices/nm-device-wpan.c b/src/devices/nm-device-wpan.c index 7076405ee5..bb7f82b9d3 100644 --- a/src/devices/nm-device-wpan.c +++ b/src/devices/nm-device-wpan.c @@ -141,8 +141,8 @@ act_stage1_prepare(NMDevice *device, NMDeviceStateReason *out_failure_reason) } /* As of kernel 4.16, the 6LoWPAN devices layered on top of WPANs - * need to be DOWN as well as the WPAN device itself in order to - * modify the WPAN properties. */ + * need to be DOWN as well as the WPAN device itself in order to + * modify the WPAN properties. */ lowpan_plink = nm_platform_link_get_by_address(platform, NM_LINK_TYPE_6LOWPAN, hwaddr, hwaddr_len); if (lowpan_plink && NM_FLAGS_HAS(lowpan_plink->n_ifi_flags, IFF_UP)) { diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index ca294a3da0..1dd5953c67 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -138,8 +138,8 @@ typedef void (*AcdCallback)(NMDevice *, NMIP4Config **, gboolean); typedef enum { /* The various NML3ConfigData types that we track explicitly. Note that - * their relative order matters: higher numbers in this enum means more - * important (and during merge overwrites other settings). */ + * their relative order matters: higher numbers in this enum means more + * important (and during merge overwrites other settings). */ L3_CONFIG_DATA_TYPE_LL_4, L3_CONFIG_DATA_TYPE_AC_6, L3_CONFIG_DATA_TYPE_DHCP_4, @@ -421,11 +421,11 @@ typedef struct _NMDevicePrivate { guint32 v6_route_table; /* when carrier goes away, we give a grace period of _get_carrier_wait_ms() - * until taking action. - * - * When changing MTU, the device might take longer then that. So, whenever - * NM changes the MTU it sets @carrier_wait_until_ms to CARRIER_WAIT_TIME_AFTER_MTU_MS - * in the future. This is used to extend the grace period in this particular case. */ + * until taking action. + * + * When changing MTU, the device might take longer then that. So, whenever + * NM changes the MTU it sets @carrier_wait_until_ms to CARRIER_WAIT_TIME_AFTER_MTU_MS + * in the future. This is used to extend the grace period in this particular case. */ gint64 carrier_wait_until_ms; union { @@ -514,7 +514,7 @@ typedef struct _NMDevicePrivate { }; /* Extra device configuration, injected by the subclass of NMDevice. - * This is used for example by NMDeviceModem for WWAN configuration. */ + * This is used for example by NMDeviceModem for WWAN configuration. */ union { struct { AppliedConfig dev2_ip_config_6; @@ -634,11 +634,11 @@ typedef struct _NMDevicePrivate { guint p_max_interval; /* the current interval. If we are probing, the interval might be lower - * then the configured max interval. */ + * then the configured max interval. */ guint p_cur_interval; /* the timestamp, when we last scheduled the timer p_cur_id with current interval - * p_cur_interval. */ + * p_cur_interval. */ gint64 p_cur_basetime_ns; NMConnectivityState state; @@ -906,12 +906,12 @@ _prop_get_connection_stable_id(NMDevice * self, priv = NM_DEVICE_GET_PRIVATE(self); /* we cache the generated stable ID for the time of an activation. - * - * The reason is, that we don't want the stable-id to change as long - * as the device is active. - * - * Especially with ${RANDOM} stable-id we want to generate *one* configuration - * for each activation. */ + * + * The reason is, that we don't want the stable-id to change as long + * as the device is active. + * + * Especially with ${RANDOM} stable-id we want to generate *one* configuration + * for each activation. */ if (G_UNLIKELY(!priv->current_stable_id)) { gs_free char * default_id = NULL; gs_free char * generated = NULL; @@ -937,8 +937,8 @@ _prop_get_connection_stable_id(NMDevice * self, uuid = nm_connection_get_uuid(connection); /* the cloned-mac-address may be generated based on the stable-id. - * Thus, at this point, we can only use the permanent MAC address - * as seed. */ + * Thus, at this point, we can only use the permanent MAC address + * as seed. */ hwaddr = nm_device_get_permanent_hw_address_full(self, TRUE, &hwaddr_is_fake); stable_type = nm_utils_stable_id_parse(stable_id, @@ -1053,10 +1053,10 @@ _prop_get_ipv6_dhcp_duid(NMDevice * self, if (NM_IN_STRSET(duid, "stable-ll", "stable-llt", "stable-uuid")) { /* preferably, we would salt the checksum differently for each @duid type. We missed - * to do that initially, so most types use the DEFAULT_SALT. - * - * Implementations that are added later, should use a distinct salt instead, - * like "stable-ll"/"stable-llt" with ARPHRD_INFINIBAND below. */ + * to do that initially, so most types use the DEFAULT_SALT. + * + * Implementations that are added later, should use a distinct salt instead, + * like "stable-ll"/"stable-llt" with ARPHRD_INFINIBAND below. */ const guint32 DEFAULT_SALT = 670531087u; nm_auto_free_checksum GChecksum *sum = NULL; NMUtilsStableType stable_type; @@ -1083,10 +1083,10 @@ _prop_get_ipv6_dhcp_duid(NMDevice * self, if (NM_IN_STRSET(duid, "stable-ll", "stable-llt")) { /* for stable LL/LLT DUIDs, we still need a hardware address to detect - * the arp-type. Alternatively, we would be able to detect it based on - * other means (e.g. NMDevice type), but instead require the hardware - * address to be present. This is at least consistent with the "ll"/"llt" - * modes above. */ + * the arp-type. Alternatively, we would be able to detect it based on + * other means (e.g. NMDevice type), but instead require the hardware + * address to be present. This is at least consistent with the "ll"/"llt" + * modes above. */ if (!hwaddr) { duid_error = "missing link-layer address"; goto out_fail; @@ -1142,13 +1142,13 @@ _prop_get_ipv6_dhcp_duid(NMDevice * self, #define EPOCH_DATETIME_THREE_YEARS (356 * 24 * 3600 * 3) /* We want a variable time between the host_id timestamp and three years - * before. Let's compute the time (in seconds) from 0 to 3 years; then we'll - * subtract it from the host_id timestamp. - */ + * before. Let's compute the time (in seconds) from 0 to 3 years; then we'll + * subtract it from the host_id timestamp. + */ time = nm_utils_host_id_get_timestamp_ns() / NM_UTILS_NSEC_PER_SEC; /* don't use too old timestamps. They cannot be expressed in DUID-LLT and - * would all be truncated to zero. */ + * would all be truncated to zero. */ time = NM_MAX(time, NM_UTILS_EPOCH_DATETIME_200001010000 + EPOCH_DATETIME_THREE_YEARS); switch (arp_type) { @@ -1291,7 +1291,7 @@ _prop_get_ipvx_route_table(NMDevice *self, int addr_family) nm_assert_addr_family(addr_family); /* the route table setting affects how we sync routes. We shall - * not change it while the device is active, hence, cache it. */ + * not change it while the device is active, hence, cache it. */ if (addr_family == AF_INET) { if (priv->v4_route_table_initialized) return priv->v4_route_table; @@ -1518,8 +1518,8 @@ _prop_get_ipvx_dhcp_iaid(NMDevice * self, } /* @iaid is in native endianness. Use unaligned_read_be32() - * so that the IAID for a given MAC address is the same on - * BE and LE machines. */ + * so that the IAID for a given MAC address is the same on + * BE and LE machines. */ iaid = unaligned_read_be32(&pllink->l_address.data[pllink->l_address.len - 4]); goto out_good; } else if (nm_streq0(iaid_str, NM_IAID_PERM_MAC)) { @@ -1850,7 +1850,7 @@ _prop_get_ipv6_ip6_privacy(NMDevice *self) g_return_val_if_fail(self, NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN); /* 1.) First look at the per-connection setting. If it is not -1 (unknown), - * use it. */ + * use it. */ connection = nm_device_get_applied_connection(self); if (connection) { NMSettingIPConfig *s_ip6 = nm_connection_get_setting_ip6_config(connection); @@ -1878,10 +1878,10 @@ _prop_get_ipv6_ip6_privacy(NMDevice *self) return NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN; /* 3.) No valid default-value configured. Fallback to reading sysctl. - * - * Instead of reading static config files in /etc, just read the current sysctl value. - * This works as NM only writes to "/proc/sys/net/ipv6/conf/IFNAME/use_tempaddr", but leaves - * the "default" entry untouched. */ + * + * Instead of reading static config files in /etc, just read the current sysctl value. + * This works as NM only writes to "/proc/sys/net/ipv6/conf/IFNAME/use_tempaddr", but leaves + * the "default" entry untouched. */ ip6_privacy = nm_platform_sysctl_get_int32( nm_device_get_platform(self), NMP_SYSCTL_PATHID_ABSOLUTE("/proc/sys/net/ipv6/conf/default/use_tempaddr"), @@ -2269,12 +2269,12 @@ nm_device_is_vpn(NMDevice *self) g_return_val_if_fail(NM_IS_DEVICE(self), FALSE); /* NetworkManager currently treats VPN connections (loaded from NetworkManager VPN plugins) - * differently. Those are considered VPNs. - * However, some native device types may also be considered VPNs... - * - * We should avoid distinguishing between is-vpn and "regular" devices. Is an (unencrypted) - * IP tunnel a VPN? Is MACSec on top of an IP tunnel a VPN? - * Sometimes we differentiate, but avoid unless reasonable. */ + * differently. Those are considered VPNs. + * However, some native device types may also be considered VPNs... + * + * We should avoid distinguishing between is-vpn and "regular" devices. Is an (unencrypted) + * IP tunnel a VPN? Is MACSec on top of an IP tunnel a VPN? + * Sometimes we differentiate, but avoid unless reasonable. */ return NM_IS_DEVICE_WIREGUARD(self); } @@ -2503,8 +2503,8 @@ nm_device_sys_iface_state_set(NMDevice *self, NMDeviceSysIfaceState sys_iface_st } /* this function only sets a flag, no immediate actions are initiated. - * - * If you change this, make sure that all callers are fine with such actions. */ + * + * If you change this, make sure that all callers are fine with such actions. */ nm_assert(priv->sys_iface_state == sys_iface_state); } @@ -2657,9 +2657,9 @@ set_ipv6_token(NMDevice *self, NMUtilsIPv6IfaceId iid, const char *token_str) gint64 val; /* Setting the kernel token is not strictly necessary as the - * IPv6 address is generated in userspace. However it is - * convenient so that users can see the token with iproute - * ('ip token'). */ + * IPv6 address is generated in userspace. However it is + * convenient so that users can see the token with iproute + * ('ip token'). */ platform = nm_device_get_platform(self); ifindex = nm_device_get_ip_ifindex(self); link = nm_platform_link_get(platform, ifindex); @@ -2670,9 +2670,9 @@ set_ipv6_token(NMDevice *self, NMUtilsIPv6IfaceId iid, const char *token_str) } /* The kernel allows setting a token only when 'accept_ra' - * is 1: temporarily flip it if necessary; unfortunately - * this will also generate an additional Router Solicitation - * from kernel. */ + * is 1: temporarily flip it if necessary; unfortunately + * this will also generate an additional Router Solicitation + * from kernel. */ val = nm_device_sysctl_ip_conf_get_int_checked(self, AF_INET6, "accept_ra", @@ -2769,9 +2769,9 @@ _set_ip_state(NMDevice *self, int addr_family, NMDeviceIPState new_state) if (new_state == NM_DEVICE_IP_STATE_DONE) { /* we only set the IPx_READY flag once we reach NM_DEVICE_IP_STATE_DONE state. We don't - * ever clear it, even if we later enter NM_DEVICE_IP_STATE_FAIL state. - * - * This is not documented/guaranteed behavior, but seems to make sense for now. */ + * ever clear it, even if we later enter NM_DEVICE_IP_STATE_FAIL state. + * + * This is not documented/guaranteed behavior, but seems to make sense for now. */ _active_connection_set_state_flags(self, addr_family == AF_INET ? NM_ACTIVATION_STATE_FLAG_IP4_READY @@ -3268,7 +3268,7 @@ _stats_refresh_rate_real(guint refresh_rate_ms) if (refresh_rate_ms < STATS_REFRESH_RATE_MS_MIN) { /* you cannot set the refresh-rate arbitrarily small. E.g. - * setting to 1ms is just killing. Have a lowest number. */ + * setting to 1ms is just killing. Have a lowest number. */ return STATS_REFRESH_RATE_MS_MIN; } @@ -3306,8 +3306,8 @@ _stats_set_refresh_rate(NMDevice *self, guint refresh_rate_ms) return; /* trigger an initial refresh of the data whenever the refresh-rate changes. - * As we process the result in an idle handler with device_link_changed(), - * we don't get the result right away. */ + * As we process the result in an idle handler with device_link_changed(), + * we don't get the result right away. */ ifindex = nm_device_get_ip_ifindex(self); if (ifindex > 0) nm_platform_link_refresh(nm_device_get_platform(self), ifindex); @@ -3343,9 +3343,9 @@ get_ip_iface_identifier(NMDevice *self, NMUtilsIPv6IfaceId *out_iid) if (pllink->type == NM_LINK_TYPE_6LOWPAN) { /* If the underlying IEEE 802.15.4 device has a short address we generate - * a "pseudo 48-bit address" that's to be used in the same fashion as a - * wired Ethernet address. The mechanism is specified in Section 6. of - * RFC 4944 */ + * a "pseudo 48-bit address" that's to be used in the same fashion as a + * wired Ethernet address. The mechanism is specified in Section 6. of + * RFC 4944 */ guint16 pan_id; guint16 short_addr; @@ -3467,27 +3467,27 @@ guint32 nm_device_get_route_metric_default(NMDeviceType device_type) { /* Device 'priority' is used for the default route-metric and is based on - * the device type. The settings ipv4.route-metric and ipv6.route-metric - * can overwrite this default. - * - * For both IPv4 and IPv6 we use the same default values. - * - * The route-metric is used for the metric of the routes of device. - * This also applies to the default route. Therefore it affects also - * which device is the "best". - * - * For comparison, note that iproute2 by default adds IPv4 routes with - * metric 0, and IPv6 routes with metric 1024. The latter is the IPv6 - * "user default" in the kernel (NM_PLATFORM_ROUTE_METRIC_DEFAULT_IP6). - * In kernel, the full uint32_t range is available for route - * metrics (except for IPv6, where 0 means 1024). - */ + * the device type. The settings ipv4.route-metric and ipv6.route-metric + * can overwrite this default. + * + * For both IPv4 and IPv6 we use the same default values. + * + * The route-metric is used for the metric of the routes of device. + * This also applies to the default route. Therefore it affects also + * which device is the "best". + * + * For comparison, note that iproute2 by default adds IPv4 routes with + * metric 0, and IPv6 routes with metric 1024. The latter is the IPv6 + * "user default" in the kernel (NM_PLATFORM_ROUTE_METRIC_DEFAULT_IP6). + * In kernel, the full uint32_t range is available for route + * metrics (except for IPv6, where 0 means 1024). + */ switch (device_type) { /* 50 is also used for VPN plugins (NM_VPN_ROUTE_METRIC_DEFAULT). - * - * Note that returning 50 from this function means that this device-type is - * in some aspects a VPN. */ + * + * Note that returning 50 from this function means that this device-type is + * in some aspects a VPN. */ case NM_DEVICE_TYPE_WIREGUARD: return NM_VPN_ROUTE_METRIC_DEFAULT; @@ -3560,7 +3560,7 @@ default_route_metric_penalty_detect(NMDevice *self, int addr_family) const gboolean IS_IPv4 = (addr_family == AF_INET); /* currently we don't differentiate between IPv4 and IPv6 when detecting - * connectivity. */ + * connectivity. */ if (priv->concheck_x[IS_IPv4].state != NM_CONNECTIVITY_FULL && nm_connectivity_check_enabled(concheck_get_mgr(self))) return TRUE; @@ -3597,9 +3597,9 @@ nm_device_get_route_metric(NMDevice *self, int addr_family) s_ip = nm_connection_get_setting_ip_config(connection, addr_family); /* Slave interfaces don't have IP settings, but we may get here when - * external changes are made or when noticing IP changes when starting - * the slave connection. - */ + * external changes are made or when noticing IP changes when starting + * the slave connection. + */ if (s_ip) { route_metric = nm_setting_ip_config_get_route_metric(s_ip); if (route_metric >= 0) @@ -3608,8 +3608,8 @@ nm_device_get_route_metric(NMDevice *self, int addr_family) } /* use the current NMConfigData, which makes this configuration reloadable. - * Note that that means that the route-metric might change between SIGHUP. - * You must cache the returned value if that is a problem. */ + * Note that that means that the route-metric might change between SIGHUP. + * You must cache the returned value if that is a problem. */ property = addr_family == AF_INET ? NM_CON_DEFAULT("ipv4.route-metric") : NM_CON_DEFAULT("ipv6.route-metric"); route_metric = nm_config_data_get_connection_default_int64(NM_CONFIG_GET_DATA, @@ -3651,7 +3651,7 @@ _get_route_table_sync_mode_stateful(NMDevice *self, int addr_family) if (!all_sync_now) { /* If there's a local route switch to all-sync in order - * to properly manage the local table */ + * to properly manage the local table */ if (addr_family == AF_INET) { const NMPlatformIP4Route *route; @@ -3677,12 +3677,12 @@ _get_route_table_sync_mode_stateful(NMDevice *self, int addr_family) all_sync_eff = TRUE; else { /* When we change from all-sync to no all-sync, we do a last all-sync one - * more time. For that, we determine the effective all-state based on the - * cached/previous all-sync flag. - * - * The purpose of this is to support reapply of route-table (and thus the - * all-sync mode). If reapply toggles from all-sync to no-all-sync, we must - * sync one last time. */ + * more time. For that, we determine the effective all-state based on the + * cached/previous all-sync flag. + * + * The purpose of this is to support reapply of route-table (and thus the + * all-sync mode). If reapply toggles from all-sync to no-all-sync, we must + * sync one last time. */ if (addr_family == AF_INET) all_sync_eff = priv->v4_route_table_all_sync_before; else @@ -3730,7 +3730,7 @@ nm_device_get_type_description(NMDevice *self) g_return_val_if_fail(self != NULL, NULL); /* Beware: this function should return the same - * value as nm_device_get_type_description() in libnm. */ + * value as nm_device_get_type_description() in libnm. */ return NM_DEVICE_GET_CLASS(self)->get_type_description(self); } @@ -3743,17 +3743,17 @@ get_type_description(NMDevice *self) nm_assert(NM_IS_DEVICE(self)); /* the default implementation for the description just returns the (modified) - * class name and depends entirely on the type of self. Note that we cache the - * description in the klass itself. - * - * Also note, that as the GObject class gets inited, it inherrits the fields - * of the parent class. That means, if NMDeviceVethClass was initialized after - * NMDeviceEthernetClass already has the description cached in the class - * (because we already fetched the description for an ethernet device), - * then default_type_description will wrongly contain "ethernet". - * To avoid that, and catch the situation, also cache the klass for - * which the description was cached. If that doesn't match, it was - * inherited and we need to reset it. */ + * class name and depends entirely on the type of self. Note that we cache the + * description in the klass itself. + * + * Also note, that as the GObject class gets inited, it inherrits the fields + * of the parent class. That means, if NMDeviceVethClass was initialized after + * NMDeviceEthernetClass already has the description cached in the class + * (because we already fetched the description for an ethernet device), + * then default_type_description will wrongly contain "ethernet". + * To avoid that, and catch the situation, also cache the klass for + * which the description was cached. If that doesn't match, it was + * inherited and we need to reset it. */ klass = NM_DEVICE_GET_CLASS(self); if (G_UNLIKELY(klass->default_type_description_klass != klass)) { const char *typename; @@ -3928,7 +3928,7 @@ concheck_is_possible(NMDevice *self) return FALSE; /* we enable periodic checks for every device state (except UNKNOWN). Especially with - * unmanaged devices, it is interesting to know whether we have connectivity on that device. */ + * unmanaged devices, it is interesting to know whether we have connectivity on that device. */ if (priv->state == NM_DEVICE_STATE_UNKNOWN) return FALSE; @@ -3959,8 +3959,8 @@ concheck_periodic_schedule_do(NMDevice *self, int addr_family, gint64 now_ns) nm_assert(priv->concheck_x[IS_IPv4].p_cur_interval > 0); /* we schedule the timeout based on our current settings cur-interval and cur-basetime. - * Before calling concheck_periodic_schedule_do(), make sure that these properties are - * correct. */ + * Before calling concheck_periodic_schedule_do(), make sure that these properties are + * correct. */ expiry = priv->concheck_x[IS_IPv4].p_cur_basetime_ns + (priv->concheck_x[IS_IPv4].p_cur_interval * NM_UTILS_NSEC_PER_SEC); @@ -4005,12 +4005,12 @@ concheck_periodic_schedule_set(NMDevice *self, int addr_family, ConcheckSchedule if (!priv->concheck_x[IS_IPv4].p_cur_id) { /* we currently don't have a timeout scheduled. No need to reschedule - * another one... */ + * another one... */ if (NM_IN_SET(mode, CONCHECK_SCHEDULE_UPDATE_INTERVAL, CONCHECK_SCHEDULE_UPDATE_INTERVAL_RESTART)) { /* ... unless, we are about to start periodic checks after update-interval. - * In this case, fall through and restart the periodic checks below. */ + * In this case, fall through and restart the periodic checks below. */ mode = CONCHECK_SCHEDULE_UPDATE_INTERVAL_RESTART; } else return; @@ -4034,10 +4034,10 @@ concheck_periodic_schedule_set(NMDevice *self, int addr_family, ConcheckSchedule if (priv->concheck_x[IS_IPv4].p_cur_interval <= priv->concheck_x[IS_IPv4].p_max_interval) { /* we currently have a shorter interval set, than what we now have. Either, - * because we are probing, or because the previous max interval was shorter. - * - * Either way, the current timer is set just fine. Nothing to do, we will - * probe our way up. */ + * because we are probing, or because the previous max interval was shorter. + * + * Either way, the current timer is set just fine. Nothing to do, we will + * probe our way up. */ return; } @@ -4048,18 +4048,18 @@ concheck_periodic_schedule_set(NMDevice *self, int addr_family, ConcheckSchedule priv->concheck_x[IS_IPv4].p_cur_interval = priv->concheck_x[IS_IPv4].p_max_interval; if (cur_expiry <= now_ns) { /* Since the last time we scheduled a periodic check, already more than the - * new max_interval passed. We need to start a check right away (and - * schedule a timeout in cur-interval in the future). */ + * new max_interval passed. We need to start a check right away (and + * schedule a timeout in cur-interval in the future). */ priv->concheck_x[IS_IPv4].p_cur_basetime_ns = now_ns; if (concheck_periodic_schedule_do(self, addr_family, now_ns)) concheck_start(self, addr_family, NULL, NULL, TRUE); } else { /* we are reducing the max-interval to a shorter interval that we have currently - * scheduled (with cur_interval). - * - * However, since the last time we scheduled the check, not even the new max-interval - * expired. All we need to do, is reschedule the timer to expire sooner. The cur_basetime - * is unchanged. */ + * scheduled (with cur_interval). + * + * However, since the last time we scheduled the check, not even the new max-interval + * expired. All we need to do, is reschedule the timer to expire sooner. The cur_basetime + * is unchanged. */ concheck_periodic_schedule_do(self, addr_family, now_ns); } return; @@ -4089,16 +4089,16 @@ concheck_periodic_schedule_set(NMDevice *self, int addr_family, ConcheckSchedule } if (any_periodic_pending) { /* we reached a timeout to schedule a new periodic request, however we still - * have period requests pending that didn't complete yet. We need to bump the - * interval already. */ + * have period requests pending that didn't complete yet. We need to bump the + * interval already. */ priv->concheck_x[IS_IPv4].p_cur_interval = NM_MIN(old_interval * 2, priv->concheck_x[IS_IPv4].p_max_interval); } /* we just reached a timeout. The expected expiry (exp_expiry) should be - * pretty close to now_ns. - * - * We want to reschedule the timeout at exp_expiry (aka now) + cur_interval. */ + * pretty close to now_ns. + * + * We want to reschedule the timeout at exp_expiry (aka now) + cur_interval. */ nm_utils_get_monotonic_timestamp_nsec_cached(&now_ns); exp_expiry = priv->concheck_x[IS_IPv4].p_cur_basetime_ns + (old_interval * NM_UTILS_NSEC_PER_SEC); @@ -4111,10 +4111,10 @@ concheck_periodic_schedule_set(NMDevice *self, int addr_family, ConcheckSchedule handle = concheck_start(self, addr_family, NULL, NULL, TRUE); if (old_interval != priv->concheck_x[IS_IPv4].p_cur_interval) { /* we just bumped the interval already when scheduling this check. - * When the handle returns, don't bump a second time. - * - * But if we reach the timeout again before the handle returns (this - * code here) we will still bump the interval. */ + * When the handle returns, don't bump a second time. + * + * But if we reach the timeout again before the handle returns (this + * code here) we will still bump the interval. */ handle->is_periodic_bump_on_complete = FALSE; } } @@ -4122,7 +4122,7 @@ concheck_periodic_schedule_set(NMDevice *self, int addr_family, ConcheckSchedule } /* we just got an event that we lost connectivity (that is, concheck returned). We reset - * the interval to min/max or increase the probe interval (bump). */ + * the interval to min/max or increase the probe interval (bump). */ case CONCHECK_SCHEDULE_RETURNED_MIN: priv->concheck_x[IS_IPv4].p_cur_interval = NM_MIN(priv->concheck_x[IS_IPv4].p_max_interval, CONCHECK_P_PROBE_INTERVAL); @@ -4138,11 +4138,11 @@ concheck_periodic_schedule_set(NMDevice *self, int addr_family, ConcheckSchedule } /* we are here, because we returned from a connectivity check and adjust the current interval. - * - * But note that we calculate the new timeout based on the time when we scheduled the - * last check, instead of counting from now. The reason is that we want that the times - * when we schedule checks be at precise intervals, without including the time it took for - * the connectivity check. */ + * + * But note that we calculate the new timeout based on the time when we scheduled the + * last check, instead of counting from now. The reason is that we want that the times + * when we schedule checks be at precise intervals, without including the time it took for + * the connectivity check. */ new_expiry = priv->concheck_x[IS_IPv4].p_cur_basetime_ns + (priv->concheck_x[IS_IPv4].p_cur_interval * NM_UTILS_NSEC_PER_SEC); tdiff = NM_MAX(new_expiry - nm_utils_get_monotonic_timestamp_nsec_cached(&now_ns), 0); @@ -4172,7 +4172,7 @@ concheck_update_interval(NMDevice *self, int addr_family, gboolean check_now) if (!new_interval) { /* this will cancel any potentially pending timeout because max-interval is zero. - * But it logs a nice message... */ + * But it logs a nice message... */ concheck_periodic_schedule_do(self, addr_family, 0); /* also update the fake connectivity state. */ @@ -4203,7 +4203,7 @@ concheck_update_state(NMDevice * self, const gboolean IS_IPv4 = (addr_family == AF_INET); /* @state is a result of the connectivity check. We only expect a precise - * number of possible values. */ + * number of possible values. */ nm_assert(NM_IN_SET(state, NM_CONNECTIVITY_LIMITED, NM_CONNECTIVITY_PORTAL, @@ -4214,18 +4214,18 @@ concheck_update_state(NMDevice * self, if (state == NM_CONNECTIVITY_ERROR) { /* on error, we don't change the current connectivity state, - * except making UNKNOWN to NONE. */ + * except making UNKNOWN to NONE. */ state = priv->concheck_x[IS_IPv4].state; if (state == NM_CONNECTIVITY_UNKNOWN) state = NM_CONNECTIVITY_NONE; } else if (state == NM_CONNECTIVITY_FAKE) { /* If the connectivity check is disabled and we obtain a fake - * result, make an optimistic guess. */ + * result, make an optimistic guess. */ if (priv->state == NM_DEVICE_STATE_ACTIVATED) { /* FIXME: the fake connectivity state depends on the availability of - * a default route. However, we have no mechanism that rechecks the - * value if a device route appears/disappears after the device - * was activated. */ + * a default route. However, we have no mechanism that rechecks the + * value if a device route appears/disappears after the device + * was activated. */ if (nm_device_get_best_default_route(self, AF_UNSPEC)) state = NM_CONNECTIVITY_FULL; else @@ -4236,21 +4236,21 @@ concheck_update_state(NMDevice * self, if (priv->concheck_x[IS_IPv4].state == state) { /* we got a connectivity update, but the state didn't change. If we were probing, - * we bump the probe frequency. */ + * we bump the probe frequency. */ if (allow_periodic_bump) concheck_periodic_schedule_set(self, addr_family, CONCHECK_SCHEDULE_RETURNED_BUMP); return; } /* we need to update the probe interval before emitting signals. Emitting - * a signal might call back into NMDevice and change the probe settings. - * So, do that first. */ + * a signal might call back into NMDevice and change the probe settings. + * So, do that first. */ if (state == NM_CONNECTIVITY_FULL) { /* we reached full connectivity state. Stop probing by setting the - * interval to the max. */ + * interval to the max. */ concheck_periodic_schedule_set(self, addr_family, CONCHECK_SCHEDULE_RETURNED_MAX); } else if (priv->concheck_x[IS_IPv4].state == NM_CONNECTIVITY_FULL) { /* we are about to loose connectivity. (re)start probing by setting - * the timeout interval to the min. */ + * the timeout interval to the min. */ concheck_periodic_schedule_set(self, addr_family, CONCHECK_SCHEDULE_RETURNED_MIN); } else { if (allow_periodic_bump) @@ -4308,8 +4308,8 @@ concheck_handle_complete(NMDeviceConnectivityHandle *handle, GError *error) const gboolean IS_IPv4 = (handle->addr_family == AF_INET); /* The moment we invoke the callback, we unlink it. It signals - * that @handle is handled -- as far as the callee of callback - * is concerned. */ + * that @handle is handled -- as far as the callee of callback + * is concerned. */ c_list_unlink(&handle->concheck_lst); if (handle->c_handle) @@ -4352,8 +4352,8 @@ concheck_cb(NMConnectivity * connectivity, if (state == NM_CONNECTIVITY_CANCELLED) { /* the only place where we nm_connectivity_check_cancel(@c_handle), is - * from inside concheck_handle_complete(). This is a recursive call, - * nothing to do. */ + * from inside concheck_handle_complete(). This is a recursive call, + * nothing to do. */ _LOGT(LOGD_CONCHECK, "connectivity: [IPv%c] complete check (seq:%llu, cancelled)", nm_utils_addr_family_to_char(handle->addr_family), @@ -4380,7 +4380,7 @@ concheck_cb(NMConnectivity * connectivity, nm_connectivity_state_to_string(state)); /* find out, if there are any periodic checks pending (either whether they - * were scheduled before or after @handle. */ + * were scheduled before or after @handle. */ any_periodic_before = FALSE; any_periodic_after = FALSE; c_list_for_each_entry (other_handle, &priv->concheck_lst_head, concheck_lst) { @@ -4395,17 +4395,17 @@ concheck_cb(NMConnectivity * connectivity, } if (NM_IN_SET(state, NM_CONNECTIVITY_ERROR)) { /* the request failed. We consider this periodic check only as completed if - * this was a periodic check, and there are not checks pending (either - * before or after this one). - * - * We allow_periodic_bump, if the request failed and there are - * still other requests periodic pending. */ + * this was a periodic check, and there are not checks pending (either + * before or after this one). + * + * We allow_periodic_bump, if the request failed and there are + * still other requests periodic pending. */ allow_periodic_bump = handle->is_periodic_bump_on_complete && !any_periodic_before && !any_periodic_after; } else { /* the request succeeded. This marks the completion of a periodic check, - * if this handle was periodic, or any previously scheduled one (that - * we are going to complete below). */ + * if this handle was periodic, or any previously scheduled one (that + * we are going to complete below). */ allow_periodic_bump = handle->is_periodic_bump_on_complete || any_periodic_before; } @@ -4415,22 +4415,22 @@ concheck_cb(NMConnectivity * connectivity, handle_is_alive = FALSE; /* we might have invoked callbacks during concheck_update_state(). The caller might have - * cancelled and thus destroyed @handle. We have to check whether handle is still alive, - * by searching it in the list of alive handles. - * - * Also, we might want to complete all pending callbacks that were started before - * @handle, as they are automatically obsoleted. */ + * cancelled and thus destroyed @handle. We have to check whether handle is still alive, + * by searching it in the list of alive handles. + * + * Also, we might want to complete all pending callbacks that were started before + * @handle, as they are automatically obsoleted. */ check_handles: c_list_for_each_entry (other_handle, &priv->concheck_lst_head, concheck_lst) { if (other_handle->addr_family != handle->addr_family) continue; if (other_handle->seq >= seq) { /* it's not guaranteed that @handle is still in the list. It might already - * be canceled while invoking callbacks for a previous other_handle. - * If it is already cancelled, @handle is a dangling pointer. - * - * Since @seq is assigned uniquely and increasing, either @other_handle is - * @handle (and thus, handle is alive), or it isn't. */ + * be canceled while invoking callbacks for a previous other_handle. + * If it is already cancelled, @handle is a dangling pointer. + * + * Since @seq is assigned uniquely and increasing, either @other_handle is + * @handle (and thus, handle is alive), or it isn't. */ if (other_handle == handle) handle_is_alive = TRUE; break; @@ -4440,19 +4440,19 @@ check_handles: if (!NM_IN_SET(state, NM_CONNECTIVITY_ERROR)) { /* we also want to complete handles that were started before the current - * @handle. Their response is out-dated. */ + * @handle. Their response is out-dated. */ concheck_handle_complete(other_handle, NULL); /* we invoked callbacks, other handles might be cancelled and removed from the list. - * Need to iterate the list from the start. */ + * Need to iterate the list from the start. */ goto check_handles; } } if (!handle_is_alive) { /* We didn't find @handle in the list of alive handles. Thus, the handles - * was cancelled while we were invoking events. Nothing to do, and don't - * touch the dangling pointer. */ + * was cancelled while we were invoking events. Nothing to do, and don't + * touch the dangling pointer. */ return; } @@ -4547,7 +4547,7 @@ nm_device_check_connectivity_cancel(NMDeviceConnectivityHandle *handle) g_return_if_fail(!c_list_is_empty(&handle->concheck_lst)); /* nobody has access to periodic handles, and cannot cancel - * them externally. */ + * them externally. */ nm_assert(!handle->is_periodic); nm_utils_error_set_cancelled(&cancelled_error, FALSE, "NMDevice"); @@ -4637,8 +4637,8 @@ nm_device_master_enslave_slave(NMDevice *self, NMDevice *slave, NMConnection *co nm_device_slave_notify_enslave(info->slave, success); /* Ensure the device's hardware address is up-to-date; it often changes - * when slaves change. - */ + * when slaves change. + */ nm_device_update_hw_address(self); /* Send ARP announcements if did not yet and have addresses. */ @@ -4646,9 +4646,9 @@ nm_device_master_enslave_slave(NMDevice *self, NMDevice *slave, NMConnection *co nm_device_arp_announce(self); /* Restart IP configuration if we're waiting for slaves. Do this - * after updating the hardware address as IP config may need the - * new address. - */ + * after updating the hardware address as IP config may need the + * new address. + */ if (success) { if (priv->ip_state_4 == NM_DEVICE_IP_STATE_WAIT) nm_device_activate_stage3_ip4_start(self); @@ -4658,8 +4658,8 @@ nm_device_master_enslave_slave(NMDevice *self, NMDevice *slave, NMConnection *co } /* Since slave devices don't have their own IP configuration, - * set the MTU here. - */ + * set the MTU here. + */ _commit_mtu(slave, NM_DEVICE_GET_PRIVATE(slave)->ip_config_4); return success; @@ -4721,7 +4721,7 @@ nm_device_master_release_one_slave(NMDevice * self, nm_device_slave_notify_release(slave, reason); /* keep both alive until the end of the function. - * Transfers ownership from slave_priv->master. */ + * Transfers ownership from slave_priv->master. */ self_free = self; c_list_unlink(&info->lst_slave); @@ -4738,8 +4738,8 @@ nm_device_master_release_one_slave(NMDevice * self, } /* Ensure the device's hardware address is up-to-date; it often changes - * when slaves change. - */ + * when slaves change. + */ nm_device_update_hw_address(self); nm_device_set_unmanaged_by_flags(slave, NM_UNMANAGED_IS_SLAVE, @@ -4793,8 +4793,8 @@ set_unmanaged_external_down(NMDevice *self, gboolean only_if_unmanaged) ext_flags = is_unmanaged_external_down(self, FALSE); if (ext_flags != NM_UNMAN_FLAG_OP_SET_UNMANAGED) { /* Ensure the assume check is queued before any queued state changes - * from the transition to UNAVAILABLE. - */ + * from the transition to UNAVAILABLE. + */ nm_device_queue_recheck_assume(self); } @@ -4883,7 +4883,7 @@ carrier_changed(NMDevice *self, gboolean carrier) if (priv->state == NM_DEVICE_STATE_ACTIVATED) nm_device_update_dynamic_ip_setup(self); /* If needed, also resume IP configuration that is - * waiting for carrier. */ + * waiting for carrier. */ if (nm_device_activate_ip4_state_in_wait(self)) nm_device_activate_stage3_ip4_start(self); if (nm_device_activate_ip6_state_in_wait(self)) @@ -4893,9 +4893,9 @@ carrier_changed(NMDevice *self, gboolean carrier) /* fall-through and change state of device */ } else if (priv->is_enslaved && !carrier) { /* Slaves don't deactivate when they lose carrier; for - * bonds/teams in particular that would be actively - * counterproductive. - */ + * bonds/teams in particular that would be actively + * counterproductive. + */ return; } @@ -4906,16 +4906,16 @@ carrier_changed(NMDevice *self, gboolean carrier) NM_DEVICE_STATE_REASON_CARRIER); } else if (priv->state == NM_DEVICE_STATE_DISCONNECTED) { /* If the device is already in DISCONNECTED state without a carrier - * (probably because it is tagged for carrier ignore) ensure that - * when the carrier appears, auto connections are rechecked for - * the device. - */ + * (probably because it is tagged for carrier ignore) ensure that + * when the carrier appears, auto connections are rechecked for + * the device. + */ nm_device_emit_recheck_auto_activate(self); } else if (priv->state == NM_DEVICE_STATE_ACTIVATED) { /* If the device is active without a carrier (probably because it is - * tagged for carrier ignore) ensure that when the carrier appears we - * renew DHCP leases and such. - */ + * tagged for carrier ignore) ensure that when the carrier appears we + * renew DHCP leases and such. + */ nm_device_update_dynamic_ip_setup(self); } } else { @@ -5064,7 +5064,7 @@ device_recheck_slave_status(NMDevice *self, const NMPlatformLink *plink) if (priv->master) { if (plink->master > 0 && plink->master == nm_device_get_ifindex(priv->master)) { /* call add-slave again. We expect @self already to be added to - * the master, but this also triggers a recheck-assume. */ + * the master, but this also triggers a recheck-assume. */ nm_device_master_add_slave(priv->master, self, FALSE); return; } @@ -5124,10 +5124,10 @@ ndisc_set_router_config(NMNDisc *ndisc, NMDevice *self) continue; /* resolve the timestamps relative to a new base. - * - * Note that for convenience, platform @addr might have timestamp and/or - * lifetime unset. We don't allow that flexibility for ndisc and require - * well defined timestamps. */ + * + * Note that for convenience, platform @addr might have timestamp and/or + * lifetime unset. We don't allow that flexibility for ndisc and require + * well defined timestamps. */ if (addr->timestamp) { nm_assert(addr->timestamp < G_MAXINT32); base = addr->timestamp; @@ -5290,8 +5290,8 @@ device_link_changed(NMDevice *self) nm_device_recheck_available_connections(self); /* Let any connections that use the new interface name have a chance - * to auto-activate on the device. - */ + * to auto-activate on the device. + */ nm_device_emit_recheck_auto_activate(self); } @@ -5325,16 +5325,16 @@ device_link_changed(NMDevice *self) reason = NM_DEVICE_STATE_REASON_NOW_MANAGED; /* If the device is a external-down candidated but no longer has external - * down set, we must clear the platform-unmanaged flag with reason - * "assumed". */ + * down set, we must clear the platform-unmanaged flag with reason + * "assumed". */ if (nm_device_get_unmanaged_mask(self, NM_UNMANAGED_EXTERNAL_DOWN) && !nm_device_get_unmanaged_flags(self, NM_UNMANAGED_EXTERNAL_DOWN)) { /* actually, user-udev overwrites external-down. So we only assume the device, - * when it is a external-down candidate, which is not managed via udev. */ + * when it is a external-down candidate, which is not managed via udev. */ if (!nm_device_get_unmanaged_mask(self, NM_UNMANAGED_USER_UDEV)) { /* Ensure the assume check is queued before any queued state changes - * from the transition to UNAVAILABLE. - */ + * from the transition to UNAVAILABLE. + */ nm_device_queue_recheck_assume(self); reason = NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED; } @@ -5349,7 +5349,7 @@ device_link_changed(NMDevice *self) if (priv->up && (!was_up || seen_down)) { /* the link was down and just came up. That happens for example, while changing MTU. - * We must restore IP configuration. */ + * We must restore IP configuration. */ if (NM_IN_SET(priv->ip_state_4, NM_DEVICE_IP_STATE_CONF, NM_DEVICE_IP_STATE_DONE)) { if (!ip_config_merge_and_apply(self, AF_INET, TRUE)) _LOGW(LOGD_IP4, "failed applying IP4 config after link comes up again"); @@ -5367,10 +5367,10 @@ device_link_changed(NMDevice *self) if (got_hw_addr && !priv->up && nm_device_get_state(self) == NM_DEVICE_STATE_UNAVAILABLE) { /* - * If the device is UNAVAILABLE, any previous try to - * bring it up probably has failed because of the - * invalid hardware address; try again. - */ + * If the device is UNAVAILABLE, any previous try to + * bring it up probably has failed because of the + * invalid hardware address; try again. + */ nm_device_bring_up(self, TRUE, NULL); nm_device_queue_recheck_available(self, NM_DEVICE_STATE_REASON_NONE, @@ -5781,23 +5781,23 @@ sriov_op_queue(NMDevice * self, SriovOp *op; /* We usually never want to cancel an async write operation, unless it's superseded - * by a newer operation (that resets the state). That is, because we need to ensure - * that we never end up doing two concurrent writes (since we write on a background - * thread, that would be unordered/racy). - * Of course, since we queue requests only per-device, when devices get renamed we - * might end up writing the same sysctl concurrently still. But that's really - * unlikely, and don't rename after udev completes! - * - * The "next" operation is not yet even started. It can be replaced/canceled right away - * when a newer request comes. - * The "pending" operation is currently ongoing, and we may cancel it if - * we have a follow-up operation (queued in "next"). Unless we have a such - * a newer request, we cannot cancel it! - * - * FIXME(shutdown): However, during shutdown we don't have a follow-up write request to cancel - * this operation and we have to give it at least some time to complete. The solution is that - * we register a way to abort the last call during shutdown, and after NM_SHUTDOWN_TIMEOUT_MS - * grace period we pull the plug and cancel it. */ + * by a newer operation (that resets the state). That is, because we need to ensure + * that we never end up doing two concurrent writes (since we write on a background + * thread, that would be unordered/racy). + * Of course, since we queue requests only per-device, when devices get renamed we + * might end up writing the same sysctl concurrently still. But that's really + * unlikely, and don't rename after udev completes! + * + * The "next" operation is not yet even started. It can be replaced/canceled right away + * when a newer request comes. + * The "pending" operation is currently ongoing, and we may cancel it if + * we have a follow-up operation (queued in "next"). Unless we have a such + * a newer request, we cannot cancel it! + * + * FIXME(shutdown): However, during shutdown we don't have a follow-up write request to cancel + * this operation and we have to give it at least some time to complete. The solution is that + * we register a way to abort the last call during shutdown, and after NM_SHUTDOWN_TIMEOUT_MS + * grace period we pull the plug and cancel it. */ op = g_slice_new(SriovOp); *op = (SriovOp){ @@ -5847,7 +5847,7 @@ static void realize_start_notify(NMDevice *self, const NMPlatformLink *pllink) { /* the default implementation of realize_start_notify() just calls - * link_changed() -- which by default does nothing. */ + * link_changed() -- which by default does nothing. */ NM_DEVICE_GET_CLASS(self)->link_changed(self, pllink); } @@ -5888,7 +5888,7 @@ realize_start_setup(NMDevice * self, gboolean unmanaged; /* plink is a NMPlatformLink type, however, we require it to come from the platform - * cache (where else would it come from?). */ + * cache (where else would it come from?). */ nm_assert(!plink || NMP_OBJECT_GET_TYPE(NMP_OBJECT_UP_CAST(plink)) == NMP_OBJECT_TYPE_LINK); g_return_if_fail(NM_IS_DEVICE(self)); @@ -5998,14 +5998,14 @@ realize_start_setup(NMDevice * self, nm_device_set_unmanaged_flags(self, NM_UNMANAGED_USER_EXPLICIT, unmanaged_user_explicit); /* Do not manage externally created software devices until they are IFF_UP - * or have IP addressing */ + * or have IP addressing */ nm_device_set_unmanaged_flags(self, NM_UNMANAGED_EXTERNAL_DOWN, is_unmanaged_external_down(self, TRUE)); /* Unmanaged the loopback device with an explicit NM_UNMANAGED_BY_TYPE flag. - * Later we might want to manage 'lo' too. Currently, that doesn't work because - * NetworkManager might down the interface or remove the 127.0.0.1 address. */ + * Later we might want to manage 'lo' too. Currently, that doesn't work because + * NetworkManager might down the interface or remove the 127.0.0.1 address. */ nm_device_set_unmanaged_flags(self, NM_UNMANAGED_BY_TYPE, is_loopback(self)); nm_device_set_unmanaged_by_user_udev(self); @@ -6056,8 +6056,8 @@ static void unrealize_notify(NMDevice *self) { /* Stub implementation for unrealize_notify(). It does nothing, - * but allows derived classes to uniformly invoke the parent - * implementation. */ + * but allows derived classes to uniformly invoke the parent + * implementation. */ } static gboolean @@ -6229,8 +6229,8 @@ nm_device_notify_availability_maybe_changed(NMDevice *self) return; /* A device could have stayed disconnected because it would - * want to register with a network server that now become - * available. */ + * want to register with a network server that now become + * available. */ nm_device_recheck_available_connections(self); if (g_hash_table_size(priv->available_connections) > 0) nm_device_emit_recheck_auto_activate(self); @@ -6378,11 +6378,11 @@ nm_device_master_add_slave(NMDevice *self, NMDevice *slave, gboolean configure) _active_connection_set_state_flags(self, NM_ACTIVATION_STATE_FLAG_MASTER_HAS_SLAVES); /* no need to emit - * - * _notify (slave, PROP_MASTER); - * - * because slave_priv->is_enslaved is not true, thus the value - * didn't change yet. */ + * + * _notify (slave, PROP_MASTER); + * + * because slave_priv->is_enslaved is not true, thus the value + * didn't change yet. */ g_warn_if_fail(!NM_FLAGS_HAS(slave_priv->unmanaged_mask, NM_UNMANAGED_IS_SLAVE)); nm_device_set_unmanaged_by_flags(slave, @@ -6432,10 +6432,10 @@ nm_device_master_check_slave_physical_port(NMDevice *self, NMDevice *slave, NMLo nm_device_get_ip_iface(slave), nm_device_get_ip_iface(info->slave)); /* Since this function will get called for every slave, we only have - * to warn about the first match we find; if there are other matches - * later in the list, we will have already warned about them matching - * @existing earlier. - */ + * to warn about the first match we find; if there are other matches + * later in the list, we will have already warned about them matching + * @existing earlier. + */ return; } } @@ -6537,7 +6537,7 @@ check_ip_state(NMDevice *self, gboolean may_fail, gboolean full_state_update) return; /* Don't progress into IP_CHECK or SECONDARIES if we're waiting for the - * master to enslave us. */ + * master to enslave us. */ if (nm_active_connection_get_master(NM_ACTIVE_CONNECTION(priv->act_request.obj)) && !priv->is_enslaved) return; @@ -6566,17 +6566,17 @@ check_ip_state(NMDevice *self, gboolean may_fail, gboolean full_state_update) && (priv->ip_state_6 == NM_DEVICE_IP_STATE_FAIL || (ip6_disabled && priv->ip_state_6 == NM_DEVICE_IP_STATE_DONE))) { /* Either both methods failed, or only one failed and the other is - * disabled */ + * disabled */ if (nm_device_sys_iface_state_is_external_or_assume(self)) { /* We have assumed configuration, but couldn't redo it. No problem, - * move to check state. */ + * move to check state. */ _set_ip_state(self, AF_INET, NM_DEVICE_IP_STATE_DONE); _set_ip_state(self, AF_INET6, NM_DEVICE_IP_STATE_DONE); state = NM_DEVICE_STATE_IP_CHECK; } else if (may_fail && get_ip_config_may_fail(self, AF_INET) && get_ip_config_may_fail(self, AF_INET6)) { /* Couldn't start either IPv6 and IPv4 autoconfiguration, - * but both are allowed to fail. */ + * but both are allowed to fail. */ state = NM_DEVICE_STATE_SECONDARIES; } else { /* Autoconfiguration attempted without success. */ @@ -6721,7 +6721,7 @@ nm_device_removed(NMDevice *self, gboolean unconfigure_ip_config) priv = NM_DEVICE_GET_PRIVATE(self); if (priv->master) { /* this is called when something externally messes with the slave or during shut-down. - * Release the slave from master, but don't touch the device. */ + * Release the slave from master, but don't touch the device. */ nm_device_master_release_one_slave(priv->master, self, FALSE, @@ -6919,11 +6919,11 @@ nm_device_autoconnect_allowed(NMDevice *self) return FALSE; /* The 'autoconnect-allowed' signal is emitted on a device to allow - * other listeners to block autoconnect on the device if they wish. - * This is mainly used by the OLPC Mesh devices to block autoconnect - * on their companion Wi-Fi device as they share radio resources and - * cannot be connected at the same time. - */ + * other listeners to block autoconnect on the device if they wish. + * This is mainly used by the OLPC Mesh devices to block autoconnect + * on their companion Wi-Fi device as they share radio resources and + * cannot be connected at the same time. + */ g_value_init(&instance, G_TYPE_OBJECT); g_value_set_object(&instance, self); @@ -6932,7 +6932,7 @@ nm_device_autoconnect_allowed(NMDevice *self) g_value_set_boolean(&retval, TRUE); /* Use g_signal_emitv() rather than g_signal_emit() to avoid the return - * value being changed if no handlers are connected */ + * value being changed if no handlers are connected */ g_signal_emitv(&instance, signals[AUTOCONNECT_ALLOWED], 0, &retval); g_value_unset(&instance); @@ -6971,12 +6971,12 @@ nm_device_can_auto_connect(NMDevice *self, NMSettingsConnection *sett_conn, char g_return_val_if_fail(!specific_object || !*specific_object, FALSE); /* the caller must ensure that nm_device_autoconnect_allowed() returns - * TRUE as well. This is done, because nm_device_can_auto_connect() - * has only one caller, and it iterates over a list of available - * connections. - * - * Hence, we don't need to re-check nm_device_autoconnect_allowed() - * over and over again. The caller is supposed to do that. */ + * TRUE as well. This is done, because nm_device_can_auto_connect() + * has only one caller, and it iterates over a list of available + * connections. + * + * Hence, we don't need to re-check nm_device_autoconnect_allowed() + * over and over again. The caller is supposed to do that. */ nm_assert(nm_device_autoconnect_allowed(self)); if (!nm_device_check_connection_available(self, @@ -7192,8 +7192,8 @@ nm_device_generate_connection(NMDevice *self, } /* Ignore the connection if it has no IP configuration, - * no slave configuration, and is not a master interface. - */ + * no slave configuration, and is not a master interface. + */ ip4_method = nm_utils_get_ip_config_method(connection, AF_INET); ip6_method = nm_utils_get_ip_config_method(connection, AF_INET6); if (nm_streq0(ip4_method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) @@ -7212,8 +7212,8 @@ nm_device_generate_connection(NMDevice *self, } /* Ignore any IPv6LL-only, not master connections without slaves, - * unless they are in the assume-ipv6ll-only list. - */ + * unless they are in the assume-ipv6ll-only list. + */ if (nm_streq0(ip4_method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) && nm_streq0(ip6_method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL) && !nm_setting_connection_get_master(NM_SETTING_CONNECTION(s_con)) @@ -7290,9 +7290,9 @@ nm_device_match_parent(NMDevice *self, const char *parent) NMConnection *connection; /* If the parent is a UUID, the connection matches when there is - * no connection active on the device or when a connection with - * that UUID is active. - */ + * no connection active on the device or when a connection with + * that UUID is active. + */ connection = nm_device_get_applied_connection(parent_device); if (connection && !nm_streq0(parent, nm_connection_get_uuid(connection))) return FALSE; @@ -7349,8 +7349,8 @@ check_connection_compatible(NMDevice *self, NMConnection *connection, GError **e return FALSE; } else if (klass->check_connection_compatible == check_connection_compatible) { /* the device class does not implement check_connection_compatible nor set - * connection_type_check_compatible. That means, it is by default not compatible - * with any connection type. */ + * connection_type_check_compatible. That means, it is by default not compatible + * with any connection type. */ nm_utils_error_set_literal(error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_INCOMPATIBLE, "device does not support any connections"); @@ -7360,8 +7360,8 @@ check_connection_compatible(NMDevice *self, NMConnection *connection, GError **e conn_iface = nm_manager_get_connection_iface(NM_MANAGER_GET, connection, NULL, NULL, &local); /* We always need a interface name for virtual devices, but for - * physical ones a connection without interface name is fine for - * any device. */ + * physical ones a connection without interface name is fine for + * any device. */ if (!conn_iface) { if (nm_connection_is_virtual(connection)) { nm_utils_error_set(error, @@ -7495,15 +7495,15 @@ unmanaged_on_quit(NMDevice *self) NMConnection *connection; /* NMDeviceWifi overwrites this function to always unmanage wifi devices. - * - * For all other types, if the device type can assume connections, we leave - * it up on quit. - * - * Originally, we would only keep devices up that can be assumed afterwards. - * However, that meant we unmanged layer-2 only devices. So, this was step - * by step refined to unmanage less (commit 25aaaab3, rh#1311988, rh#1333983). - * But there are more scenarios where we also want to keep the device up - * (rh#1378418, rh#1371126). */ + * + * For all other types, if the device type can assume connections, we leave + * it up on quit. + * + * Originally, we would only keep devices up that can be assumed afterwards. + * However, that meant we unmanged layer-2 only devices. So, this was step + * by step refined to unmanage less (commit 25aaaab3, rh#1311988, rh#1333983). + * But there are more scenarios where we also want to keep the device up + * (rh#1378418, rh#1371126). */ if (!nm_device_can_assume_connections(self)) return TRUE; @@ -8027,10 +8027,10 @@ activate_stage1_device_prepare(NMDevice *self) } /* When changing the number of VFs the kernel can block - * for very long time in the write to sysfs, especially - * if autoprobe-drivers is enabled. Do it asynchronously - * to avoid blocking the entire NM process. - */ + * for very long time in the write to sysfs, especially + * if autoprobe-drivers is enabled. Do it asynchronously + * to avoid blocking the entire NM process. + */ sriov_op_queue(self, nm_setting_sriov_get_total_vfs(s_sriov), autoprobe, @@ -8221,8 +8221,8 @@ _routing_rules_sync(NMDevice *self, NMTernary set_mode) nm_ip_routing_rule_to_platform(rule, &plrule); /* We track this rule, but we also make it explicitly not weakly-tracked - * (meaning to untrack NMP_RULES_MANAGER_EXTERN_WEAKLY_TRACKED_USER_TAG at - * the same time). */ + * (meaning to untrack NMP_RULES_MANAGER_EXTERN_WEAKLY_TRACKED_USER_TAG at + * the same time). */ nmp_rules_manager_track(rules_manager, &plrule, 10, @@ -8254,18 +8254,18 @@ _routing_rules_sync(NMDevice *self, NMTernary set_mode) keep_deleted_rules = FALSE; if (set_mode == NM_TERNARY_DEFAULT) { /* when exiting NM, we leave the device up and the rules configured. - * We just all nmp_rules_manager_sync() to forget about the synced rules, - * but we don't actually delete them. - * - * FIXME: that is a problem after restart of NetworkManager, because these - * rules will look like externally added, and NM will no longer remove - * them. - * To fix that, we could during "assume" mark the rules of the profile - * as owned (and "added" by the device). The problem with that is that it - * wouldn't cover rules that devices add by internal decision (not because - * of a setting in the profile, e.g. WireGuard could setup policy routing). - * Maybe it would be better to remember these orphaned rules at exit in a - * file and track them after restart again. */ + * We just all nmp_rules_manager_sync() to forget about the synced rules, + * but we don't actually delete them. + * + * FIXME: that is a problem after restart of NetworkManager, because these + * rules will look like externally added, and NM will no longer remove + * them. + * To fix that, we could during "assume" mark the rules of the profile + * as owned (and "added" by the device). The problem with that is that it + * wouldn't cover rules that devices add by internal decision (not because + * of a setting in the profile, e.g. WireGuard could setup policy routing). + * Maybe it would be better to remember these orphaned rules at exit in a + * file and track them after restart again. */ keep_deleted_rules = TRUE; } nmp_rules_manager_sync(rules_manager, keep_deleted_rules); @@ -8850,7 +8850,7 @@ ip_config_merge_and_apply(NMDevice *self, int addr_family, gboolean commit) ignore_auto_dns = nm_setting_ip_config_get_ignore_auto_dns(s_ip); /* if the connection has an explicit gateway, we also ignore - * the default routes from other sources. */ + * the default routes from other sources. */ ignore_default_routes = nm_setting_ip_config_get_never_default(s_ip) || nm_setting_ip_config_get_gateway(s_ip); @@ -8962,8 +8962,8 @@ ip_config_merge_and_apply(NMDevice *self, int addr_family, gboolean commit) 0); /* Merge WWAN config *last* to ensure modem-given settings overwrite - * any external stuff set by pppd or other scripts. - */ + * any external stuff set by pppd or other scripts. + */ config = applied_config_get_current(&priv->dev2_ip_config_x[IS_IPv4]); if (config) { nm_ip_config_merge(composite, @@ -8989,7 +8989,7 @@ ip_config_merge_and_apply(NMDevice *self, int addr_family, gboolean commit) } /* Merge user overrides into the composite config. For assumed connections, - * con_ip_config_x is empty. */ + * con_ip_config_x is empty. */ if (priv->con_ip_config_x[IS_IPv4]) { nm_ip_config_merge(composite, priv->con_ip_config_x[IS_IPv4], @@ -9060,9 +9060,9 @@ dhcp4_lease_change(NMDevice *self, NMIP4Config *config, gboolean bound) } /* TODO: we should perform DAD again whenever we obtain a - * new lease after an expiry. But what should we do if - * a duplicate address is detected? Fail the connection; - * restart DHCP; continue without an address? */ + * new lease after an expiry. But what should we do if + * a duplicate address is detected? Fail the connection; + * restart DHCP; continue without an address? */ if (bound && !nm_dhcp_client_accept(priv->dhcp_data_4.client, &error)) { _LOGW(LOGD_DHCP4, "error accepting lease: %s", error->message); return FALSE; @@ -9112,15 +9112,15 @@ dhcp_grace_period_start(NMDevice *self, int addr_family) guint32 timeout; /* In any other case (expired lease, assumed connection, etc.), - * wait for some time before failing the IP method. - */ + * wait for some time before failing the IP method. + */ if (priv->dhcp_data_x[IS_IPv4].grace_pending) { /* already pending. */ return FALSE; } /* Start a grace period equal to the DHCP timeout multiplied - * by a constant factor. */ + * by a constant factor. */ timeout = _prop_get_ipvx_dhcp_timeout(self, addr_family); if (timeout == NM_DHCP_TIMEOUT_INFINITY) _LOGI(LOGD_DHCP_from_addr_family(addr_family), @@ -9160,18 +9160,18 @@ dhcp4_fail(NMDevice *self, NMDhcpState dhcp_state) goto clear_config; /* ... and also if there are static addresses configured - * on the interface. - */ + * on the interface. + */ if (priv->ip_state_4 == NM_DEVICE_IP_STATE_DONE && priv->con_ip_config_4 && nm_ip4_config_get_num_addresses(priv->con_ip_config_4) > 0) goto clear_config; /* Fail the method when one of the following is true: - * 1) the DHCP client terminated: it does not make sense to start a grace - * period without a client running; - * 2) we failed to get an initial lease AND the client was - * not active before. - */ + * 1) the DHCP client terminated: it does not make sense to start a grace + * period without a client running; + * 2) we failed to get an initial lease AND the client was + * not active before. + */ if (dhcp_state == NM_DHCP_STATE_TERMINATED || (!priv->dhcp_data_4.was_active && priv->ip_state_4 == NM_DEVICE_IP_STATE_CONF)) { nm_device_activate_schedule_ip_config_timeout(self, AF_INET); @@ -9235,8 +9235,8 @@ dhcp4_state_changed(NMDhcpClient *client, priv->dhcp_data_4.grace_pending = FALSE; /* After some failures, we have been able to renew the lease: - * update the ip state - */ + * update the ip state + */ if (priv->ip_state_4 == NM_DEVICE_IP_STATE_FAIL) _set_ip_state(self, AF_INET, NM_DEVICE_IP_STATE_CONF); @@ -9459,7 +9459,7 @@ connection_requires_carrier(NMConnection *connection) gboolean ip4_used = FALSE, ip6_used = FALSE; /* We can progress to IP_CONFIG now, so that we're enslaved. - * That may actually cause carrier to go up and thus continue activation. */ + * That may actually cause carrier to go up and thus continue activation. */ s_con = nm_connection_get_setting_connection(connection); if (nm_setting_connection_get_master(s_con)) return FALSE; @@ -9467,8 +9467,8 @@ connection_requires_carrier(NMConnection *connection) ip4_carrier_wanted = connection_ip_method_requires_carrier(connection, AF_INET, &ip4_used); if (ip4_carrier_wanted) { /* If IPv4 wants a carrier and cannot fail, the whole connection - * requires a carrier regardless of the IPv6 method. - */ + * requires a carrier regardless of the IPv6 method. + */ s_ip4 = nm_connection_get_setting_ip4_config(connection); if (s_ip4 && !nm_setting_ip_config_get_may_fail(s_ip4)) return TRUE; @@ -9477,16 +9477,16 @@ connection_requires_carrier(NMConnection *connection) ip6_carrier_wanted = connection_ip_method_requires_carrier(connection, AF_INET6, &ip6_used); if (ip6_carrier_wanted) { /* If IPv6 wants a carrier and cannot fail, the whole connection - * requires a carrier regardless of the IPv4 method. - */ + * requires a carrier regardless of the IPv4 method. + */ s_ip6 = nm_connection_get_setting_ip6_config(connection); if (s_ip6 && !nm_setting_ip_config_get_may_fail(s_ip6)) return TRUE; } /* If an IP version wants a carrier and the other IP version isn't - * used, the connection requires carrier since it will just fail without one. - */ + * used, the connection requires carrier since it will just fail without one. + */ if (ip4_carrier_wanted && !ip6_used) return TRUE; if (ip6_carrier_wanted && !ip4_used) @@ -9504,9 +9504,9 @@ have_any_ready_slaves(NMDevice *self) CList * iter; /* Any enslaved slave is "ready" in the generic case as it's - * at least >= NM_DEVCIE_STATE_IP_CONFIG and has had Layer 2 - * properties set up. - */ + * at least >= NM_DEVCIE_STATE_IP_CONFIG and has had Layer 2 + * properties set up. + */ c_list_for_each (iter, &priv->slaves) { info = c_list_entry(iter, SlaveInfo, lst_slave); if (NM_DEVICE_GET_PRIVATE(info->slave)->is_enslaved) @@ -9594,18 +9594,18 @@ dhcp6_fail(NMDevice *self, NMDhcpState dhcp_state) if (is_dhcp_managed) { /* ... and also if there are static addresses configured - * on the interface. - */ + * on the interface. + */ if (priv->ip_state_6 == NM_DEVICE_IP_STATE_DONE && priv->con_ip_config_6 && nm_ip6_config_get_num_addresses(priv->con_ip_config_6)) goto clear_config; /* Fail the method when one of the following is true: - * 1) the DHCP client terminated: it does not make sense to start a grace - * period without a client running; - * 2) we failed to get an initial lease AND the client was - * not active before. - */ + * 1) the DHCP client terminated: it does not make sense to start a grace + * period without a client running; + * 2) we failed to get an initial lease AND the client was + * not active before. + */ if (dhcp_state == NM_DHCP_STATE_TERMINATED || (!priv->dhcp_data_6.was_active && priv->ip_state_6 == NM_DEVICE_IP_STATE_CONF)) { nm_device_activate_schedule_ip_config_timeout(self, AF_INET6); @@ -9653,9 +9653,9 @@ dhcp6_state_changed(NMDhcpClient *client, nm_clear_g_source(&priv->dhcp_data_6.grace_id); priv->dhcp_data_6.grace_pending = FALSE; /* If the server sends multiple IPv6 addresses, we receive a state - * changed event for each of them. Use the event ID to merge IPv6 - * addresses from the same transaction into a single configuration. - */ + * changed event for each of them. Use the event ID to merge IPv6 + * addresses from the same transaction into a single configuration. + */ event_id = nm_dhcp_utils_get_dhcp6_event_id(options); @@ -9678,8 +9678,8 @@ dhcp6_state_changed(NMDhcpClient *client, } /* After long time we have been able to renew the lease: - * update the ip state - */ + * update the ip state + */ if (priv->ip_state_6 == NM_DEVICE_IP_STATE_FAIL) _set_ip_state(self, AF_INET6, NM_DEVICE_IP_STATE_CONF); @@ -9710,9 +9710,9 @@ dhcp6_state_changed(NMDhcpClient *client, break; case NM_DHCP_STATE_TERMINATED: /* In IPv6 info-only mode, the client doesn't handle leases so it - * may exit right after getting a response from the server. That's - * normal. In that case we just ignore the exit. - */ + * may exit right after getting a response from the server. That's + * normal. In that case we just ignore the exit. + */ if (priv->dhcp6.mode == NM_NDISC_DHCP_LEVEL_OTHERCONF) break; /* fall-through */ @@ -9731,8 +9731,8 @@ dhcp6_prefix_delegated(NMDhcpClient *client, NMPlatformIP6Address *prefix, gpoin NMDevice *self = NM_DEVICE(user_data); /* Just re-emit. The device just contributes the prefix to the - * pool in NMPolicy, which decides about subnet allocation - * on the shared devices. */ + * pool in NMPolicy, which decides about subnet allocation + * on the shared devices. */ g_signal_emit(self, signals[IP6_PREFIX_DELEGATED], 0, prefix); } @@ -10089,7 +10089,7 @@ check_and_add_ipv6ll_addr(NMDevice *self) if (priv->linklocal6_timeout_id) { /* We already started and attempt to add a LL address. For the EUI-64 - * mode we can't pick a new one, we'll just fail. */ + * mode we can't pick a new one, we'll just fail. */ _LOGW(LOGD_IP6, "linklocal6: DAD failed for an EUI-64 address"); linklocal6_failed(self); return; @@ -10133,10 +10133,10 @@ linklocal6_start(NMDevice *self) check_and_add_ipv6ll_addr(self); /* Depending on the network and what the 'dad_transmits' and 'retrans_time_ms' - * sysctl values are, DAD for the IPv6LL address may take quite a while. - * FIXME: use dad/retrans sysctl values if they are higher than a minimum time. - * (rh #1101809) - */ + * sysctl values are, DAD for the IPv6LL address may take quite a while. + * FIXME: use dad/retrans sysctl values if they are higher than a minimum time. + * (rh #1101809) + */ priv->linklocal6_timeout_id = g_timeout_add_seconds(15, linklocal6_timeout_cb, self); return FALSE; } @@ -10247,9 +10247,9 @@ nm_device_get_configured_mtu_wired_parent(NMDevice * self, if (parent_mtu && mtu > parent_mtu) { /* Trying to set a MTU that is out of range from configuration: - * fall back to the parent MTU and set force flag so that it - * overrides an MTU with higher priority already configured. - */ + * fall back to the parent MTU and set force flag so that it + * overrides an MTU with higher priority already configured. + */ *out_source = NM_DEVICE_MTU_SOURCE_PARENT; *out_force = TRUE; return parent_mtu; @@ -10284,9 +10284,9 @@ _set_mtu(NMDevice *self, guint32 mtu) if (priv->master) { /* changing the MTU of a slave, might require the master to reset - * its MTU. Note that the master usually cannot set a MTU larger - * then the slave's. Hence, when the slave increases the MTU, - * master might want to retry setting the MTU. */ + * its MTU. Note that the master usually cannot set a MTU larger + * then the slave's. Hence, when the slave increases the MTU, + * master might want to retry setting the MTU. */ nm_device_commit_mtu(priv->master); } } @@ -10325,7 +10325,7 @@ _commit_mtu(NMDevice *self, const NMIP4Config *config) if (!nm_device_get_applied_connection(self) || nm_device_sys_iface_state_is_external_or_assume(self)) { /* we don't tamper with the MTU of disconnected and - * external/assumed devices. */ + * external/assumed devices. */ return; } @@ -10334,25 +10334,25 @@ _commit_mtu(NMDevice *self, const NMIP4Config *config) gboolean force = FALSE; /* We take the MTU from various sources: (in order of increasing - * priority) parent link, IP configuration (which contains the - * MTU from DHCP/PPP), connection profile. - * - * We could just compare it with the platform MTU and apply it - * when different, but this would revert at random times manual - * changes done by the user with the MTU from the connection. - * - * Instead, we remember the source of the currently configured - * MTU and apply the new one only when the new source has a - * higher priority, so that we don't set a MTU from same source - * multiple times. An exception to this is for the PARENT - * source, since we need to keep tracking the parent MTU when it - * changes. - * - * The subclass can set the @force argument to TRUE to signal that the - * returned MTU should be applied even if it has a lower priority. This - * is useful when the value from a lower source should - * preempt the one from higher ones. - */ + * priority) parent link, IP configuration (which contains the + * MTU from DHCP/PPP), connection profile. + * + * We could just compare it with the platform MTU and apply it + * when different, but this would revert at random times manual + * changes done by the user with the MTU from the connection. + * + * Instead, we remember the source of the currently configured + * MTU and apply the new one only when the new source has a + * higher priority, so that we don't set a MTU from same source + * multiple times. An exception to this is for the PARENT + * source, since we need to keep tracking the parent MTU when it + * changes. + * + * The subclass can set the @force argument to TRUE to signal that the + * returned MTU should be applied even if it has a lower priority. This + * is useful when the value from a lower source should + * preempt the one from higher ones. + */ if (NM_DEVICE_GET_CLASS(self)->get_configured_mtu) mtu = NM_DEVICE_GET_CLASS(self)->get_configured_mtu(self, &source, &force); @@ -10393,11 +10393,11 @@ _commit_mtu(NMDevice *self, const NMIP4Config *config) NM_SETTING_IP6_CONFIG_METHOD_IGNORE, NM_SETTING_IP6_CONFIG_METHOD_DISABLED)) { /* the interface has IPv6 enabled. The MTU with IPv6 cannot be smaller - * then 1280. - * - * For slave-devices (that don't have @s_ip6 we) don't do this fixup because - * it's anyway an unsolved problem when the slave configures a conflicting - * MTU. */ + * then 1280. + * + * For slave-devices (that don't have @s_ip6 we) don't do this fixup because + * it's anyway an unsolved problem when the slave configures a conflicting + * MTU. */ mtu_desired = 1280; } } @@ -10405,8 +10405,8 @@ _commit_mtu(NMDevice *self, const NMIP4Config *config) ip6_mtu = priv->ip6_mtu; if (!ip6_mtu && priv->mtu_source == NM_DEVICE_MTU_SOURCE_NONE) { /* initially, if the IPv6 MTU is not specified, grow it as large as the - * link MTU @mtu_desired. Only exception is, if @mtu_desired is so small - * to disable IPv6. */ + * link MTU @mtu_desired. Only exception is, if @mtu_desired is so small + * to disable IPv6. */ if (mtu_desired >= 1280) ip6_mtu = mtu_desired; } @@ -10462,7 +10462,7 @@ _commit_mtu(NMDevice *self, const NMIP4Config *config) if (!priv->mtu_initial && !priv->ip6_mtu_initial) { /* before touching any of the MTU parameters, record the - * original setting to restore on deactivation. */ + * original setting to restore on deactivation. */ priv->mtu_initial = mtu_plat; priv->ip6_mtu_initial = _IP6_MTU_SYS(); } @@ -10554,9 +10554,9 @@ ndisc_config_changed(NMNDisc *ndisc, const NMNDiscData *rdata, guint changed_int guint32 ifa_flags; /* Check, whether kernel is recent enough to help user space handling RA. - * If it's not supported, we have no ipv6-privacy and must add autoconf - * addresses as /128. The reason for the /128 is to prevent the kernel - * from adding a prefix route for this address. */ + * If it's not supported, we have no ipv6-privacy and must add autoconf + * addresses as /128. The reason for the /128 is to prevent the kernel + * from adding a prefix route for this address. */ ifa_flags = 0; if (nm_platform_kernel_support_get(NM_PLATFORM_KERNEL_SUPPORT_TYPE_EXTENDED_IFA_FLAGS)) { ifa_flags |= IFA_F_NOPREFIXROUTE; @@ -10674,20 +10674,20 @@ ndisc_ra_timeout(NMNDisc *ndisc, NMDevice *self) NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self); /* We don't want to stop listening for router advertisements completely, - * but instead let device activation continue activating. If an RA - * shows up later, we'll use it as long as the device is not disconnected. - */ + * but instead let device activation continue activating. If an RA + * shows up later, we'll use it as long as the device is not disconnected. + */ _LOGD(LOGD_IP6, "timed out waiting for IPv6 router advertisement"); if (priv->ip_state_6 == NM_DEVICE_IP_STATE_CONF) { /* If RA is our only source of addressing information and we don't - * ever receive one, then time out IPv6. But if there is other - * IPv6 configuration, like manual IPv6 addresses or external IPv6 - * config, consider that sufficient for IPv6 success. - * - * FIXME: it doesn't seem correct to determine this based on which - * addresses we find inside priv->ip_config_6. - */ + * ever receive one, then time out IPv6. But if there is other + * IPv6 configuration, like manual IPv6 addresses or external IPv6 + * config, consider that sufficient for IPv6 success. + * + * FIXME: it doesn't seem correct to determine this based on which + * addresses we find inside priv->ip_config_6. + */ if (priv->ip_config_6 && nm_ip6_config_find_first_address(priv->ip_config_6, NM_PLATFORM_MATCH_WITH_ADDRTYPE_NORMAL @@ -10711,7 +10711,7 @@ addrconf6_start_with_link_ready(NMDevice *self) nm_ndisc_set_iid(priv->ndisc, iid); } else { /* Don't abort the addrconf at this point -- if ndisc needs the iid - * it will notice this itself. */ + * it will notice this itself. */ _LOGI(LOGD_IP6, "addrconf6: no interface identifier; IPv6 address creation may fail"); } @@ -10959,8 +10959,8 @@ ip_requires_slaves(NMDevice *self, int addr_family) return nm_streq(method, NM_SETTING_IP4_CONFIG_METHOD_AUTO); /* SLAAC, DHCP, and Link-Local depend on connectivity (and thus slaves) - * to complete addressing. SLAAC and DHCP need a peer to provide a prefix. - */ + * to complete addressing. SLAAC and DHCP need a peer to provide a prefix. + */ return NM_IN_STRSET(method, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NM_SETTING_IP6_CONFIG_METHOD_DHCP); @@ -10994,8 +10994,8 @@ act_stage3_ip_config_start(NMDevice * self, if (nm_device_is_master(self) && ip_requires_slaves(self, addr_family)) { /* If the master has no ready slaves, and depends on slaves for - * a successful IP configuration attempt, then postpone IP addressing. - */ + * a successful IP configuration attempt, then postpone IP addressing. + */ if (!have_any_ready_slaves(self)) { _LOGI(LOGD_DEVICE | LOGD_IP, "IPv%c config waiting until slaves are ready", @@ -11086,13 +11086,13 @@ act_stage3_ip_config_start(NMDevice * self, if (!nm_device_sys_iface_state_is_external(self)) { if (priv->master) { /* If a device only has an IPv6 link-local address, - * we don't generate an assumed connection. Therefore, - * when a new slave connection (without IP configuration) - * is activated on the device, the link-local address - * remains configured. The IP configuration of an activated - * slave should not depend on the previous state. Flush - * addresses and routes on activation. - */ + * we don't generate an assumed connection. Therefore, + * when a new slave connection (without IP configuration) + * is activated on the device, the link-local address + * remains configured. The IP configuration of an activated + * slave should not depend on the previous state. Flush + * addresses and routes on activation. + */ ifindex = nm_device_get_ip_ifindex(self); platform = nm_device_get_platform(self); @@ -11107,9 +11107,9 @@ act_stage3_ip_config_start(NMDevice * self, gboolean ipv6ll_handle_old = priv->ipv6ll_handle; /* When activating an IPv6 'ignore' connection we need to revert back - * to kernel IPv6LL, but the kernel won't actually assign an address - * to the interface until disable_ipv6 is bounced. - */ + * to kernel IPv6LL, but the kernel won't actually assign an address + * to the interface until disable_ipv6 is bounced. + */ set_nm_ipv6ll(self, FALSE); if (ipv6ll_handle_old) nm_device_sysctl_ip_conf_set(self, AF_INET6, "disable_ipv6", "1"); @@ -11120,15 +11120,15 @@ act_stage3_ip_config_start(NMDevice * self, } /* Ensure the MTU makes sense. If it was below 1280 the kernel would not - * expose any ipv6 sysctls or allow presence of any addresses on the interface, - * including LL, which * would make it impossible to autoconfigure MTU to a - * correct value. */ + * expose any ipv6 sysctls or allow presence of any addresses on the interface, + * including LL, which * would make it impossible to autoconfigure MTU to a + * correct value. */ _commit_mtu(self, priv->ip_config_4); /* Any method past this point requires an IPv6LL address. Use NM-controlled - * IPv6LL if this is not an assumed connection, since assumed connections - * will already have IPv6 set up. - */ + * IPv6LL if this is not an assumed connection, since assumed connections + * will already have IPv6 set up. + */ if (!nm_device_sys_iface_state_is_external_or_assume(self)) set_nm_ipv6ll(self, TRUE); @@ -11137,9 +11137,9 @@ act_stage3_ip_config_start(NMDevice * self, set_disable_ipv6(self, "0"); /* Synchronize external IPv6 configuration with kernel, since - * linklocal6_start() uses the information there to determine if we can - * proceed with the selected method (SLAAC, DHCP, link-local). - */ + * linklocal6_start() uses the information there to determine if we can + * proceed with the selected method (SLAAC, DHCP, link-local). + */ nm_platform_process_events(nm_device_get_platform(self)); g_clear_object(&priv->ext_ip6_config_captured); priv->ext_ip6_config_captured = @@ -11272,8 +11272,8 @@ nm_device_activate_stage3_ip6_start(NMDevice *self) if (!ip6_config) ip6_config = nm_device_ip6_config_new(self); /* Here we get a static IPv6 config, like for Shared where it's - * autogenerated or from modems where it comes from ModemManager. - */ + * autogenerated or from modems where it comes from ModemManager. + */ nm_assert(!applied_config_get_current(&priv->ac_ip6_config)); applied_config_init(&priv->ac_ip6_config, ip6_config); nm_device_activate_schedule_ip_config_result(self, AF_INET6, NULL); @@ -11689,15 +11689,15 @@ start_sharing(NMDevice *self, NMIP4Config *config, GError **error) switch (nm_setting_connection_get_metered(s_con)) { case NM_METERED_YES: /* honor the metered flag. Note that reapply on the device does not affect - * the metered setting. This is different from other profiles, where the - * metered flag of an activated profile can be changed (reapplied). */ + * the metered setting. This is different from other profiles, where the + * metered flag of an activated profile can be changed (reapplied). */ announce_android_metered = TRUE; break; case NM_METERED_UNKNOWN: /* we pick up the current value and announce it. But again, we cannot update - * the announced setting without restarting dnsmasq. That means, if the default - * route changes w.r.t. being metered, then the shared connection does not get - * updated before reactivating. */ + * the announced setting without restarting dnsmasq. That means, if the default + * route changes w.r.t. being metered, then the shared connection does not get + * updated before reactivating. */ announce_android_metered = NM_IN_SET(nm_manager_get_metered(NM_MANAGER_GET), NM_METERED_YES, NM_METERED_GUESS_YES); break; @@ -11755,8 +11755,8 @@ nm_device_arp_announce(NMDevice *self) return; /* We only care about manually-configured addresses; DHCP- and autoip-configured - * ones should already have been seen on the network at this point. - */ + * ones should already have been seen on the network at this point. + */ connection = nm_device_get_applied_connection(self); if (!connection) return; @@ -11839,8 +11839,8 @@ activate_stage5_ip_config_result_4(NMDevice *self) } /* If IPv4 wasn't the first to complete, and DHCP was used, then ensure - * dispatcher scripts get the DHCP lease information. - */ + * dispatcher scripts get the DHCP lease information. + */ if (priv->dhcp_data_4.client && nm_device_activate_ip4_state_in_conf(self) && (nm_device_get_state(self) > NM_DEVICE_STATE_IP_CONFIG)) { nm_dispatcher_call_device(NM_DISPATCHER_ACTION_DHCP4_CHANGE, self, NULL, NULL, NULL, NULL); @@ -11853,9 +11853,9 @@ activate_stage5_ip_config_result_4(NMDevice *self) SlaveInfo *info; /* Skip announcement if there are no device enslaved, for two reasons: - * 1) the master has a temporary MAC address until the first slave comes - * 2) announcements are going to be dropped anyway without slaves - */ + * 1) the master has a temporary MAC address until the first slave comes + * 2) announcements are going to be dropped anyway without slaves + */ do_announce = FALSE; c_list_for_each (iter, &priv->slaves) { @@ -11893,8 +11893,8 @@ nm_device_activate_schedule_ip_config_result(NMDevice *self, int addr_family, NM applied_config_init(&priv->dev_ip_config_4, config); } else { /* If IP had previously failed, move it back to NM_DEVICE_IP_STATE_CONF since we - * clearly now have configuration. - */ + * clearly now have configuration. + */ if (priv->ip_state_6 == NM_DEVICE_IP_STATE_FAIL) _set_ip_state(self, AF_INET6, NM_DEVICE_IP_STATE_CONF); } @@ -11966,8 +11966,8 @@ dad6_get_pending_addresses(NMDevice *self) } /* We are interested only in addresses that we have explicitly configured, - * not in externally added ones. - */ + * not in externally added ones. + */ for (i = 0; i < G_N_ELEMENTS(confs); i++) { if (!confs[i]) continue; @@ -12010,8 +12010,8 @@ activate_stage5_ip_config_result_6(NMDevice *self) && priv->ip_state_6 == NM_DEVICE_IP_STATE_CONF) { if (applied_config_get_current(&priv->dhcp6.ip6_config)) { /* If IPv6 wasn't the first IP to complete, and DHCP was used, - * then ensure dispatcher scripts get the DHCP lease information. - */ + * then ensure dispatcher scripts get the DHCP lease information. + */ nm_dispatcher_call_device(NM_DISPATCHER_ACTION_DHCP6_CHANGE, self, NULL, @@ -12079,7 +12079,7 @@ act_request_set(NMDevice *self, NMActRequest *act_request) return; /* always clear the public flag. The few callers that set a new @act_request - * don't want that the property is public yet. */ + * don't want that the property is public yet. */ nm_dbus_track_obj_path_set(&priv->act_request, act_request, FALSE); if (act_request) { @@ -12352,11 +12352,11 @@ nm_device_reactivate_ip4_config(NMDevice * self, gint64 metric_old, metric_new; /* For dynamic IP methods (DHCP, IPv4LL, WWAN) the route metric is - * set at activation/renewal time using the value from static - * configuration. To support runtime change we need to update the - * dynamic configuration in place and tell the DHCP client the new - * value to use for future renewals. - */ + * set at activation/renewal time using the value from static + * configuration. To support runtime change we need to update the + * dynamic configuration in place and tell the DHCP client the new + * value to use for future renewals. + */ metric_old = nm_setting_ip_config_get_route_metric(s_ip4_old); metric_new = nm_setting_ip_config_get_route_metric(s_ip4_new); @@ -12486,12 +12486,12 @@ can_reapply_change(NMDevice * self, { if (nm_streq(setting_name, NM_SETTING_CONNECTION_SETTING_NAME)) { /* Whitelist allowed properties from "connection" setting which are - * allowed to differ. - * - * This includes UUID, there is no principal problem with reapplying a - * connection and changing its UUID. In fact, disallowing it makes it - * cumbersome for the user to reapply any connection but the original - * settings-connection. */ + * allowed to differ. + * + * This includes UUID, there is no principal problem with reapplying a + * connection and changing its UUID. In fact, disallowing it makes it + * cumbersome for the user to reapply any connection but the original + * settings-connection. */ return nm_device_hash_check_invalid_keys(diffs, NM_SETTING_CONNECTION_SETTING_NAME, error, @@ -12584,8 +12584,8 @@ check_and_reapply_connection(NMDevice * self, } /************************************************************************** - * check for unsupported changes and reject to reapply - *************************************************************************/ + * check for unsupported changes and reject to reapply + *************************************************************************/ if (diffs) { char * setting_name; GHashTable *setting_diff; @@ -12617,8 +12617,8 @@ check_and_reapply_connection(NMDevice * self, } /************************************************************************** - * Update applied connection - *************************************************************************/ + * Update applied connection + *************************************************************************/ if (diffs) nm_active_connection_version_id_bump((NMActiveConnection *) priv->act_request.obj); @@ -12637,8 +12637,8 @@ check_and_reapply_connection(NMDevice * self, NMSettingConnection *s_con_a, *s_con_n; /* we allow re-applying a connection with differing ID, UUID, STABLE_ID and AUTOCONNECT. - * This is for convenience but these values are not actually changeable. So, check - * if they changed, and if the did revert to the original values. */ + * This is for convenience but these values are not actually changeable. So, check + * if they changed, and if the did revert to the original values. */ s_con_a = nm_connection_get_setting_connection(applied); s_con_n = nm_connection_get_setting_connection(connection); @@ -12680,14 +12680,14 @@ check_and_reapply_connection(NMDevice * self, priv->v6_route_table_initialized = FALSE; /************************************************************************** - * Reapply changes - * - * Note that reapply_connection() is called as very first. This is for example - * important for NMDeviceWireGuard, which implements coerce_route_table() - * and get_extra_rules(). - * That is because NMDeviceWireGuard caches settings, so during reapply that - * cache must be updated *first*. - *************************************************************************/ + * Reapply changes + * + * Note that reapply_connection() is called as very first. This is for example + * important for NMDeviceWireGuard, which implements coerce_route_table() + * and get_extra_rules(). + * That is because NMDeviceWireGuard caches settings, so during reapply that + * cache must be updated *first*. + *************************************************************************/ klass->reapply_connection(self, con_old, con_new); if (priv->state >= NM_DEVICE_STATE_CONFIG) @@ -13225,15 +13225,15 @@ _device_activate(NMDevice *self, NMActRequest *req) nm_assert(nm_device_is_real(self)); /* Ensure the activation request is still valid; the master may have - * already failed in which case activation of this device should not proceed. - */ + * already failed in which case activation of this device should not proceed. + */ if (nm_active_connection_get_state(NM_ACTIVE_CONNECTION(req)) >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) return; if (!nm_device_get_managed(self, FALSE)) { /* It's unclear why the device would be unmanaged at this point. - * Just to be sure, handle it and error out. */ + * Just to be sure, handle it and error out. */ _LOGE(LOGD_DEVICE, "Activation: failed activating connection '%s' because device is still unmanaged", nm_active_connection_get_settings_connection_id((NMActiveConnection *) req)); @@ -13286,7 +13286,7 @@ _carrier_wait_check_act_request_must_queue(NMDevice *self, NMActRequest *req) NMConnection * connection; /* If we have carrier or if we are not waiting for it, the activation - * request is not blocked waiting for carrier. */ + * request is not blocked waiting for carrier. */ if (priv->carrier) return FALSE; if (priv->carrier_wait_id == 0) @@ -13302,12 +13302,12 @@ _carrier_wait_check_act_request_must_queue(NMDevice *self, NMActRequest *req) NULL, NULL)) { /* We passed all @flags we have, and no @specific_object. - * This equals maximal availability, if a connection is not available - * in this case, it is not waiting for carrier. - * - * Actually, why are we even trying to activate it? Strange, but whatever - * the reason, don't wait for carrier. - */ + * This equals maximal availability, if a connection is not available + * in this case, it is not waiting for carrier. + * + * Actually, why are we even trying to activate it? Strange, but whatever + * the reason, don't wait for carrier. + */ return FALSE; } @@ -13319,11 +13319,11 @@ _carrier_wait_check_act_request_must_queue(NMDevice *self, NMActRequest *req) NULL, NULL)) { /* The connection was available with flags ALL, and it is still available - * if we pretend not to wait for carrier. That means that the - * connection is available now, and does not wait for carrier. - * - * Since the flags increase the availability of a connection, when checking - * ALL&~WAITING_CARRIER, it means that we certainly would wait for carrier. */ + * if we pretend not to wait for carrier. That means that the + * connection is available now, and does not wait for carrier. + * + * Since the flags increase the availability of a connection, when checking + * ALL&~WAITING_CARRIER, it means that we certainly would wait for carrier. */ return FALSE; } @@ -13359,13 +13359,13 @@ nm_device_disconnect_active_connection(NMActiveConnection * active, nm_device_state_changed(self, NM_DEVICE_STATE_DEACTIVATING, device_reason); } else { /* @active is the current ac of @self, but it's going down already. - * Nothing to do. */ + * Nothing to do. */ } return; } /* the active connection references this device, but it's neither the - * queued_act_request nor the current act_request. Just set it to fail... */ + * queued_act_request nor the current act_request. Just set it to fail... */ do_fail: nm_active_connection_set_state_fail(active, active_reason, NULL); } @@ -13437,10 +13437,10 @@ nm_device_is_activating(NMDevice *self) return TRUE; /* There's a small race between the time when stage 1 is scheduled - * and when the device actually sets STATE_PREPARE when the activation - * handler is actually run. If there's an activation handler scheduled - * we're activating anyway. - */ + * and when the device actually sets STATE_PREPARE when the activation + * handler is actually run. If there's an activation handler scheduled + * we're activating anyway. + */ return priv->activation_source_id_4 != 0; } @@ -13560,7 +13560,7 @@ nm_device_set_ip_config(NMDevice * self, if (new_config && old_config) { /* has_changes is set only on relevant changes, because when the configuration changes, - * this causes a re-read and reset. This should only happen for relevant changes */ + * this causes a re-read and reset. This should only happen for relevant changes */ nm_ip_config_replace(old_config, new_config, &has_changes); if (has_changes) { _LOGD(LOGD_IP_from_af(addr_family), @@ -13651,9 +13651,9 @@ _replace_vpn_config_in_list(GSList **plist, GObject *old, GObject *new) GSList *old_link; /* Below, assert that @new is not yet tracked, but still behave - * correctly in any case. Don't complain for missing @old since - * it could have been removed when the parent device became - * unmanaged. */ + * correctly in any case. Don't complain for missing @old since + * it could have been removed when the parent device became + * unmanaged. */ if (old && (old_link = g_slist_find(*plist, old))) { if (old != new) { @@ -13905,7 +13905,7 @@ ip_check_ping_watch_cb(GPid pid, int status, gpointer user_data) ip_check_pre_up(self); } else { /* If ping exited with an error it may have returned early, - * wait 1 second and restart it */ + * wait 1 second and restart it */ priv->gw_ping.watch = g_timeout_add_seconds(1, respawn_ping_cb, self); } } @@ -13964,9 +13964,9 @@ nm_device_start_ip_check(NMDevice *self) NMLogDomain log_domain = LOGD_IP4; /* Shouldn't be any active ping here, since IP_CHECK happens after the - * first IP method completes. Any subsequently completing IP method doesn't - * get checked. - */ + * first IP method completes. Any subsequently completing IP method doesn't + * get checked. + */ g_return_if_fail(!priv->gw_ping.watch); g_return_if_fail(!priv->gw_ping.timeout); g_return_if_fail(!priv->gw_ping.pid); @@ -14097,25 +14097,25 @@ nm_device_bring_up(NMDevice *self, gboolean block, gboolean *no_firmware) } /* some ethernet devices fail to report capabilities unless the device - * is up. Re-read the capabilities. */ + * is up. Re-read the capabilities. */ capabilities = 0; if (NM_DEVICE_GET_CLASS(self)->get_generic_capabilities) capabilities |= NM_DEVICE_GET_CLASS(self)->get_generic_capabilities(self); _add_capabilities(self, capabilities); /* Devices that support carrier detect must be IFF_UP to report carrier - * changes; so after setting the device IFF_UP we must suppress startup - * complete (via a pending action) until either the carrier turns on, or - * a timeout is reached. - */ + * changes; so after setting the device IFF_UP we must suppress startup + * complete (via a pending action) until either the carrier turns on, or + * a timeout is reached. + */ if (nm_device_has_capability(self, NM_DEVICE_CAP_CARRIER_DETECT)) { gint64 now_ms, until_ms; /* we start a grace period of 5 seconds during which we will schedule - * a pending action whenever we have no carrier. - * - * If during that time carrier goes away, we declare the interface - * as not ready. */ + * a pending action whenever we have no carrier. + * + * If during that time carrier goes away, we declare the interface + * as not ready. */ nm_clear_g_source(&priv->carrier_wait_id); if (!priv->carrier) nm_device_add_pending_action(self, NM_PENDING_ACTION_CARRIER_WAIT, FALSE); @@ -14257,9 +14257,9 @@ update_ext_ip_config(NMDevice *self, int addr_family, gboolean intersect_configs if (priv->ext_ip_config_4) { if (intersect_configs) { /* This function was called upon external changes. Remove the configuration - * (addresses,routes) that is no longer present externally from the internal - * config. This way, we don't re-add addresses that were manually removed - * by the user. */ + * (addresses,routes) that is no longer present externally from the internal + * config. This way, we don't re-add addresses that were manually removed + * by the user. */ if (priv->con_ip_config_4) { nm_ip4_config_intersect(priv->con_ip_config_4, priv->ext_ip_config_4, @@ -14276,8 +14276,8 @@ update_ext_ip_config(NMDevice *self, int addr_family, gboolean intersect_configs } /* Remove parts from ext_ip_config_4 to only contain the information that - * was configured externally -- we already have the same configuration from - * internal origins. */ + * was configured externally -- we already have the same configuration from + * internal origins. */ if (priv->con_ip_config_4) { nm_ip4_config_subtract(priv->ext_ip_config_4, priv->con_ip_config_4, @@ -14312,9 +14312,9 @@ update_ext_ip_config(NMDevice *self, int addr_family, gboolean intersect_configs if (intersect_configs) { /* This function was called upon external changes. Remove the configuration - * (addresses,routes) that is no longer present externally from the internal - * config. This way, we don't re-add addresses that were manually removed - * by the user. */ + * (addresses,routes) that is no longer present externally from the internal + * config. This way, we don't re-add addresses that were manually removed + * by the user. */ if (priv->con_ip_config_6) { nm_ip6_config_intersect(priv->con_ip_config_6, priv->ext_ip_config_6, @@ -14336,8 +14336,8 @@ update_ext_ip_config(NMDevice *self, int addr_family, gboolean intersect_configs } /* Remove parts from ext_ip_config_6 to only contain the information that - * was configured externally -- we already have the same configuration from - * internal origins. */ + * was configured externally -- we already have the same configuration from + * internal origins. */ if (priv->con_ip_config_6) { nm_ip6_config_subtract(priv->ext_ip_config_6, priv->con_ip_config_6, @@ -14415,9 +14415,9 @@ queued_ip_config_change(NMDevice *self, int addr_family) return G_SOURCE_CONTINUE; /* If a commit is scheduled, this function would potentially interfere with - * it changing IP configurations before they are applied. Postpone the - * update in such case. - */ + * it changing IP configurations before they are applied. Postpone the + * update in such case. + */ if (priv->activation_source_id_x[IS_IPv4] != 0 && priv->activation_source_func_x[IS_IPv4] == activate_stage5_ip_config_result_x[IS_IPv4]) return G_SOURCE_CONTINUE; @@ -14428,8 +14428,8 @@ queued_ip_config_change(NMDevice *self, int addr_family) if (!IS_IPv4) { /* Check whether we need to complete waiting for link-local. - * We are also called from an idle handler, so no problem doing state transitions - * now. */ + * We are also called from an idle handler, so no problem doing state transitions + * now. */ linklocal6_check_complete(self); } @@ -14472,10 +14472,10 @@ queued_ip_config_change(NMDevice *self, int addr_family) nm_ndisc_emit_config_change(priv->ndisc, ndisc_config_changed); /* If no IPv6 link-local address exists but other addresses do then we - * must add the LL address to remain conformant with RFC 3513 chapter 2.1 - * ("Addressing Model"): "All interfaces are required to have at least - * one link-local unicast address". - */ + * must add the LL address to remain conformant with RFC 3513 chapter 2.1 + * ("Addressing Model"): "All interfaces are required to have at least + * one link-local unicast address". + */ if (priv->ip_config_6 && nm_ip6_config_get_num_addresses(priv->ip_config_6)) need_ipv6ll = TRUE; if (need_ipv6ll) @@ -14641,27 +14641,27 @@ static gboolean _get_managed_by_flags(NMUnmanagedFlags flags, NMUnmanagedFlags mask, gboolean for_user_request) { /* Evaluate the managed state based on the unmanaged flags. - * - * Some flags are authoritative, meaning they always cause - * the device to be unmanaged (e.g. @NM_UNMANAGED_PLATFORM_INIT). - * - * OTOH, some flags can be overwritten. For example NM_UNMANAGED_USER_UDEV - * is ignored once NM_UNMANAGED_USER_EXPLICIT is set. The idea is that - * the flag from the configuration has no effect once the user explicitly - * touches the unmanaged flags. */ + * + * Some flags are authoritative, meaning they always cause + * the device to be unmanaged (e.g. @NM_UNMANAGED_PLATFORM_INIT). + * + * OTOH, some flags can be overwritten. For example NM_UNMANAGED_USER_UDEV + * is ignored once NM_UNMANAGED_USER_EXPLICIT is set. The idea is that + * the flag from the configuration has no effect once the user explicitly + * touches the unmanaged flags. */ if (for_user_request) { /* @for_user_request can make the result only ~more~ managed. - * If the flags already indicate a managed state for a non-user-request, - * then it is also managed for an explicit user-request. - * - * Effectively, this check is redundant, as the code below already - * already ensures that. Still, express this invariant explicitly here. */ + * If the flags already indicate a managed state for a non-user-request, + * then it is also managed for an explicit user-request. + * + * Effectively, this check is redundant, as the code below already + * already ensures that. Still, express this invariant explicitly here. */ if (_get_managed_by_flags(flags, mask, FALSE)) return TRUE; /* A for-user-request, is effectively the same as pretending - * that user-explicit flag is cleared. */ + * that user-explicit flag is cleared. */ mask |= NM_UNMANAGED_USER_EXPLICIT; flags &= ~NM_UNMANAGED_USER_EXPLICIT; } @@ -14669,22 +14669,22 @@ _get_managed_by_flags(NMUnmanagedFlags flags, NMUnmanagedFlags mask, gboolean fo if (NM_FLAGS_ANY(mask, NM_UNMANAGED_USER_SETTINGS) && !NM_FLAGS_ANY(flags, NM_UNMANAGED_USER_SETTINGS)) { /* NM_UNMANAGED_USER_SETTINGS can only explicitly unmanage a device. It cannot - * *manage* it. Having NM_UNMANAGED_USER_SETTINGS explicitly not set, is the - * same as having it not set at all. */ + * *manage* it. Having NM_UNMANAGED_USER_SETTINGS explicitly not set, is the + * same as having it not set at all. */ mask &= ~NM_UNMANAGED_USER_SETTINGS; } if (NM_FLAGS_ANY(mask, NM_UNMANAGED_USER_UDEV)) { /* configuration from udev or nm-config overwrites the by-default flag - * which is based on the device type. - * configuration from udev overwrites external-down */ + * which is based on the device type. + * configuration from udev overwrites external-down */ flags &= ~(NM_UNMANAGED_BY_DEFAULT | NM_UNMANAGED_EXTERNAL_DOWN); } if (NM_FLAGS_ANY(mask, NM_UNMANAGED_USER_CONF)) { /* configuration from NetworkManager.conf overwrites the by-default flag - * which is based on the device type. - * It also overwrites the udev configuration and external-down */ + * which is based on the device type. + * It also overwrites the udev configuration and external-down */ flags &= ~(NM_UNMANAGED_BY_DEFAULT | NM_UNMANAGED_USER_UDEV | NM_UNMANAGED_EXTERNAL_DOWN); } @@ -14695,7 +14695,7 @@ _get_managed_by_flags(NMUnmanagedFlags flags, NMUnmanagedFlags mask, gboolean fo if (NM_FLAGS_HAS(mask, NM_UNMANAGED_USER_EXPLICIT)) { /* if the device is managed by user-decision, certain other flags - * are ignored. */ + * are ignored. */ flags &= ~(NM_UNMANAGED_BY_DEFAULT | NM_UNMANAGED_USER_UDEV | NM_UNMANAGED_USER_CONF | NM_UNMANAGED_EXTERNAL_DOWN); } @@ -14981,13 +14981,13 @@ nm_device_set_unmanaged_by_user_settings(NMDevice *self) if (nm_device_get_unmanaged_flags(self, NM_UNMANAGED_PLATFORM_INIT)) { /* the device is already unmanaged due to platform-init. - * - * We want to delay evaluating the device spec, because it will freeze - * the permanent MAC address. That should not be done, before the platform - * link is fully initialized (via UDEV). - * - * Note that when clearing NM_UNMANAGED_PLATFORM_INIT, we will re-evaluate - * whether the device is unmanaged by user-settings. */ + * + * We want to delay evaluating the device spec, because it will freeze + * the permanent MAC address. That should not be done, before the platform + * link is fully initialized (via UDEV). + * + * Note that when clearing NM_UNMANAGED_PLATFORM_INIT, we will re-evaluate + * whether the device is unmanaged by user-settings. */ return; } @@ -15202,10 +15202,10 @@ nm_device_update_metered(NMDevice *self) } /* Otherwise, look at connection type. For Bluetooth, we look at the type of - * Bluetooth sharing: for PANU/DUN (where we are receiving internet from - * another device) we set GUESS_YES; for NAP (where we are sharing internet - * to another device) we set GUESS_NO. We ignore WiMAX here as it’s no - * longer supported by NetworkManager. */ + * Bluetooth sharing: for PANU/DUN (where we are receiving internet from + * another device) we set GUESS_YES; for NAP (where we are sharing internet + * to another device) we set GUESS_NO. We ignore WiMAX here as it’s no + * longer supported by NetworkManager. */ if (value == NM_METERED_INVALID && nm_connection_is_type(connection, NM_SETTING_BLUETOOTH_SETTING_NAME)) { if (_nm_connection_get_setting_bluetooth_for_nap(connection)) { @@ -15369,7 +15369,7 @@ nm_device_check_connection_available(NMDevice * self, #if NM_MORE_ASSERTS >= 2 { /* The meaning of the flags is so that *adding* a flag relaxes a condition, thus making - * the device *more* available. Assert against that requirement by testing all the flags. */ + * the device *more* available. Assert against that requirement by testing all the flags. */ NMDeviceCheckConAvailableFlags i, j, k; gboolean available_all[NM_DEVICE_CHECK_CON_AVAILABLE_ALL + 1] = {FALSE}; @@ -15422,23 +15422,23 @@ check_connection_available(NMDevice * self, NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self); /* Connections which require a network connection are not available when - * the device has no carrier, even with ignore-carrer=TRUE. - */ + * the device has no carrier, even with ignore-carrer=TRUE. + */ if (priv->carrier || !connection_requires_carrier(connection)) return TRUE; if (NM_FLAGS_HAS(flags, _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST_WAITING_CARRIER) && priv->carrier_wait_id != 0) { /* The device has no carrier though the connection requires it. - * - * If we are still waiting for carrier, the connection is available - * for an explicit user-request. */ + * + * If we are still waiting for carrier, the connection is available + * for an explicit user-request. */ return TRUE; } /* master types are always available even without carrier. - * Making connection non-available would un-enslave slaves which - * is not desired. */ + * Making connection non-available would un-enslave slaves which + * is not desired. */ if (nm_device_is_master(self)) return TRUE; @@ -15524,8 +15524,8 @@ nm_device_get_best_connection(NMDevice *self, const char *specific_object, GErro guint64 candidate_timestamp = 0; /* If a specific object is given, only include connections that are - * compatible with it. - */ + * compatible with it. + */ if (specific_object /* << Optimization: we know that the connection is available without @specific_object. */ && !nm_device_check_connection_available( self, @@ -15726,7 +15726,7 @@ nm_device_has_pending_action_reason(NMDevice *self) if (!priv->pending_actions->next && nm_device_get_state(self) == NM_DEVICE_STATE_ACTIVATED && nm_streq(priv->pending_actions->data, NM_PENDING_ACTION_CARRIER_WAIT)) { /* if the device is already in activated state, and the only reason - * why it appears still busy is "carrier-wait", then we are already complete. */ + * why it appears still busy is "carrier-wait", then we are already complete. */ return NULL; } @@ -15736,7 +15736,7 @@ nm_device_has_pending_action_reason(NMDevice *self) if (nm_device_is_real(self) && nm_device_get_unmanaged_flags(self, NM_UNMANAGED_PLATFORM_INIT)) { /* as long as the platform link is not yet initialized, we have a pending - * action. */ + * action. */ return NM_PENDING_ACTION_LINK_INIT; } @@ -15816,8 +15816,8 @@ _cleanup_generic_post(NMDevice *self, CleanupType cleanup_type) priv->linklocal6_dad_counter = 0; /* Clean up IP configs; this does not actually deconfigure the - * interface; the caller must flush routes and addresses explicitly. - */ + * interface; the caller must flush routes and addresses explicitly. + */ nm_device_set_ip_config(self, AF_INET, NULL, TRUE, NULL); nm_device_set_ip_config(self, AF_INET6, NULL, TRUE, NULL); g_clear_object(&priv->proxy_config); @@ -15845,7 +15845,7 @@ _cleanup_generic_post(NMDevice *self, CleanupType cleanup_type) priv->vpn_configs_6 = NULL; /* We no longer accept the delegations. nm_device_set_ip_config(NULL) - * above disables them. */ + * above disables them. */ nm_assert(priv->needs_ip6_subnet == FALSE); if (priv->act_request.obj) { @@ -15858,15 +15858,15 @@ _cleanup_generic_post(NMDevice *self, CleanupType cleanup_type) if (cleanup_type == CLEANUP_TYPE_DECONFIGURE) { /* Check if the device was deactivated, and if so, delete_link. - * Don't call delete_link synchronously because we are currently - * handling a state change -- which is not reentrant. */ + * Don't call delete_link synchronously because we are currently + * handling a state change -- which is not reentrant. */ delete_on_deactivate_check_and_schedule(self, nm_device_get_ip_ifindex(self)); } /* ip_iface should be cleared after flushing all routes and addresses, since - * those are identified by ip_iface, not by iface (which might be a tty - * or ATM device). - */ + * those are identified by ip_iface, not by iface (which might be a tty + * or ATM device). + */ _set_ip_ifindex(self, 0, NULL); } @@ -15948,15 +15948,15 @@ nm_device_cleanup(NMDevice *self, NMDeviceStateReason reason, CleanupType cleanu if (ifindex > 0) { /* during device cleanup, we want to reset the MAC address of the device - * to the initial state. - * - * We certainly want to do that when reaching the UNMANAGED state... */ + * to the initial state. + * + * We certainly want to do that when reaching the UNMANAGED state... */ if (nm_device_get_state(self) <= NM_DEVICE_STATE_UNMANAGED) nm_device_hw_addr_reset(self, "unmanage"); else { /* for other device states (UNAVAILABLE, DISCONNECTED), allow the - * device to overwrite the reset behavior, so that Wi-Fi can set - * a randomized MAC address used during scanning. */ + * device to overwrite the reset behavior, so that Wi-Fi can set + * a randomized MAC address used during scanning. */ NM_DEVICE_GET_CLASS(self)->deactivate_reset_hw_addr(self); } } @@ -16305,30 +16305,30 @@ deactivate_dispatcher_complete(NMDispatcherCallId *call_id, gpointer user_data) if (NM_DEVICE_GET_CLASS(self)->deactivate_async) { /* FIXME: the virtual function deactivate_async() has only this caller here. - * And the NMDevice subtypes are well aware of the circumstances when they - * are called. We shall make the function less generic and thus (as the scope - * is narrower) more convenient. - * - * - Drop the callback argument. Instead, when deactivate_async() completes, the - * subtype shall call a method _nm_device_deactivate_async_done(). Because as - * it is currently, subtypes need to pretend this callback and the user-data - * would be opaque, and carry it around. When it's in fact very clear what this - * is. - * - * - Also drop the GCancellable argument. Upon cancellation, NMDevice shall - * call another virtual function deactivate_async_abort(). As it is currently, - * callers need to register to the cancelled signal of the cancellable. It - * seems simpler to just implement the deactivate_async_abort() function. - * On the other hand, some implementations actually use the GCancellable. - * So, NMDevice shall do both: it shall both pass a cancellable, but also - * invoke deactivate_async_abort(). It allow the implementation to honor - * whatever is simpler for their purpose. - * - * - sometimes, the subclass can complete right away. Scheduling the completion - * in an idle handler is cumbersome. Allow the function to return FALSE to - * indicate that the device is already deactivated and the callback (or - * _nm_device_deactivate_async_done()) won't be invoked. - */ + * And the NMDevice subtypes are well aware of the circumstances when they + * are called. We shall make the function less generic and thus (as the scope + * is narrower) more convenient. + * + * - Drop the callback argument. Instead, when deactivate_async() completes, the + * subtype shall call a method _nm_device_deactivate_async_done(). Because as + * it is currently, subtypes need to pretend this callback and the user-data + * would be opaque, and carry it around. When it's in fact very clear what this + * is. + * + * - Also drop the GCancellable argument. Upon cancellation, NMDevice shall + * call another virtual function deactivate_async_abort(). As it is currently, + * callers need to register to the cancelled signal of the cancellable. It + * seems simpler to just implement the deactivate_async_abort() function. + * On the other hand, some implementations actually use the GCancellable. + * So, NMDevice shall do both: it shall both pass a cancellable, but also + * invoke deactivate_async_abort(). It allow the implementation to honor + * whatever is simpler for their purpose. + * + * - sometimes, the subclass can complete right away. Scheduling the completion + * in an idle handler is cumbersome. Allow the function to return FALSE to + * indicate that the device is already deactivated and the callback (or + * _nm_device_deactivate_async_done()) won't be invoked. + */ priv->deactivating_cancellable = g_cancellable_new(); NM_DEVICE_GET_CLASS(self)->deactivate_async(self, priv->deactivating_cancellable, @@ -16365,9 +16365,9 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, } /* Do nothing if state isn't changing, but as a special case allow - * re-setting UNAVAILABLE if the device is missing firmware so that we - * can retry device initialization. - */ + * re-setting UNAVAILABLE if the device is missing firmware so that we + * can retry device initialization. + */ if ((priv->state == state) && (state != NM_DEVICE_STATE_UNAVAILABLE || !priv->firmware_missing)) { _LOGD(LOGD_DEVICE, @@ -16388,8 +16388,8 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, _sys_iface_state_to_str(priv->sys_iface_state)); /* in order to prevent triggering any callback caused - * by the device not having any pending action anymore - * we add one here that gets removed at the end of the function */ + * by the device not having any pending action anymore + * we add one here that gets removed at the end of the function */ nm_device_add_pending_action(self, NM_PENDING_ACTION_IN_STATE_CHANGE, TRUE); priv->in_state_changed = TRUE; @@ -16437,8 +16437,8 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, } /* Handle the new state here; but anything that could trigger - * another state change should be done below. - */ + * another state change should be done below. + */ switch (state) { case NM_DEVICE_STATE_UNMANAGED: nm_device_set_firmware_missing(self, FALSE); @@ -16477,29 +16477,29 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, } /* Ensure the device gets deactivated in response to stuff like - * carrier changes or rfkill. But don't deactivate devices that are - * about to assume a connection since that defeats the purpose of - * assuming the device's existing connection. - * - * Note that we "deactivate" the device even when coming from - * UNMANAGED, to ensure that it's in a clean state. - */ + * carrier changes or rfkill. But don't deactivate devices that are + * about to assume a connection since that defeats the purpose of + * assuming the device's existing connection. + * + * Note that we "deactivate" the device even when coming from + * UNMANAGED, to ensure that it's in a clean state. + */ nm_device_cleanup(self, reason, CLEANUP_TYPE_DECONFIGURE); } break; case NM_DEVICE_STATE_DISCONNECTED: if (old_state > NM_DEVICE_STATE_DISCONNECTED) { /* Ensure devices that previously assumed a connection now have - * userspace IPv6LL enabled. - */ + * userspace IPv6LL enabled. + */ set_nm_ipv6ll(self, TRUE); nm_device_cleanup(self, reason, CLEANUP_TYPE_DECONFIGURE); } else if (old_state < NM_DEVICE_STATE_DISCONNECTED) { if (priv->sys_iface_state == NM_DEVICE_SYS_IFACE_STATE_MANAGED) { /* Ensure IPv6 is set up as it may not have been done when - * entering the UNAVAILABLE state depending on the reason. - */ + * entering the UNAVAILABLE state depending on the reason. + */ ip6_managed_setup(self); } } @@ -16510,8 +16510,8 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, case NM_DEVICE_STATE_NEED_AUTH: if (old_state > NM_DEVICE_STATE_NEED_AUTH) { /* Clean up any half-done IP operations if the device's layer2 - * finds out it needs authentication during IP config. - */ + * finds out it needs authentication during IP config. + */ _cleanup_ip_pre(self, AF_INET, CLEANUP_TYPE_DECONFIGURE); _cleanup_ip_pre(self, AF_INET6, CLEANUP_TYPE_DECONFIGURE); } @@ -16545,11 +16545,11 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, switch (state) { case NM_DEVICE_STATE_UNAVAILABLE: /* If the device can activate now (ie, it's got a carrier, the supplicant - * is active, or whatever) schedule a delayed transition to DISCONNECTED - * to get things rolling. The device can't transition immediately because - * we can't change states again from the state handler for a variety of - * reasons. - */ + * is active, or whatever) schedule a delayed transition to DISCONNECTED + * to get things rolling. The device can't transition immediately because + * we can't change states again from the state handler for a variety of + * reasons. + */ if (nm_device_is_available(self, NM_DEVICE_CHECK_DEV_AVAILABLE_NONE)) { nm_device_queue_recheck_available(self, NM_DEVICE_STATE_REASON_NONE, @@ -16562,7 +16562,7 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, _cancel_activation(self); /* We cache the ignore_carrier state to not react on config-reloads while the connection - * is active. But on deactivating, reset the ignore-carrier flag to the current state. */ + * is active. But on deactivating, reset the ignore-carrier flag to the current state. */ priv->ignore_carrier = nm_config_data_get_ignore_carrier(NM_CONFIG_GET_DATA, self); if (quitting) { @@ -16611,11 +16611,11 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, break; case NM_DEVICE_STATE_FAILED: /* Usually upon failure the activation chain is interrupted in - * one of the stages; but in some cases the device fails for - * external events (as a failure of master connection) while - * the activation sequence is running and so we need to ensure - * that the chain is terminated here. - */ + * one of the stages; but in some cases the device fails for + * external events (as a failure of master connection) while + * the activation sequence is running and so we need to ensure + * that the chain is terminated here. + */ _cancel_activation(self); sett_conn = nm_device_get_settings_connection(self); @@ -16627,10 +16627,10 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, nm_device_master_release_slaves(self); /* If the connection doesn't yet have a timestamp, set it to zero so that - * we can distinguish between connections we've tried to activate and have - * failed (zero timestamp), connections that succeeded (non-zero timestamp), - * and those we haven't tried yet (no timestamp). - */ + * we can distinguish between connections we've tried to activate and have + * failed (zero timestamp), connections that succeeded (non-zero timestamp), + * and those we haven't tried yet (no timestamp). + */ if (sett_conn && !nm_settings_connection_get_timestamp(sett_conn, NULL)) nm_settings_connection_update_timestamp(sett_conn, (guint64) 0); @@ -16641,9 +16641,9 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, break; } /* Schedule the transition to DISCONNECTED. The device can't transition - * immediately because we can't change states again from the state - * handler for a variety of reasons. - */ + * immediately because we can't change states again from the state + * handler for a variety of reasons. + */ nm_device_queue_state(self, NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_REASON_NONE); break; case NM_DEVICE_STATE_IP_CHECK: @@ -16655,8 +16655,8 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, nm_device_start_ip_check(self); /* IP-related properties are only valid when the device has IP configuration; - * now that it does, ensure their change notifications are emitted. - */ + * now that it does, ensure their change notifications are emitted. + */ notify_ip_properties(self); break; case NM_DEVICE_STATE_SECONDARIES: @@ -16680,8 +16680,8 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, } /* IP-related properties are only valid when the device has IP configuration. - * If it no longer does, ensure their change notifications are emitted. - */ + * If it no longer does, ensure their change notifications are emitted. + */ if (ip_config_valid(old_state) && !ip_config_valid(state)) notify_ip_properties(self); @@ -16721,8 +16721,8 @@ queued_state_set(gpointer user_data) "change state"); /* Clear queued state struct before triggering state change, since - * the state change may queue another state. - */ + * the state change may queue another state. + */ priv->queued_state.id = 0; new_state = priv->queued_state.state; new_reason = priv->queued_state.reason; @@ -16758,7 +16758,7 @@ nm_device_queue_state(NMDevice *self, NMDeviceState state, NMDeviceStateReason r } /* Add pending action for the new state before clearing the queued states, so - * that we don't accidentally pop all pending states and reach 'startup complete' */ + * that we don't accidentally pop all pending states and reach 'startup complete' */ nm_device_add_pending_action(self, queued_state_to_string(state), TRUE); /* We should only ever have one delayed state transition at a time */ @@ -16861,10 +16861,10 @@ nm_device_update_hw_address(NMDevice *self) char s_buf[NM_UTILS_HWADDR_LEN_MAX_STR]; /* we cannot change the address length of a device once it is set (except - * unrealizing the device). - * - * The reason is that the permanent and initial MAC addresses also must have the - * same address length, so it's unclear what it would mean that the length changes. */ + * unrealizing the device). + * + * The reason is that the permanent and initial MAC addresses also must have the + * same address length, so it's unclear what it would mean that the length changes. */ _LOGD(LOGD_PLATFORM | LOGD_DEVICE, "hw-addr: read a MAC address with differing length (%s vs. %s)", priv->hw_addr, @@ -16886,8 +16886,8 @@ nm_device_update_hw_address(NMDevice *self) || (priv->hw_addr_type == HW_ADDR_TYPE_UNSET && priv->state < NM_DEVICE_STATE_PREPARE && !nm_device_is_activating(self))) { /* when we get a hw_addr the first time or while the device - * is not activated (with no explicit hw address set), always - * update our initial hw-address as well. */ + * is not activated (with no explicit hw address set), always + * update our initial hw-address as well. */ nm_device_update_initial_hw_address(self); } return TRUE; @@ -16901,7 +16901,7 @@ nm_device_update_initial_hw_address(NMDevice *self) if (priv->hw_addr && !nm_streq0(priv->hw_addr_initial, priv->hw_addr)) { if (priv->hw_addr_initial && priv->hw_addr_type != HW_ADDR_TYPE_UNSET) { /* once we have the initial hw address set, we only allow - * update if the currently type is "unset". */ + * update if the currently type is "unset". */ return; } g_free(priv->hw_addr_initial); @@ -16923,10 +16923,10 @@ nm_device_update_permanent_hw_address(NMDevice *self, gboolean force_freeze) if (priv->hw_addr_perm) { /* the permanent hardware address is only read once and not - * re-read later. - * - * Except during unrealize/realize cycles, where we clear the permanent - * hardware address during unrealization. */ + * re-read later. + * + * Except during unrealize/realize cycles, where we clear the permanent + * hardware address during unrealization. */ return; } @@ -16935,12 +16935,12 @@ nm_device_update_permanent_hw_address(NMDevice *self, gboolean force_freeze) return; /* the user is advised to configure stable MAC addresses for software devices via - * UDEV. Thus, check whether the link is fully initialized. */ + * UDEV. Thus, check whether the link is fully initialized. */ pllink = nm_platform_link_get(nm_device_get_platform(self), ifindex); if (!pllink || !pllink->initialized) { if (!force_freeze) { /* we can afford to wait. Back off and leave the permanent MAC address - * undecided for now. */ + * undecided for now. */ return; } /* try to refresh the link just to give UDEV a bit more time... */ @@ -16952,9 +16952,9 @@ nm_device_update_permanent_hw_address(NMDevice *self, gboolean force_freeze) if (!priv->hw_addr_len) { /* we need the current MAC address because we require the permanent MAC address - * to have the same length as the current address. - * - * Abort if there is no current MAC address. */ + * to have the same length as the current address. + * + * Abort if there is no current MAC address. */ return; } @@ -16968,16 +16968,16 @@ nm_device_update_permanent_hw_address(NMDevice *self, gboolean force_freeze) } /* we failed to read a permanent MAC address, thus we use a fake address, - * that is the current MAC address of the device. - * - * Note that the permanet MAC address of a NMDevice instance does not change - * after being set once. Thus, we use now a fake address and stick to that - * (until we unrealize the device). */ + * that is the current MAC address of the device. + * + * Note that the permanet MAC address of a NMDevice instance does not change + * after being set once. Thus, we use now a fake address and stick to that + * (until we unrealize the device). */ priv->hw_addr_perm_fake = TRUE; /* We also persist our choice of the fake address to the device state - * file to use the same address on restart of NetworkManager. - * First, try to reload the address from the state file. */ + * file to use the same address on restart of NetworkManager. + * First, try to reload the address from the state file. */ dev_state = nm_config_device_state_get(nm_config_get(), ifindex); if (dev_state && dev_state->perm_hw_addr_fake && nm_utils_hwaddr_aton(dev_state->perm_hw_addr_fake, buf, priv->hw_addr_len) @@ -17071,8 +17071,8 @@ _hw_addr_set(NMDevice * self, if (nm_device_get_device_type(self) == NM_DEVICE_TYPE_WIFI) { /* Always take the device down for Wi-Fi because - * wpa_supplicant needs it to properly detect the MAC - * change. */ + * wpa_supplicant needs it to properly detect the MAC + * change. */ retry_down = FALSE; was_taken_down = TRUE; nm_device_take_down(self, FALSE); @@ -17110,18 +17110,18 @@ again: detail); /* The platform call indicated success, however the address is not - * as expected. That is either due to a driver issue (brcmfmac, bgo#770456, - * rh#1374023) or a race where externally the MAC address was reset. - * The race is rather unlikely. - * - * The alternative would be to postpone the activation in case the - * MAC address is not yet ready and poll without blocking. However, - * that is rather complicated and it is not expected that this case - * happens for regular drivers. - * Note that brcmfmac can block NetworkManager for 500 msec while - * taking down the device. Let's add another 100 msec to that. - * - * wait/poll up to 100 msec until it changes. */ + * as expected. That is either due to a driver issue (brcmfmac, bgo#770456, + * rh#1374023) or a race where externally the MAC address was reset. + * The race is rather unlikely. + * + * The alternative would be to postpone the activation in case the + * MAC address is not yet ready and poll without blocking. However, + * that is rather complicated and it is not expected that this case + * happens for regular drivers. + * Note that brcmfmac can block NetworkManager for 500 msec while + * taking down the device. Let's add another 100 msec to that. + * + * wait/poll up to 100 msec until it changes. */ poll_end = nm_utils_get_monotonic_timestamp_usec() + (100 * 1000); for (;;) { @@ -17166,8 +17166,8 @@ handle_fail: if (retry_down) { /* changing the MAC address failed, but also the device was up (and we did not yet try to take - * it down). Optimally, we change the MAC address without taking the device down, but some - * devices don't like that. So, retry with taking the device down. */ + * it down). Optimally, we change the MAC address without taking the device down, but some + * devices don't like that. So, retry with taking the device down. */ retry_down = FALSE; was_taken_down = TRUE; nm_device_take_down(self, FALSE); @@ -17196,9 +17196,9 @@ nm_device_hw_addr_set(NMDevice *self, const char *addr, const char *detail, gboo if (set_permanent) { /* The type is set to PERMANENT by NMDeviceVlan when taking the MAC - * address from the parent and by NMDeviceWifi when setting a random MAC - * address during scanning. - */ + * address from the parent and by NMDeviceWifi when setting a random MAC + * address during scanning. + */ priv->hw_addr_type = HW_ADDR_TYPE_PERMANENT; } @@ -17289,8 +17289,8 @@ _hw_addr_get_cloned(NMDevice * self, } else if (NM_IN_STRSET(addr, NM_CLONED_MAC_RANDOM)) { if (priv->hw_addr_type == HW_ADDR_TYPE_GENERATED) { /* hm, we already use a generate MAC address. Most certainly, that is from the same - * activation request, so we should not create a new random address, instead keep - * the current. */ + * activation request, so we should not create a new random address, instead keep + * the current. */ goto out_no_action; } hw_addr_generated = nm_utils_hw_addr_gen_random_eth( @@ -17316,7 +17316,7 @@ _hw_addr_get_cloned(NMDevice * self, if (priv->hw_addr_type == HW_ADDR_TYPE_GENERATED) { /* hm, we already use a generate MAC address. Most certainly, that is from the same - * activation request, so let's skip creating the stable address anew. */ + * activation request, so let's skip creating the stable address anew. */ goto out_no_action; } @@ -17430,7 +17430,7 @@ nm_device_hw_addr_reset(NMDevice *self, const char *detail) addr = nm_device_get_initial_hw_address(self); if (!addr) { /* as hw_addr_type is not UNSET, we expect that we can get an - * initial address to which to reset. */ + * initial address to which to reset. */ g_return_val_if_reached(FALSE); } @@ -17450,8 +17450,8 @@ nm_device_get_permanent_hw_address_full(NMDevice *self, if (!priv->hw_addr_perm && force_freeze) { /* somebody requests a permanent MAC address, but we don't have it set - * yet. We cannot delay it any longer and try to get it without waiting - * for UDEV. */ + * yet. We cannot delay it any longer and try to get it without waiting + * for UDEV. */ nm_device_update_permanent_hw_address(self, TRUE); } @@ -17649,8 +17649,8 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) switch (prop_id) { case PROP_UDI: /* UDI is (depending on the device type) a path to sysfs and can contain - * non-UTF-8. - * ip link add name $'d\xccf\\c' type dummy */ + * non-UTF-8. + * ip link add name $'d\xccf\\c' type dummy */ g_value_take_string( value, nm_utils_str_utf8safe_escape_cp(priv->udi, NM_UTILS_STR_UTF8_SAFE_FLAG_NONE)); @@ -18177,8 +18177,8 @@ dispose(GObject *object) if (nm_clear_g_source(&priv->queued_state.id)) { /* FIXME: we'd expect the queud_state to be already cleared and this statement - * not being necessary. Add this check here to hopefully investigate crash - * rh#1270247. */ + * not being necessary. Add this check here to hopefully investigate crash + * rh#1270247. */ g_return_if_reached(); } } @@ -18217,7 +18217,7 @@ finalize(GObject *object) G_OBJECT_CLASS(nm_device_parent_class)->finalize(object); /* for testing, NMDeviceTest does not invoke NMDevice::constructed, - * and thus @settings might be unset. */ + * and thus @settings might be unset. */ nm_g_object_unref(priv->settings); nm_g_object_unref(priv->manager); diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h index 39567ef3a3..cc3f281070 100644 --- a/src/devices/nm-device.h +++ b/src/devices/nm-device.h @@ -22,10 +22,10 @@ typedef enum _nm_packed { NM_DEVICE_SYS_IFACE_STATE_MANAGED, /* the REMOVED state applies when the device is manually set to unmanaged - * or the link was externally removed. In both cases, we move the device - * to UNMANAGED state, without touching the link -- be it, because the link - * is already gone or because we want to release it (give it up). - */ + * or the link was externally removed. In both cases, we move the device + * to UNMANAGED state, without touching the link -- be it, because the link + * is already gone or because we want to release it (give it up). + */ NM_DEVICE_SYS_IFACE_STATE_REMOVED, } NMDeviceSysIfaceState; @@ -40,15 +40,15 @@ static inline NMDeviceStateReason nm_device_state_reason_check(NMDeviceStateReason reason) { /* the device-state-reason serves mostly informational purpose during a state - * change. In some cases however, decisions are made based on the reason. - * I tend to think that interpreting the state reason to derive some behaviors - * is confusing, because the cause and effect are so far apart. - * - * This function is here to mark source that inspects the reason to make - * a decision -- contrary to places that set the reason. Thus, by grepping - * for nm_device_state_reason_check() you can find the "effect" to a certain - * reason. - */ + * change. In some cases however, decisions are made based on the reason. + * I tend to think that interpreting the state reason to derive some behaviors + * is confusing, because the cause and effect are so far apart. + * + * This function is here to mark source that inspects the reason to make + * a decision -- contrary to places that set the reason. Thus, by grepping + * for nm_device_state_reason_check() you can find the "effect" to a certain + * reason. + */ return reason; } @@ -153,24 +153,24 @@ typedef enum { /*< skip >*/ NM_DEVICE_CHECK_CON_AVAILABLE_NONE = 0, /* since NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST is a collection of flags with more fine grained - * parts, this flag in general indicates that this is a user-request. */ + * parts, this flag in general indicates that this is a user-request. */ _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST = (1L << 0), /* we also consider devices which have no carrier but are still waiting for the driver - * to detect carrier. Usually, such devices are not yet available, however for a user-request - * they are. They might fail later if carrier doesn't come. */ + * to detect carrier. Usually, such devices are not yet available, however for a user-request + * they are. They might fail later if carrier doesn't come. */ _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST_WAITING_CARRIER = (1L << 1), /* usually, a profile is only available if the Wi-Fi AP is in range. For an - * explicit user request, we also consider profiles for APs that are not (yet) - * visible. */ + * explicit user request, we also consider profiles for APs that are not (yet) + * visible. */ _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST_IGNORE_AP = (1L << 2), /* a device can be marked as unmanaged for various reasons. Some of these reasons - * are authoritative, others not. Non-authoritative reasons can be overruled by - * `nmcli device set $DEVICE managed yes`. Also, for an explicit user activation - * request we may want to consider the device as managed. This flag makes devices - * that are unmanaged appear available. */ + * are authoritative, others not. Non-authoritative reasons can be overruled by + * `nmcli device set $DEVICE managed yes`. Also, for an explicit user activation + * request we may want to consider the device as managed. This flag makes devices + * that are unmanaged appear available. */ _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST_OVERRULE_UNMANAGED = (1L << 3), /* a collection of flags, that are commonly set for an explicit user-request. */ @@ -197,9 +197,9 @@ typedef enum { /*< skip >*/ NM_DEVICE_CHECK_DEV_AVAILABLE_NONE = 0, /* the device is considered available, even if it has no carrier. - * - * For various device types (software devices) we ignore carrier based - * on the type. So, for them, this flag has no effect anyway. */ + * + * For various device types (software devices) we ignore carrier based + * on the type. So, for them, this flag has no effect anyway. */ _NM_DEVICE_CHECK_DEV_AVAILABLE_IGNORE_CARRIER = (1L << 0), NM_DEVICE_CHECK_DEV_AVAILABLE_FOR_USER_REQUEST = @@ -219,17 +219,17 @@ typedef struct _NMDeviceClass { const char *connection_type_supported; /* most device types, can only handle profiles of a particular type. This - * is the connection.type setting, as checked by nm_device_check_connection_compatible() */ + * is the connection.type setting, as checked by nm_device_check_connection_compatible() */ const char *connection_type_check_compatible; const NMLinkType *link_types; /* if the device MTU is set based on parent's one, this specifies - * a delta in the MTU allowed value due the encapsulation overhead */ + * a delta in the MTU allowed value due the encapsulation overhead */ guint16 mtu_parent_delta; /* Whether the device type is a master-type. This depends purely on the - * type (NMDeviceClass), not the actual device instance. */ + * type (NMDeviceClass), not the actual device instance. */ bool is_master : 1; void (*state_changed)(NMDevice * device, @@ -240,22 +240,22 @@ typedef struct _NMDeviceClass { void (*link_changed)(NMDevice *self, const NMPlatformLink *pllink); /** - * create_and_realize(): - * @self: the #NMDevice - * @connection: the #NMConnection being activated - * @parent: the parent #NMDevice, if any - * @out_plink: on success, a backing kernel network device if one exists. - * The returned pointer is owned by platform and only valid until the - * next platform operation. - * @error: location to store error, or %NULL - * - * Create any backing resources (kernel devices, etc) required for this - * device to activate @connection. If the device is backed by a kernel - * network device, that device should be returned in @out_plink after - * being created. - * - * Returns: %TRUE on success, %FALSE on error - */ + * create_and_realize(): + * @self: the #NMDevice + * @connection: the #NMConnection being activated + * @parent: the parent #NMDevice, if any + * @out_plink: on success, a backing kernel network device if one exists. + * The returned pointer is owned by platform and only valid until the + * next platform operation. + * @error: location to store error, or %NULL + * + * Create any backing resources (kernel devices, etc) required for this + * device to activate @connection. If the device is backed by a kernel + * network device, that device should be returned in @out_plink after + * being created. + * + * Returns: %TRUE on success, %FALSE on error + */ gboolean (*create_and_realize)(NMDevice * self, NMConnection * connection, NMDevice * parent, @@ -263,32 +263,32 @@ typedef struct _NMDeviceClass { GError ** error); /** - * realize_start_notify(): - * @self: the #NMDevice - * @pllink: the #NMPlatformLink if backed by a kernel netdevice - * - * Hook for derived classes to be notfied during realize_start_setup() - * and perform additional setup. - * - * The default implementation of NMDevice calls link_changed(). - */ + * realize_start_notify(): + * @self: the #NMDevice + * @pllink: the #NMPlatformLink if backed by a kernel netdevice + * + * Hook for derived classes to be notfied during realize_start_setup() + * and perform additional setup. + * + * The default implementation of NMDevice calls link_changed(). + */ void (*realize_start_notify)(NMDevice *self, const NMPlatformLink *pllink); /** - * unrealize(): - * @self: the #NMDevice - * - * Remove the device backing resources. - */ + * unrealize(): + * @self: the #NMDevice + * + * Remove the device backing resources. + */ gboolean (*unrealize)(NMDevice *self, GError **error); /** - * unrealize_notify(): - * @self: the #NMDevice - * - * Hook for derived classes to clear any properties that depend on backing resources - * (kernel devices, etc). This is called by nm_device_unrealize() during unrealization. - */ + * unrealize_notify(): + * @self: the #NMDevice + * + * Hook for derived classes to clear any properties that depend on backing resources + * (kernel devices, etc). This is called by nm_device_unrealize() during unrealization. + */ void (*unrealize_notify)(NMDevice *self); /* Hardware state (IFF_UP) */ @@ -308,14 +308,14 @@ typedef struct _NMDeviceClass { void (*set_enabled)(NMDevice *self, gboolean enabled); /* let the subclass return additional NMPlatformRoutingRule (in form of NMPObject - * pointers) that shall be added to the rules provided by this device. - * The returned GPtrArray will be g_ptr_array_unref()'ed. The subclass may or - * may not keep an additional reference and return this array again and again. */ + * pointers) that shall be added to the rules provided by this device. + * The returned GPtrArray will be g_ptr_array_unref()'ed. The subclass may or + * may not keep an additional reference and return this array again and again. */ GPtrArray *(*get_extra_rules)(NMDevice *self); /* allow derived classes to override the result of nm_device_autoconnect_allowed(). - * If the value changes, the class should call nm_device_emit_recheck_auto_activate(), - * which emits NM_DEVICE_RECHECK_AUTO_ACTIVATE signal. */ + * If the value changes, the class should call nm_device_emit_recheck_auto_activate(), + * which emits NM_DEVICE_RECHECK_AUTO_ACTIVATE signal. */ gboolean (*get_autoconnect_allowed)(NMDevice *self); gboolean (*can_auto_connect)(NMDevice * self, @@ -327,7 +327,7 @@ typedef struct _NMDeviceClass { gboolean * out_force); /* allow the subclass to overwrite the routing table. This is mainly useful - * to change from partial mode (route-table=0) to full-sync mode (route-table=254). */ + * to change from partial mode (route-table=0) to full-sync mode (route-table=254). */ guint32 (*coerce_route_table)(NMDevice *self, int addr_family, guint32 route_table, @@ -336,24 +336,24 @@ typedef struct _NMDeviceClass { const char *(*get_auto_ip_config_method)(NMDevice *self, int addr_family); /* Checks whether the connection is compatible with the device using - * only the devices type and characteristics. Does not use any live - * network information like Wi-Fi scan lists etc. - */ + * only the devices type and characteristics. Does not use any live + * network information like Wi-Fi scan lists etc. + */ gboolean (*check_connection_compatible)(NMDevice * self, NMConnection *connection, GError ** error); /* Checks whether the connection is likely available to be activated, - * including any live network information like scan lists. The connection - * is checked against the object defined by @specific_object, if given. - * Returns TRUE if the connection is available; FALSE if not. - * - * The passed @flags affect whether a connection is considered - * available or not. Adding more flags, means the connection is - * *more* available. - * - * Specifying @specific_object can only reduce the availability of a connection. - */ + * including any live network information like scan lists. The connection + * is checked against the object defined by @specific_object, if given. + * Returns TRUE if the connection is available; FALSE if not. + * + * The passed @flags affect whether a connection is considered + * available or not. Adding more flags, means the connection is + * *more* available. + * + * Specifying @specific_object can only reduce the availability of a connection. + */ gboolean (*check_connection_available)(NMDevice * self, NMConnection * connection, NMDeviceCheckConAvailableFlags flags, @@ -438,8 +438,8 @@ typedef struct _NMDeviceClass { gboolean (*set_platform_mtu)(NMDevice *self, guint32 mtu); /* Control whether to call stage1 and stage2 callbacks also for assuming - * a device or for external activations. In this case, the callback must - * take care not to touch the device's configuration. */ + * a device or for external activations. In this case, the callback must + * take care not to touch the device's configuration. */ bool act_stage1_prepare_also_for_external_or_assume : 1; bool act_stage2_config_also_for_external_or_assume : 1; @@ -460,7 +460,7 @@ static inline const char * _nm_device_get_iface(NMDevice *device) { /* like nm_device_get_iface(), but gracefully accept NULL without - * asserting. */ + * asserting. */ return device ? nm_device_get_iface(device) : NULL; } @@ -617,7 +617,7 @@ typedef enum { /*< skip >*/ NM_UNMANAGED_NONE = 0, /* these flags are authoritative. If one of them is set, - * the device cannot be managed. */ + * the device cannot be managed. */ NM_UNMANAGED_SLEEPING = (1LL << 0), NM_UNMANAGED_QUITTING = (1LL << 1), NM_UNMANAGED_PARENT = (1LL << 2), @@ -627,7 +627,7 @@ typedef enum { /*< skip >*/ NM_UNMANAGED_USER_SETTINGS = (1LL << 6), /* These flags can be non-effective and be overwritten - * by other flags. */ + * by other flags. */ NM_UNMANAGED_BY_DEFAULT = (1LL << 8), NM_UNMANAGED_USER_CONF = (1LL << 9), NM_UNMANAGED_USER_UDEV = (1LL << 10), diff --git a/src/devices/nm-lldp-listener.c b/src/devices/nm-lldp-listener.c index 20fbd195e6..0b70ce1cc7 100644 --- a/src/devices/nm-lldp-listener.c +++ b/src/devices/nm-lldp-listener.c @@ -288,16 +288,16 @@ parse_management_address_tlv(const uint8_t *data, gsize len) guint32 v_address_subtype; /* 802.1AB-2009 - Figure 8-11 - * - * - TLV type / length (2 bytes) - * - address string length (1 byte) - * - address subtype (1 byte) - * - address (1 to 31 bytes) - * - interface number subtype (1 byte) - * - interface number (4 bytes) - * - OID string length (1 byte) - * - OID (0 to 128 bytes) - */ + * + * - TLV type / length (2 bytes) + * - address string length (1 byte) + * - address subtype (1 byte) + * - address (1 to 31 bytes) + * - interface number subtype (1 byte) + * - interface number (4 bytes) + * - OID string length (1 byte) + * - OID (0 to 128 bytes) + */ if (len < 11) return NULL; @@ -449,8 +449,8 @@ lldp_neighbor_new(sd_lldp_neighbor *neighbor_sd) } if (!s_chassis_id) { /* Invalid/unsupported chassis_id? Expose as hex string. This format is not stable, and - * in the future we may add a better string representation for these case (thus - * changing the API). */ + * in the future we may add a better string representation for these case (thus + * changing the API). */ s_chassis_id = nm_utils_bin2hexstr_full(chassis_id, chassis_id_len, '\0', FALSE, NULL); } @@ -470,8 +470,8 @@ lldp_neighbor_new(sd_lldp_neighbor *neighbor_sd) } if (!s_port_id) { /* Invalid/unsupported port_id? Expose as hex string. This format is not stable, and - * in the future we may add a better string representation for these case (thus - * changing the API). */ + * in the future we may add a better string representation for these case (thus + * changing the API). */ s_port_id = nm_utils_bin2hexstr_full(port_id, port_id_len, '\0', FALSE, NULL); } @@ -594,7 +594,7 @@ lldp_neighbor_to_variant(LldpNeighbor *neigh) continue; /* in other cases, something is seriously wrong. Abort, but - * keep what we parsed so far. */ + * keep what we parsed so far. */ break; } diff --git a/src/devices/ovs/nm-device-ovs-bridge.c b/src/devices/ovs/nm-device-ovs-bridge.c index 2c2c559977..b5477cee1a 100644 --- a/src/devices/ovs/nm-device-ovs-bridge.c +++ b/src/devices/ovs/nm-device-ovs-bridge.c @@ -45,7 +45,7 @@ create_and_realize(NMDevice * device, GError ** error) { /* The actual backing resources will be created on enslavement by the port - * when it can identify the port and the bridge. */ + * when it can identify the port and the bridge. */ return TRUE; } diff --git a/src/devices/ovs/nm-device-ovs-interface.c b/src/devices/ovs/nm-device-ovs-interface.c index fa97dfb6e2..b976d3d509 100644 --- a/src/devices/ovs/nm-device-ovs-interface.c +++ b/src/devices/ovs/nm-device-ovs-interface.c @@ -53,8 +53,8 @@ create_and_realize(NMDevice * device, GError ** error) { /* The actual backing resources will be created once an interface is - * added to a port of ours, since there can be neither an empty port nor - * an empty bridge. */ + * added to a port of ours, since there can be neither an empty port nor + * an empty bridge. */ return TRUE; } @@ -151,14 +151,14 @@ static gboolean set_platform_mtu(NMDevice *device, guint32 mtu) { /* - * If the MTU is not set in ovsdb, Open vSwitch will change - * the MTU of an internal interface to match the minimum of - * the other interfaces in the bridge. - */ + * If the MTU is not set in ovsdb, Open vSwitch will change + * the MTU of an internal interface to match the minimum of + * the other interfaces in the bridge. + */ /* FIXME(shutdown): the function should become cancellable so - * that it doesn't need to hold a reference to the device, and - * it can be stopped during shutdown. - */ + * that it doesn't need to hold a reference to the device, and + * it can be stopped during shutdown. + */ if (_is_internal_interface(device)) { nm_ovsdb_set_interface_mtu(nm_ovsdb_get(), nm_device_get_ip_iface(device), @@ -302,11 +302,11 @@ deactivate_async(NMDevice * device, _LOGT(LOGD_CORE, "deactivate: start async"); /* We want to ensure that the kernel link for this device is - * removed upon disconnection so that it will not interfere with - * later activations of the same device. Unfortunately there is - * no synchronization mechanism with vswitchd, we only update - * ovsdb and wait that changes are picked up. - */ + * removed upon disconnection so that it will not interfere with + * later activations of the same device. Unfortunately there is + * no synchronization mechanism with vswitchd, we only update + * ovsdb and wait that changes are picked up. + */ data = g_slice_new(DeactivateData); *data = (DeactivateData){ @@ -327,11 +327,11 @@ deactivate_async(NMDevice * device, if (priv->waiting_for_interface) { /* At this point we have issued an INSERT and a DELETE - * command for the interface to ovsdb. We don't know if - * vswitchd will see the two updates or only one. We - * must add a timeout to avoid waiting forever in case - * the link doesn't appear. - */ + * command for the interface to ovsdb. We don't know if + * vswitchd will see the two updates or only one. We + * must add a timeout to avoid waiting forever in case + * the link doesn't appear. + */ data->link_timeout_id = g_timeout_add(6000, deactivate_link_timeout, data); _LOGT(LOGD_DEVICE, "deactivate: waiting for link to disappear in 6 seconds"); } else @@ -349,10 +349,10 @@ static gboolean can_update_from_platform_link(NMDevice *device, const NMPlatformLink *plink) { /* If the device is deactivating, we already sent the - * deletion command to ovsdb and we don't want to deal - * with any new link appearing from the previous - * activation. - */ + * deletion command to ovsdb and we don't want to deal + * with any new link appearing from the previous + * activation. + */ return !plink || nm_device_get_state(device) != NM_DEVICE_STATE_DEACTIVATING; } diff --git a/src/devices/ovs/nm-device-ovs-port.c b/src/devices/ovs/nm-device-ovs-port.c index 4717be172a..59ca5ddafc 100644 --- a/src/devices/ovs/nm-device-ovs-port.c +++ b/src/devices/ovs/nm-device-ovs-port.c @@ -46,7 +46,7 @@ create_and_realize(NMDevice * device, GError ** error) { /* The port will be added to ovsdb when an interface is enslaved, - * because there's no such thing like an empty port. */ + * because there's no such thing like an empty port. */ return TRUE; } @@ -148,7 +148,7 @@ release_slave(NMDevice *device, NMDevice *slave, gboolean configure) del_iface_cb, g_object_ref(slave)); /* Open VSwitch is going to delete this one. We must ignore what happens - * next with the interface. */ + * next with the interface. */ if (NM_IS_DEVICE_OVS_INTERFACE(slave)) nm_device_update_from_platform_link(slave, NULL); } else diff --git a/src/devices/ovs/nm-ovs-factory.c b/src/devices/ovs/nm-ovs-factory.c index 0513784f7d..db2165836c 100644 --- a/src/devices/ovs/nm-ovs-factory.c +++ b/src/devices/ovs/nm-ovs-factory.c @@ -167,8 +167,8 @@ ovsdb_interface_failed(NMOvsdb * ovsdb, } /* The patch interface which gets created first is expected to - * fail because the second patch doesn't exist yet. Ignore all - * failures of patch interfaces. */ + * fail because the second patch doesn't exist yet. Ignore all + * failures of patch interfaces. */ if (connection && (c = nm_settings_connection_get_connection(connection)) && (type = nm_connection_get_connection_type(c)) && nm_streq0(type, NM_SETTING_OVS_INTERFACE_SETTING_NAME) diff --git a/src/devices/ovs/nm-ovsdb.c b/src/devices/ovs/nm-ovsdb.c index aa3977ec7c..3cbc6d2272 100644 --- a/src/devices/ovs/nm-ovsdb.c +++ b/src/devices/ovs/nm-ovsdb.c @@ -1170,7 +1170,7 @@ ovsdb_got_update(NMOvsdb *self, json_t *msg) &interface) == -1) { /* This doesn't really have to be an error; the key might - * be missing if there really are no bridges present. */ + * be missing if there really are no bridges present. */ _LOGD("Bad update: %s", json_error.text); } @@ -1216,7 +1216,7 @@ ovsdb_got_update(NMOvsdb *self, json_t *msg) ovs_interface->connection_uuid ?: ""); if (g_strcmp0(ovs_interface->type, "internal") == 0) { /* Currently, the factory only creates NMDevices for - * internal interfaces. Ignore the rest. */ + * internal interfaces. Ignore the rest. */ g_signal_emit(self, signals[DEVICE_REMOVED], 0, @@ -1247,7 +1247,7 @@ ovsdb_got_update(NMOvsdb *self, json_t *msg) ovs_interface->connection_uuid ?: ""); if (g_strcmp0(ovs_interface->type, "internal") == 0) { /* Currently, the factory only creates NMDevices for - * internal interfaces. Ignore the rest. */ + * internal interfaces. Ignore the rest. */ g_signal_emit(self, signals[DEVICE_ADDED], 0, @@ -1256,7 +1256,7 @@ ovsdb_got_update(NMOvsdb *self, json_t *msg) } } /* The error is a string. No error is indicated by an empty set, - * because why the fuck not: [ "set": [] ] */ + * because why the fuck not: [ "set": [] ] */ if (error && json_is_string(error)) { g_signal_emit(self, signals[INTERFACE_FAILED], @@ -1524,7 +1524,7 @@ ovsdb_got_msg(NMOvsdb *self, json_t *msg) priv->num_failures = 0; /* Don't progress further commands in case the callback hit an error - * and disconnected us. */ + * and disconnected us. */ if (!priv->conn) return; @@ -1594,8 +1594,8 @@ ovsdb_read_cb(GObject *source_object, GAsyncResult *res, gpointer user_data) do { priv->bufp = 0; /* The callback always eats up only up to a single byte. This makes - * it possible for us to identify complete JSON objects in spite of - * us not knowing the length in advance. */ + * it possible for us to identify complete JSON objects in spite of + * us not knowing the length in advance. */ msg = json_load_callback(_json_callback, self, JSON_DISABLE_EOF_CHECK, &json_error); if (msg) { ovsdb_got_msg(self, msg); @@ -1741,7 +1741,7 @@ _monitor_bridges_cb(NMOvsdb *self, json_t *result, GError *error, gpointer user_ } /* Treat the first response the same as the subsequent "update" - * messages we eventually get. */ + * messages we eventually get. */ ovsdb_got_update(self, result); } @@ -1801,7 +1801,7 @@ ovsdb_try_connect(NMOvsdb *self) g_object_unref(addr); /* Queue a monitor call before any other command, ensuring that we have an up - * to date view of existing bridged that we need for add and remove ops. */ + * to date view of existing bridged that we need for add and remove ops. */ ovsdb_call_method(self, OVSDB_MONITOR, NULL, diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c index c7b5b88b1b..110b22082f 100644 --- a/src/devices/team/nm-device-team.c +++ b/src/devices/team/nm-device-team.c @@ -340,8 +340,8 @@ teamd_timeout_cb(gpointer user_data) NM_DEVICE_STATE_REASON_TEAMD_CONTROL_FAILED); } else { /* Read again the configuration after the timeout since it might - * have changed. - */ + * have changed. + */ if (!teamd_read_config(self)) { _LOGW(LOGD_TEAM, "failed to read teamd configuration"); nm_device_state_changed(device, @@ -362,16 +362,16 @@ teamd_ready(NMDeviceTeam *self) if (priv->kill_in_progress) { /* If we are currently killing teamd, we are not - * interested in knowing when it becomes ready. */ + * interested in knowing when it becomes ready. */ return; } nm_device_queue_recheck_assume(device); /* Grab a teamd control handle even if we aren't going to use it - * immediately. But if we are, and grabbing it failed, fail the - * device activation. - */ + * immediately. But if we are, and grabbing it failed, fail the + * device activation. + */ success = ensure_teamd_connection(device); if (nm_device_get_state(device) != NM_DEVICE_STATE_PREPARE @@ -426,8 +426,8 @@ teamd_dbus_appeared(GDBusConnection *connection, _LOGI(LOGD_TEAM, "teamd appeared on D-Bus"); /* If another teamd grabbed the bus name while our teamd was starting, - * just ignore the death of our teamd and run with the existing one. - */ + * just ignore the death of our teamd and run with the existing one. + */ if (priv->teamd_process_watch) { gs_unref_variant GVariant *ret = NULL; guint32 pid; @@ -450,11 +450,11 @@ teamd_dbus_appeared(GDBusConnection *connection, teamd_cleanup(self, FALSE); } else { /* The process that registered on the bus died. If it's - * the teamd instance we just started, ignore the event - * as we already detect the failure through the process - * watch. If it's a previous instance that got killed, - * also ignore that as our new instance will register - * again. */ + * the teamd instance we just started, ignore the event + * as we already detect the failure through the process + * watch. If it's a previous instance that got killed, + * also ignore that as our new instance will register + * again. */ _LOGD(LOGD_TEAM, "failed to determine D-Bus name owner, ignoring"); return; } @@ -473,9 +473,9 @@ teamd_dbus_vanished(GDBusConnection *dbus_connection, const char *name, gpointer if (!priv->tdc) { /* g_bus_watch_name will always raise an initial signal, to indicate whether the - * name exists/not exists initially. Do not take this as a failure if it hadn't - * previously appeared. - */ + * name exists/not exists initially. Do not take this as a failure if it hadn't + * previously appeared. + */ _LOGD(LOGD_TEAM, "teamd not on D-Bus (ignored)"); return; } @@ -522,8 +522,8 @@ teamd_process_watch_cb(GPid pid, int status, gpointer user_data) priv->teamd_process_watch = 0; /* If teamd quit within 5 seconds of starting, it's probably hosed - * and will just die again, so fail the activation. - */ + * and will just die again, so fail the activation. + */ if (priv->teamd_timeout && (state >= NM_DEVICE_STATE_PREPARE) && (state <= NM_DEVICE_STATE_ACTIVATED)) { _LOGW(LOGD_TEAM, @@ -658,7 +658,7 @@ teamd_start(NMDeviceTeam *self) json_error_t jerror; /* Inject the hwaddr property into the JSON configuration. - * While doing so, detect potential conflicts */ + * While doing so, detect potential conflicts */ json = json_loads(config ?: "{}", JSON_REJECT_DUPLICATES, &jerror); g_return_val_if_fail(json, FALSE); @@ -749,10 +749,10 @@ act_stage1_prepare(NMDevice *device, NMDeviceStateReason *out_failure_reason) if (priv->tdc) { /* If the existing teamd config is the same as we're about to use, - * then we can proceed. If it's not the same, and we have a PID, - * kill it so we can respawn it with the right config. If we don't - * have a PID, then we must fail. - */ + * then we can proceed. If it's not the same, and we have a PID, + * kill it so we can respawn it with the right config. If we don't + * have a PID, then we must fail. + */ cfg = teamdctl_config_get_raw(priv->tdc); if (cfg && nm_streq0(cfg, nm_setting_team_get_config(s_team))) { _LOGD(LOGD_TEAM, "using existing matching teamd config"); @@ -894,9 +894,9 @@ release_slave(NMDevice *device, NMDevice *slave, gboolean configure) _LOGW(LOGD_TEAM, "failed to release team port %s", nm_device_get_ip_iface(slave)); /* Kernel team code "closes" the port when releasing it, (which clears - * IFF_UP), so we must bring it back up here to ensure carrier changes and - * other state is noticed by the now-released port. - */ + * IFF_UP), so we must bring it back up here to ensure carrier changes and + * other state is noticed by the now-released port. + */ if (!nm_device_bring_up(slave, TRUE, NULL)) { _LOGW(LOGD_TEAM, "released team port %s could not be brought up", diff --git a/src/devices/tests/test-acd.c b/src/devices/tests/test-acd.c index f11188202e..e7dd1f4413 100644 --- a/src/devices/tests/test-acd.c +++ b/src/devices/tests/test-acd.c @@ -115,9 +115,9 @@ test_acd_common(test_fixture *fixture, TestInfo *info) return; /* first, try with a short waittime. We hope that this is long enough - * to successfully complete the test. Only if that's not the case, we - * assume the computer is currently busy (high load) and we retry with - * a longer timeout. */ + * to successfully complete the test. Only if that's not the case, we + * assume the computer is currently busy (high load) and we retry with + * a longer timeout. */ wait_time = WAIT_TIME_OPTIMISTIC; again: @@ -163,7 +163,7 @@ again: if (wait_time == WAIT_TIME_OPTIMISTIC) { /* probably we just had a glitch and the system took longer than - * expected. Re-verify with a large timeout this time. */ + * expected. Re-verify with a large timeout this time. */ wait_time = 1000; goto again; } diff --git a/src/devices/tests/test-lldp.c b/src/devices/tests/test-lldp.c index 9ac577331a..a9bedd8cc8 100644 --- a/src/devices/tests/test-lldp.c +++ b/src/devices/tests/test-lldp.c @@ -227,7 +227,7 @@ TEST_RECV_DATA_DEFINE(_test_recv_data0_twice, TEST_RECV_FRAME_DEFINE( _test_recv_data1_frame0, /* lldp.detailed.pcap from - * https://wiki.wireshark.org/SampleCaptures#Link_Layer_Discovery_Protocol_.28LLDP.29 */ + * https://wiki.wireshark.org/SampleCaptures#Link_Layer_Discovery_Protocol_.28LLDP.29 */ "{'raw': <[byte 0x01, 0x80, 0xc2, 0x00, 0x00, 0x0e, 0x00, 0x01, 0x30, 0xf9, 0xad, 0xa0, 0x88, " "0xcc, 0x02, 0x07, 0x04, 0x00, 0x01, 0x30, 0xf9, 0xad, 0xa0, 0x04, 0x04, 0x05, 0x31, 0x2f, " "0x31, 0x06, 0x02, 0x00, 0x78, 0x08, 0x17, 0x53, 0x75, 0x6d, 0x6d, 0x69, 0x74, 0x33, 0x30, " diff --git a/src/devices/wifi/nm-device-iwd.c b/src/devices/wifi/nm-device-iwd.c index a56a491fac..8e22fcc230 100644 --- a/src/devices/wifi/nm-device-iwd.c +++ b/src/devices/wifi/nm-device-iwd.c @@ -244,13 +244,13 @@ insert_ap_from_network(NMDeviceIwd *self, } /* What we get from IWD are networks, or ESSs, that may contain - * multiple APs, or BSSs, each. We don't get information about any - * specific BSSs within an ESS but we can safely present each ESS - * as an individual BSS to NM, which will be seen as ESSs comprising - * a single BSS each. NM won't be able to handle roaming but IWD - * already does that. We fake the BSSIDs as they don't play any - * role either. - */ + * multiple APs, or BSSs, each. We don't get information about any + * specific BSSs within an ESS but we can safely present each ESS + * as an individual BSS to NM, which will be seen as ESSs comprising + * a single BSS each. NM won't be able to handle roaming but IWD + * already does that. We fake the BSSIDs as they don't play any + * role either. + */ bssid[0] = 0x00; bssid[1] = 0x01; bssid[2] = 0x02; @@ -308,9 +308,9 @@ get_ordered_networks_cb(GObject *source, GAsyncResult *res, gpointer user_data) priv = NM_DEVICE_IWD_GET_PRIVATE(self); /* Depending on whether we're using the Station interface or the Device - * interface for compatibility with IWD <= 0.7, the return signature of - * GetOrderedNetworks will be different. - */ + * interface for compatibility with IWD <= 0.7, the return signature of + * GetOrderedNetworks will be different. + */ compat = priv->dbus_station_proxy == priv->dbus_device_proxy; return_sig = compat ? "(a(osns))" : "(a(on))"; @@ -350,9 +350,9 @@ get_ordered_networks_cb(GObject *source, GAsyncResult *res, gpointer user_data) if (ap == priv->current_ap) { /* Normally IWD will prevent the current AP from being - * removed from the list and set a low signal strength, - * but just making sure. - */ + * removed from the list and set a low signal strength, + * but just making sure. + */ continue; } @@ -643,8 +643,8 @@ check_connection_compatible(NMDevice *device, NMConnection *connection, GError * if (NM_IN_STRSET(mode, NULL, NM_SETTING_WIRELESS_MODE_INFRA)) { /* 8021x networks can only be used if they've been provisioned on the IWD side and - * thus are Known Networks. - */ + * thus are Known Networks. + */ if (security == NM_IWD_NETWORK_SECURITY_8021X) { if (!is_connection_known_network(connection)) { nm_utils_error_set_literal(error, @@ -717,7 +717,7 @@ check_connection_available(NMDevice * device, g_return_val_if_fail(s_wifi, FALSE); /* a connection that is available for a certain @specific_object, MUST - * also be available in general (without @specific_object). */ + * also be available in general (without @specific_object). */ if (specific_object) { ap = nm_wifi_ap_lookup_for_device(NM_DEVICE(self), specific_object); @@ -754,8 +754,8 @@ check_connection_available(NMDevice * device, } /* 8021x networks can only be used if they've been provisioned on the IWD side and - * thus are Known Networks. - */ + * thus are Known Networks. + */ if (nm_wifi_connection_get_iwd_security(connection, NULL) == NM_IWD_NETWORK_SECURITY_8021X) { if (!is_ap_known_network(ap)) { nm_utils_error_set_literal( @@ -818,9 +818,9 @@ complete_connection(NMDevice * device, ap = nm_wifi_aps_find_first_compatible(&priv->aps_lst_head, connection); if (!ap) { /* If we still don't have an AP, then the WiFI settings needs to be - * fully specified by the client. Might not be able to find an AP - * if the network isn't broadcasting the SSID for example. - */ + * fully specified by the client. Might not be able to find an AP + * if the network isn't broadcasting the SSID for example. + */ if (!nm_setting_verify(NM_SETTING(s_wifi), connection, error)) return FALSE; @@ -916,14 +916,14 @@ is_available(NMDevice *device, NMDeviceCheckDevAvailableFlags flags) NMDeviceState state = nm_device_get_state(device); /* Available if either the device is UP and in station mode - * or in AP/Ad-Hoc modes while activating or activated. Device - * may be temporarily DOWN while activating or deactivating and - * we don't want it to be marked unavailable because of this. - * - * For reference: - * We call nm_device_queue_recheck_available whenever - * priv->enabled changes or priv->dbus_station_proxy changes. - */ + * or in AP/Ad-Hoc modes while activating or activated. Device + * may be temporarily DOWN while activating or deactivating and + * we don't want it to be marked unavailable because of this. + * + * For reference: + * We call nm_device_queue_recheck_available whenever + * priv->enabled changes or priv->dbus_station_proxy changes. + */ return priv->dbus_obj && priv->enabled && (priv->dbus_station_proxy || (state >= NM_DEVICE_STATE_CONFIG && state <= NM_DEVICE_STATE_DEACTIVATING)); @@ -959,16 +959,16 @@ can_auto_connect(NMDevice *device, NMSettingsConnection *sett_conn, char **speci g_return_val_if_fail(s_wifi, FALSE); /* Don't auto-activate AP or Ad-Hoc connections. - * Note the wpa_supplicant backend has the opposite policy. - */ + * Note the wpa_supplicant backend has the opposite policy. + */ mode = nm_setting_wireless_get_mode(s_wifi); if (mode && g_strcmp0(mode, NM_SETTING_WIRELESS_MODE_INFRA) != 0) return FALSE; /* Don't autoconnect to networks that have been tried at least once - * but haven't been successful, since these are often accidental choices - * from the menu and the user may not know the password. - */ + * but haven't been successful, since these are often accidental choices + * from the menu and the user may not know the password. + */ if (nm_settings_connection_get_timestamp(sett_conn, ×tamp)) { if (timestamp == 0) return FALSE; @@ -1008,10 +1008,10 @@ scan_cb(GObject *source, GAsyncResult *res, gpointer user_data) _notify(self, PROP_LAST_SCAN); /* On success, priv->scanning becomes true right before or right - * after this callback, so the next automatic scan will be - * scheduled when priv->scanning goes back to false. On error, - * schedule a retry now. - */ + * after this callback, so the next automatic scan will be + * scheduled when priv->scanning goes back to false. On error, + * schedule a retry now. + */ if (error && !priv->scanning) schedule_periodic_scan(self, FALSE); } @@ -1364,8 +1364,8 @@ network_connect_cb(GObject *source, GAsyncResult *res, gpointer user_data) gs_free char *dbus_error = NULL; /* Connection failed; radio problems or if the network wasn't - * open, the passwords or certificates may be wrong. - */ + * open, the passwords or certificates may be wrong. + */ _LOGE(LOGD_DEVICE | LOGD_WIFI, "Activation: (wifi) Network.Connect failed: %s", @@ -1449,9 +1449,9 @@ act_failed_cb(GObject *source, GAsyncResult *res, gpointer user_data) return; /* Change state to FAILED unless already done by state_changed - * which may have been triggered by the station interface - * appearing on DBus. - */ + * which may have been triggered by the station interface + * appearing on DBus. + */ if (nm_device_get_state(device) == NM_DEVICE_STATE_CONFIG) nm_device_queue_state(device, NM_DEVICE_STATE_FAILED, @@ -1636,10 +1636,10 @@ act_set_mode(NMDeviceIwd *self) mode = nm_setting_wireless_get_mode(s_wireless); /* We need to first set interface mode (Device.Mode) to ap or ad-hoc. - * We can't directly queue a call to the Start/StartOpen method on - * the DBus interface that's going to be created after the property - * set call returns. - */ + * We can't directly queue a call to the Start/StartOpen method on + * the DBus interface that's going to be created after the property + * set call returns. + */ iwd_mode = nm_streq(mode, NM_SETTING_WIRELESS_MODE_AP) ? "ap" : "ad-hoc"; if (!priv->cancellable) @@ -1767,11 +1767,11 @@ act_stage1_prepare(NMDevice *device, NMDeviceStateReason *out_failure_reason) add_new: /* If the user is trying to connect to an AP that NM doesn't yet know about - * (hidden network or something) or starting a Hotspot, create an fake AP - * from the security settings in the connection. This "fake" AP gets used - * until the real one is found in the scan list (Ad-Hoc or Hidden), or until - * the device is deactivated (Ad-Hoc or Hotspot). - */ + * (hidden network or something) or starting a Hotspot, create an fake AP + * from the security settings in the connection. This "fake" AP gets used + * until the real one is found in the scan list (Ad-Hoc or Hidden), or until + * the device is deactivated (Ad-Hoc or Hotspot). + */ ap_fake = nm_wifi_ap_new_fake_from_connection(connection); if (!ap_fake) g_return_val_if_reached(NM_ACT_STAGE_RETURN_FAILURE); @@ -1815,9 +1815,9 @@ act_stage2_config(NMDevice *device, NMDeviceStateReason *out_failure_reason) } /* 802.1x networks that are not IWD Known Networks will definitely - * fail, for other combinations we will let the Connect call fail - * or ask us for any missing secrets through the Agent. - */ + * fail, for other combinations we will let the Connect call fail + * or ask us for any missing secrets through the Agent. + */ if (nm_connection_get_setting_802_1x(connection) && !is_ap_known_network(ap)) { _LOGI(LOGD_DEVICE | LOGD_WIFI, "Activation: (wifi) access point '%s' has 802.1x security but is not configured " @@ -1869,8 +1869,8 @@ act_stage2_config(NMDevice *device, NMDeviceStateReason *out_failure_reason) priv->cancellable = g_cancellable_new(); /* Call Network.Connect. No timeout because IWD already handles - * timeouts. - */ + * timeouts. + */ g_dbus_proxy_call(network_proxy, "Connect", NULL, @@ -1963,16 +1963,16 @@ schedule_periodic_scan(NMDeviceIwd *self, gboolean initial_scan) g_variant_unref(value); /* Start scan immediately after a disconnect, mode change or - * device UP, otherwise wait a period dependent on the current - * state. - * - * (initial_scan && disconnected) override priv->scanning below - * because of an IWD quirk where a device will often be in the - * autoconnect state and scanning at the time of our initial_scan, - * but our logic will the send it a Disconnect() causing IWD to - * exit autoconnect and interrupt the ongoing scan, meaning that - * we still want a new scan ASAP. - */ + * device UP, otherwise wait a period dependent on the current + * state. + * + * (initial_scan && disconnected) override priv->scanning below + * because of an IWD quirk where a device will often be in the + * autoconnect state and scanning at the time of our initial_scan, + * but our logic will the send it a Disconnect() causing IWD to + * exit autoconnect and interrupt the ongoing scan, meaning that + * we still want a new scan ASAP. + */ if (initial_scan && disconnected) interval = 0; else if (!priv->periodic_scan_id && !priv->scanning) @@ -2011,10 +2011,10 @@ device_state_changed(NMDevice * device, break; case NM_DEVICE_STATE_UNAVAILABLE: /* - * If the device is enabled and the IWD manager is ready, - * transition to DISCONNECTED because the device is now - * ready to use. - */ + * If the device is enabled and the IWD manager is ready, + * transition to DISCONNECTED because the device is now + * ready to use. + */ if (priv->enabled && priv->dbus_station_proxy) { nm_device_queue_recheck_available(device, NM_DEVICE_STATE_REASON_SUPPLICANT_AVAILABLE, @@ -2176,11 +2176,11 @@ state_changed(NMDeviceIwd *self, const char *new_state) if (NM_IN_STRSET(new_state, "connecting", "connected", "roaming")) { /* If we were connecting, do nothing, the confirmation of - * a connection success is handled in the Device.Connect - * method return callback. Otherwise, IWD must have connected - * without Network Manager's will so for simplicity force a - * disconnect. - */ + * a connection success is handled in the Device.Connect + * method return callback. Otherwise, IWD must have connected + * without Network Manager's will so for simplicity force a + * disconnect. + */ if (iwd_connection) return; @@ -2188,17 +2188,17 @@ state_changed(NMDeviceIwd *self, const char *new_state) send_disconnect(self); } else if (NM_IN_STRSET(new_state, "disconnecting", "disconnected")) { /* Call Disconnect on the IWD device object to make sure it - * disables its own autoconnect. - */ + * disables its own autoconnect. + */ send_disconnect(self); /* - * If IWD is still handling the Connect call, let our Connect - * callback for the dbus method handle the failure. The main - * reason we can't handle the failure here is because the method - * callback will have more information on the specific failure - * reason. - */ + * If IWD is still handling the Connect call, let our Connect + * callback for the dbus method handle the failure. The main + * reason we can't handle the failure here is because the method + * callback will have more information on the specific failure + * reason. + */ if (NM_IN_SET(dev_state, NM_DEVICE_STATE_CONFIG, NM_DEVICE_STATE_NEED_AUTH)) return; @@ -2212,8 +2212,8 @@ state_changed(NMDeviceIwd *self, const char *new_state) } /* Don't allow new connection until iwd exits disconnecting and no - * Connect callback is pending. - */ + * Connect callback is pending. + */ if (NM_IN_STRSET(new_state, "disconnected")) { priv->can_connect = TRUE; if (!can_connect) @@ -2331,19 +2331,19 @@ powered_changed(NMDeviceIwd *self, gboolean new_powered) } /* We expect one of the three interfaces to always be present when - * device is Powered so if AP and AdHoc are not present we should - * be in station mode. - */ + * device is Powered so if AP and AdHoc are not present we should + * be in station mode. + */ if (new_powered && !priv->dbus_ap_proxy && !priv->dbus_adhoc_proxy) { interface = g_dbus_object_get_interface(priv->dbus_obj, NM_IWD_STATION_INTERFACE); if (!interface) { /* No Station interface on the device object. Check if the - * "State" property is present on the Device interface, that - * would mean we're dealing with an IWD version from before the - * Device/Station split (0.7 or earlier) and we can easily - * handle that by making priv->dbus_device_proxy and - * priv->dbus_station_proxy both point at the Device interface. - */ + * "State" property is present on the Device interface, that + * would mean we're dealing with an IWD version from before the + * Device/Station split (0.7 or earlier) and we can easily + * handle that by making priv->dbus_device_proxy and + * priv->dbus_station_proxy both point at the Device interface. + */ value = g_dbus_proxy_get_cached_property(priv->dbus_device_proxy, "State"); if (value) { g_variant_unref(value); @@ -2534,13 +2534,13 @@ nm_device_iwd_agent_query(NMDeviceIwd *self, GDBusMethodInvocation *invocation) return TRUE; /* Normally require new secrets every time IWD asks for them. - * IWD only queries us if it has not saved the secrets (e.g. by policy) - * or a previous attempt has failed with current secrets so it wants - * a fresh set. However if this is a new connection it may include - * all of the needed settings already so allow using these, too. - * Connection timestamp is set after activation or after first - * activation failure (to 0). - */ + * IWD only queries us if it has not saved the secrets (e.g. by policy) + * or a previous attempt has failed with current secrets so it wants + * a fresh set. However if this is a new connection it may include + * all of the needed settings already so allow using these, too. + * Connection timestamp is set after activation or after first + * activation failure (to 0). + */ if (nm_settings_connection_get_timestamp(nm_act_request_get_settings_connection(req), NULL)) get_secret_flags |= NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW; diff --git a/src/devices/wifi/nm-device-olpc-mesh.c b/src/devices/wifi/nm-device-olpc-mesh.c index 7cbfadf27a..6aa2586899 100644 --- a/src/devices/wifi/nm-device-olpc-mesh.c +++ b/src/devices/wifi/nm-device-olpc-mesh.c @@ -70,7 +70,7 @@ get_autoconnect_allowed(NMDevice *device) return FALSE; /* We must not attempt to autoconnect when the companion is connected or - * connecting, * because we'd tear down its connection. */ + * connecting, * because we'd tear down its connection. */ if (nm_device_get_state(priv->companion) > NM_DEVICE_STATE_DISCONNECTED) return FALSE; @@ -162,7 +162,7 @@ _mesh_set_channel(NMDeviceOlpcMesh *self, guint32 channel) channel = old_channel; /* We want to call this even if the channel number is the same, - * because that actually starts the mesh with the configured mesh ID. */ + * because that actually starts the mesh with the configured mesh ID. */ if (!nm_platform_mesh_set_channel(platform, ifindex, channel)) return FALSE; @@ -287,7 +287,7 @@ companion_autoconnect_allowed_cb(NMDeviceWifi *companion, gpointer user_data) NMDeviceState state = nm_device_get_state(NM_DEVICE(self)); /* Don't allow the companion to autoconnect while a mesh connection is - * active */ + * active */ return (state < NM_DEVICE_STATE_PREPARE) || (state > NM_DEVICE_STATE_ACTIVATED); } diff --git a/src/devices/wifi/nm-device-wifi-p2p.c b/src/devices/wifi/nm-device-wifi-p2p.c index f9ddee4e63..81ff675f5c 100644 --- a/src/devices/wifi/nm-device-wifi-p2p.c +++ b/src/devices/wifi/nm-device-wifi-p2p.c @@ -38,10 +38,10 @@ typedef struct { NMSupplicantManager *sup_mgr; /* NOTE: In theory management and group ifaces could be identical. However, - * in practice, this cannot happen currently as NMDeviceWifiP2P is only - * created for existing non-P2P interfaces. - * (i.e. a single standalone P2P interface is not supported at this point) - */ + * in practice, this cannot happen currently as NMDeviceWifiP2P is only + * created for existing non-P2P interfaces. + * (i.e. a single standalone P2P interface is not supported at this point) + */ NMSupplicantInterface *mgmt_iface; NMSupplicantInterface *group_iface; @@ -161,7 +161,7 @@ check_connection_peer_joined(NMDeviceWifiP2P *device) return FALSE; /* Comparing the object path found on the group_iface with the peers - * found on the mgmt_iface is legal. */ + * found on the mgmt_iface is legal. */ group = nm_supplicant_interface_get_p2p_group_path(priv->group_iface); if (!group) return FALSE; @@ -242,9 +242,9 @@ check_connection_compatible(NMDevice *device, NMConnection *connection, GError * /* TODO: Allow limitting the interface using the HW-address? */ /* We don't need to check anything else here. The P2P device will only - * exists if we are able to establish a P2P connection, and there should - * be no further restrictions necessary. - */ + * exists if we are able to establish a P2P connection, and there should + * be no further restrictions necessary. + */ return TRUE; } @@ -514,7 +514,7 @@ peer_add_remove(NMDeviceWifiP2P *self, if (is_adding) { /* If we are in prepare state, then we are currently runnign a find - * to search for the requested peer. */ + * to search for the requested peer. */ if (priv->find_peer_timeout_id != 0) { NMConnection *connection; @@ -830,7 +830,7 @@ supplicant_iface_group_started_cb(NMSupplicantInterface *iface, priv->group_iface = g_object_ref(group_iface); /* We need to wait for the interface to be ready and the group - * information to be resolved. */ + * information to be resolved. */ g_signal_connect(priv->group_iface, "notify::" NM_SUPPLICANT_INTERFACE_P2P_GROUP_JOINED, G_CALLBACK(supplicant_iface_group_joined_updated_cb), @@ -907,10 +907,10 @@ device_state_changed(NMDevice * device, if (new_state <= NM_DEVICE_STATE_UNAVAILABLE) { /* Clean up the supplicant interface because in these states the - * device cannot be used. - * Do not clean up for the UNMANAGED to UNAVAILABLE transition which - * will happen during initialization. - */ + * device cannot be used. + * Do not clean up for the UNMANAGED to UNAVAILABLE transition which + * will happen during initialization. + */ if (priv->mgmt_iface && old_state > new_state) supplicant_interfaces_release(self, TRUE); @@ -940,7 +940,7 @@ device_state_changed(NMDevice * device, break; case NM_DEVICE_STATE_FAILED: /* Clear any critical protocol notification in the wifi stack. - * At this point the IP device may have been removed already. */ + * At this point the IP device may have been removed already. */ nm_supplicant_manager_set_wfd_ies(priv->sup_mgr, NULL); if (nm_device_get_ip_ifindex(device) > 0) nm_platform_wifi_indicate_addressing_running(nm_device_get_platform(device), diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index 459b713359..33bd3a2b9d 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -323,8 +323,8 @@ _scan_request_ssids_track(NMDeviceWifiPrivate *priv, const GPtrArray *ssids) priv->scan_request_ssids_hash = g_hash_table_new(nm_pgbytes_hash, nm_pgbytes_equal); /* Do a little dance. New elements shall keep their order as in @ssids, but all - * new elements should be sorted in the list preexisting elements of the list. - * First move the old elements away, and splice them back afterwards. */ + * new elements should be sorted in the list preexisting elements of the list. + * First move the old elements away, and splice them back afterwards. */ c_list_init(&old_lst_head); c_list_splice(&old_lst_head, &priv->scan_request_ssids_lst_head); @@ -350,7 +350,7 @@ _scan_request_ssids_track(NMDeviceWifiPrivate *priv, const GPtrArray *ssids) c_list_splice(&priv->scan_request_ssids_lst_head, &old_lst_head); /* Trim the excess. After our splice with old_lst_head, the list contains the new - * elements (from @ssids) at the front (in there original order), followed by older elements. */ + * elements (from @ssids) at the front (in there original order), followed by older elements. */ _scan_request_ssids_remove_all(priv, now_msec, SCAN_REQUEST_SSIDS_MAX_NUM); } @@ -370,9 +370,9 @@ nm_device_wifi_scanning_prohibited_track(NMDeviceWifi *self, priv = NM_DEVICE_WIFI_GET_PRIVATE(self); /* We track these with a simple CList. This would be not efficient, if - * there would be many users that need to be tracked at the same time (there - * aren't). In fact, most of the time there is no NMDeviceOlpcMesh and - * nobody tracks itself here. Optimize for that and simplicity. */ + * there would be many users that need to be tracked at the same time (there + * aren't). In fact, most of the time there is no NMDeviceOlpcMesh and + * nobody tracks itself here. Optimize for that and simplicity. */ elem = nm_c_list_elem_find_first(&priv->scanning_prohibited_lst_head, iter, iter == tag); @@ -451,8 +451,8 @@ _scan_notify_is_scanning(NMDeviceWifi *self) if (scanning) { /* while the device is activating/activated, we don't need the pending - * action. The pending action exists to delay startup complete, while - * activating that is already achieved via other means. */ + * action. The pending action exists to delay startup complete, while + * activating that is already achieved via other means. */ if (state <= NM_DEVICE_STATE_DISCONNECTED || state > NM_DEVICE_STATE_ACTIVATED) nm_device_add_pending_action(NM_DEVICE(self), NM_PENDING_ACTION_WIFI_SCAN, FALSE); } @@ -488,15 +488,15 @@ _scan_notify_allowed(NMDeviceWifi *self, NMTernary do_kickoff) /* something prohibits scanning. */ } else if (NM_IN_SET(priv->mode, NM_802_11_MODE_ADHOC, NM_802_11_MODE_AP)) { /* Don't scan when a an AP or Ad-Hoc connection is active as it will - * disrupt connected clients or peers. */ + * disrupt connected clients or peers. */ } else if (NM_IN_SET(state, NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_FAILED)) { /* Can always scan when disconnected */ explicit_allowed = TRUE; periodic_allowed = TRUE; } else if (NM_IN_SET(state, NM_DEVICE_STATE_ACTIVATED)) { /* Prohibit periodic scans when connected; we ask the supplicant to - * background scan for us, unless the connection is locked to a specific - * BSSID (in which case scanning is effectively disabled). */ + * background scan for us, unless the connection is locked to a specific + * BSSID (in which case scanning is effectively disabled). */ periodic_allowed = FALSE; /* Prohibit scans if the supplicant is busy */ @@ -538,11 +538,11 @@ static gboolean unmanaged_on_quit(NMDevice *self) { /* Wi-Fi devices cannot be assumed and are always taken down. - * However, also when being disconnected, we scan and thus - * set the MAC address to a random value. - * - * We must restore the original MAC address when quitting, thus - * signal to unmanage the device. */ + * However, also when being disconnected, we scan and thus + * set the MAC address to a random value. + * + * We must restore the original MAC address when quitting, thus + * signal to unmanage the device. */ return TRUE; } @@ -731,8 +731,8 @@ periodic_update(NMDeviceWifi *self) if (nm_device_get_state(NM_DEVICE(self)) != NM_DEVICE_STATE_ACTIVATED) { /* BSSID and signal strength have meaningful values only if the device - * is activated and not scanning. - */ + * is activated and not scanning. + */ return; } @@ -742,9 +742,9 @@ periodic_update(NMDeviceWifi *self) nm_supplicant_interface_get_state(priv->sup_iface)) || nm_supplicant_interface_get_scanning(priv->sup_iface)) { /* Only update current AP if we're actually talking to something, otherwise - * assume the old one (if any) is still valid until we're told otherwise or - * the connection fails. - */ + * assume the old one (if any) is still valid until we're told otherwise or + * the connection fails. + */ return; } @@ -933,8 +933,8 @@ deactivate(NMDevice *device) nm_platform_wifi_indicate_addressing_running(nm_device_get_platform(device), ifindex, FALSE); /* Ensure we're in infrastructure mode after deactivation; some devices - * (usually older ones) don't scan well in adhoc mode. - */ + * (usually older ones) don't scan well in adhoc mode. + */ if (nm_platform_wifi_get_mode(nm_device_get_platform(device), ifindex) != NM_802_11_MODE_INFRA) { nm_device_take_down(NM_DEVICE(self), TRUE); @@ -1074,7 +1074,7 @@ check_connection_available(NMDevice * device, g_return_val_if_fail(s_wifi, FALSE); /* a connection that is available for a certain @specific_object, MUST - * also be available in general (without @specific_object). */ + * also be available in general (without @specific_object). */ if (specific_object) { NMWifiAP *ap; @@ -1096,8 +1096,8 @@ check_connection_available(NMDevice * device, } /* Ad-Hoc, AP and Mesh connections are always available because they may be - * started at any time. - */ + * started at any time. + */ mode = nm_setting_wireless_get_mode(s_wifi); if (g_strcmp0(mode, NM_SETTING_WIRELESS_MODE_ADHOC) == 0 || g_strcmp0(mode, NM_SETTING_WIRELESS_MODE_AP) == 0 @@ -1105,13 +1105,13 @@ check_connection_available(NMDevice * device, return TRUE; /* Hidden SSIDs obviously don't always appear in the scan list either. - * - * For an explicit user-activation-request, a connection is considered - * available because for hidden Wi-Fi, clients didn't consistently - * set the 'hidden' property to indicate hidden SSID networks. If - * activating but the network isn't available let the device recheck - * availability. - */ + * + * For an explicit user-activation-request, a connection is considered + * available because for hidden Wi-Fi, clients didn't consistently + * set the 'hidden' property to indicate hidden SSID networks. If + * activating but the network isn't available let the device recheck + * availability. + */ if (nm_setting_wireless_get_hidden(s_wifi) || NM_FLAGS_HAS(flags, _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST_IGNORE_AP)) return TRUE; @@ -1172,9 +1172,9 @@ complete_connection(NMDevice * device, ap = nm_wifi_aps_find_first_compatible(&priv->aps_lst_head, connection); /* If we still don't have an AP, then the WiFI settings needs to be - * fully specified by the client. Might not be able to find an AP - * if the network isn't broadcasting the SSID for example. - */ + * fully specified by the client. Might not be able to find an AP + * if the network isn't broadcasting the SSID for example. + */ if (!ap) { if (!nm_setting_verify(NM_SETTING(s_wifi), connection, error)) return FALSE; @@ -1213,17 +1213,17 @@ complete_connection(NMDevice * device, if (ssid == NULL) { /* The AP must be hidden. Connecting to a Wi-Fi AP requires the SSID - * as part of the initial handshake, so check the connection details - * for the SSID. The AP object will still be used for encryption - * settings and such. - */ + * as part of the initial handshake, so check the connection details + * for the SSID. The AP object will still be used for encryption + * settings and such. + */ ssid = nm_setting_wireless_get_ssid(s_wifi); } if (ssid == NULL) { /* If there's no SSID on the AP itself, and no SSID in the - * connection data, then we cannot connect at all. Return an error. - */ + * connection data, then we cannot connect at all. Return an error. + */ g_set_error_literal( error, NM_DEVICE_ERROR, @@ -1235,8 +1235,8 @@ complete_connection(NMDevice * device, if (ap) { /* If the SSID is a well-known SSID, lock the connection to the AP's - * specific BSSID so NM doesn't autoconnect to some random wifi net. - */ + * specific BSSID so NM doesn't autoconnect to some random wifi net. + */ if (!nm_wifi_ap_complete_connection(ap, connection, nm_wifi_utils_is_manf_default_ssid(ssid), @@ -1384,10 +1384,10 @@ _hw_addr_set_scanning(NMDeviceWifi *self, gboolean do_reset) gs_free char *hw_addr_scan = NULL; /* the random MAC address for scanning expires after a while. - * - * We don't bother with to update the MAC address exactly when - * it expires, instead on the next scan request, we will generate - * a new one.*/ + * + * We don't bother with to update the MAC address exactly when + * it expires, instead on the next scan request, we will generate + * a new one.*/ priv->hw_addr_scan_expire = now + SCAN_RAND_MAC_ADDRESS_EXPIRE_SEC; generate_mac_address_mask = @@ -1615,7 +1615,7 @@ _scan_request_ssids_build_hidden(NMDeviceWifi *self, if (n_hidden > 4) { /* we allow at most 4 hidden profiles to be actively scanned. The - * reason is speed and to not disclose too many SSIDs. */ + * reason is speed and to not disclose too many SSIDs. */ break; } @@ -1665,10 +1665,10 @@ _scan_supplicant_request_scan_cb(NMSupplicantInterface *supp_iface, _LOGT_scan("scan request completed (D-Bus request)"); /* we just completed a scan request, but possibly the supplicant's state is not yet toggled - * to "scanning". That means, our internal scanning state "priv->scan_is_scanning" would already - * flip to idle, while in a moment the supplicant would toggle the state again. - * - * Artificially keep the scanning state on, for another SCAN_EXTRA_DELAY_MSEC msec. */ + * to "scanning". That means, our internal scanning state "priv->scan_is_scanning" would already + * flip to idle, while in a moment the supplicant would toggle the state again. + * + * Artificially keep the scanning state on, for another SCAN_EXTRA_DELAY_MSEC msec. */ nm_clear_g_source_inst(&priv->scan_request_delay_source); priv->scan_request_delay_source = nm_g_source_attach(nm_g_timeout_source_new(SCAN_EXTRA_DELAY_MSEC, @@ -1841,8 +1841,8 @@ _scan_kickoff(NMDeviceWifi *self) self); /* It's OK to call _scan_notify_is_scanning() again. They mutually call each other, - * but _scan_kickoff() sets "priv->scan_request_cancellable" which will stop - * them from recursing indefinitely. */ + * but _scan_kickoff() sets "priv->scan_request_cancellable" which will stop + * them from recursing indefinitely. */ _scan_notify_is_scanning(self); } @@ -1902,7 +1902,7 @@ try_fill_ssid_for_hidden_ap(NMDeviceWifi *self, NMWifiAP *ap) g_return_if_fail(bssid); /* Look for this AP's BSSID in the seen-bssids list of a connection, - * and if a match is found, copy over the SSID */ + * and if a match is found, copy over the SSID */ connections = nm_settings_get_connections(nm_device_get_settings((NMDevice *) self), NULL); for (i = 0; connections[i]; i++) { NMSettingsConnection *sett_conn = connections[i]; @@ -1937,10 +1937,10 @@ supplicant_iface_bss_changed_cb(NMSupplicantInterface *iface, return; if (found_ap == priv->current_ap) { /* The current AP cannot be removed (to prevent NM indicating that - * it is connected, but to nothing), but it must be removed later - * when the current AP is changed or cleared. Set 'fake' to - * indicate that this AP is now unknown to the supplicant. - */ + * it is connected, but to nothing), but it must be removed later + * when the current AP is changed or cleared. Set 'fake' to + * indicate that this AP is now unknown to the supplicant. + */ if (nm_wifi_ap_set_fake(found_ap, TRUE)) _ap_dump(self, LOGL_DEBUG, found_ap, "updated", 0); } else { @@ -1959,8 +1959,8 @@ supplicant_iface_bss_changed_cb(NMSupplicantInterface *iface, if (!bss_info->bssid_valid) { /* We failed to initialize the info about the AP. This can - * happen due to an error in the D-Bus communication. In this case - * we ignore the info. */ + * happen due to an error in the D-Bus communication. In this case + * we ignore the info. */ return; } @@ -1991,8 +1991,8 @@ supplicant_iface_bss_changed_cb(NMSupplicantInterface *iface, } /* Update the current AP if the supplicant notified a current BSS change - * before it sent the current BSS's scan result. - */ + * before it sent the current BSS's scan result. + */ if (nm_supplicant_interface_get_current_bss(iface) == bss_info->bss_path) supplicant_iface_notify_current_bss(priv->sup_iface, NULL, self); @@ -2051,30 +2051,30 @@ wifi_secrets_cb(NMActRequest * req, _LOGW(LOGD_WIFI, "no secrets: %s", error->message); /* Even if WPS is still pending, let's abort the activation when the secret - * request returns. - * - * This means, a user can only effectively use WPS when also running a secret - * agent, and pressing the push button while being prompted for the password. - * Note, that in the secret prompt the user can see that WPS is in progress - * (via the NM_SECRET_AGENT_GET_SECRETS_FLAG_WPS_PBC_ACTIVE flag). - * - * Previously, WPS was not cancelled when the secret request returns. - * Note that in common use-cases WPS is enabled in the connection profile - * but it won't succeed (because it's disabled in the AP or because the - * user is not prepared to press the push button). - * That means for example, during boot we would try to autoconnect with WPS. - * At that point, there is no secret-agent running, and WPS is pending for - * full 30 seconds. If in the meantime a secret agent registers (because - * of logging into the DE), the profile is still busy waiting for WPS to time - * out. Only after that delay, autoconnect starts again (note that autoconnect gets - * not blocked in this case, because a secret agent registered in the meantime). - * - * It seems wrong to continue doing WPS if the user is not aware - * that WPS is ongoing. The user is required to perform an action (push button), - * and must be told via the secret prompt. - * If no secret-agent is running, if the user cancels the secret-request, or any - * other error to obtain secrets, the user apparently does not want WPS either. - */ + * request returns. + * + * This means, a user can only effectively use WPS when also running a secret + * agent, and pressing the push button while being prompted for the password. + * Note, that in the secret prompt the user can see that WPS is in progress + * (via the NM_SECRET_AGENT_GET_SECRETS_FLAG_WPS_PBC_ACTIVE flag). + * + * Previously, WPS was not cancelled when the secret request returns. + * Note that in common use-cases WPS is enabled in the connection profile + * but it won't succeed (because it's disabled in the AP or because the + * user is not prepared to press the push button). + * That means for example, during boot we would try to autoconnect with WPS. + * At that point, there is no secret-agent running, and WPS is pending for + * full 30 seconds. If in the meantime a secret agent registers (because + * of logging into the DE), the profile is still busy waiting for WPS to time + * out. Only after that delay, autoconnect starts again (note that autoconnect gets + * not blocked in this case, because a secret agent registered in the meantime). + * + * It seems wrong to continue doing WPS if the user is not aware + * that WPS is ongoing. The user is required to perform an action (push button), + * and must be told via the secret prompt. + * If no secret-agent is running, if the user cancels the secret-request, or any + * other error to obtain secrets, the user apparently does not want WPS either. + */ nm_clear_g_source(&priv->wps_timeout_id); nm_device_state_changed(device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_NO_SECRETS); return; @@ -2206,9 +2206,9 @@ link_timeout_cb(gpointer user_data) priv->link_timeout_id = 0; /* Disconnect event while activated; the supplicant hasn't been able - * to reassociate within the timeout period, so the connection must - * fail. - */ + * to reassociate within the timeout period, so the connection must + * fail. + */ if (nm_device_get_state(device) != NM_DEVICE_STATE_ACTIVATED) return FALSE; @@ -2238,15 +2238,15 @@ need_new_8021x_secrets(NMDeviceWifi * self, g_return_val_if_fail(connection != NULL, FALSE); /* 802.1x stuff only happens in the supplicant's ASSOCIATED state when it's - * attempting to authenticate with the AP. - */ + * attempting to authenticate with the AP. + */ if (old_state != NM_SUPPLICANT_INTERFACE_STATE_ASSOCIATED) return FALSE; /* If it's an 802.1x or LEAP connection with "always ask"/unsaved secrets - * then we need to ask again because it might be an OTP token and the PIN - * may have changed. - */ + * then we need to ask again because it might be an OTP token and the PIN + * may have changed. + */ s_8021x = nm_connection_get_setting_802_1x(connection); if (s_8021x) { @@ -2302,10 +2302,10 @@ need_new_wpa_psk(NMDeviceWifi * self, if (g_strcmp0(key_mgmt, "wpa-psk") == 0) { /* -4 (locally-generated WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY) usually - * means the driver missed beacons from the AP. This usually happens - * due to driver bugs or faulty power-save management. It doesn't - * indicate that the PSK is wrong. - */ + * means the driver missed beacons from the AP. This usually happens + * due to driver bugs or faulty power-save management. It doesn't + * indicate that the PSK is wrong. + */ #define LOCAL_WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY -4 if (disconnect_reason == LOCAL_WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY) return FALSE; @@ -2385,10 +2385,10 @@ supplicant_iface_state_down(NMDeviceWifi *self) cleanup_association_attempt(self, FALSE); /* If the device is already in UNAVAILABLE state then the state change - * is a NOP and the interface won't be re-acquired in the device state - * change handler. So ensure we have a new one here so that we're - * ready if the supplicant comes back. - */ + * is a NOP and the interface won't be re-acquired in the device state + * change handler. So ensure we have a new one here so that we're + * ready if the supplicant comes back. + */ supplicant_interface_release(self); if (priv->failed_iface_count < 5) priv->reacquire_iface_id = g_timeout_add_seconds(10, reacquire_interface_cb, self); @@ -2447,8 +2447,8 @@ supplicant_iface_state(NMDeviceWifi * self, nm_clear_g_source(&priv->wps_timeout_id); /* If this is the initial association during device activation, - * schedule the next activation stage. - */ + * schedule the next activation stage. + */ if (devstate == NM_DEVICE_STATE_CONFIG) { NMSettingWireless *s_wifi; GBytes * ssid; @@ -2473,20 +2473,20 @@ supplicant_iface_state(NMDeviceWifi * self, case NM_SUPPLICANT_INTERFACE_STATE_DISCONNECTED: if ((devstate == NM_DEVICE_STATE_ACTIVATED) || nm_device_is_activating(device)) { /* Disconnect of an 802.1x/LEAP connection during authentication, - * or disconnect of a WPA-PSK connection during the 4-way handshake, - * often means secrets are wrong. Not always the case, but until we - * have more information from wpa_supplicant about why the - * disconnect happened this is the best we can do. - */ + * or disconnect of a WPA-PSK connection during the 4-way handshake, + * often means secrets are wrong. Not always the case, but until we + * have more information from wpa_supplicant about why the + * disconnect happened this is the best we can do. + */ if (handle_8021x_or_psk_auth_fail(self, new_state, old_state, disconnect_reason)) break; } /* Otherwise, it might be a stupid driver or some transient error, so - * let the supplicant try to reconnect a few more times. Give it more - * time if a scan is in progress since the link might be dropped during - * the scan but will be re-established when the scan is done. - */ + * let the supplicant try to reconnect a few more times. Give it more + * time if a scan is in progress since the link might be dropped during + * the scan but will be re-established when the scan is done. + */ if (devstate == NM_DEVICE_STATE_ACTIVATED) { if (priv->link_timeout_id == 0) { priv->link_timeout_id = @@ -2497,8 +2497,8 @@ supplicant_iface_state(NMDeviceWifi * self, break; case NM_SUPPLICANT_INTERFACE_STATE_INACTIVE: /* we would clear _scan_has_pending_action_set() and trigger a new scan. - * However, we don't want to cancel the current pending action, so force - * a new scan request. */ + * However, we don't want to cancel the current pending action, so force + * a new scan request. */ break; default: break; @@ -2561,9 +2561,9 @@ supplicant_iface_notify_current_bss(NMSupplicantInterface *iface, gs_free char *old_ssid_s = NULL; /* Don't ever replace a "fake" current AP if we don't know about the - * supplicant's current BSS yet. It'll get replaced when we receive - * the current BSS's scan result. - */ + * supplicant's current BSS yet. It'll get replaced when we receive + * the current BSS's scan result. + */ if (new_ap == NULL && nm_wifi_ap_get_fake(priv->current_ap)) return; @@ -2586,10 +2586,10 @@ supplicant_iface_notify_current_bss(NMSupplicantInterface *iface, if (new_bssid) { /* The new AP could be in a different layer 3 network - * and so the old DHCP lease could be no longer valid. - * Also, some APs (e.g. Cisco) can be configured to drop - * all traffic until DHCP completes. To support such - * cases, renew the lease when roaming to a new AP. */ + * and so the old DHCP lease could be no longer valid. + * Also, some APs (e.g. Cisco) can be configured to drop + * all traffic until DHCP completes. To support such + * cases, renew the lease when roaming to a new AP. */ nm_device_update_dynamic_ip_setup(NM_DEVICE(self)); } @@ -2617,8 +2617,8 @@ recheck_p2p_availability(NMDeviceWifi *self) gs_free char *iface_name = NULL; /* Create a P2P device. "p2p-dev-" is the same prefix as chosen by - * wpa_supplicant internally. - */ + * wpa_supplicant internally. + */ iface_name = g_strconcat("p2p-dev-", nm_device_get_iface(NM_DEVICE(self)), NULL); priv->p2p_device = nm_device_wifi_p2p_new(iface_name); @@ -2753,10 +2753,10 @@ supplicant_connection_timeout_cb(gpointer user_data) return FALSE; /* Timed out waiting for a successful connection to the AP; if the AP's - * security requires network-side authentication (like WPA or 802.1x) - * and the connection attempt timed out then it's likely the authentication - * information (passwords, pin codes, etc) are wrong. - */ + * security requires network-side authentication (like WPA or 802.1x) + * and the connection attempt timed out then it's likely the authentication + * information (passwords, pin codes, etc) are wrong. + */ req = nm_device_get_act_request(device); g_assert(req); @@ -2766,9 +2766,9 @@ supplicant_connection_timeout_cb(gpointer user_data) if (NM_IN_SET(priv->mode, NM_802_11_MODE_ADHOC, NM_802_11_MODE_MESH, NM_802_11_MODE_AP)) { /* In Ad-Hoc and AP modes there's nothing to check the encryption key - * (if any), so supplicant timeouts here are almost certainly the wifi - * driver being really stupid. - */ + * (if any), so supplicant timeouts here are almost certainly the wifi + * driver being really stupid. + */ _LOGW(LOGD_DEVICE | LOGD_WIFI, "Activation: (wifi) %s network creation took too long, failing activation", priv->mode == NM_802_11_MODE_ADHOC ? "Ad-Hoc" : "Hotspot"); @@ -2785,15 +2785,15 @@ supplicant_connection_timeout_cb(gpointer user_data) gboolean new_secrets = TRUE; /* Connection failed; either driver problems, the encryption key is - * wrong, or the passwords or certificates were wrong. - */ + * wrong, or the passwords or certificates were wrong. + */ _LOGW(LOGD_DEVICE | LOGD_WIFI, "Activation: (wifi) association took too long"); /* Ask for new secrets only if we've never activated this connection - * before. If we've connected before, don't bother the user with - * dialogs, just retry or fail, and if we never connect the user can - * fix the password somewhere else. - */ + * before. If we've connected before, don't bother the user with + * dialogs, just retry or fail, and if we never connect the user can + * fix the password somewhere else. + */ if (nm_settings_connection_get_timestamp(nm_act_request_get_settings_connection(req), ×tamp)) new_secrets = !timestamp; @@ -3035,11 +3035,11 @@ act_stage1_prepare(NMDevice *device, NMDeviceStateReason *out_failure_reason) if (!ap) { /* If the user is trying to connect to an AP that NM doesn't yet know about - * (hidden network or something), starting a Hotspot or joining a Mesh, - * create a fake APfrom the security settings in the connection. This "fake" - * AP gets used until the real one is found in the scan list (Ad-Hoc or Hidden), - * or until the device is deactivated (Hotspot). - */ + * (hidden network or something), starting a Hotspot or joining a Mesh, + * create a fake APfrom the security settings in the connection. This "fake" + * AP gets used until the real one is found in the scan list (Ad-Hoc or Hidden), + * or until the device is deactivated (Hotspot). + */ ap_fake = nm_wifi_ap_new_fake_from_connection(connection); if (!ap_fake) g_return_val_if_reached(NM_ACT_STAGE_RETURN_FAILURE); @@ -3189,9 +3189,9 @@ act_stage2_config(NMDevice *device, NMDeviceStateReason *out_failure_reason) priv->ssid_found = FALSE; /* Supplicant requires an initial frequency for Ad-Hoc, Hotspot and Mesh; - * if the user didn't specify one and we didn't find an AP that matched - * the connection, just pick a frequency the device supports. - */ + * if the user didn't specify one and we didn't find an AP that matched + * the connection, just pick a frequency the device supports. + */ if (NM_IN_SET(ap_mode, NM_802_11_MODE_ADHOC, NM_802_11_MODE_MESH) || nm_wifi_ap_is_hotspot(ap)) ensure_hotspot_frequency(self, s_wireless, ap); @@ -3312,13 +3312,13 @@ act_stage4_ip_config_timeout(NMDevice * device, } /* If IP configuration times out and it's a static WEP connection, that - * usually means the WEP key is wrong. WEP's Open System auth mode has - * no provision for figuring out if the WEP key is wrong, so you just have - * to wait for DHCP to fail to figure it out. For all other Wi-Fi security - * types (open, WPA, 802.1x, etc) if the secrets/certs were wrong the - * connection would have failed before IP configuration. - * - * Activation failed, we must have bad encryption key */ + * usually means the WEP key is wrong. WEP's Open System auth mode has + * no provision for figuring out if the WEP key is wrong, so you just have + * to wait for DHCP to fail to figure it out. For all other Wi-Fi security + * types (open, WPA, 802.1x, etc) if the secrets/certs were wrong the + * connection would have failed before IP configuration. + * + * Activation failed, we must have bad encryption key */ _LOGW(LOGD_DEVICE | LOGD_WIFI, "Activation: (wifi) could not get IP configuration for connection '%s'.", nm_connection_get_id(connection)); @@ -3351,19 +3351,19 @@ activation_success_handler(NMDevice *device) nm_platform_wifi_indicate_addressing_running(nm_device_get_platform(device), ifindex, FALSE); /* There should always be a current AP, either a fake one because we haven't - * seen a scan result for the activated AP yet, or a real one from the - * supplicant's scan list. - */ + * seen a scan result for the activated AP yet, or a real one from the + * supplicant's scan list. + */ g_warn_if_fail(priv->current_ap); if (priv->current_ap) { if (nm_wifi_ap_get_fake(priv->current_ap)) { gboolean ap_changed = FALSE; /* If the activation AP hasn't been seen by the supplicant in a scan - * yet, it will be "fake". This usually happens for Ad-Hoc and - * AP-mode connections. Fill in the details from the device itself - * until the supplicant sends the scan result. - */ + * yet, it will be "fake". This usually happens for Ad-Hoc and + * AP-mode connections. Fill in the details from the device itself + * until the supplicant sends the scan result. + */ if (!nm_wifi_ap_get_address(priv->current_ap)) { guint8 bssid[ETH_ALEN] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; gs_free char *bssid_str = NULL; @@ -3415,8 +3415,8 @@ device_state_changed(NMDevice * device, if (new_state <= NM_DEVICE_STATE_UNAVAILABLE) { /* Clean up the supplicant interface because in these states the - * device cannot be used. - */ + * device cannot be used. + */ supplicant_interface_release(self); nm_clear_g_source(&priv->periodic_update_id); @@ -3432,9 +3432,9 @@ device_state_changed(NMDevice * device, break; case NM_DEVICE_STATE_UNAVAILABLE: /* If the device is enabled and the supplicant manager is ready, - * acquire a supplicant interface and transition to DISCONNECTED because - * the device is now ready to use. - */ + * acquire a supplicant interface and transition to DISCONNECTED because + * the device is now ready to use. + */ if (priv->enabled && (nm_device_get_firmware_missing(device) == FALSE)) { if (!priv->sup_iface) supplicant_interface_acquire(self); diff --git a/src/devices/wifi/nm-iwd-manager.c b/src/devices/wifi/nm-iwd-manager.c index 61ad41aa93..9bc2a49809 100644 --- a/src/devices/wifi/nm-iwd-manager.c +++ b/src/devices/wifi/nm-iwd-manager.c @@ -264,7 +264,7 @@ register_agent(NMIwdManager *self) if (!agent_manager) { /* IWD prior to 1.0 dated 30 October, 2019 has the agent manager on a - * different path. */ + * different path. */ agent_manager = g_dbus_object_manager_get_interface(priv->object_manager, "/", NM_IWD_AGENT_MANAGER_INTERFACE); @@ -424,10 +424,10 @@ mirror_8021x_connection(NMIwdManager *self, const char *name, gboolean create_ne } /* If we already have an NMSettingsConnection matching this - * KnownNetwork, whether it's saved or an in-memory connection - * potentially created by ourselves then we have nothing left to - * do here. - */ + * KnownNetwork, whether it's saved or an in-memory connection + * potentially created by ourselves then we have nothing left to + * do here. + */ if (settings_connection || !create_new) return settings_connection; @@ -461,11 +461,11 @@ mirror_8021x_connection(NMIwdManager *self, const char *name, gboolean create_ne nm_connection_add_setting(connection, setting); /* "password" and "private-key-password" may be requested by the IWD agent - * from NM and IWD will implement a specific secret cache policy so by - * default respect that policy and don't save copies of those secrets in - * NM settings. The saved values can not be used anyway because of our - * use of NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW. - */ + * from NM and IWD will implement a specific secret cache policy so by + * default respect that policy and don't save copies of those secrets in + * NM settings. The saved values can not be used anyway because of our + * use of NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW. + */ setting = NM_SETTING(g_object_new(NM_TYPE_SETTING_802_1X, NM_SETTING_802_1X_PASSWORD_FLAGS, NM_SETTING_SECRET_FLAG_NOT_SAVED, @@ -506,7 +506,7 @@ mirror_8021x_connection_take_and_delete(NMSettingsConnection *sett_conn) flags = nm_settings_connection_get_flags(sett_conn); /* If connection has not been saved since we created it - * in interface_added it too can be removed now. */ + * in interface_added it too can be removed now. */ if (NM_FLAGS_HAS(flags, NM_SETTINGS_CONNECTION_INT_FLAGS_NM_GENERATED)) nm_settings_connection_delete(sett_conn, FALSE); @@ -662,8 +662,8 @@ connection_removed(NMSettings *settings, NMSettingsConnection *sett_conn, gpoint g_clear_object(&data->mirror_connection); /* Don't call Forget for an 8021x network until there's no - * longer *any* matching NMSettingsConnection (debatable) - */ + * longer *any* matching NMSettingsConnection (debatable) + */ new_mirror_conn = mirror_8021x_connection(self, id.name, FALSE); if (new_mirror_conn) { data->mirror_connection = g_object_ref(new_mirror_conn); @@ -729,9 +729,9 @@ release_object_manager(NMIwdManager *self) agent_connection = g_dbus_object_manager_client_get_connection(omc); /* We're is called when we're shutting down (i.e. our DBus connection - * is being closed, and IWD will detect this) or IWD was stopped so - * in either case calling UnregisterAgent will not do anything. - */ + * is being closed, and IWD will detect this) or IWD was stopped so + * in either case calling UnregisterAgent will not do anything. + */ g_dbus_connection_unregister_object(agent_connection, priv->agent_id); priv->agent_id = 0; nm_clear_g_free(&priv->agent_path); @@ -950,8 +950,8 @@ dispose(GObject *object) } /* This may trigger mirror connection removals so it happens - * after the g_signal_handlers_disconnect_by_data above. - */ + * after the g_signal_handlers_disconnect_by_data above. + */ nm_clear_pointer(&priv->known_networks, g_hash_table_destroy); if (priv->manager) { diff --git a/src/devices/wifi/nm-wifi-ap.c b/src/devices/wifi/nm-wifi-ap.c index 01320d975e..518c568762 100644 --- a/src/devices/wifi/nm-wifi-ap.c +++ b/src/devices/wifi/nm-wifi-ap.c @@ -817,8 +817,8 @@ nm_wifi_ap_new_fake_from_connection(NMConnection *connection) add_group_ciphers(ap, s_wireless_sec); } else if (adhoc && psk) { /* Ad-Hoc has special requirements: proto=RSN, pairwise=CCMP and - * group=CCMP. - */ + * group=CCMP. + */ flags = priv->wpa_flags | NM_802_11_AP_SEC_KEY_MGMT_PSK; /* Clear ciphers; only CCMP is supported */ diff --git a/src/devices/wifi/nm-wifi-factory.c b/src/devices/wifi/nm-wifi-factory.c index 113b7f6a5d..f8284fcf0c 100644 --- a/src/devices/wifi/nm-wifi-factory.c +++ b/src/devices/wifi/nm-wifi-factory.c @@ -110,9 +110,9 @@ create_device(NMDeviceFactory * factory, } /* Ignore monitor-mode and other unhandled interface types. - * FIXME: keep TYPE_MONITOR devices in UNAVAILABLE state and manage - * them if/when they change to a handled type. - */ + * FIXME: keep TYPE_MONITOR devices in UNAVAILABLE state and manage + * them if/when they change to a handled type. + */ mode = nm_platform_wifi_get_mode(NM_PLATFORM_GET, plink->ifindex); if (mode == NM_802_11_MODE_UNKNOWN) { *out_ignore = TRUE; diff --git a/src/devices/wifi/nm-wifi-utils.c b/src/devices/wifi/nm-wifi-utils.c index 9712942257..7c79bd0e6d 100644 --- a/src/devices/wifi/nm-wifi-utils.c +++ b/src/devices/wifi/nm-wifi-utils.c @@ -47,11 +47,11 @@ verify_leap(NMSettingWirelessSecurity *s_wsec, leap_username = nm_setting_wireless_security_get_leap_username(s_wsec); /* One (or both) of two things indicates we want LEAP: - * 1) auth_alg == 'leap' - * 2) valid leap_username + * 1) auth_alg == 'leap' + * 2) valid leap_username * * LEAP always requires a LEAP username. - */ + */ if (auth_alg) { if (!strcmp(auth_alg, "leap")) { @@ -97,8 +97,8 @@ verify_leap(NMSettingWirelessSecurity *s_wsec, } /* At this point if auth_alg is set it must be 'leap', and if key_mgmt - * is set it must be 'ieee8021x'. - */ + * is set it must be 'ieee8021x'. + */ if (leap_username) { if (auth_alg) g_assert(strcmp(auth_alg, "leap") == 0); @@ -610,8 +610,8 @@ nm_wifi_utils_complete_connection(GBytes * ap_ssid, } /* For now mesh requires channel and band, fill them only if both not present. - * Do not check existing values against an existing ap/mesh point, - * mesh join will start a new network if required */ + * Do not check existing values against an existing ap/mesh point, + * mesh join will start a new network if required */ if (mesh) { const char *band; guint32 channel; @@ -732,8 +732,8 @@ nm_wifi_utils_complete_connection(GBytes * ap_ssid, if (s_8021x) { /* Dynamic WEP requires a valid 802.1x setting since we can't - * autocomplete 802.1x. - */ + * autocomplete 802.1x. + */ if (!nm_setting_verify(NM_SETTING(s_8021x), NULL, error)) return FALSE; } @@ -802,13 +802,13 @@ nm_wifi_utils_complete_connection(GBytes * ap_ssid, "open", NULL); /* Leave proto/pairwise/group as client set them; if they are unset the - * supplicant will figure out the best combination at connect time. - */ + * supplicant will figure out the best combination at connect time. + */ /* 802.1x also requires the client to completely fill in the 8021x - * setting. Since there's so much configuration required for it, there's - * no way it can be automatically completed. - */ + * setting. Since there's so much configuration required for it, there's + * no way it can be automatically completed. + */ } else if ((key_mgmt && !strcmp(key_mgmt, "sae")) || (ap_rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_SAE)) { g_object_set(s_wsec, @@ -836,8 +836,8 @@ nm_wifi_utils_complete_connection(GBytes * ap_ssid, "open", NULL); /* Leave proto/pairwise/group as client set them; if they are unset the - * supplicant will figure out the best combination at connect time. - */ + * supplicant will figure out the best combination at connect time. + */ } else { g_set_error_literal(error, NM_CONNECTION_ERROR, @@ -856,11 +856,11 @@ nm_wifi_utils_is_manf_default_ssid(GBytes *ssid) gsize ssid_l; int i; /* - * List of manufacturer default SSIDs that are often unchanged by users. - * - * NOTE: this list should *not* contain networks that you would like to - * automatically roam to like "Starbucks" or "AT&T" or "T-Mobile HotSpot". - */ + * List of manufacturer default SSIDs that are often unchanged by users. + * + * NOTE: this list should *not* contain networks that you would like to + * automatically roam to like "Starbucks" or "AT&T" or "T-Mobile HotSpot". + */ static const char *manf_defaults[] = { "linksys", "linksys-a", diff --git a/src/devices/wifi/tests/test-devices-wifi.c b/src/devices/wifi/tests/test-devices-wifi.c index a94bad7e26..9c2839fa0c 100644 --- a/src/devices/wifi/tests/test-devices-wifi.c +++ b/src/devices/wifi/tests/test-devices-wifi.c @@ -267,8 +267,8 @@ test_open_ap_empty_connection(void) GError * error = NULL; /* Test that an empty source connection is correctly filled with the - * SSID and Infra modes of the given AP details. - */ + * SSID and Infra modes of the given AP details. + */ src = nm_simple_connection_new(); success = complete_connection(ssid, @@ -300,9 +300,9 @@ test_open_ap_leap_connection_1(gconstpointer add_wifi) GError * error = NULL; /* Test that a basic connection filled with a LEAP username is - * rejected when completion is attempted with an open AP. LEAP requires - * the AP to have the Privacy bit set. - */ + * rejected when completion is attempted with an open AP. LEAP requires + * the AP to have the Privacy bit set. + */ src = nm_simple_connection_new(); if (add_wifi) @@ -336,8 +336,8 @@ test_open_ap_leap_connection_2(void) GError * error = NULL; /* Test that a basic connection specifying IEEE8021x security (ie, Dynamic - * WEP or LEAP) is rejected when completion is attempted with an open AP. - */ + * WEP or LEAP) is rejected when completion is attempted with an open AP. + */ src = nm_simple_connection_new(); fill_wifi_empty(src); @@ -374,8 +374,8 @@ test_open_ap_wep_connection(gconstpointer add_wifi) GError * error = NULL; /* Test that a static WEP connection is rejected when completion is - * attempted with an open AP. - */ + * attempted with an open AP. + */ src = nm_simple_connection_new(); if (add_wifi) @@ -447,9 +447,9 @@ static void test_open_ap_wpa_psk_connection_1(void) { /* Test that a WPA-PSK connection filling only the PSK itself and *not* - * filling the wifi setting is rejected when completion is attempted with - * an open AP. - */ + * filling the wifi setting is rejected when completion is attempted with + * an open AP. + */ test_ap_wpa_psk_connection_base(NULL, NULL, NM_802_11_AP_FLAGS_NONE, @@ -464,9 +464,9 @@ static void test_open_ap_wpa_psk_connection_2(void) { /* Test that a WPA-PSK connection filling only the PSK itself and also - * filling the wifi setting is rejected when completion is attempted with - * an open AP. - */ + * filling the wifi setting is rejected when completion is attempted with + * an open AP. + */ test_ap_wpa_psk_connection_base(NULL, NULL, NM_802_11_AP_FLAGS_NONE, @@ -481,8 +481,8 @@ static void test_open_ap_wpa_psk_connection_3(void) { /* Test that a WPA-PSK connection filling the PSK and setting the auth alg - * to 'open' is rejected when completion is attempted with an open AP. - */ + * to 'open' is rejected when completion is attempted with an open AP. + */ test_ap_wpa_psk_connection_base(NULL, "open", NM_802_11_AP_FLAGS_NONE, @@ -497,9 +497,9 @@ static void test_open_ap_wpa_psk_connection_4(void) { /* Test that a WPA-PSK connection filling the PSK and setting the auth alg - * to 'shared' is rejected when completion is attempted with an open AP. - * Shared auth cannot be used with WPA. - */ + * to 'shared' is rejected when completion is attempted with an open AP. + * Shared auth cannot be used with WPA. + */ test_ap_wpa_psk_connection_base(NULL, "shared", NM_802_11_AP_FLAGS_NONE, @@ -514,8 +514,8 @@ static void test_open_ap_wpa_psk_connection_5(void) { /* Test that a WPA-PSK connection filling the PSK, the auth algorithm, and - * key management is rejected when completion is attempted with an open AP. - */ + * key management is rejected when completion is attempted with an open AP. + */ test_ap_wpa_psk_connection_base("wpa-psk", "open", NM_802_11_AP_FLAGS_NONE, @@ -745,8 +745,8 @@ test_priv_ap_empty_connection(void) GError * error = NULL; /* Test that an empty connection is completed to a valid Static WEP - * connection when completed with an AP with the Privacy bit set. - */ + * connection when completed with an AP with the Privacy bit set. + */ src = nm_simple_connection_new(); success = complete_connection(ssid, @@ -788,9 +788,9 @@ test_priv_ap_leap_connection_1(gconstpointer add_wifi) GError * error = NULL; /* Test that an minimal LEAP connection specifying only key management and - * the LEAP username is completed to a full LEAP connection when completed - * with an AP with the Privacy bit set. - */ + * the LEAP username is completed to a full LEAP connection when completed + * with an AP with the Privacy bit set. + */ src = nm_simple_connection_new(); if (add_wifi) @@ -806,9 +806,9 @@ test_priv_ap_leap_connection_1(gconstpointer add_wifi) src, &error); /* We expect success here; since LEAP APs just set the 'privacy' flag - * there's no way to determine from the AP's beacon whether it's static WEP, - * dynamic WEP, or LEAP. - */ + * there's no way to determine from the AP's beacon whether it's static WEP, + * dynamic WEP, or LEAP. + */ expected = create_basic(ssid, NULL, NM_802_11_MODE_INFRA); fill_wsec(expected, exp_wsec); COMPARE(src, expected, success, error, 0, 0); @@ -831,9 +831,9 @@ test_priv_ap_leap_connection_2(void) GError * error = NULL; /* Test that an minimal LEAP connection specifying only key management and - * the LEAP auth alg is completed to a full LEAP connection when completed - * with an AP with the Privacy bit set. - */ + * the LEAP auth alg is completed to a full LEAP connection when completed + * with an AP with the Privacy bit set. + */ src = nm_simple_connection_new(); fill_wifi_empty(src); @@ -875,9 +875,9 @@ test_priv_ap_dynamic_wep_1(void) GError * error = NULL; /* Test that an minimal Dynamic WEP connection specifying key management, - * the auth algorithm, and valid 802.1x setting is completed to a valid - * Dynamic WEP connection when completed with an AP with the Privacy bit set. - */ + * the auth algorithm, and valid 802.1x setting is completed to a valid + * Dynamic WEP connection when completed with an AP with the Privacy bit set. + */ src = nm_simple_connection_new(); fill_wifi_empty(src); @@ -923,9 +923,9 @@ test_priv_ap_dynamic_wep_2(void) GError * error = NULL; /* Test that an minimal Dynamic WEP connection specifying only the auth - * algorithm and a valid 802.1x setting is completed to a valid Dynamic - * WEP connection when completed with an AP with the Privacy bit set. - */ + * algorithm and a valid 802.1x setting is completed to a valid Dynamic + * WEP connection when completed with an AP with the Privacy bit set. + */ src = nm_simple_connection_new(); fill_wifi_empty(src); @@ -967,8 +967,8 @@ test_priv_ap_dynamic_wep_3(void) GError * error = NULL; /* Ensure that a basic connection specifying 'shared' auth and an 802.1x - * setting is rejected, as 802.1x is incompatible with 'shared' auth. - */ + * setting is rejected, as 802.1x is incompatible with 'shared' auth. + */ src = nm_simple_connection_new(); fill_wifi_empty(src); @@ -995,9 +995,9 @@ static void test_priv_ap_wpa_psk_connection_1(void) { /* Test that a basic WPA-PSK connection is rejected when completion is - * attempted with an AP with just the Privacy bit set. Lack of WPA/RSN - * flags means the AP provides Static/Dynamic WEP or LEAP, not WPA. - */ + * attempted with an AP with just the Privacy bit set. Lack of WPA/RSN + * flags means the AP provides Static/Dynamic WEP or LEAP, not WPA. + */ test_ap_wpa_psk_connection_base(NULL, NULL, NM_802_11_AP_FLAGS_PRIVACY, @@ -1012,9 +1012,9 @@ static void test_priv_ap_wpa_psk_connection_2(void) { /* Test that a basic WPA-PSK connection is rejected when completion is - * attempted with an AP with just the Privacy bit set. Lack of WPA/RSN - * flags means the AP provides Static/Dynamic WEP or LEAP, not WPA. - */ + * attempted with an AP with just the Privacy bit set. Lack of WPA/RSN + * flags means the AP provides Static/Dynamic WEP or LEAP, not WPA. + */ test_ap_wpa_psk_connection_base(NULL, NULL, NM_802_11_AP_FLAGS_PRIVACY, @@ -1029,10 +1029,10 @@ static void test_priv_ap_wpa_psk_connection_3(void) { /* Test that a basic WPA-PSK connection specifying only the auth algorithm - * is rejected when completion is attempted with an AP with just the Privacy - * bit set. Lack of WPA/RSN flags means the AP provides Static/Dynamic WEP - * or LEAP, not WPA. - */ + * is rejected when completion is attempted with an AP with just the Privacy + * bit set. Lack of WPA/RSN flags means the AP provides Static/Dynamic WEP + * or LEAP, not WPA. + */ test_ap_wpa_psk_connection_base(NULL, "open", NM_802_11_AP_FLAGS_PRIVACY, @@ -1047,10 +1047,10 @@ static void test_priv_ap_wpa_psk_connection_4(void) { /* Test that a basic WPA-PSK connection specifying only the auth algorithm - * is rejected when completion is attempted with an AP with just the Privacy - * bit set. Lack of WPA/RSN flags means the AP provides Static/Dynamic WEP - * or LEAP, not WPA. Second, 'shared' auth is incompatible with WPA. - */ + * is rejected when completion is attempted with an AP with just the Privacy + * bit set. Lack of WPA/RSN flags means the AP provides Static/Dynamic WEP + * or LEAP, not WPA. Second, 'shared' auth is incompatible with WPA. + */ test_ap_wpa_psk_connection_base(NULL, "shared", NM_802_11_AP_FLAGS_PRIVACY, @@ -1065,10 +1065,10 @@ static void test_priv_ap_wpa_psk_connection_5(void) { /* Test that a WPA-PSK connection specifying both the key management and - * auth algorithm is rejected when completion is attempted with an AP with - * just the Privacy bit set. Lack of WPA/RSN flags means the AP provides - * Static/Dynamic WEP or LEAP, not WPA. - */ + * auth algorithm is rejected when completion is attempted with an AP with + * just the Privacy bit set. Lack of WPA/RSN flags means the AP provides + * Static/Dynamic WEP or LEAP, not WPA. + */ test_ap_wpa_psk_connection_base("wpa-psk", "open", NM_802_11_AP_FLAGS_PRIVACY, @@ -1095,9 +1095,9 @@ test_wpa_ap_empty_connection(gconstpointer data) GError * error = NULL; /* Test that a basic WPA-PSK connection specifying just key management and - * the auth algorithm is completed successfully when given an AP with WPA - * or RSN flags. - */ + * the auth algorithm is completed successfully when given an AP with WPA + * or RSN flags. + */ src = nm_simple_connection_new(); success = complete_connection(ssid, @@ -1136,8 +1136,8 @@ test_wpa_ap_leap_connection_1(gconstpointer data) GError * error = NULL; /* Test that completion of a LEAP connection with a WPA-enabled AP is - * rejected since WPA APs (usually) do not support LEAP. - */ + * rejected since WPA APs (usually) do not support LEAP. + */ src = nm_simple_connection_new(); fill_wifi_empty(src); @@ -1172,8 +1172,8 @@ test_wpa_ap_leap_connection_2(gconstpointer data) GError * error = NULL; /* Test that completion of a LEAP connection with a WPA-enabled AP is - * rejected since WPA APs (usually) do not support LEAP. - */ + * rejected since WPA APs (usually) do not support LEAP. + */ src = nm_simple_connection_new(); fill_wifi_empty(src); @@ -1206,8 +1206,8 @@ test_wpa_ap_dynamic_wep_connection(gconstpointer data) GError * error = NULL; /* Test that completion of a Dynamic WEP connection with a WPA-enabled AP is - * rejected since WPA APs (usually) do not support Dynamic WEP. - */ + * rejected since WPA APs (usually) do not support Dynamic WEP. + */ src = nm_simple_connection_new(); fill_wifi_empty(src); @@ -1471,9 +1471,9 @@ main(int argc, char **argv) g_test_add_func("/wifi/lock_bssid", test_lock_bssid); /* Open AP tests; make sure that connections to be completed that have - * various security-related settings already set cause the completion - * to fail. - */ + * various security-related settings already set cause the completion + * to fail. + */ g_test_add_func("/wifi/open_ap/empty_connection", test_open_ap_empty_connection); g_test_add_data_func("/wifi/open_ap/leap_connection/1", (gconstpointer) TRUE, diff --git a/src/devices/wwan/nm-device-modem.c b/src/devices/wwan/nm-device-modem.c index 50a0b66842..0165526385 100644 --- a/src/devices/wwan/nm-device-modem.c +++ b/src/devices/wwan/nm-device-modem.c @@ -115,23 +115,23 @@ modem_prepare_result(NMModem *modem, gboolean success, guint i_reason, gpointer if (!success) { /* There are several reasons to block autoconnection at device level: - * - * - Wrong SIM-PIN: The device won't autoconnect because it doesn't make sense - * to retry the connection with the same PIN. This error also makes autoconnection - * blocked at settings level, so not even a modem unplug and replug will allow - * autoconnection again. It is somewhat redundant to block autoconnection at - * both device and setting level really. - * - * - SIM wrong or not inserted: If the modem is reporting a SIM not inserted error, - * we can block autoconnection at device level, so that if the same device is - * unplugged and replugged with a SIM (or if a SIM hotplug event happens in MM, - * recreating the device completely), we can try the autoconnection again. - * - * - Modem initialization failed: For some reason unknown to NM, the modem wasn't - * initialized correctly, which leads to an unusable device. A device unplug and - * replug may solve the issue, so make it a device-level autoconnection blocking - * reason. - */ + * + * - Wrong SIM-PIN: The device won't autoconnect because it doesn't make sense + * to retry the connection with the same PIN. This error also makes autoconnection + * blocked at settings level, so not even a modem unplug and replug will allow + * autoconnection again. It is somewhat redundant to block autoconnection at + * both device and setting level really. + * + * - SIM wrong or not inserted: If the modem is reporting a SIM not inserted error, + * we can block autoconnection at device level, so that if the same device is + * unplugged and replugged with a SIM (or if a SIM hotplug event happens in MM, + * recreating the device completely), we can try the autoconnection again. + * + * - Modem initialization failed: For some reason unknown to NM, the modem wasn't + * initialized correctly, which leads to an unusable device. A device unplug and + * replug may solve the issue, so make it a device-level autoconnection blocking + * reason. + */ switch (nm_device_state_reason_check(reason)) { case NM_DEVICE_STATE_REASON_GSM_SIM_PIN_REQUIRED: case NM_DEVICE_STATE_REASON_GSM_SIM_PUK_REQUIRED: @@ -162,8 +162,8 @@ modem_auth_requested(NMModem *modem, gpointer user_data) NMDevice *device = NM_DEVICE(user_data); /* Auth requests (PIN, PAP/CHAP passwords, etc) only get handled - * during activation. - */ + * during activation. + */ if (!nm_device_is_activating(device)) return; @@ -265,8 +265,8 @@ modem_ip6_config_result(NMModem * modem, break; default: /* Should never get here since we've assured that the IPv6 method - * will either be "auto" or "ignored" when starting IPv6 configuration. - */ + * will either be "auto" or "ignored" when starting IPv6 configuration. + */ nm_assert_not_reached(); } } @@ -287,9 +287,9 @@ ip_ifindex_changed_cb(NMModem *modem, GParamSpec *pspec, gpointer user_data) } /* Disable IPv6 immediately on the interface since NM handles IPv6 - * internally, and leaving it enabled could allow the kernel's IPv6 - * RA handling code to run before NM is ready. - */ + * internally, and leaving it enabled could allow the kernel's IPv6 + * RA handling code to run before NM is ready. + */ nm_device_sysctl_ip_conf_set(device, AF_INET6, "disable_ipv6", "1"); } @@ -339,8 +339,8 @@ modem_state_cb(NMModem *modem, int new_state_i, int old_state_i, gpointer user_d if (new_state <= NM_MODEM_STATE_DISABLING && old_state > NM_MODEM_STATE_DISABLING && priv->rf_enabled) { /* Called when the ModemManager modem enabled state is changed externally - * to NetworkManager (eg something using MM's D-Bus API directly). - */ + * to NetworkManager (eg something using MM's D-Bus API directly). + */ if (nm_device_is_activating(device) || dev_state == NM_DEVICE_STATE_ACTIVATED) { /* user-initiated action, hence DISCONNECTED not FAILED */ nm_device_state_changed(device, @@ -353,7 +353,7 @@ modem_state_cb(NMModem *modem, int new_state_i, int old_state_i, gpointer user_d if (new_state < NM_MODEM_STATE_CONNECTING && old_state >= NM_MODEM_STATE_CONNECTING && dev_state >= NM_DEVICE_STATE_NEED_AUTH && dev_state <= NM_DEVICE_STATE_ACTIVATED) { /* Fail the device if the modem disconnects unexpectedly while the - * device is activating/activated. */ + * device is activating/activated. */ nm_device_state_changed(device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_MODEM_NO_CARRIER); @@ -362,8 +362,8 @@ modem_state_cb(NMModem *modem, int new_state_i, int old_state_i, gpointer user_d if (new_state > NM_MODEM_STATE_LOCKED && old_state == NM_MODEM_STATE_LOCKED) { /* If the modem is now unlocked, enable/disable it according to the - * device's enabled/disabled state. - */ + * device's enabled/disabled state. + */ nm_modem_set_mm_enabled(priv->modem, priv->rf_enabled); if (dev_state == NM_DEVICE_STATE_NEED_AUTH) { @@ -661,8 +661,8 @@ set_enabled(NMDevice *device, gboolean enabled) NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE(self); /* Called only by the Manager in response to rfkill switch changes or - * global user WWAN enable/disable preference changes. - */ + * global user WWAN enable/disable preference changes. + */ priv->rf_enabled = enabled; if (priv->modem) { @@ -731,9 +731,9 @@ static guint32 get_dhcp_timeout_for_device(NMDevice *device, int addr_family) { /* DHCP is always done by the modem firmware, not by the network, and - * by the time we get around to DHCP the firmware should already know - * the IP addressing details. So the DHCP timeout can be much shorter. - */ + * by the time we get around to DHCP the firmware should already know + * the IP addressing details. So the DHCP timeout can be much shorter. + */ return 15; } diff --git a/src/devices/wwan/nm-modem-broadband.c b/src/devices/wwan/nm-modem-broadband.c index 987fd68a78..5ac5f4a1cd 100644 --- a/src/devices/wwan/nm-modem-broadband.c +++ b/src/devices/wwan/nm-modem-broadband.c @@ -25,12 +25,12 @@ MODEM_CAPS_3GPP(MMModemCapability caps) { G_GNUC_BEGIN_IGNORE_DEPRECATIONS /* MM_MODEM_CAPABILITY_LTE_ADVANCED is marked as deprecated since ModemManager 1.14.0. - * - * The flag probably was never used, it certainly isn't used since 1.14.0. - * - * Still, just to be sure, there is no harm in checking it here. Suppress the - * warning, it should have no bad effect. - */ + * + * The flag probably was never used, it certainly isn't used since 1.14.0. + * + * Still, just to be sure, there is no harm in checking it here. Suppress the + * warning, it should have no bad effect. + */ return NM_FLAGS_ANY(caps, (MM_MODEM_CAPABILITY_GSM_UMTS | MM_MODEM_CAPABILITY_LTE | MM_MODEM_CAPABILITY_LTE_ADVANCED)); @@ -205,7 +205,7 @@ get_capabilities(NMModem * _self, guint n_supported; /* For now, we don't care about the capability combinations, just merge all - * combinations in a single mask */ + * combinations in a single mask */ if (mm_modem_get_supported_capabilities(self->_priv.modem_iface, &supported, &n_supported)) { guint i; @@ -412,8 +412,8 @@ connect_ready(MMModemSimple *simple_iface, GAsyncResult *res, NMModemBroadband * ctx->ip_type_tries++; } else { /* If the modem/provider lies and the IP type we tried isn't supported, - * retry with the next one, if any. - */ + * retry with the next one, if any. + */ ctx->ip_types_i++; ctx->ip_type_tries = 0; } @@ -1067,7 +1067,7 @@ static_stage3_ip4_config_start(NMModem * modem, NMModemBroadbandPrivate *priv = NM_MODEM_BROADBAND_GET_PRIVATE(self); /* We schedule it in an idle just to follow the same logic as in the - * generic modem implementation. */ + * generic modem implementation. */ nm_clear_g_source(&priv->idle_id_ip4); priv->idle_id_ip4 = g_idle_add((GSourceFunc) static_stage3_ip4_done, self); @@ -1196,7 +1196,7 @@ stage3_ip6_config_request(NMModem *modem, NMDeviceStateReason *out_failure_reaso NMModemBroadbandPrivate *priv = NM_MODEM_BROADBAND_GET_PRIVATE(self); /* We schedule it in an idle just to follow the same logic as in the - * generic modem implementation. */ + * generic modem implementation. */ nm_clear_g_source(&priv->idle_id_ip6); priv->idle_id_ip6 = g_idle_add((GSourceFunc) stage3_ip6_done, self); @@ -1343,9 +1343,9 @@ modem_state_changed(MMModem * modem, NMModemBroadband * self) { /* After the SIM is unlocked MM1 will move the device to INITIALIZING which - * is an unavailable state. That makes state handling confusing here, so - * suppress this state change and let the modem move from LOCKED to DISABLED. - */ + * is an unavailable state. That makes state handling confusing here, so + * suppress this state change and let the modem move from LOCKED to DISABLED. + */ if (new_state == MM_MODEM_STATE_INITIALIZING && old_state == MM_MODEM_STATE_LOCKED) return; @@ -1495,7 +1495,7 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps } /* Note: don't grab the Simple iface here; the Modem interface is the - * only one assumed to be always valid and available */ + * only one assumed to be always valid and available */ break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); diff --git a/src/devices/wwan/nm-modem-manager.c b/src/devices/wwan/nm-modem-manager.c index ed701dae75..090cdb212e 100644 --- a/src/devices/wwan/nm-modem-manager.c +++ b/src/devices/wwan/nm-modem-manager.c @@ -53,8 +53,8 @@ typedef struct { guint relaunch_id; /* this only has one use: that the <info> logging line about - * ModemManager available distinguishes between first-time - * and later name-owner-changed. */ + * ModemManager available distinguishes between first-time + * and later name-owner-changed. */ enum { LOG_AVAILABLE_NOT_INITIALIZED = 0, LOG_AVAILABLE_YES, @@ -259,15 +259,15 @@ modm_handle_name_owner_changed(MMManager *modem_manager, GParamSpec *pspec, NMMo g_free(name_owner); /* Hack alert: GDBusObjectManagerClient won't signal neither 'object-added' - * nor 'object-removed' if it was created while there was no ModemManager in - * the bus. This hack avoids this issue until we get a GIO with the fix - * included... */ + * nor 'object-removed' if it was created while there was no ModemManager in + * the bus. This hack avoids this issue until we get a GIO with the fix + * included... */ modm_clear_manager(self); modm_ensure_manager(self); /* Whenever GDBusObjectManagerClient is fixed, we can just do the following: - * modm_manager_available (self); - */ + * modm_manager_available (self); + */ } static void @@ -362,8 +362,8 @@ modm_manager_new_cb(GObject *source, GAsyncResult *res, gpointer user_data) if (!modem_manager) { /* We're not really supposed to get any error here. If we do get one, - * though, just re-schedule the MMManager creation after some time. - * During this period, name-owner changes won't be followed. */ + * though, just re-schedule the MMManager creation after some time. + * During this period, name-owner changes won't be followed. */ _LOGW("error creating ModemManager client: %s", error->message); /* Setup timeout to relaunch */ modm_schedule_manager_relaunch(self, MODEM_POKE_INTERVAL); @@ -398,8 +398,8 @@ modm_ensure_manager(NMModemManager *self) g_assert(priv->dbus_connection); /* Create the GDBusObjectManagerClient. We do not request to autostart, as - * we don't really want the MMManager creation to fail. We can always poke - * later on if we want to request the autostart */ + * we don't really want the MMManager creation to fail. We can always poke + * later on if we want to request the autostart */ if (!priv->modm.manager) { if (!priv->main_cancellable) priv->main_cancellable = g_cancellable_new(); @@ -431,7 +431,7 @@ modm_schedule_manager_relaunch(NMModemManager *self, guint n_seconds) NMModemManagerPrivate *priv = NM_MODEM_MANAGER_GET_PRIVATE(self); /* No need to pass an extra reference to self; timeout/idle will be - * cancelled if the object gets disposed. */ + * cancelled if the object gets disposed. */ if (n_seconds) priv->modm.relaunch_id = g_timeout_add_seconds(n_seconds, (GSourceFunc) modm_schedule_manager_relaunch_cb, self); @@ -508,8 +508,8 @@ nm_modem_manager_name_owner_ref(NMModemManager *self) if (priv->modm.proxy_ref_count++ > 0) { /* only try once to create the proxy. If proxy creation - * for the first "ref" failed, it's unclear what to do. - * The proxy is hosed. */ + * for the first "ref" failed, it's unclear what to do. + * The proxy is hosed. */ return; } @@ -570,10 +570,10 @@ ofono_create_modem(NMModemManager *self, const char *path) NMModem * modem = NULL; /* Ensure duplicate modems aren't created. Because we're not using the - * ObjectManager interface there's a race during oFono startup where we - * receive ModemAdded signals before GetModems() returns, so some of the - * modems returned from GetModems() may already have been created. - */ + * ObjectManager interface there's a race during oFono startup where we + * receive ModemAdded signals before GetModems() returns, so some of the + * modems returned from GetModems() may already have been created. + */ if (!g_hash_table_lookup(priv->modems, path)) { modem = nm_modem_ofono_new(path); if (modem) diff --git a/src/devices/wwan/nm-modem-ofono.c b/src/devices/wwan/nm-modem-ofono.c index 0439c36283..42149a1bd0 100644 --- a/src/devices/wwan/nm-modem-ofono.c +++ b/src/devices/wwan/nm-modem-ofono.c @@ -361,13 +361,13 @@ sim_get_properties_done(GObject *source, GAsyncResult *result, gpointer user_dat _LOGD("sim v_dict is type: %s", g_variant_get_type_string(v_dict)); /* - * TODO: - * 1) optimize by looking up properties ( Online, Interfaces ), instead - * of iterating - * - * 2) reduce code duplication between all of the get_properties_done - * functions in this class. - */ + * TODO: + * 1) optimize by looking up properties ( Online, Interfaces ), instead + * of iterating + * + * 2) reduce code duplication between all of the get_properties_done + * functions in this class. + */ g_variant_iter_init(&i, v_dict); while (g_variant_iter_next(&i, "{&sv}", &property, &v)) { @@ -514,13 +514,13 @@ connman_get_properties_done(GObject *source, GAsyncResult *result, gpointer user v_dict = g_variant_get_child_value(v_properties, 0); /* - * TODO: - * 1) optimize by looking up properties ( Online, Interfaces ), instead - * of iterating - * - * 2) reduce code duplication between all of the get_properties_done - * functions in this class. - */ + * TODO: + * 1) optimize by looking up properties ( Online, Interfaces ), instead + * of iterating + * + * 2) reduce code duplication between all of the get_properties_done + * functions in this class. + */ g_variant_iter_init(&i, v_dict); while (g_variant_iter_next(&i, "{&sv}", &property, &v)) { @@ -584,8 +584,8 @@ handle_connman_iface(NMModemOfono *self, gboolean found) } /* The connection manager proxy disappeared, we should - * consider the modem disabled. - */ + * consider the modem disabled. + */ priv->gprs_attached = FALSE; update_modem_state(self); @@ -691,13 +691,13 @@ modem_get_properties_done(GObject *source, GAsyncResult *result, gpointer user_d } /* - * TODO: - * 1) optimize by looking up properties ( Online, Interfaces ), instead - * of iterating - * - * 2) reduce code duplication between all of the get_properties_done - * functions in this class. - */ + * TODO: + * 1) optimize by looking up properties ( Online, Interfaces ), instead + * of iterating + * + * 2) reduce code duplication between all of the get_properties_done + * functions in this class. + */ g_variant_iter_init(&i, v_dict); while (g_variant_iter_next(&i, "{&sv}", &property, &v)) { @@ -730,11 +730,11 @@ stage1_prepare_done(GObject *source, GAsyncResult *result, gpointer user_data) nm_modem_emit_prepare_result(NM_MODEM(self), FALSE, NM_DEVICE_STATE_REASON_MODEM_BUSY); /* - * FIXME: add code to check for InProgress so that the - * connection doesn't continue to try and activate, - * leading to the connection being disabled, and a 5m - * timeout... - */ + * FIXME: add code to check for InProgress so that the + * connection doesn't continue to try and activate, + * leading to the connection being disabled, and a 5m + * timeout... + */ } } @@ -757,10 +757,10 @@ context_property_changed(GDBusProxy *proxy, const char *property, GVariant *v, g _LOGD("PropertyChanged: %s", property); /* - * TODO: might be a good idea and re-factor this to mimic bluez-device, - * ie. have this function just check the key, and call a sub-func to - * handle the action. - */ + * TODO: might be a good idea and re-factor this to mimic bluez-device, + * ie. have this function just check the key, and call a sub-func to + * handle the action. + */ if (g_strcmp0(property, "Settings") != 0) return; @@ -968,9 +968,9 @@ context_proxy_new_cb(GObject *source, GAsyncResult *result, gpointer user_data) } /* We have an old copy of the settings from a previous activation, - * clear it so that we can gate getting the IP config from oFono - * on whether or not we have already received them - */ + * clear it so that we can gate getting the IP config from oFono + * on whether or not we have already received them + */ g_clear_object(&priv->ip4_config); _nm_dbus_signal_connect(priv->context_proxy, @@ -1156,8 +1156,8 @@ nm_modem_ofono_new(const char *path) nm_log_info(LOGD_MB, "ofono: creating new Ofono modem path %s", path); /* Use short modem name (not its object path) as the NM device name (which - * comes from NM_MODEM_UID)and the device ID. - */ + * comes from NM_MODEM_UID)and the device ID. + */ basename = g_path_get_basename(path); return (NMModem *) g_object_new(NM_TYPE_MODEM_OFONO, diff --git a/src/devices/wwan/nm-modem.c b/src/devices/wwan/nm-modem.c index 9e4126ab40..89b9cc1e8d 100644 --- a/src/devices/wwan/nm-modem.c +++ b/src/devices/wwan/nm-modem.c @@ -63,7 +63,7 @@ typedef struct _NMModemPrivate { char *data_port; /* TODO: ip_iface is solely used for nm_modem_owns_port(). - * We should rework the code that it's not necessary */ + * We should rework the code that it's not necessary */ char *ip_iface; int ip_ifindex; @@ -214,10 +214,10 @@ nm_modem_unclaim(NMModem *self) g_return_if_fail(priv->claimed); /* we don't actually unclaim the instance. This instance should not be re-used - * by another owner, that is because we only claim modems as we receive them. - * There is no mechanism that somebody else would later re-use them again. - * - * // priv->claimed = FALSE; */ + * by another owner, that is because we only claim modems as we receive them. + * There is no mechanism that somebody else would later re-use them again. + * + * // priv->claimed = FALSE; */ g_object_unref(self); } @@ -513,9 +513,9 @@ ppp_ifindex_set(NMPPPManager *ppp_manager, int ifindex, const char *iface, gpoin if (ifindex <= 0 && iface) { /* this might happen, if the ifname was already deleted - * and we failed to resolve ifindex. - * - * Forget about the name. */ + * and we failed to resolve ifindex. + * + * Forget about the name. */ iface = NULL; } _set_ip_ifindex(self, ifindex, iface); @@ -533,13 +533,13 @@ ppp_ip4_config(NMPPPManager *ppp_manager, NMIP4Config *config, gpointer user_dat gboolean dns_workaround = FALSE; /* Work around a PPP bug (#1732) which causes many mobile broadband - * providers to return 10.11.12.13 and 10.11.12.14 for the DNS servers. - * Apparently fixed in ppp-2.4.5 but we've had some reports that this is - * not the case. - * - * http://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=2e09ef6886bbf00bc5a9a641110f801e372ffde6 - * http://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=f8191bf07df374f119a07910a79217c7618f113e - */ + * providers to return 10.11.12.13 and 10.11.12.14 for the DNS servers. + * Apparently fixed in ppp-2.4.5 but we've had some reports that this is + * not the case. + * + * http://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=2e09ef6886bbf00bc5a9a641110f801e372ffde6 + * http://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=f8191bf07df374f119a07910a79217c7618f113e + */ num = nm_ip4_config_get_num_nameservers(config); if (num == 2) { @@ -555,9 +555,9 @@ ppp_ip4_config(NMPPPManager *ppp_manager, NMIP4Config *config, gpointer user_dat } /* Be somewhat conservative about substitutions; the "bad" nameservers - * could actually be valid in some cases, so only substitute if ppp - * returns *only* the two bad nameservers. - */ + * could actually be valid in some cases, so only substitute if ppp + * returns *only* the two bad nameservers. + */ dns_workaround = (found1 && found2); } @@ -641,9 +641,9 @@ ppp_stage3_ip_config_start(NMModem * self, g_return_val_if_fail(NM_IS_ACT_REQUEST(req), NM_ACT_STAGE_RETURN_FAILURE); /* If we're already running PPP don't restart it; for example, if both - * IPv4 and IPv6 are requested, IPv4 gets started first, but we use the - * same pppd for both v4 and v6. - */ + * IPv4 and IPv6 are requested, IPv4 gets started first, but we use the + * same pppd for both v4 and v6. + */ if (priv->ppp_manager) return NM_ACT_STAGE_RETURN_POSTPONE; @@ -662,17 +662,17 @@ ppp_stage3_ip_config_start(NMModem * self, } /* Check if ModemManager requested a specific IP timeout to be used. If 0 reported, - * use the default one (30s) */ + * use the default one (30s) */ if (priv->mm_ip_timeout > 0) { _LOGI("using modem-specified IP timeout: %u seconds", priv->mm_ip_timeout); ip_timeout = priv->mm_ip_timeout; } /* Some tty drivers and modems ignore port speed, but pppd requires the - * port speed to be > 0 or it exits. If the port speed is 0 pass an - * explicit speed to pppd to prevent the exit. - * https://bugzilla.redhat.com/show_bug.cgi?id=1281731 - */ + * port speed to be > 0 or it exits. If the port speed is 0 pass an + * explicit speed to pppd to prevent the exit. + * https://bugzilla.redhat.com/show_bug.cgi?id=1281731 + */ if (port_speed_is_zero(priv->data_port)) baud_override = 57600; @@ -790,9 +790,9 @@ nm_modem_ip4_pre_commit(NMModem *modem, NMDevice *device, NMIP4Config *config) NMModemPrivate *priv = NM_MODEM_GET_PRIVATE(modem); /* If the modem has an ethernet-type data interface (ie, not PPP and thus - * not point-to-point) and IP config has a /32 prefix, then we assume that - * ARP will be pointless and we turn it off. - */ + * not point-to-point) and IP config has a /32 prefix, then we assume that + * ARP will be pointless and we turn it off. + */ if (priv->ip4_method == NM_MODEM_IP_METHOD_STATIC || priv->ip4_method == NM_MODEM_IP_METHOD_AUTO) { const NMPlatformIP4Address *address = nm_ip4_config_get_first_address(config); @@ -821,8 +821,8 @@ nm_modem_emit_ip6_config_result(NMModem *self, NMIP6Config *config, GError *erro if (config) { /* If the IPv6 configuration only included a Link-Local address, then - * we have to run SLAAC to get the full IPv6 configuration. - */ + * we have to run SLAAC to get the full IPv6 configuration. + */ nm_ip_config_iter_ip6_address_for_each (&ipconf_iter, config, &addr) { if (IN6_IS_ADDR_LINKLOCAL(&addr->address)) { if (!priv->iid.id) @@ -886,9 +886,9 @@ nm_modem_stage3_ip6_config_start(NMModem * self, case NM_MODEM_IP_METHOD_STATIC: case NM_MODEM_IP_METHOD_AUTO: /* Both static and DHCP/Auto retrieve a base IP config from the modem - * which in the static case is the full config, and the DHCP/Auto case - * is just the IPv6LL address to use for SLAAC. - */ + * which in the static case is the full config, and the DHCP/Auto case + * is just the IPv6LL address to use for SLAAC. + */ ret = NM_MODEM_GET_CLASS(self)->stage3_ip6_config_request(self, out_failure_reason); break; default: @@ -1068,8 +1068,8 @@ nm_modem_act_stage2_config(NMModem *self) priv = NM_MODEM_GET_PRIVATE(self); /* Clear secrets tries counter since secrets were successfully used - * already if we get here. - */ + * already if we get here. + */ priv->secrets_tries = 0; } @@ -1105,9 +1105,9 @@ nm_modem_check_connection_compatible(NMModem *self, NMConnection *connection, GE } /* SIM properties may not be available before the SIM is unlocked, so - * to ensure that autoconnect works, the connection's SIM properties - * are only compared if present on the device. - */ + * to ensure that autoconnect works, the connection's SIM properties + * are only compared if present on the device. + */ if (priv->sim_id && (str = nm_setting_gsm_get_sim_id(s_gsm))) { if (!nm_streq(str, priv->sim_id)) { @@ -1304,8 +1304,8 @@ nm_modem_deactivate_async(NMModem * self, if (ppp_manager) { /* If we have a PPP manager, stop it. - * - * Pass on the reference in @ppp_manager. */ + * + * Pass on the reference in @ppp_manager. */ nm_ppp_manager_stop(ppp_manager, ctx->cancellable, _deactivate_ppp_manager_stop_cb, ctx); return; } @@ -1409,8 +1409,8 @@ nm_modem_get_ip_ifindex(NMModem *self) priv = NM_MODEM_GET_PRIVATE(self); /* internally we track an unset ip_ifindex as -1. - * For the caller of nm_modem_get_ip_ifindex(), this - * shall be zero too. */ + * For the caller of nm_modem_get_ip_ifindex(), this + * shall be zero too. */ return priv->ip_ifindex != -1 ? priv->ip_ifindex : 0; } @@ -1955,18 +1955,18 @@ nm_modem_class_init(NMModemClass *klass) G_TYPE_POINTER); /** - * NMModem::ip6-config-result: - * @modem: the #NMModem on which the signal is emitted - * @config: the #NMIP6Config to apply to the modem's data port - * @do_slaac: %TRUE if IPv6 SLAAC should be started - * @error: a #GError if any error occurred during IP configuration - * - * This signal is emitted when IPv6 configuration has completed or failed. - * If @error is set the configuration failed. If @config is set, then - * the details should be applied to the data port before any further - * configuration (like SLAAC) is done. @do_slaac indicates whether SLAAC - * should be started after applying @config to the data port. - */ + * NMModem::ip6-config-result: + * @modem: the #NMModem on which the signal is emitted + * @config: the #NMIP6Config to apply to the modem's data port + * @do_slaac: %TRUE if IPv6 SLAAC should be started + * @error: a #GError if any error occurred during IP configuration + * + * This signal is emitted when IPv6 configuration has completed or failed. + * If @error is set the configuration failed. If @config is set, then + * the details should be applied to the data port before any further + * configuration (like SLAAC) is done. @do_slaac indicates whether SLAAC + * should be started after applying @config to the data port. + */ signals[IP6_CONFIG_RESULT] = g_signal_new(NM_MODEM_IP6_CONFIG_RESULT, G_OBJECT_CLASS_TYPE(object_class), G_SIGNAL_RUN_FIRST, diff --git a/src/devices/wwan/nm-modem.h b/src/devices/wwan/nm-modem.h index 8d56df40f3..4e9bd7a0a2 100644 --- a/src/devices/wwan/nm-modem.h +++ b/src/devices/wwan/nm-modem.h @@ -129,8 +129,8 @@ typedef struct { NMDeviceStateReason *out_failure_reason); /* Request the IP6 config; when the config returns the modem - * subclass should emit the ip6_config_result signal. - */ + * subclass should emit the ip6_config_result signal. + */ NMActStageReturn (*stage3_ip6_config_request)(NMModem * self, NMDeviceStateReason *out_failure_reason); diff --git a/src/devices/wwan/nm-wwan-factory.c b/src/devices/wwan/nm-wwan-factory.c index 602950268f..3d5f7f9577 100644 --- a/src/devices/wwan/nm-wwan-factory.c +++ b/src/devices/wwan/nm-wwan-factory.c @@ -72,9 +72,9 @@ modem_added_cb(NMModemManager *manager, NMModem *modem, gpointer user_data) driver = nm_modem_get_driver(modem); /* If it was a Bluetooth modem and no bluetooth device claimed it, ignore - * it. The rfcomm port (and thus the modem) gets created automatically - * by the Bluetooth code during the connection process. - */ + * it. The rfcomm port (and thus the modem) gets created automatically + * by the Bluetooth code during the connection process. + */ if (driver && strstr(driver, "bluetooth")) { nm_log_dbg( LOGD_MB, diff --git a/src/dhcp/nm-dhcp-client.c b/src/dhcp/nm-dhcp-client.c index 7741de1231..1cc2b54285 100644 --- a/src/dhcp/nm-dhcp-client.c +++ b/src/dhcp/nm-dhcp-client.c @@ -451,10 +451,10 @@ nm_dhcp_client_set_state(NMDhcpClient *self, watch_cleanup(self); /* The client may send same-state transitions for RENEW/REBIND events and - * the lease may have changed, so handle same-state transitions for the - * EXTENDED and BOUND states. Ignore same-state transitions for other - * events since the lease won't have changed and the state was already handled. - */ + * the lease may have changed, so handle same-state transitions for the + * EXTENDED and BOUND states. Ignore same-state transitions for other + * events since the lease won't have changed and the state was already handled. + */ if ((priv->state == new_state) && !NM_IN_SET(new_state, NM_DHCP_STATE_BOUND, NM_DHCP_STATE_EXTENDED)) return; @@ -741,8 +741,8 @@ bytearray_variant_to_string(NMDhcpClient *self, GVariant *value, const char *key array = g_variant_get_fixed_array(value, &length, 1); /* Since the DHCP options come through environment variables, they should - * already be UTF-8 safe, but just make sure. - */ + * already be UTF-8 safe, but just make sure. + */ str = g_string_sized_new(length); for (i = 0; i < length; i++) { c = array[i]; @@ -806,20 +806,20 @@ maybe_add_option(NMDhcpClient *self, GHashTable *hash, const char *key, GVariant g_hash_table_insert(hash, g_strdup(key), str_value); /* dhclient has no special labels for private dhcp options: it uses "unknown_xyz" - * labels for that. We need to identify those to alias them to our "private_xyz" - * format unused in the internal dchp plugins. - */ + * labels for that. We need to identify those to alias them to our "private_xyz" + * format unused in the internal dchp plugins. + */ if ((priv_opt_num = label_is_unknown_xyz(key)) > 0) { gs_free guint8 *check_val = NULL; char * hex_str = NULL; gsize len; /* dhclient passes values from dhcp private options in its own "string" format: - * if the raw values are printable as ascii strings, it will pass the string - * representation; if the values are not printable as an ascii string, it will - * pass a string displaying the hex values (hex string). Try to enforce passing - * always an hex string, converting string representation if needed. - */ + * if the raw values are printable as ascii strings, it will pass the string + * representation; if the values are not printable as an ascii string, it will + * pass a string displaying the hex values (hex string). Try to enforce passing + * always an hex string, converting string representation if needed. + */ check_val = nm_utils_hexstr2bin_alloc(str_value, FALSE, TRUE, ":", 0, &len); hex_str = nm_utils_bin2hexstr_full(check_val ?: (guint8 *) str_value, check_val ? len : strlen(str_value), @@ -912,8 +912,8 @@ nm_dhcp_client_handle_event(gpointer unused, if (!IN6_IS_ADDR_UNSPECIFIED(&prefix.address)) { /* If we got an IPv6 prefix to delegate, we don't change the state - * of the DHCP client instance. Instead, we just signal the prefix - * to the device. */ + * of the DHCP client instance. Instead, we just signal the prefix + * to the device. */ nm_dhcp_client_emit_ipv6_prefix_delegated(self, &prefix); } else { /* Fail if no valid IP config was received */ @@ -1129,9 +1129,9 @@ dispose(GObject *object) NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE(self); /* Stopping the client is left up to the controlling device - * explicitly since we may want to quit NetworkManager but not terminate - * the DHCP client. - */ + * explicitly since we may want to quit NetworkManager but not terminate + * the DHCP client. + */ nm_assert(c_list_is_empty(&self->dhcp_client_lst)); diff --git a/src/dhcp/nm-dhcp-client.h b/src/dhcp/nm-dhcp-client.h index 066ed436d2..f33c4911be 100644 --- a/src/dhcp/nm-dhcp-client.h +++ b/src/dhcp/nm-dhcp-client.h @@ -94,14 +94,14 @@ typedef struct { void (*stop)(NMDhcpClient *self, gboolean release); /** - * get_duid: - * @self: the #NMDhcpClient - * - * Attempts to find an existing DHCPv6 DUID for this client in the DHCP - * client's persistent configuration. Returned DUID should be the binary - * representation of the DUID. If no DUID is found, %NULL should be - * returned. - */ + * get_duid: + * @self: the #NMDhcpClient + * + * Attempts to find an existing DHCPv6 DUID for this client in the DHCP + * client's persistent configuration. Returned DUID should be the binary + * representation of the DUID. If no DUID is found, %NULL should be + * returned. + */ GBytes *(*get_duid)(NMDhcpClient *self); } NMDhcpClientClass; diff --git a/src/dhcp/nm-dhcp-dhclient-utils.c b/src/dhcp/nm-dhcp-dhclient-utils.c index d09b162c41..9c1863974e 100644 --- a/src/dhcp/nm-dhcp-dhclient-utils.c +++ b/src/dhcp/nm-dhcp-dhclient-utils.c @@ -112,8 +112,8 @@ add_ip4_config(GString * str, nm_assert(p); /* Allow type 0 (non-hardware address) to be represented as a string - * as long as all the characters are printable. - */ + * as long as all the characters are printable. + */ for (i = 1; (p[0] == 0) && i < l; i++) { if (!g_ascii_isprint(p[i]) || p[i] == '\\' || p[i] == '"') break; @@ -345,7 +345,7 @@ nm_dhcp_dhclient_create_config(const char * interface, if (NM_STR_HAS_PREFIX(p, "lease") || NM_STR_HAS_PREFIX(p, "alias") || NM_STR_HAS_PREFIX(p, "interface") || NM_STR_HAS_PREFIX(p, "pseudo")) { /* skip over these blocks, except 'interface' when it - * matches the current interface */ + * matches the current interface */ blocks_skip++; g_string_append_c(blocks_stack, 'b'); if (!intf[0] && NM_STR_HAS_PREFIX(p, "interface")) { @@ -377,12 +377,12 @@ nm_dhcp_dhclient_create_config(const char * interface, continue; /* Some timing parameters in dhclient should not be imported (timeout, retry). - * The retry parameter will be simply not used as we will exit on first failure. - * The timeout one instead may affect NetworkManager behavior: if the timeout - * elapses before dhcp-timeout dhclient will report failure and cause NM to - * fail the dhcp process before dhcp-timeout. So, always skip importing timeout - * as we will need to add one greater than dhcp-timeout. - */ + * The retry parameter will be simply not used as we will exit on first failure. + * The timeout one instead may affect NetworkManager behavior: if the timeout + * elapses before dhcp-timeout dhclient will report failure and cause NM to + * fail the dhcp process before dhcp-timeout. So, always skip importing timeout + * as we will need to add one greater than dhcp-timeout. + */ if (!strncmp(p, TIMEOUT_TAG, strlen(TIMEOUT_TAG)) || !strncmp(p, RETRY_TAG, strlen(RETRY_TAG))) continue; @@ -407,8 +407,8 @@ nm_dhcp_dhclient_create_config(const char * interface, } /* To let user's FQDN options (except "fqdn.fqdn") override the - * default ones set by NM, add them later - */ + * default ones set by NM, add them later + */ if (!strncmp(p, FQDN_TAG_PREFIX, NM_STRLEN(FQDN_TAG_PREFIX))) { if (!fqdn_opts) fqdn_opts = g_ptr_array_new_full(5, g_free); @@ -453,8 +453,8 @@ nm_dhcp_dhclient_create_config(const char * interface, g_string_append_c(new_contents, '\n'); /* ensure dhclient timeout is greater than dhcp-timeout: as dhclient timeout default value is - * 60 seconds, we need this only if dhcp-timeout is greater than 60. - */ + * 60 seconds, we need this only if dhcp-timeout is greater than 60. + */ if (timeout >= 60) { timeout = timeout < G_MAXINT32 ? timeout + 1 : G_MAXINT32; g_string_append_printf(new_contents, "timeout %u;\n", timeout); @@ -567,8 +567,8 @@ nm_dhcp_dhclient_unescape_duid(const char *duid) guint8 octal; /* FIXME: it's wrong to have an "unescape-duid" function. dhclient - * defines a file format with escaping. So we need a general unescape - * function that can handle dhclient syntax. */ + * defines a file format with escaping. So we need a general unescape + * function that can handle dhclient syntax. */ len = strlen(duid); unescaped = g_byte_array_sized_new(len); @@ -584,7 +584,7 @@ nm_dhcp_dhclient_unescape_duid(const char *duid) i += 2; } else { /* FIXME: don't warn on untrusted data. Either signal an error, or accept - * it silently. */ + * it silently. */ /* One of ", ', $, `, \, |, or & */ g_warn_if_fail(p[i] == '"' || p[i] == '\'' || p[i] == '$' || p[i] == '`' @@ -682,9 +682,9 @@ nm_dhcp_dhclient_save_duid(const char *leasefile, GBytes *duid, GError **error) const char *l; /* If we find an uncommented DUID in the file, check if - * equal to the one we are going to write: if so, no need - * to update the lease file, otherwise skip the old DUID. - */ + * equal to the one we are going to write: if so, no need + * to update the lease file, otherwise skip the old DUID. + */ l = nm_str_skip_leading_spaces(str); if (g_str_has_prefix(l, DUID_PREFIX)) { gs_strfreev char **split = NULL; diff --git a/src/dhcp/nm-dhcp-dhclient.c b/src/dhcp/nm-dhcp-dhclient.c index 6dddef75ba..9b72ce11f0 100644 --- a/src/dhcp/nm-dhcp-dhclient.c +++ b/src/dhcp/nm-dhcp-dhclient.c @@ -118,10 +118,10 @@ get_dhclient_leasefile(int addr_family, NM_SET_OUT(out_preferred_path, g_steal_pointer(&path)); /* If the leasefile we're looking for doesn't exist yet in the new location - * (eg, /var/lib/NetworkManager) then look in old locations to maintain - * backwards compatibility with external tools (like dracut) that put - * leasefiles there. - */ + * (eg, /var/lib/NetworkManager) then look in old locations to maintain + * backwards compatibility with external tools (like dracut) that put + * leasefiles there. + */ /* Old Debian, SUSE, and Mandriva location */ g_free(path); @@ -201,9 +201,9 @@ find_existing_config(NMDhcpDhclient *self, int addr_family, const char *iface, c char *path; /* NetworkManager-overridden configuration can be used to ship DHCP config - * with NetworkManager itself. It can be uuid-specific, device-specific - * or generic. - */ + * with NetworkManager itself. It can be uuid-specific, device-specific + * or generic. + */ if (uuid) { path = g_strdup_printf(NMCONFDIR "/dhclient%s-%s.conf", _addr_family_to_path_part(addr_family), @@ -229,13 +229,13 @@ find_existing_config(NMDhcpDhclient *self, int addr_family, const char *iface, c g_free(path); /* Distribution's dhclient configuration is used so that we can use - * configuration shipped with dhclient (if any). - * - * This replaces conditional compilation based on distribution name. Fedora - * and Debian store the configs in /etc/dhcp while upstream defaults to /etc - * which is then used by many other distributions. Some distributions - * (including Fedora) don't even provide a default configuration file. - */ + * configuration shipped with dhclient (if any). + * + * This replaces conditional compilation based on distribution name. Fedora + * and Debian store the configs in /etc/dhcp while upstream defaults to /etc + * which is then used by many other distributions. Some distributions + * (including Fedora) don't even provide a default configuration file. + */ path = g_strdup_printf(SYSCONFDIR "/dhcp/dhclient%s-%s.conf", _addr_family_to_path_part(addr_family), iface); @@ -428,8 +428,8 @@ dhclient_start(NMDhcpClient *client, g_ptr_array_add(argv, (gpointer) "-d"); /* Be quiet. dhclient logs to syslog anyway. And we duplicate the syslog - * to stderr in case of NM running with --debug. - */ + * to stderr in case of NM running with --debug. + */ g_ptr_array_add(argv, (gpointer) "-q"); if (release) @@ -459,9 +459,9 @@ dhclient_start(NMDhcpClient *client, } /* Usually the system bus address is well-known; but if it's supposed - * to be something else, we need to push it to dhclient, since dhclient - * sanitizes the environment it gives the action scripts. - */ + * to be something else, we need to push it to dhclient, since dhclient + * sanitizes the environment it gives the action scripts. + */ system_bus_address = getenv("DBUS_SYSTEM_BUS_ADDRESS"); if (system_bus_address) { system_bus_address_env = g_strdup_printf("DBUS_SYSTEM_BUS_ADDRESS=%s", system_bus_address); diff --git a/src/dhcp/nm-dhcp-dhcpcanon.c b/src/dhcp/nm-dhcp-dhcpcanon.c index 83d7bd25d8..2cf7b93795 100644 --- a/src/dhcp/nm-dhcp-dhcpcanon.c +++ b/src/dhcp/nm-dhcp-dhcpcanon.c @@ -124,9 +124,9 @@ dhcpcanon_start(NMDhcpClient *client, } /* Usually the system bus address is well-known; but if it's supposed - * to be something else, we need to push it to dhcpcanon, since dhcpcanon - * sanitizes the environment it gives the action scripts. - */ + * to be something else, we need to push it to dhcpcanon, since dhcpcanon + * sanitizes the environment it gives the action scripts. + */ system_bus_address = getenv("DBUS_SYSTEM_BUS_ADDRESS"); if (system_bus_address) { system_bus_address_env = g_strdup_printf("DBUS_SYSTEM_BUS_ADDRESS=%s", system_bus_address); diff --git a/src/dhcp/nm-dhcp-dhcpcd.c b/src/dhcp/nm-dhcp-dhcpcd.c index eea928aec6..449cd4d460 100644 --- a/src/dhcp/nm-dhcp-dhcpcd.c +++ b/src/dhcp/nm-dhcp-dhcpcd.c @@ -87,8 +87,8 @@ ip4_start(NMDhcpClient *client, iface = nm_dhcp_client_get_iface(client); /* dhcpcd does not allow custom pidfiles; the pidfile is always - * RUNSTATEDIR "dhcpcd-<ifname>.pid". - */ + * RUNSTATEDIR "dhcpcd-<ifname>.pid". + */ priv->pid_file = g_strdup_printf(RUNSTATEDIR "/dhcpcd-%s.pid", iface); dhcpcd_path = nm_dhcp_dhcpcd_get_path(); @@ -119,9 +119,9 @@ ip4_start(NMDhcpClient *client, g_ptr_array_add(argv, (gpointer) nm_dhcp_helper_path); /* IPv4-only for now. NetworkManager knows better than dhcpcd when to - * run IPv6, and dhcpcd's automatic Router Solicitations cause problems - * with devices that don't expect them. - */ + * run IPv6, and dhcpcd's automatic Router Solicitations cause problems + * with devices that don't expect them. + */ g_ptr_array_add(argv, (gpointer) "-4"); hostname = nm_dhcp_client_get_hostname(client); diff --git a/src/dhcp/nm-dhcp-helper.c b/src/dhcp/nm-dhcp-helper.c index 818a6f3c68..325f1be54e 100644 --- a/src/dhcp/nm-dhcp-helper.c +++ b/src/dhcp/nm-dhcp-helper.c @@ -83,12 +83,12 @@ build_signal_parameters(void) continue; /* Value passed as a byte array rather than a string, because there are - * no character encoding guarantees with DHCP, and D-Bus requires - * strings to be UTF-8. - * - * Note that we can't use g_variant_new_bytestring() here, because that - * includes the trailing '\0'. (??!?) - */ + * no character encoding guarantees with DHCP, and D-Bus requires + * strings to be UTF-8. + * + * Note that we can't use g_variant_new_bytestring() here, because that + * includes the trailing '\0'. (??!?) + */ g_variant_builder_add(&builder, "{sv}", name, @@ -128,10 +128,10 @@ main(int argc, char *argv[]) gint64 time_end; /* Connecting to the unix socket can fail with EAGAIN if there are too - * many pending connections and the server can't accept them in time - * before reaching backlog capacity. Ideally the server should increase - * the backlog length, but GLib doesn't provide a way to change it for a - * GDBus server. Retry for up to 5 seconds in case of failure. */ + * many pending connections and the server can't accept them in time + * before reaching backlog capacity. Ideally the server should increase + * the backlog length, but GLib doesn't provide a way to change it for a + * GDBus server. Retry for up to 5 seconds in case of failure. */ time_start = g_get_monotonic_time(); time_end = time_start + (5000 * 1000L); try_count = 0; @@ -193,10 +193,10 @@ do_notify: gint64 interval; /* I am not sure that a race can actually happen, as we register the object - * on the server side during GDBusServer:new-connection signal. - * - * However, there was also a race for subscribing to an event, so let's just - * do some retry. */ + * on the server side during GDBusServer:new-connection signal. + * + * However, there was also a race for subscribing to an event, so let's just + * do some retry. */ if (remaining_time > 0) { _LOGi("failure to call notify: %s (retry %u)", error->message, try_count); interval = NM_CLAMP((gint64)(100L * (1L << NM_MIN(try_count, 31))), 5000, 25000); @@ -209,9 +209,9 @@ do_notify: g_clear_error(&error); /* for backward compatibility, try to emit the signal. There is no stable - * API between the dhcp-helper and NetworkManager. However, while upgrading - * the NetworkManager package, a newer helper might want to notify an - * older server, which still uses the "Event". */ + * API between the dhcp-helper and NetworkManager. However, while upgrading + * the NetworkManager package, a newer helper might want to notify an + * older server, which still uses the "Event". */ if (!g_dbus_connection_emit_signal(connection, NULL, "/", diff --git a/src/dhcp/nm-dhcp-listener.c b/src/dhcp/nm-dhcp-listener.c index add389f62c..9fd5fca4eb 100644 --- a/src/dhcp/nm-dhcp-listener.c +++ b/src/dhcp/nm-dhcp-listener.c @@ -27,7 +27,7 @@ const NMDhcpClientFactory *const _nm_dhcp_manager_factories[6] = { /* the order here matters, as we will try the plugins in this order to find - * the first available plugin. */ + * the first available plugin. */ #if WITH_DHCPCANON &_nm_dhcp_client_factory_dhcpcanon, @@ -108,8 +108,8 @@ get_option(GVariant *options, const char *key) bytes = g_variant_get_fixed_array(value, &len, 1); /* Since the DHCP options come through environment variables, they should - * already be UTF-8 safe, but just make sure. - */ + * already be UTF-8 safe, but just make sure. + */ converted = g_malloc(len + 1); for (s = bytes, d = converted; s < bytes + len; s++, d++) { /* Convert NULLs to spaces and non-ASCII characters to ? */ @@ -228,7 +228,7 @@ new_connection_cb(NMDBusManager * mgr, GError * error = NULL; /* it is important to register the object during the new-connection signal, - * as this avoids races with the connecting object. */ + * as this avoids races with the connecting object. */ registration_id = _dbus_connection_register_object(self, connection, &error); if (!registration_id) { _LOGE("failure to register %s for connection %p: %s", diff --git a/src/dhcp/nm-dhcp-manager.c b/src/dhcp/nm-dhcp-manager.c index 7596901c64..f064760312 100644 --- a/src/dhcp/nm-dhcp-manager.c +++ b/src/dhcp/nm-dhcp-manager.c @@ -92,24 +92,24 @@ _client_factory_get_gtype(const NMDhcpClientFactory *client_factory, int addr_fa nm_assert_addr_family(addr_family); /* currently, the chosen DHCP plugin for IPv4 and IPv6 is configured in NetworkManager.conf - * and cannot be reloaded. It would be nice to configure the plugin per address family - * or to be able to reload it. - * - * Note that certain options in NetworkManager.conf depend on the chosen DHCP plugin. - * See "dhcp-plugin:" in "Device List Format" (`man NetworkManager.conf`). - * Supporting reloading the plugin would also require to re-evalate the decisions from - * the "Device List Format". Likewise, having per-address family plugins would make the - * "main.dhcp" setting and "dhcp-plugin:" match non-sensical because these configurations - * currently are address family independent. - * - * So actually, we don't want that complexity. We want to phase out all plugins in favor - * of the internal plugin. - * However, certain existing plugins are well known to not support an address family. - * In those cases, we should just silently fallback to the internal plugin. - * - * This could be a problem with forward compatibility if we ever intended to add IPv6 support - * to those plugins. But we don't intend to do so. The internal plugin is the way forward and - * not extending other plugins. */ + * and cannot be reloaded. It would be nice to configure the plugin per address family + * or to be able to reload it. + * + * Note that certain options in NetworkManager.conf depend on the chosen DHCP plugin. + * See "dhcp-plugin:" in "Device List Format" (`man NetworkManager.conf`). + * Supporting reloading the plugin would also require to re-evalate the decisions from + * the "Device List Format". Likewise, having per-address family plugins would make the + * "main.dhcp" setting and "dhcp-plugin:" match non-sensical because these configurations + * currently are address family independent. + * + * So actually, we don't want that complexity. We want to phase out all plugins in favor + * of the internal plugin. + * However, certain existing plugins are well known to not support an address family. + * In those cases, we should just silently fallback to the internal plugin. + * + * This could be a problem with forward compatibility if we ever intended to add IPv6 support + * to those plugins. But we don't intend to do so. The internal plugin is the way forward and + * not extending other plugins. */ if (client_factory->get_type_per_addr_family) gtype = client_factory->get_type_per_addr_family(addr_family); @@ -173,9 +173,9 @@ remove_client(NMDhcpManager *self, NMDhcpClient *client) c_list_unlink(&client->dhcp_client_lst); /* Stopping the client is left up to the controlling device - * explicitly since we may want to quit NetworkManager but not terminate - * the DHCP client. - */ + * explicitly since we may want to quit NetworkManager but not terminate + * the DHCP client. + */ } static void @@ -280,11 +280,11 @@ client_start(NMDhcpManager * self, client = get_client_for_ifindex(self, addr_family, ifindex); if (client) { /* FIXME: we cannot just call synchronously "stop()" and forget about the client. - * We need to wait for the client to be fully stopped because most/all clients - * cannot quit right away. - * - * FIXME(shutdown): also fix this during shutdown, to wait for all DHCP clients - * to be fully stopped. */ + * We need to wait for the client to be fully stopped because most/all clients + * cannot quit right away. + * + * FIXME(shutdown): also fix this during shutdown, to wait for all DHCP clients + * to be fully stopped. */ remove_client(self, client); nm_dhcp_client_stop(client, FALSE); g_object_unref(client); @@ -345,30 +345,30 @@ client_start(NMDhcpManager * self, self); /* unfortunately, our implementations work differently per address-family regarding client-id/DUID. - * - * - for IPv4, the calling code may determine a client-id (from NM's connection profile). - * If present, it is taken. If not present, the DHCP plugin uses a plugin specific default. - * - for "internal" plugin, the default is just "mac". - * - for "dhclient", we try to get the configuration from dhclient's /etc/dhcp or fallback - * to whatever dhclient uses by default. - * We do it this way, because for dhclient the user may configure a default - * outside of NM, and we want to honor that. Worse, dhclient could be a wapper - * script where the wrapper script overwrites the client-id. We need to distinguish - * between: force a particular client-id and leave it unspecified to whatever dhclient - * wants. - * - * - for IPv6, the calling code always determines a client-id. It also specifies @enforce_duid, - * to determine whether the given client-id must be used. - * - for "internal" plugin @enforce_duid doesn't matter and the given client-id is - * always used. - * - for "dhclient", @enforce_duid FALSE means to first try to load the DUID from the - * lease file, and only otherwise fallback to the given client-id. - * - other plugins don't support DHCPv6. - * It's done this way, so that existing dhclient setups don't change behavior on upgrade. - * - * This difference is cumbersome and only exists because of "dhclient" which supports hacking the - * default outside of NetworkManager API. - */ + * + * - for IPv4, the calling code may determine a client-id (from NM's connection profile). + * If present, it is taken. If not present, the DHCP plugin uses a plugin specific default. + * - for "internal" plugin, the default is just "mac". + * - for "dhclient", we try to get the configuration from dhclient's /etc/dhcp or fallback + * to whatever dhclient uses by default. + * We do it this way, because for dhclient the user may configure a default + * outside of NM, and we want to honor that. Worse, dhclient could be a wapper + * script where the wrapper script overwrites the client-id. We need to distinguish + * between: force a particular client-id and leave it unspecified to whatever dhclient + * wants. + * + * - for IPv6, the calling code always determines a client-id. It also specifies @enforce_duid, + * to determine whether the given client-id must be used. + * - for "internal" plugin @enforce_duid doesn't matter and the given client-id is + * always used. + * - for "dhclient", @enforce_duid FALSE means to first try to load the DUID from the + * lease file, and only otherwise fallback to the given client-id. + * - other plugins don't support DHCPv6. + * It's done this way, so that existing dhclient setups don't change behavior on upgrade. + * + * This difference is cumbersome and only exists because of "dhclient" which supports hacking the + * default outside of NetworkManager API. + */ if (addr_family == AF_INET) { success = nm_dhcp_client_start_ip4(client, @@ -430,10 +430,10 @@ nm_dhcp_manager_start_ip4(NMDhcpManager * self, if (send_hostname) { /* Use, in order of preference: - * 1. FQDN from configuration - * 2. hostname from configuration - * 3. system hostname (only host part) - */ + * 1. FQDN from configuration + * 2. hostname from configuration + * 3. system hostname (only host part) + */ if (dhcp_fqdn) { hostname = dhcp_fqdn; use_fqdn = TRUE; @@ -652,9 +652,9 @@ nm_dhcp_manager_init(NMDhcpManager *self) nm_log_info(LOGD_DHCP, "dhcp-init: Using DHCP client '%s'", client_factory->name); /* NOTE: currently the DHCP plugin is chosen once at start. It's not - * possible to reload that configuration. If that ever becomes possible, - * beware that the "dhcp-plugin" device spec made decisions based on - * the previous plugin and may need reevaluation. */ + * possible to reload that configuration. If that ever becomes possible, + * beware that the "dhcp-plugin" device spec made decisions based on + * the previous plugin and may need reevaluation. */ priv->client_factory = client_factory; } diff --git a/src/dhcp/nm-dhcp-nettools.c b/src/dhcp/nm-dhcp-nettools.c index 5b9300846f..183e26bb3f 100644 --- a/src/dhcp/nm-dhcp-nettools.c +++ b/src/dhcp/nm-dhcp-nettools.c @@ -75,8 +75,8 @@ static void set_error_nettools(GError **error, int r, const char *message) { /* the error code returned from n_dhcp4_* API is either a negative - * errno, or a positive internal error code. Generate different messages - * for these. */ + * errno, or a positive internal error code. Generate different messages + * for these. */ if (r < 0) nm_utils_error_set_errno(error, r, "%s: %s", message); else @@ -228,21 +228,21 @@ lease_option_print_domain_name(GString * str, uint8_t c; /* - * We are given two adjacent memory regions. The @cache contains alreday parsed - * domain names, and the @datap contains the remaining data to parse. - * - * A domain name is formed from a sequence of labels. Each label start with - * a length byte, where the two most significant bits are unset. A zero-length - * label indicates the end of the domain name. - * - * Alternatively, a label can be followed by an offset (indicated by the two - * most significant bits being set in the next byte that is read). The offset - * is an offset into the cache, where the next label of the domain name can - * be found. - * - * Note, that each time a jump to an offset is performed, the size of the - * cache shrinks, so this is guaranteed to terminate. - */ + * We are given two adjacent memory regions. The @cache contains alreday parsed + * domain names, and the @datap contains the remaining data to parse. + * + * A domain name is formed from a sequence of labels. Each label start with + * a length byte, where the two most significant bits are unset. A zero-length + * label indicates the end of the domain name. + * + * Alternatively, a label can be followed by an offset (indicated by the two + * most significant bits being set in the next byte that is read). The offset + * is an offset into the cache, where the next label of the domain name can + * be found. + * + * Note, that each time a jump to an offset is performed, the size of the + * cache shrinks, so this is guaranteed to terminate. + */ if (cache + n_cache != *datap) return FALSE; @@ -257,9 +257,9 @@ lease_option_print_domain_name(GString * str, if (n_label == 0) { /* - * We reached the final label of the domain name. Adjust - * the cache to include the consumed data, and return. - */ + * We reached the final label of the domain name. Adjust + * the cache to include the consumed data, and return. + */ *n_cachep = *datap - cache; return TRUE; } @@ -279,9 +279,9 @@ lease_option_print_domain_name(GString * str, size_t offset = (c & 0x3F) << 16; /* - * The offset is given as two bytes (in big endian), where the - * two high bits are masked out. - */ + * The offset is given as two bytes (in big endian), where the + * two high bits are masked out. + */ if (!lease_option_consume(&c, sizeof(c), domainp, n_domainp)) return FALSE; @@ -387,7 +387,7 @@ lease_parse_address(NDhcp4ClientLease *lease, n_dhcp4_client_lease_get_basetime(lease, &nettools_basetime); /* usually we shouldn't assert against external libraries like n-dhcp4. - * Here we still do it... it seems safe enough. */ + * Here we still do it... it seems safe enough. */ nm_assert(nettools_basetime > 0); nm_assert(nettools_lifetime >= nettools_basetime); nm_assert(((nettools_lifetime - nettools_basetime) % NM_UTILS_NSEC_PER_SEC) == 0); @@ -400,15 +400,15 @@ lease_parse_address(NDhcp4ClientLease *lease, lifetime = nettools_lifetime - nettools_basetime; /* we "ceil" the value to the next second. In practice, we don't expect any sub-second values - * from n-dhcp4 anyway, so this should have no effect. */ + * from n-dhcp4 anyway, so this should have no effect. */ lifetime += NM_UTILS_NSEC_PER_SEC - 1; } ts = nm_utils_monotonic_timestamp_from_boottime(nettools_basetime, 1); /* the timestamp must be positive, because we only started nettools DHCP client - * after obtaining the first monotonic timestamp. Hence, the lease must have been - * received afterwards. */ + * after obtaining the first monotonic timestamp. Hence, the lease must have been + * received afterwards. */ nm_assert(ts >= NM_UTILS_NSEC_PER_SEC); a_timestamp = ts / NM_UTILS_NSEC_PER_SEC; @@ -499,7 +499,7 @@ lease_parse_address_list(NDhcp4ClientLease * lease, case NM_DHCP_OPTION_DHCP4_DOMAIN_NAME_SERVER: if (addr.s_addr == 0 || nm_ip4_addr_is_localhost(addr.s_addr)) { /* Skip localhost addresses, like also networkd does. - * See https://github.com/systemd/systemd/issues/4524. */ + * See https://github.com/systemd/systemd/issues/4524. */ continue; } nm_ip4_config_add_nameserver(ip4_config, addr.s_addr); @@ -559,7 +559,7 @@ lease_parse_routes(NDhcp4ClientLease *lease, if (plen == 0) { /* if there are multiple default routes, we add them with differing - * metrics. */ + * metrics. */ m = default_route_metric; if (default_route_metric < G_MAXUINT32) default_route_metric++; @@ -603,16 +603,16 @@ lease_parse_routes(NDhcp4ClientLease *lease, if (has_classless) { /* RFC 3443: if the DHCP server returns both a Classless Static Routes - * option and a Static Routes option, the DHCP client MUST ignore the - * Static Routes option. */ + * option and a Static Routes option, the DHCP client MUST ignore the + * Static Routes option. */ continue; } if (plen == 0) { /* for option 33 (static route), RFC 2132 says: - * - * The default route (0.0.0.0) is an illegal destination for a static - * route. */ + * + * The default route (0.0.0.0) is an illegal destination for a static + * route. */ continue; } @@ -649,16 +649,16 @@ lease_parse_routes(NDhcp4ClientLease *lease, if (has_router_from_classless) { /* If the DHCP server returns both a Classless Static Routes option and a - * Router option, the DHCP client MUST ignore the Router option [RFC 3442]. - * - * Be more lenient and ignore the Router option only if Classless Static - * Routes contain a default gateway (as other DHCP backends do). - */ + * Router option, the DHCP client MUST ignore the Router option [RFC 3442]. + * + * Be more lenient and ignore the Router option only if Classless Static + * Routes contain a default gateway (as other DHCP backends do). + */ continue; } /* if there are multiple default routes, we add them with differing - * metrics. */ + * metrics. */ m = default_route_metric; if (default_route_metric < G_MAXUINT32) default_route_metric++; @@ -937,7 +937,7 @@ lease_parse_private_options(NDhcp4ClientLease *lease, GHashTable *options) int r; /* We manage private options 249 (private classless static route) and 252 (wpad) in a special - * way, so skip them as we here just manage all (the other) private options as raw data */ + * way, so skip them as we here just manage all (the other) private options as raw data */ if (NM_IN_SET(i, NM_DHCP_OPTION_DHCP4_PRIVATE_CLASSLESS_STATIC_ROUTE, NM_DHCP_OPTION_DHCP4_PRIVATE_PROXY_AUTODISCOVERY)) @@ -1137,12 +1137,12 @@ dhcp4_event_cb(int fd, GIOCondition condition, gpointer data) r = n_dhcp4_client_dispatch(priv->client); if (r < 0) { /* FIXME: if any operation (e.g. send()) fails during the - * dispatch, n-dhcp4 returns an error without arming timers - * or progressing state, so the only reasonable thing to do - * is to move to failed state so that the client will be - * restarted. Ideally n-dhcp4 should retry failed operations - * a predefined number of times (possibly infinite). - */ + * dispatch, n-dhcp4 returns an error without arming timers + * or progressing state, so the only reasonable thing to do + * is to move to failed state so that the client will be + * restarted. Ideally n-dhcp4 should retry failed operations + * a predefined number of times (possibly infinite). + */ _LOGE("error %d dispatching events", r); nm_clear_g_source_inst(&priv->event_source); nm_dhcp_client_set_state(NM_DHCP_CLIENT(self), NM_DHCP_STATE_FAIL, NULL, NULL); @@ -1199,7 +1199,7 @@ nettools_create(NMDhcpNettools *self, const char *dhcp_anycast_addr, GError **er } /* Note that we always set a client-id. In particular for infiniband that is necessary, - * see https://tools.ietf.org/html/rfc4390#section-2.1 . */ + * see https://tools.ietf.org/html/rfc4390#section-2.1 . */ client_id = nm_dhcp_client_get_client_id(NM_DHCP_CLIENT(self)); if (!client_id) { client_id_new = nm_utils_dhcp_client_id_mac(arp_type, hwaddr_arr, hwaddr_len); @@ -1341,9 +1341,9 @@ ip4_start(NMDhcpClient *client, } /* - * FIXME: - * Select, or configure, a reasonable start delay, to protect poor servers being flooded. - */ + * FIXME: + * Select, or configure, a reasonable start delay, to protect poor servers being flooded. + */ n_dhcp4_client_probe_config_set_start_delay(config, 1); nm_dhcp_utils_get_leasefile_path(AF_INET, @@ -1356,12 +1356,12 @@ ip4_start(NMDhcpClient *client, inet_pton(AF_INET, last_ip4_address, &last_addr); else { /* - * TODO: we stick to the systemd-networkd lease file format. Quite easy for now to - * just use the functions in systemd code. Anyway, as in the end we just use the - * ip address from all the options found in the lease, write a function that parses - * the lease file just for the assigned address and returns it in &last_address. - * Then drop reference to systemd-networkd structures and functions. - */ + * TODO: we stick to the systemd-networkd lease file format. Quite easy for now to + * just use the functions in systemd code. Anyway, as in the end we just use the + * ip address from all the options found in the lease, write a function that parses + * the lease file just for the assigned address and returns it in &last_address. + * Then drop reference to systemd-networkd structures and functions. + */ nm_auto(sd_dhcp_lease_unrefp) sd_dhcp_lease *lease = NULL; dhcp_lease_load(&lease, lease_file); diff --git a/src/dhcp/nm-dhcp-options.c b/src/dhcp/nm-dhcp-options.c index abf533cdb6..03d783e7b1 100644 --- a/src/dhcp/nm-dhcp-options.c +++ b/src/dhcp/nm-dhcp-options.c @@ -23,8 +23,8 @@ const NMDhcpOption _nm_dhcp_option_dhcp4_options[] = { REQ(NM_DHCP_OPTION_DHCP4_INTERFACE_MTU, "interface_mtu", TRUE), REQ(NM_DHCP_OPTION_DHCP4_BROADCAST, "broadcast_address", TRUE), /* RFC 3442: The Classless Static Routes option code MUST appear in the parameter - * request list prior to both the Router option code and the Static - * Routes option code, if present. */ + * request list prior to both the Router option code and the Static + * Routes option code, if present. */ REQ(NM_DHCP_OPTION_DHCP4_CLASSLESS_STATIC_ROUTE, "rfc3442_classless_static_routes", TRUE), REQ(NM_DHCP_OPTION_DHCP4_ROUTER, "routers", TRUE), REQ(NM_DHCP_OPTION_DHCP4_STATIC_ROUTE, "static_routes", TRUE), @@ -174,8 +174,8 @@ const NMDhcpOption _nm_dhcp_option_dhcp6_options[] = { REQ(NM_DHCP_OPTION_DHCP6_CLIENTID, "dhcp6_client_id", FALSE), /* Don't request server ID by default; some servers don't reply to - * Information Requests that request the Server ID. - */ + * Information Requests that request the Server ID. + */ REQ(NM_DHCP_OPTION_DHCP6_SERVERID, "dhcp6_server_id", FALSE), REQ(NM_DHCP_OPTION_DHCP6_DNS_SERVERS, "dhcp6_name_servers", TRUE), diff --git a/src/dhcp/nm-dhcp-systemd.c b/src/dhcp/nm-dhcp-systemd.c index 2d25735d7d..0e76512275 100644 --- a/src/dhcp/nm-dhcp-systemd.c +++ b/src/dhcp/nm-dhcp-systemd.c @@ -202,7 +202,7 @@ lease_to_ip4_config(NMDedupMultiIndex *multi_idx, if (addr_list[i].s_addr == 0 || nm_ip4_addr_is_localhost(addr_list[i].s_addr)) { /* Skip localhost addresses, like also networkd does. - * See https://github.com/systemd/systemd/issues/4524. */ + * See https://github.com/systemd/systemd/issues/4524. */ continue; } nm_ip4_config_add_nameserver(ip4_config, addr_list[i].s_addr); @@ -236,7 +236,7 @@ lease_to_ip4_config(NMDedupMultiIndex *multi_idx, s); /* Multiple domains sometimes stuffed into option 15 "Domain Name". - * As systemd escapes such characters, split them at \\032. */ + * As systemd escapes such characters, split them at \\032. */ domains = g_strsplit(s, "\\032", 0); for (d = domains; *d; d++) nm_ip4_config_add_domain(ip4_config, *d); @@ -309,22 +309,22 @@ lease_to_ip4_config(NMDedupMultiIndex *multi_idx, if (option == NM_DHCP_OPTION_DHCP4_STATIC_ROUTE && has_classless_route) { /* RFC 3443: if the DHCP server returns both a Classless Static Routes - * option and a Static Routes option, the DHCP client MUST ignore the - * Static Routes option. */ + * option and a Static Routes option, the DHCP client MUST ignore the + * Static Routes option. */ continue; } if (r_plen == 0 && option == NM_DHCP_OPTION_DHCP4_STATIC_ROUTE) { /* for option 33 (static route), RFC 2132 says: - * - * The default route (0.0.0.0) is an illegal destination for a static - * route. */ + * + * The default route (0.0.0.0) is an illegal destination for a static + * route. */ continue; } if (r_plen == 0) { /* if there are multiple default routes, we add them with differing - * metrics. */ + * metrics. */ m = default_route_metric; if (default_route_metric < G_MAXUINT32) default_route_metric++; @@ -376,16 +376,16 @@ lease_to_ip4_config(NMDedupMultiIndex *multi_idx, if (has_router_from_classless) { /* If the DHCP server returns both a Classless Static Routes option and a - * Router option, the DHCP client MUST ignore the Router option [RFC 3442]. - * - * Be more lenient and ignore the Router option only if Classless Static - * Routes contain a default gateway (as other DHCP backends do). - */ + * Router option, the DHCP client MUST ignore the Router option [RFC 3442]. + * + * Be more lenient and ignore the Router option only if Classless Static + * Routes contain a default gateway (as other DHCP backends do). + */ continue; } /* if there are multiple default routes, we add them with differing - * metrics. */ + * metrics. */ m = default_route_metric; if (default_route_metric < G_MAXUINT32) default_route_metric++; @@ -674,7 +674,7 @@ ip4_start(NMDhcpClient *client, } /* Note that we always set a client-id. In particular for infiniband that is necessary, - * see https://tools.ietf.org/html/rfc4390#section-2.1 . */ + * see https://tools.ietf.org/html/rfc4390#section-2.1 . */ r = sd_dhcp_client_set_client_id(sd_client, client_id_arr[0], client_id_arr + 1, @@ -697,9 +697,9 @@ ip4_start(NMDhcpClient *client, hostname = nm_dhcp_client_get_hostname(client); if (hostname) { /* FIXME: sd-dhcp decides which hostname/FQDN option to send (12 or 81) - * only based on whether the hostname has a domain part or not. At the - * moment there is no way to force one or another. - */ + * only based on whether the hostname has a domain part or not. At the + * moment there is no way to force one or another. + */ r = sd_dhcp_client_set_hostname(sd_client, hostname); if (r < 0) { nm_utils_error_set_errno(error, r, "failed to set DHCP hostname: %s"); @@ -1021,7 +1021,7 @@ ip6_start(NMDhcpClient * client, if (needed_prefixes > 1) _LOGW("dhcp-client6: only one prefix request is supported"); /* FIXME: systemd-networkd API only allows to request a - * single prefix */ + * single prefix */ r = sd_dhcp6_client_set_prefix_delegation(sd_client, TRUE); if (r < 0) { nm_utils_error_set_errno(error, r, "failed to enable prefix delegation: %s"); diff --git a/src/dhcp/nm-dhcp-utils.c b/src/dhcp/nm-dhcp-utils.c index da505d94a9..ae73303845 100644 --- a/src/dhcp/nm-dhcp-utils.c +++ b/src/dhcp/nm-dhcp-utils.c @@ -218,29 +218,29 @@ ip4_process_classless_routes(const char * iface, *gwaddr = 0; /* dhcpd/dhclient in Fedora has support for rfc3442 implemented using a - * slightly different format: - * - * option classless-static-routes = array of (destination-descriptor ip-address); - * - * which results in: - * - * 0 192.168.0.113 25.129.210.177.132 192.168.0.113 7.2 10.34.255.6 - * - * dhcpcd supports classless static routes natively and uses this same - * option identifier with the following format: - * - * 192.168.10.0/24 192.168.1.1 10.0.0.0/8 10.17.66.41 - */ + * slightly different format: + * + * option classless-static-routes = array of (destination-descriptor ip-address); + * + * which results in: + * + * 0 192.168.0.113 25.129.210.177.132 192.168.0.113 7.2 10.34.255.6 + * + * dhcpcd supports classless static routes natively and uses this same + * option identifier with the following format: + * + * 192.168.10.0/24 192.168.1.1 10.0.0.0/8 10.17.66.41 + */ str = g_hash_table_lookup(options, "classless_static_routes"); /* dhclient doesn't have actual support for rfc3442 classless static routes - * upstream. Thus, people resort to defining the option in dhclient.conf - * and using arbitrary formats like so: - * - * option rfc3442-classless-static-routes code 121 = array of unsigned integer 8; - * - * See https://lists.isc.org/pipermail/dhcp-users/2008-December/007629.html - */ + * upstream. Thus, people resort to defining the option in dhclient.conf + * and using arbitrary formats like so: + * + * option rfc3442-classless-static-routes code 121 = array of unsigned integer 8; + * + * See https://lists.isc.org/pipermail/dhcp-users/2008-December/007629.html + */ if (!str) str = g_hash_table_lookup(options, "rfc3442_classless_static_routes"); @@ -428,8 +428,8 @@ nm_dhcp_utils_ip4_config_from_options(NMDedupMultiIndex *multi_idx, nm_platform_ip4_address_set_addr(&address, addr, plen); /* Routes: if the server returns classless static routes, we MUST ignore - * the 'static_routes' option. - */ + * the 'static_routes' option. + */ if (!ip4_process_classless_routes(iface, options, route_table, @@ -443,8 +443,8 @@ nm_dhcp_utils_ip4_config_from_options(NMDedupMultiIndex *multi_idx, gateway_has = TRUE; } else { /* If the gateway wasn't provided as a classless static route with a - * subnet length of 0, try to find it using the old-style 'routers' option. - */ + * subnet length of 0, try to find it using the old-style 'routers' option. + */ str = g_hash_table_lookup(options, "routers"); if (str) { gs_free const char **routers = nm_utils_strsplit_set(str, " "); @@ -745,9 +745,9 @@ nm_dhcp_utils_client_id_string_to_bytes(const char *client_id) bytes = nm_utils_hexstr2bin(client_id); /* the result must be at least two bytes long, - * because @client_id contains a delimiter - * but nm_utils_hexstr2bin() does not allow - * leading nor trailing delimiters. */ + * because @client_id contains a delimiter + * but nm_utils_hexstr2bin() does not allow + * leading nor trailing delimiters. */ nm_assert(!bytes || g_bytes_get_size(bytes) >= 2); } if (!bytes) { diff --git a/src/dhcp/tests/test-dhcp-utils.c b/src/dhcp/tests/test-dhcp-utils.c index 738c6bb82d..8626b66fad 100644 --- a/src/dhcp/tests/test-dhcp-utils.c +++ b/src/dhcp/tests/test-dhcp-utils.c @@ -414,8 +414,8 @@ test_dhcpcd_invalid_classless_routes_1(void) g_test_assert_expected_messages(); /* Test falling back to old-style static routes if the classless static - * routes are invalid. - */ + * routes are invalid. + */ g_assert_cmpint(nm_ip4_config_get_num_routes(ip4_config), ==, 3); ip4_test_route(ip4_config, 0, expected_route1_dest, expected_route1_gw, 32); ip4_test_route(ip4_config, 1, expected_route2_dest, expected_route2_gw, 32); @@ -445,8 +445,8 @@ test_dhclient_invalid_classless_routes_2(void) g_test_assert_expected_messages(); /* Test falling back to old-style static routes if the classless static - * routes are invalid. - */ + * routes are invalid. + */ g_assert_cmpint(nm_ip4_config_get_num_routes(ip4_config), ==, 3); ip4_test_route(ip4_config, 0, expected_route1_dest, expected_route1_gw, 32); ip4_test_route(ip4_config, 1, expected_route2_dest, expected_route2_gw, 32); @@ -476,8 +476,8 @@ test_dhcpcd_invalid_classless_routes_2(void) g_test_assert_expected_messages(); /* Test falling back to old-style static routes if the classless static - * routes are invalid. - */ + * routes are invalid. + */ /* Routes */ g_assert_cmpint(nm_ip4_config_get_num_routes(ip4_config), ==, 3); @@ -684,9 +684,9 @@ test_ip4_prefix_classless(void) const NMPlatformIP4Address * address; /* Ensure that the missing-subnet-mask handler doesn't mangle classless - * subnet masks at all. The handler should trigger only if the server - * doesn't send the subnet mask. - */ + * subnet masks at all. The handler should trigger only if the server + * doesn't send the subnet mask. + */ options = fill_table(generic_options, NULL); g_hash_table_insert(options, "ip_address", "172.16.54.22"); diff --git a/src/dns/nm-dns-dnsmasq.c b/src/dns/nm-dns-dnsmasq.c index 3c5bf2fa15..10fb6732fa 100644 --- a/src/dns/nm-dns-dnsmasq.c +++ b/src/dns/nm-dns-dnsmasq.c @@ -80,9 +80,9 @@ static struct { guint watch_id; /* whether the external process (with the pid from PIDFILE) was already killed. - * This only happens once, once we do that, we remember to not do it again. - * The reason is that later one, when we want to kill the process it's a - * child process. So, we wait for the exit code. */ + * This only happens once, once we do that, we remember to not do it again. + * The reason is that later one, when we want to kill the process it's a + * child process. So, we wait for the exit code. */ bool kill_external_done : 1; bool terminate_sigkill : 1; @@ -295,7 +295,7 @@ _gl_pid_spawn_register_for_termination(void) { if (gl_pid.pid > 0 && !gl_pid.terminate_handle) { /* Create a shutdown handle as a reminder that the currently running process must be terminated - * first. This also happens to block shutdown... */ + * first. This also happens to block shutdown... */ gl_pid.terminate_handle = nm_shutdown_wait_obj_register_handle_full( g_strdup_printf("kill-dnsmasq-process-%" G_PID_FORMAT, gl_pid.pid), TRUE); @@ -362,8 +362,8 @@ _gl_pid_spawn_cancelled_cb(GCancellable *cancellable, GlPidSpawnAsyncData *sdata gl_pid.spawn_data = NULL; /* When the cancellable gets cancelled, we terminate the current dnsmasq instance - * in the background. The only way for keeping dnsmasq running while unregistering - * the callback is by calling _gl_pid_spawn() without a new callback. */ + * in the background. The only way for keeping dnsmasq running while unregistering + * the callback is by calling _gl_pid_spawn() without a new callback. */ _gl_pid_spawn_register_for_termination(); } else nm_assert_not_reached(); @@ -441,7 +441,7 @@ _gl_pid_spawn_watch_cb(GPid pid, int status, gpointer user_data) if (gl_pid.pid != pid) { /* this can only happen, if we timed out and no longer care about this PID. - * We still kept the watch-id active, to reap the process. Nothing to do. */ + * We still kept the watch-id active, to reap the process. Nothing to do. */ return; } @@ -456,8 +456,8 @@ _gl_pid_spawn_watch_cb(GPid pid, int status, gpointer user_data) if (gl_pid.spawn_data) { if (was_stopping) { /* The current process was scheduled to be terminated. That means the pending - * spawn_data is not for that former instance, but for starting a new one. - * This spawn-request is not yet complete, instead it's just about to start. */ + * spawn_data is not for that former instance, but for starting a new one. + * This spawn-request is not yet complete, instead it's just about to start. */ } else _gl_pid_spawn_notify(g_steal_pointer(&gl_pid.spawn_data), pid, &status, NULL); } @@ -636,15 +636,15 @@ _gl_pid_spawn(const char * dm_binary, gl_pid.spawn_data); /* If dnsmasq is running, we terminate it and start a new instance. - * - * If the user would not provide a new callback, this would mean to fail/abort - * the currently subscribed notification (below). But it would leave the dnsmasq - * instance running in the background. - * This allows the user to say to not care about the current instance - * anymore, but still leave it running. - * - * To kill the dnsmasq process without scheduling a new one, cancel the cancellable - * instead. */ + * + * If the user would not provide a new callback, this would mean to fail/abort + * the currently subscribed notification (below). But it would leave the dnsmasq + * instance running in the background. + * This allows the user to say to not care about the current instance + * anymore, but still leave it running. + * + * To kill the dnsmasq process without scheduling a new one, cancel the cancellable + * instead. */ _gl_pid_spawn_register_for_termination(); } else { nm_assert(!notify); @@ -656,9 +656,9 @@ _gl_pid_spawn(const char * dm_binary, gs_free_error GError *error = NULL; /* we don't mark the error as G_IO_ERROR/G_IO_ERROR_CANCELLED. That - * is reserved for cancelling the cancellable. However, the current - * request was obsoleted/replaced by a new one, so we fail it with - * NM_UTILS_ERROR/NM_UTILS_ERROR_CANCELLED_DISPOSING. */ + * is reserved for cancelling the cancellable. However, the current + * request was obsoleted/replaced by a new one, so we fail it with + * NM_UTILS_ERROR/NM_UTILS_ERROR_CANCELLED_DISPOSING. */ nm_utils_error_set_cancelled(&error, TRUE, NULL); _gl_pid_spawn_notify(sdata_replace, 0, NULL, error); } @@ -761,10 +761,10 @@ ip_addr_to_string(int addr_family, gconstpointer addr, const char *iface, char * else _nm_utils_inet6_ntop(addr, buf2); /* Need to scope link-local addresses with %<zone-id>. Before dnsmasq 2.58, - * only '@' was supported as delimiter. Since 2.58, '@' and '%' are - * supported. Due to a bug, since 2.73 only '%' works properly as "server" - * address. - */ + * only '@' was supported as delimiter. Since 2.58, '@' and '%' are + * supported. Due to a bug, since 2.73 only '%' works properly as "server" + * address. + */ separator = IN6_IS_ADDR_LINKLOCAL(addr) ? "%" : "@"; } @@ -924,7 +924,7 @@ _main_cleanup(NMDnsDnsmasq *self, gboolean emit_failed) nm_clear_g_cancellable(&priv->update_cancellable); /* cancelling the main_cancellable will also cause _gl_pid_spawn*() to terminate the - * process in the background. */ + * process in the background. */ nm_clear_g_cancellable(&priv->main_cancellable); if (!priv->is_stopped && priv->burst_retry_timeout_id == 0) { @@ -1061,8 +1061,8 @@ start_dnsmasq(NMDnsDnsmasq *self, gboolean force_start, GError **error) dm_binary = nm_utils_find_helper("dnsmasq", DNSMASQ_PATH, NULL); if (!dm_binary) { /* We resolve the binary name before trying to start it asynchronously. - * The reason is, that if dnsmasq is not installed, we want to fail early, - * so that NMDnsManager can fallback to a non-caching implementation. */ + * The reason is, that if dnsmasq is not installed, we want to fail early, + * so that NMDnsManager can fallback to a non-caching implementation. */ nm_utils_error_set(error, NM_UTILS_ERROR_UNKNOWN, "could not find dnsmasq binary"); return FALSE; } @@ -1146,7 +1146,7 @@ stop(NMDnsPlugin *plugin) nm_clear_g_source(&priv->burst_retry_timeout_id); /* Cancelling the cancellable will also terminate the - * process (in the background). */ + * process (in the background). */ _main_cleanup(self, FALSE); } diff --git a/src/dns/nm-dns-manager.c b/src/dns/nm-dns-manager.c index ef86782f57..c1f3cc960a 100644 --- a/src/dns/nm-dns-manager.c +++ b/src/dns/nm-dns-manager.c @@ -462,10 +462,10 @@ merge_one_ip_config(NMResolvConfData *rc, int ifindex, const NMIPConfig *ip_conf } if (num_nameservers == 0) { /* If the @ip_config contributes no DNS servers, ignore whether trust-ad is set or unset - * for this @ip_config. */ + * for this @ip_config. */ } else if (has_trust_ad) { /* We only set has_trust_ad to TRUE, if all IP configs agree (or don't contribute). - * Once set to FALSE, it doesn't get reset. */ + * Once set to FALSE, it doesn't get reset. */ if (rc->has_trust_ad == NM_TERNARY_DEFAULT) rc->has_trust_ad = NM_TERNARY_TRUE; } else @@ -566,8 +566,8 @@ dispatch_netconfig(NMDnsManager * self, str = g_string_new(""); /* NM is writing already-merged DNS information to netconfig, so it - * does not apply to a specific network interface. - */ + * does not apply to a specific network interface. + */ netconfig_construct_str(self, str, "INTERFACE", "NetworkManager"); netconfig_construct_strv(self, str, "DNSSEARCH", searches); netconfig_construct_strv(self, str, "DNSSERVERS", nameservers); @@ -634,19 +634,19 @@ create_resolv_conf(const char *const *searches, if (l == 0 || NM_STRCHAR_ANY(s, ch, NM_IN_SET(ch, ' ', '\t', '\n'))) { /* there should be no such characters in the search entry. Also, - * because glibc parser would treat them as line/word separator. - * - * Skip the value silently. */ + * because glibc parser would treat them as line/word separator. + * + * Skip the value silently. */ continue; } if (search_base_idx > 0) { if (str->len - search_base_idx + 1 + l > 254) { /* this entry crosses the 256 character boundary. Older glibc versions - * would truncate the entry at this point. - * - * Fill the line with spaces to cross the 256 char boundary and continue - * afterwards. This way, the truncation happens between two search entries. */ + * would truncate the entry at this point. + * + * Fill the line with spaces to cross the 256 char boundary and continue + * afterwards. This way, the truncation happens between two search entries. */ while (str->len - search_base_idx < 257) g_string_append_c(str, ' '); search_base_idx = 0; @@ -879,12 +879,12 @@ update_resolv_conf(NMDnsManager * self, rc_path = rc_path_real; else { /* realpath did not resolve a path-name. That either means, - * _PATH_RESCONF: - * - does not exist - * - is a plain file - * - is a dangling symlink - * - * Handle the case, where it is a dangling symlink... */ + * _PATH_RESCONF: + * - does not exist + * - is a plain file + * - is a dangling symlink + * + * Handle the case, where it is a dangling symlink... */ rc_path_syml = nm_utils_read_link_absolute(_PATH_RESCONF, NULL); if (rc_path_syml) rc_path = rc_path_syml; @@ -892,8 +892,8 @@ update_resolv_conf(NMDnsManager * self, } /* we first write to /etc/resolv.conf directly. If that fails, - * we still continue to write to runstatedir but remember the - * error. */ + * we still continue to write to runstatedir but remember the + * error. */ if (!g_file_set_contents(rc_path, content, -1, &local)) { _LOGT("update-resolv-conf: write to %s failed (rc-manager=%s, %s)", rc_path, @@ -901,7 +901,7 @@ update_resolv_conf(NMDnsManager * self, local->message); g_propagate_error(error, local); /* clear @error, so that we don't try reset it. This is the error - * we want to propagate to the caller. */ + * we want to propagate to the caller. */ error = NULL; write_file_result = SR_ERROR; } else { @@ -937,8 +937,8 @@ update_resolv_conf(NMDnsManager * self, if (success) { errsv = errno; /* only set an error here if write_resolv_conf() was successful, - * since its error is more important. - */ + * since its error is more important. + */ g_set_error(error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_FAILED, @@ -992,9 +992,9 @@ update_resolv_conf(NMDnsManager * self, } /* By this point, /etc/resolv.conf exists and is a symlink to our internal - * resolv.conf. We update the symlink so that applications get an inotify - * notification. - */ + * resolv.conf. We update the symlink so that applications get an inotify + * notification. + */ if (unlink(RESOLV_CONF_TMP) != 0 && ((errsv = errno) != ENOENT)) { g_set_error(error, NM_MANAGER_ERROR, @@ -1066,7 +1066,7 @@ compute_hash(NMDnsManager *self, const NMGlobalDnsConfig *global, guint8 buffer[ const CList *head; /* FIXME(ip-config-checksum): this relies on the fact that an IP - * configuration without DNS parameters gives a zero checksum. */ + * configuration without DNS parameters gives a zero checksum. */ head = _ip_config_lst_head(self); c_list_for_each_entry (ip_data, head, ip_config_lst) nm_ip_config_hash(ip_data->ip_config, sum, TRUE); @@ -1209,12 +1209,12 @@ _collect_resolv_conf_data(NMDnsManager * self, } /* If the hostname is a FQDN ("dcbw.example.com"), then add the domain part of it - * ("example.com") to the searches list, to ensure that we can still resolve its - * non-FQ form ("dcbw") too. (Also, if there are no other search domains specified, - * this makes a good default.) However, if the hostname is the top level of a domain - * (eg, "example.com"), then use the hostname itself as the search (since the user is - * unlikely to want "com" as a search domain). - */ + * ("example.com") to the searches list, to ensure that we can still resolve its + * non-FQ form ("dcbw") too. (Also, if there are no other search domains specified, + * this makes a good default.) However, if the hostname is the top level of a domain + * (eg, "example.com"), then use the hostname itself as the search (since the user is + * unlikely to want "com" as a search domain). + */ if (priv->hostname) { const char *hostdomain = strchr(priv->hostname, '.'); @@ -1371,14 +1371,14 @@ rebuild_domain_lists(NMDnsManager *self) num_dom1 = 0; /* Add wildcard lookup domain to connections with the default route. - * If there is no default route, add the wildcard domain to all non-VPN - * connections */ + * If there is no default route, add the wildcard domain to all non-VPN + * connections */ if (default_route_found) { /* FIXME: this heuristic of which device has a default route does - * not work with policy routing (as used by default with WireGuard). - * We should have a more stable mechanism where an NMIPConfig indicates - * whether it is suitable for certain operations (like having an automatically - * added "~" domain). */ + * not work with policy routing (as used by default with WireGuard). + * We should have a more stable mechanism where an NMIPConfig indicates + * whether it is suitable for certain operations (like having an automatically + * added "~" domain). */ if (nm_ip_config_best_default_route_get(ip_config)) domains[num_dom1++] = "~"; } else { @@ -1543,8 +1543,8 @@ update_dns(NMDnsManager *self, gboolean no_caching, GError **error) _LOGW("update-dns: plugin %s update failed: %s", plugin_name, plugin_error->message); /* If the plugin failed to update, we shouldn't write out a local - * caching DNS configuration to resolv.conf. - */ + * caching DNS configuration to resolv.conf. + */ caching = FALSE; } @@ -1552,8 +1552,8 @@ plugin_skip:; } /* Clear the generated search list as it points to - * strings owned by IP configurations and we can't - * guarantee they stay alive. */ + * strings owned by IP configurations and we can't + * guarantee they stay alive. */ clear_domain_lists(self); update_resolv_conf_no_stub(self, @@ -1562,9 +1562,9 @@ plugin_skip:; NM_CAST_STRV_CC(options)); /* If caching was successful, we only send 127.0.0.1 to /etc/resolv.conf - * to ensure that the glibc resolver doesn't try to round-robin nameservers, - * but only uses the local caching nameserver. - */ + * to ensure that the glibc resolver doesn't try to round-robin nameservers, + * but only uses the local caching nameserver. + */ if (caching) { const char *lladdr = "127.0.0.1"; @@ -1590,7 +1590,7 @@ plugin_skip:; priv->rc_manager); resolv_conf_updated = TRUE; /* If we have ended with no nameservers avoid updating again resolv.conf - * on stop, as some external changes may be applied to it in the meanwhile */ + * on stop, as some external changes may be applied to it in the meanwhile */ if (!nameservers && !options) priv->dns_touched = FALSE; break; @@ -1845,10 +1845,10 @@ nm_dns_manager_stop(NMDnsManager *self) _LOGT("stopping..."); /* If we're quitting, leave a valid resolv.conf in place, not one - * pointing to 127.0.0.1 if dnsmasq was active. But if we haven't - * done any DNS updates yet, there's no reason to touch resolv.conf - * on shutdown. - */ + * pointing to 127.0.0.1 if dnsmasq was active. But if we haven't + * done any DNS updates yet, there's no reason to touch resolv.conf + * on shutdown. + */ if (priv->dns_touched && priv->plugin && NM_IS_DNS_DNSMASQ(priv->plugin)) { gs_free_error GError *error = NULL; @@ -1903,8 +1903,8 @@ _check_resconf_immutable(NMDnsManagerResolvConfManager rc_manager) switch (rc_manager) { case NM_DNS_MANAGER_RESOLV_CONF_MAN_SYMLINK: /* we don't care whether the link-target is immutable. - * If the symlink points to another file, rc-manager=symlink anyway backs off. - * Otherwise, we would only check whether our internal resolv.conf is immutable. */ + * If the symlink points to another file, rc-manager=symlink anyway backs off. + * Otherwise, we would only check whether our internal resolv.conf is immutable. */ return NM_DNS_MANAGER_RESOLV_CONF_MAN_SYMLINK; case NM_DNS_MANAGER_RESOLV_CONF_MAN_UNKNOWN: case NM_DNS_MANAGER_RESOLV_CONF_MAN_UNMANAGED: @@ -1953,13 +1953,13 @@ _resolvconf_resolved_managed(void) nm_auto_free char *real_path = NULL; /* see if resolv.conf is a symlink with a target that is - * exactly like one of the candidates. - * - * This check will work for symlinks, even if the target - * does not exist and realpath() cannot resolve anything. - * - * We want to handle that, because systemd-resolved might not - * have started yet. */ + * exactly like one of the candidates. + * + * This check will work for symlinks, even if the target + * does not exist and realpath() cannot resolve anything. + * + * We want to handle that, because systemd-resolved might not + * have started yet. */ full_path = g_file_read_link(_PATH_RESCONF, NULL); if (nm_utils_strv_find_first((char **) RESOLVED_PATHS, G_N_ELEMENTS(RESOLVED_PATHS), @@ -1968,13 +1968,13 @@ _resolvconf_resolved_managed(void) return TRUE; /* see if resolv.conf is a symlink that resolves exactly one - * of the candidate paths. - * - * This check will work for symlinks that can be resolved - * to a realpath, but the actual file might not exist. - * - * We want to handle that, because systemd-resolved might not - * have started yet. */ + * of the candidate paths. + * + * This check will work for symlinks that can be resolved + * to a realpath, but the actual file might not exist. + * + * We want to handle that, because systemd-resolved might not + * have started yet. */ real_path = realpath(_PATH_RESCONF, NULL); if (nm_utils_strv_find_first((char **) RESOLVED_PATHS, G_N_ELEMENTS(RESOLVED_PATHS), @@ -1983,16 +1983,16 @@ _resolvconf_resolved_managed(void) return TRUE; /* fall-through and resolve the symlink, to check the file - * it points to (below). - * - * This check is the most reliable, but it only works if - * systemd-resolved already started and created the file. */ + * it points to (below). + * + * This check is the most reliable, but it only works if + * systemd-resolved already started and created the file. */ if (stat(_PATH_RESCONF, &st) != 0) return FALSE; } /* see if resolv.conf resolves to one of the candidate - * paths (or whether it is hard-linked). */ + * paths (or whether it is hard-linked). */ for (i = 0; i < G_N_ELEMENTS(RESOLVED_PATHS); i++) { const char *p = RESOLVED_PATHS[i]; @@ -2093,25 +2093,25 @@ again: rc_manager = NM_DNS_MANAGER_RESOLV_CONF_MAN_UNMANAGED; else if (HAS_RESOLVCONF && g_file_test(RESOLVCONF_PATH, G_FILE_TEST_IS_EXECUTABLE)) { /* We detect /sbin/resolvconf only at this stage. That means, if you install - * or uninstall openresolv afterwards, you need to reload the DNS settings - * (with SIGHUP or `systemctl reload NetworkManager.service`). - * - * We only accept resolvconf if NetworkManager was built with --with-resolvconf. - * For example, on Fedora the systemd package provides a compat resolvconf - * implementation for systemd-resolved. But using that never makes sense, because - * there we either use full systemd-resolved mode or not. In no case does it - * make sense to call that resolvconf implementation. */ + * or uninstall openresolv afterwards, you need to reload the DNS settings + * (with SIGHUP or `systemctl reload NetworkManager.service`). + * + * We only accept resolvconf if NetworkManager was built with --with-resolvconf. + * For example, on Fedora the systemd package provides a compat resolvconf + * implementation for systemd-resolved. But using that never makes sense, because + * there we either use full systemd-resolved mode or not. In no case does it + * make sense to call that resolvconf implementation. */ rc_manager = NM_DNS_MANAGER_RESOLV_CONF_MAN_RESOLVCONF; } else if (HAS_NETCONFIG && g_file_test(NETCONFIG_PATH, G_FILE_TEST_IS_EXECUTABLE)) { /* Like for resolvconf, we detect only once. We only autoenable this - * option, if NetworkManager was built with netconfig explicitly enabled. */ + * option, if NetworkManager was built with netconfig explicitly enabled. */ rc_manager = NM_DNS_MANAGER_RESOLV_CONF_MAN_NETCONFIG; } else rc_manager = NM_DNS_MANAGER_RESOLV_CONF_MAN_SYMLINK; } /* The systemd-resolved plugin is special. We typically always want to keep - * systemd-resolved up to date even if the configured plugin is different. */ + * systemd-resolved up to date even if the configured plugin is different. */ if (systemd_resolved) { if (!priv->sd_resolve_plugin) { priv->sd_resolve_plugin = nm_dns_systemd_resolved_new(); @@ -2162,9 +2162,9 @@ config_changed_cb(NMConfig * config, NM_CONFIG_CHANGE_DNS_MODE | NM_CONFIG_CHANGE_RC_MANAGER | NM_CONFIG_CHANGE_CAUSE_SIGHUP | NM_CONFIG_CHANGE_CAUSE_DNS_FULL)) { /* reload the resolv-conf mode also on SIGHUP (when DNS_MODE didn't change). - * The reason is, that the configuration also depends on whether resolv.conf - * is immutable, thus, without the configuration changing, we always want to - * re-configure the mode. */ + * The reason is, that the configuration also depends on whether resolv.conf + * is immutable, thus, without the configuration changing, we always want to + * re-configure the mode. */ init_resolv_conf_mode( self, NM_FLAGS_ANY(changes, NM_CONFIG_CHANGE_CAUSE_SIGHUP | NM_CONFIG_CHANGE_CAUSE_DNS_FULL)); diff --git a/src/dns/nm-dns-plugin.h b/src/dns/nm-dns-plugin.h index 1ddd8a31e1..4abb4eea27 100644 --- a/src/dns/nm-dns-plugin.h +++ b/src/dns/nm-dns-plugin.h @@ -26,10 +26,10 @@ typedef struct { GObjectClass parent; /* Called when DNS information is changed. 'configs' is an array - * of pointers to NMDnsIPConfigData sorted by priority. - * 'global_config' is the optional global DNS - * configuration. - */ + * of pointers to NMDnsIPConfigData sorted by priority. + * 'global_config' is the optional global DNS + * configuration. + */ gboolean (*update)(NMDnsPlugin * self, const NMGlobalDnsConfig *global_config, const CList * ip_config_lst_head, @@ -41,9 +41,9 @@ typedef struct { const char *plugin_name; /* Types should set to TRUE if they start a local caching nameserver - * that listens on localhost and would block any other local caching - * nameserver from operating. - */ + * that listens on localhost and would block any other local caching + * nameserver from operating. + */ bool is_caching : 1; } NMDnsPluginClass; diff --git a/src/dns/nm-dns-systemd-resolved.c b/src/dns/nm-dns-systemd-resolved.c index 9c42c37195..64118d2792 100644 --- a/src/dns/nm-dns-systemd-resolved.c +++ b/src/dns/nm-dns-systemd-resolved.c @@ -279,7 +279,7 @@ send_updates(NMDnsSystemdResolved *self) if (!priv->dbus_has_owner) { if (priv->try_start_blocked) { /* we have no name owner and we already tried poking the service to - * autostart. */ + * autostart. */ _LOGT("send-updates: no name owner"); return; } @@ -306,13 +306,13 @@ send_updates(NMDnsSystemdResolved *self) (request_item = c_list_first_entry(&priv->request_queue_lst_head, RequestItem, request_queue_lst))) { /* Above we explicitly call "StartServiceByName" trying to avoid D-Bus activating systmd-resolved - * multiple times. There is still a race, were we might hit this line although actually - * the service just quit this very moment. In that case, we would try to D-Bus activate the - * service multiple times during each call (something we wanted to avoid). - * - * But this is hard to avoid, because we'd have to check the error failure to detect the reason - * and retry. The race is not critical, because at worst it results in logging a warning - * about failure to start systemd.resolved. */ + * multiple times. There is still a race, were we might hit this line although actually + * the service just quit this very moment. In that case, we would try to D-Bus activate the + * service multiple times during each call (something we wanted to avoid). + * + * But this is hard to avoid, because we'd have to check the error failure to detect the reason + * and retry. The race is not critical, because at worst it results in logging a warning + * about failure to start systemd.resolved. */ g_dbus_connection_call(priv->dbus_connection, SYSTEMD_RESOLVED_DBUS_SERVICE, SYSTEMD_RESOLVED_DBUS_PATH, @@ -420,7 +420,7 @@ name_owner_changed_cb(GDBusConnection *connection, if (!priv->dbus_initied) { /* There was a race and we got a NameOwnerChanged signal before GetNameOwner - * returns. */ + * returns. */ priv->dbus_initied = TRUE; nm_clear_g_cancellable(&priv->cancellable); } diff --git a/src/dns/nm-dns-unbound.c b/src/dns/nm-dns-unbound.c index b90cae4c2c..30637f8d71 100644 --- a/src/dns/nm-dns-unbound.c +++ b/src/dns/nm-dns-unbound.c @@ -36,14 +36,14 @@ update(NMDnsPlugin * plugin, int status; /* TODO: We currently call a script installed with the dnssec-trigger - * package that queries all information itself. Later, the dependency - * on that package will be optional and the only hard dependency will - * be unbound. - * - * Unbound configuration should be later handled by this plugin directly, - * without calling custom scripts. The dnssec-trigger functionality - * may be eventually merged into NetworkManager. - */ + * package that queries all information itself. Later, the dependency + * on that package will be optional and the only hard dependency will + * be unbound. + * + * Unbound configuration should be later handled by this plugin directly, + * without calling custom scripts. The dnssec-trigger functionality + * may be eventually merged into NetworkManager. + */ if (!g_spawn_sync("/", argv, NULL, 0, NULL, NULL, NULL, NULL, &status, &local)) { nm_utils_error_set(error, NM_UTILS_ERROR_UNKNOWN, diff --git a/src/dnsmasq/nm-dnsmasq-manager.c b/src/dnsmasq/nm-dnsmasq-manager.c index 7edc784239..a234213a12 100644 --- a/src/dnsmasq/nm-dnsmasq-manager.c +++ b/src/dnsmasq/nm-dnsmasq-manager.c @@ -120,11 +120,11 @@ create_dm_cmd_line(const char * iface, } /* dnsmasq may read from its default config file location, which if that - * location is a valid config file, it will combine with the options here - * and cause undesirable side-effects. Like sending bogus IP addresses - * as the gateway or whatever. So tell dnsmasq not to use any config file - * at all. - */ + * location is a valid config file, it will combine with the options here + * and cause undesirable side-effects. Like sending bogus IP addresses + * as the gateway or whatever. So tell dnsmasq not to use any config file + * at all. + */ nm_strv_ptrarray_add_string_dup(cmd, "--conf-file=/dev/null"); nm_strv_ptrarray_add_string_dup(cmd, "--no-hosts"); @@ -134,9 +134,9 @@ create_dm_cmd_line(const char * iface, nm_strv_ptrarray_add_string_dup(cmd, "--clear-on-reload"); /* Use strict order since in the case of VPN connections, the VPN's - * nameservers will be first in resolv.conf, and those need to be tried - * first by dnsmasq to successfully resolve names from the VPN. - */ + * nameservers will be first in resolv.conf, and those need to be tried + * first by dnsmasq to successfully resolve names from the VPN. + */ nm_strv_ptrarray_add_string_dup(cmd, "--strict-order"); _nm_utils_inet4_ntop(listen_address->address, listen_address_s); @@ -179,7 +179,7 @@ create_dm_cmd_line(const char * iface, if (announce_android_metered) { /* force option 43 to announce ANDROID_METERED. Do this, even if the client - * did not ask for this option. See https://www.lorier.net/docs/android-metered.html */ + * did not ask for this option. See https://www.lorier.net/docs/android-metered.html */ nm_strv_ptrarray_add_string_dup(cmd, "--dhcp-option-force=43,ANDROID_METERED"); } diff --git a/src/dnsmasq/nm-dnsmasq-utils.c b/src/dnsmasq/nm-dnsmasq-utils.c index ffd6469ae5..db97ed31b0 100644 --- a/src/dnsmasq/nm-dnsmasq-utils.c +++ b/src/dnsmasq/nm-dnsmasq-utils.c @@ -34,18 +34,18 @@ nm_dnsmasq_utils_get_range(const NMPlatformIP4Address *addr, if (prefix < 24) { /* if the subnet is larger then /24, we partition it and treat it - * like it would be a /24. - * - * Hence, the resulting range will always be between x.x.x.1/24 - * and x.x.x.254/24, with x.x.x.0 being the network address of the - * host. - * - * In this case, only a /24 portion of the subnet is used. - * No particular reason for that, but it's unlikely that a user - * would use NetworkManager's shared method when having hundred - * of DHCP clients. So, restrict the range to the same /24 in - * which the host address lies. - */ + * like it would be a /24. + * + * Hence, the resulting range will always be between x.x.x.1/24 + * and x.x.x.254/24, with x.x.x.0 being the network address of the + * host. + * + * In this case, only a /24 portion of the subnet is used. + * No particular reason for that, but it's unlikely that a user + * would use NetworkManager's shared method when having hundred + * of DHCP clients. So, restrict the range to the same /24 in + * which the host address lies. + */ prefix = 24; } @@ -56,8 +56,8 @@ nm_dnsmasq_utils_get_range(const NMPlatformIP4Address *addr, host = ntohl(host); /* if host is the network or broadcast address, coerce it to - * one above or below. Usually, we wouldn't expect the user - * to pick such an address. */ + * one above or below. Usually, we wouldn't expect the user + * to pick such an address. */ if (host == (host & netmask)) host++; else if (host == (host | ~netmask)) @@ -68,17 +68,17 @@ nm_dnsmasq_utils_get_range(const NMPlatformIP4Address *addr, last = (host | ~netmask) - 1; /* Depending on whether host is above or below the middle of - * the subnet, the larger part if handed out. - * - * If the host is in the lower half, the range starts - * at the lower end with the host (plus reserved), until the - * broadcast address - * - * If the host is in the upper half, the range starts above - * the network-address and goes up until the host (except reserved). - * - * reserved is up to 8 addresses, 10% of the determined range. - */ + * the subnet, the larger part if handed out. + * + * If the host is in the lower half, the range starts + * at the lower end with the host (plus reserved), until the + * broadcast address + * + * If the host is in the upper half, the range starts above + * the network-address and goes up until the host (except reserved). + * + * reserved is up to 8 addresses, 10% of the determined range. + */ mid = (host & netmask) | (((first + last) / 2) & ~netmask); if (host > mid) { /* use lower range */ diff --git a/src/initrd/nmi-cmdline-reader.c b/src/initrd/nmi-cmdline-reader.c index 28eab122e5..a37018a996 100644 --- a/src/initrd/nmi-cmdline-reader.c +++ b/src/initrd/nmi-cmdline-reader.c @@ -192,11 +192,11 @@ reader_get_connection(Reader * reader, guint i; /* - * If ifname was not given, we'll match the connection by type. - * If the type was not given either, then we're happy with any connection but slaves. - * This is so that things like "bond=bond0:eth1,eth2 nameserver=1.3.3.7 end up - * slapping the nameserver to the most reasonable connection (bond0). - */ + * If ifname was not given, we'll match the connection by type. + * If the type was not given either, then we're happy with any connection but slaves. + * This is so that things like "bond=bond0:eth1,eth2 nameserver=1.3.3.7 end up + * slapping the nameserver to the most reasonable connection (bond0). + */ for (i = 0; i < reader->array->len; i++) { candidate = g_hash_table_lookup(reader->hash, reader->array->pdata[i]); s_con = nm_connection_get_setting_connection(candidate); @@ -1079,9 +1079,9 @@ nmi_cmdline_reader_parse(const char *sysfs_dir, const char *const *argv, char ** if (!nm_utils_hwaddr_valid(bootif, ETH_ALEN) && g_str_has_prefix(bootif, "01-") && nm_utils_hwaddr_valid(&bootif[3], ETH_ALEN)) { /* - * BOOTIF MAC address can be prefixed with a hardware type identifier. - * "01" stays for "wired", no other are known. - */ + * BOOTIF MAC address can be prefixed with a hardware type identifier. + * "01" stays for "wired", no other are known. + */ bootif += 3; } diff --git a/src/initrd/nmi-dt-reader.c b/src/initrd/nmi-dt-reader.c index 212b114bb3..c7a8e0868b 100644 --- a/src/initrd/nmi-dt-reader.c +++ b/src/initrd/nmi-dt-reader.c @@ -153,10 +153,10 @@ nmi_dt_reader_parse(const char *sysfs_dir) tokens = g_strsplit(path, ",", 0); /* - * Ethernet device settings. Defined by "Open Firmware, - * Recommended Practice: Device Support Extensions, Version 1.0 [1] - * [1] https://www.devicetree.org/open-firmware/practice/devicex/dse1_0a.ps - */ + * Ethernet device settings. Defined by "Open Firmware, + * Recommended Practice: Device Support Extensions, Version 1.0 [1] + * [1] https://www.devicetree.org/open-firmware/practice/devicex/dse1_0a.ps + */ for (i = 0; tokens[i]; i++) { /* Skip these. They have magical meaning for OpenFirmware. */ @@ -184,10 +184,10 @@ nmi_dt_reader_parse(const char *sysfs_dir) } /* - * Network boot configuration. Defined by "Open Firmware, - * Recommended Practice: TFTP Booting Extension, Version 1.0 [1] - * [1] https://www.devicetree.org/open-firmware/practice/obp-tftp/tftp1_0.pdf - */ + * Network boot configuration. Defined by "Open Firmware, + * Recommended Practice: TFTP Booting Extension, Version 1.0 [1] + * [1] https://www.devicetree.org/open-firmware/practice/obp-tftp/tftp1_0.pdf + */ for (; tokens[i]; i++) { if (NM_IN_STRSET(tokens[i], "bootp", "dhcp", "rarp")) { @@ -219,7 +219,7 @@ nmi_dt_reader_parse(const char *sysfs_dir) if (tokens[i] && (strchr(tokens[i], '.') || strchr(tokens[i], ':'))) { /* yaboot claims the mask can be specified here, - * though it doesn't support it. */ + * though it doesn't support it. */ s_netmask = tokens[i]; i++; } diff --git a/src/initrd/nmi-ibft-reader.c b/src/initrd/nmi-ibft-reader.c index 9c3b10d434..3d309d7d9f 100644 --- a/src/initrd/nmi-ibft-reader.c +++ b/src/initrd/nmi-ibft-reader.c @@ -344,8 +344,8 @@ is_ibft_vlan_device(GHashTable *nic) if (s_vlan_id) { /* VLAN 0 is normally a valid VLAN ID, but in the iBFT case it - * means "no VLAN". - */ + * means "no VLAN". + */ if (_nm_utils_ascii_str_to_int64(s_vlan_id, 10, 1, 4095, -1) != -1) return TRUE; } @@ -364,8 +364,8 @@ vlan_setting_add_from_block(GHashTable *nic, NMConnection *connection, GError ** g_assert(connection); /* This won't fail since this function shouldn't be called unless the - * iBFT VLAN ID exists and is > 0. - */ + * iBFT VLAN ID exists and is > 0. + */ vlan_id_str = (const char *) g_hash_table_lookup(nic, "vlan"); g_assert(vlan_id_str); diff --git a/src/initrd/tests/test-ibft-reader.c b/src/initrd/tests/test-ibft-reader.c index 2511aebac3..6745d8df30 100644 --- a/src/initrd/tests/test-ibft-reader.c +++ b/src/initrd/tests/test-ibft-reader.c @@ -235,9 +235,9 @@ test_read_ibft(void) GError * error = NULL; /* This test doesn't actually test too much (apart from the presence of - * IPv6 that is not covered by other tests), but the test fixture is a good - * example of about everything that can be included in iBFT table (as of - * ACPI 3.0b). */ + * IPv6 that is not covered by other tests), but the test fixture is a good + * example of about everything that can be included in iBFT table (as of + * ACPI 3.0b). */ connection = read_connection(TEST_INITRD_DIR "/sysfs", "00:53:00:AB:00:01", &error); g_assert(connection); diff --git a/src/main-utils.c b/src/main-utils.c index c6f95a11f2..c425195756 100644 --- a/src/main-utils.c +++ b/src/main-utils.c @@ -142,8 +142,8 @@ nm_main_utils_ensure_rundir() } /* NM_CONFIG_DEVICE_STATE_DIR is used to determine whether NM is restarted or not. - * It is important to set NMConfigCmdLineOptions.first_start before creating - * the directory. */ + * It is important to set NMConfigCmdLineOptions.first_start before creating + * the directory. */ nm_assert(g_str_has_prefix(NM_CONFIG_DEVICE_STATE_DIR, NMRUNDIR "/")); if (g_mkdir(NM_CONFIG_DEVICE_STATE_DIR, 0755) != 0) { errsv = errno; @@ -236,16 +236,16 @@ nm_main_utils_early_setup(const char * progname, const char ** opt_loc_log_level = NULL, **opt_loc_log_domains = NULL; /* Make GIO ignore the remote VFS service; otherwise it tries to use the - * session bus to contact the remote service, and NM shouldn't ever be - * talking on the session bus. See rh #588745 - */ + * session bus to contact the remote service, and NM shouldn't ever be + * talking on the session bus. See rh #588745 + */ setenv("GIO_USE_VFS", "local", 1); /* - * Set the umask to 0022, which results in 0666 & ~0022 = 0644. - * Otherwise, if root (or an su'ing user) has a wacky umask, we could - * write out an unreadable resolv.conf. - */ + * Set the umask to 0022, which results in 0666 & ~0022 = 0644. + * Otherwise, if root (or an su'ing user) has a wacky umask, we could + * write out an unreadable resolv.conf. + */ umask(022); /* Ensure gettext() gets the right environment (bgo #666516) */ diff --git a/src/main.c b/src/main.c index 0983c283ba..854cfc0ee2 100644 --- a/src/main.c +++ b/src/main.c @@ -96,7 +96,7 @@ _init_nm_debug(NMConfig *config) #if !defined(__SANITIZE_ADDRESS__) if (NM_FLAGS_HAS(flags, D_RLIMIT_CORE)) { /* only enable this, if explicitly requested, because it might - * expose sensitive data. */ + * expose sensitive data. */ struct rlimit limit = { .rlim_cur = RLIM_INFINITY, @@ -132,11 +132,11 @@ nm_main_config_reload(int signal) nm_log_info(LOGD_CORE, "reload configuration (signal %s)...", strsignal(signal)); /* The signal handler thread is only installed after - * creating NMConfig instance, and on shut down we - * no longer run the mainloop (to reach this point). - * - * Hence, a NMConfig singleton instance must always be - * available. */ + * creating NMConfig instance, and on shut down we + * no longer run the mainloop (to reach this point). + * + * Hence, a NMConfig singleton instance must always be + * available. */ nm_config_reload(nm_config_get(), reload_flags, TRUE); } @@ -270,17 +270,17 @@ _dbus_manager_init(NMConfig *config) if (c_a_q_type == NM_CONFIG_CONFIGURE_AND_QUIT_ENABLED) { /* D-Bus is useless in configure and quit mode -- we're eventually dropping - * off and potential clients would have no way of knowing whether we're - * finished already or didn't start yet. - * - * But we still create a nm_dbus_manager_get_dbus_connection() D-Bus connection - * so that we can talk to other services like firewalld. */ + * off and potential clients would have no way of knowing whether we're + * finished already or didn't start yet. + * + * But we still create a nm_dbus_manager_get_dbus_connection() D-Bus connection + * so that we can talk to other services like firewalld. */ return nm_dbus_manager_acquire_bus(busmgr, FALSE); } nm_assert(c_a_q_type == NM_CONFIG_CONFIGURE_AND_QUIT_INITRD); /* in initrd we don't have D-Bus at all. Don't even try to get the G_BUS_TYPE_SYSTEM - * connection. And of course don't claim the D-Bus name. */ + * connection. And of course don't claim the D-Bus name. */ return TRUE; } @@ -304,7 +304,7 @@ main(int argc, char *argv[]) int errsv; /* Known to cause a possible deadlock upon GDBus initialization: - * https://bugzilla.gnome.org/show_bug.cgi?id=674885 */ + * https://bugzilla.gnome.org/show_bug.cgi?id=674885 */ g_type_ensure(G_TYPE_SOCKET); g_type_ensure(G_TYPE_DBUS_CONNECTION); g_type_ensure(NM_TYPE_DBUS_MANAGER); @@ -314,7 +314,7 @@ main(int argc, char *argv[]) main_loop = g_main_loop_new(NULL, FALSE); /* we determine a first-start (contrary to a restart during the same boot) - * based on the existence of NM_CONFIG_DEVICE_STATE_DIR directory. */ + * based on the existence of NM_CONFIG_DEVICE_STATE_DIR directory. */ config_cli = nm_config_cmd_line_options_new( !g_file_test(NM_CONFIG_DEVICE_STATE_DIR, G_FILE_TEST_IS_DIR)); @@ -344,13 +344,13 @@ main(int argc, char *argv[]) nm_main_utils_ensure_rundir(); /* When running from the build directory, determine our build directory - * base and set helper paths in the build tree */ + * base and set helper paths in the build tree */ if (global_opt.run_from_build_dir) { char *path, *slash; int g; /* exe is <basedir>/src/.libs/lt-NetworkManager, so chop off - * the last three components */ + * the last three components */ path = realpath("/proc/self/exe", NULL); g_assert(path != NULL); for (g = 0; g < 3; ++g) { @@ -360,7 +360,7 @@ main(int argc, char *argv[]) } /* don't free these strings, we need them for the entire - * process lifetime */ + * process lifetime */ nm_dhcp_helper_path = g_strdup_printf("%s/src/dhcp/nm-dhcp-helper", path); g_free(path); @@ -388,15 +388,15 @@ main(int argc, char *argv[]) _init_nm_debug(config); /* Initialize logging from config file *only* if not explicitly - * specified by commandline. - */ + * specified by commandline. + */ if (global_opt.opt_log_level == NULL && global_opt.opt_log_domains == NULL) { if (!nm_logging_setup(nm_config_get_log_level(config), nm_config_get_log_domains(config), &bad_domains, &error_invalid_logging_config)) { /* ignore error, and print the failure reason below. - * Likewise, print about bad_domains below. */ + * Likewise, print about bad_domains below. */ } } @@ -497,15 +497,15 @@ main(int argc, char *argv[]) nm_platform_process_events(NM_PLATFORM_GET); /* Make sure the loopback interface is up. If interface is down, we bring - * it up and kernel will assign it link-local IPv4 and IPv6 addresses. If - * it was already up, we assume is in clean state. - * - * TODO: it might be desirable to check the list of addresses and compare - * it with a list of expected addresses (one of the protocol families - * could be disabled). The 'lo' interface is sometimes used for assigning - * global addresses so their availability doesn't depend on the state of - * physical interfaces. - */ + * it up and kernel will assign it link-local IPv4 and IPv6 addresses. If + * it was already up, we assume is in clean state. + * + * TODO: it might be desirable to check the list of addresses and compare + * it with a list of expected addresses (one of the protocol families + * could be disabled). The 'lo' interface is sometimes used for assigning + * global addresses so their availability doesn't depend on the state of + * physical interfaces. + */ nm_log_dbg(LOGD_CORE, "setting up local loopback"); nm_platform_link_set_up(NM_PLATFORM_GET, 1, NULL); @@ -520,9 +520,9 @@ main(int argc, char *argv[]) done: /* write the device-state to file. Note that we only persist the - * state here. We don't bother updating the state as devices - * change during regular operation. If NM is killed with SIGKILL, - * it misses to update the state. */ + * state here. We don't bother updating the state as devices + * change during regular operation. If NM is killed with SIGKILL, + * it misses to update the state. */ nm_manager_write_device_state_all(manager); nm_manager_stop(manager); diff --git a/src/ndisc/nm-lndp-ndisc.c b/src/ndisc/nm-lndp-ndisc.c index a9bd72f3c0..19e4dd7a8a 100644 --- a/src/ndisc/nm-lndp-ndisc.c +++ b/src/ndisc/nm-lndp-ndisc.c @@ -109,16 +109,16 @@ receive_ra(struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) guint32 val; /* Router discovery is subject to the following RFC documents: - * - * http://tools.ietf.org/html/rfc4861 - * http://tools.ietf.org/html/rfc4862 - * - * The biggest difference from good old DHCP is that all configuration - * items have their own lifetimes and they are merged from various - * sources. Router discovery is *not* contract-based, so there is *no* - * single time when the configuration is finished and updates can - * come at any time. - */ + * + * http://tools.ietf.org/html/rfc4861 + * http://tools.ietf.org/html/rfc4862 + * + * The biggest difference from good old DHCP is that all configuration + * items have their own lifetimes and they are merged from various + * sources. Router discovery is *not* contract-based, so there is *no* + * single time when the configuration is finished and updates can + * come at any time. + */ _LOGD("received router advertisement at %d", (int) now); gateway_addr = *ndp_msg_addrto(msg); @@ -126,11 +126,11 @@ receive_ra(struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) g_return_val_if_reached(0); /* DHCP level: - * - * The problem with DHCP level is what to do if subsequent - * router advertisements carry different flags. Currently, we just - * rewrite the flag with every inbound RA. - */ + * + * The problem with DHCP level is what to do if subsequent + * router advertisements carry different flags. Currently, we just + * rewrite the flag with every inbound RA. + */ { NMNDiscDHCPLevel dhcp_level; @@ -142,7 +142,7 @@ receive_ra(struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) dhcp_level = NM_NDISC_DHCP_LEVEL_NONE; /* when receiving multiple RA (possibly from different routers), - * let's keep the "most managed" level. */ + * let's keep the "most managed" level. */ G_STATIC_ASSERT_EXPR(NM_NDISC_DHCP_LEVEL_MANAGED > NM_NDISC_DHCP_LEVEL_OTHERCONF); G_STATIC_ASSERT_EXPR(NM_NDISC_DHCP_LEVEL_OTHERCONF > NM_NDISC_DHCP_LEVEL_NONE); dhcp_level = MAX(dhcp_level, rdata->public.dhcp_level); @@ -154,11 +154,11 @@ receive_ra(struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) } /* Default gateway: - * - * Subsequent router advertisements can represent new default gateways - * on the network. We should present all of them in router preference - * order. - */ + * + * Subsequent router advertisements can represent new default gateways + * on the network. We should present all of them in router preference + * order. + */ { const NMNDiscGateway gateway = { .address = gateway_addr, @@ -248,10 +248,10 @@ receive_ra(struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) }; /* Pad the lifetime somewhat to give a bit of slack in cases - * where one RA gets lost or something (which can happen on unreliable - * links like Wi-Fi where certain types of frames are not retransmitted). - * Note that 0 has special meaning and is therefore not adjusted. - */ + * where one RA gets lost or something (which can happen on unreliable + * links like Wi-Fi where certain types of frames are not retransmitted). + * Note that 0 has special meaning and is therefore not adjusted. + */ if (dns_server.lifetime && dns_server.lifetime < 7200) dns_server.lifetime = 7200; if (nm_ndisc_add_dns_server(ndisc, &dns_server)) @@ -270,10 +270,10 @@ receive_ra(struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) }; /* Pad the lifetime somewhat to give a bit of slack in cases - * where one RA gets lost or something (which can happen on unreliable - * links like Wi-Fi where certain types of frames are not retransmitted). - * Note that 0 has special meaning and is therefore not adjusted. - */ + * where one RA gets lost or something (which can happen on unreliable + * links like Wi-Fi where certain types of frames are not retransmitted). + * Note that 0 has special meaning and is therefore not adjusted. + */ if (dns_domain.lifetime && dns_domain.lifetime < 7200) dns_domain.lifetime = 7200; if (nm_ndisc_add_dns_domain(ndisc, &dns_domain)) @@ -309,9 +309,9 @@ receive_ra(struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) } } else { /* All sorts of bad things would happen if we accepted this. - * Kernel would set it, but would flush out all IPv6 addresses away - * from the link, even the link-local, and we wouldn't be able to - * listen for further RAs that could fix the MTU. */ + * Kernel would set it, but would flush out all IPv6 addresses away + * from the link, even the link-local, and we wouldn't be able to + * listen for further RAs that could fix the MTU. */ _LOGW("MTU too small for IPv6 ignored: %d", mtu); } } @@ -382,7 +382,7 @@ send_ra(NMNDisc *ndisc, GError **error) ndp_msgra_router_lifetime_set(ndp_msgra(msg), NM_NDISC_ROUTER_LIFETIME); /* The device let us know about all addresses that the device got - * whose prefixes are suitable for delegating. Let's announce them. */ + * whose prefixes are suitable for delegating. Let's announce them. */ for (i = 0; i < rdata->addresses->len; i++) { NMNDiscAddress *address = &g_array_index(rdata->addresses, NMNDiscAddress, i); guint32 age = NM_CLAMP((gint64) now - (gint64) address->timestamp, 0, G_MAXUINT32 - 1); diff --git a/src/ndisc/nm-ndisc.c b/src/ndisc/nm-ndisc.c index 2d7030a06f..bcfc26557c 100644 --- a/src/ndisc/nm-ndisc.c +++ b/src/ndisc/nm-ndisc.c @@ -110,9 +110,9 @@ nm_ndisc_data_to_l3cd(NMDedupMultiIndex * multi_idx, nm_l3_config_data_set_ip6_privacy(l3cd, ip6_privacy); /* Check, whether kernel is recent enough to help user space handling RA. - * If it's not supported, we have no ipv6-privacy and must add autoconf - * addresses as /128. The reason for the /128 is to prevent the kernel - * from adding a prefix route for this address. */ + * If it's not supported, we have no ipv6-privacy and must add autoconf + * addresses as /128. The reason for the /128 is to prevent the kernel + * from adding a prefix route for this address. */ ifa_flags = 0; if (kernel_support_extended_ifa_flags) { ifa_flags |= IFA_F_NOPREFIXROUTE; @@ -178,8 +178,8 @@ nm_ndisc_data_to_l3cd(NMDedupMultiIndex * multi_idx, if (first_pref != rdata->gateways[i].preference && !kernel_support_rta_pref) { /* We are unable to configure a router preference. Hence, we skip all gateways - * with a different preference from the first gateway. Note, that the gateways - * are sorted in order of highest to lowest preference. */ + * with a different preference from the first gateway. Note, that the gateways + * are sorted in order of highest to lowest preference. */ break; } } @@ -538,7 +538,7 @@ nm_ndisc_add_address(NMNDisc *ndisc, const NMNDiscAddress *new, gint32 now_s, gb if (from_ra) { /* RFC4862 5.5.3.d, we find an existing address with the same prefix. - * (note that all prefixes at this point have implicitly length /64). */ + * (note that all prefixes at this point have implicitly length /64). */ if (memcmp(&item->address, &new->address, 8) == 0) { existing = item; break; @@ -617,9 +617,9 @@ nm_ndisc_add_address(NMNDisc *ndisc, const NMNDiscAddress *new, gint32 now_s, gb } /* we create at most max_addresses autoconf addresses. This is different from - * what the kernel does, because it considers *all* addresses (including - * static and other temporary addresses). - **/ + * what the kernel does, because it considers *all* addresses (including + * static and other temporary addresses). + **/ if (priv->max_addresses && rdata->addresses->len >= priv->max_addresses) return FALSE; @@ -654,12 +654,12 @@ nm_ndisc_add_route(NMNDisc *ndisc, const NMNDiscRoute *new) if (new->plen == 0 || new->plen > 128) { /* Only expect non-default routes. The router has no idea what the - * local configuration or user preferences are, so sending routes - * with a prefix length of 0 must be ignored by NMNDisc. - * - * Also, upper layers also don't expect that NMNDisc exposes routes - * with a plen or zero or larger then 128. - */ + * local configuration or user preferences are, so sending routes + * with a prefix length of 0 must be ignored by NMNDisc. + * + * Also, upper layers also don't expect that NMNDisc exposes routes + * with a plen or zero or larger then 128. + */ g_return_val_if_reached(FALSE); } @@ -902,7 +902,7 @@ announce_router_initial(NMNDisc *ndisc) nm_clear_g_source(&priv->send_ra_id); /* Schedule the initial send rather early. Clamp the delay by minimal - * delay and not the initial advert internal so that we start fast. */ + * delay and not the initial advert internal so that we start fast. */ if (G_LIKELY(!priv->send_ra_id)) { priv->send_ra_id = g_timeout_add_seconds(g_random_int_range(0, NM_NDISC_ROUTER_ADVERT_DELAY), @@ -1100,8 +1100,8 @@ nm_ndisc_stop(NMNDisc *ndisc) priv->rdata.public.hop_limit = 64; /* Start at very low number so that last_rs - router_solicitation_interval - * is much lower than nm_utils_get_monotonic_timestamp_sec() at startup. - */ + * is much lower than nm_utils_get_monotonic_timestamp_sec() at startup. + */ priv->last_rs = G_MININT32; nm_clear_g_source_inst(&priv->ra_timeout_source); nm_clear_g_source(&priv->send_rs_id); @@ -1534,8 +1534,8 @@ nm_ndisc_init(NMNDisc *ndisc) priv->rdata.public.hop_limit = 64; /* Start at very low number so that last_rs - router_solicitation_interval - * is much lower than nm_utils_get_monotonic_timestamp_sec() at startup. - */ + * is much lower than nm_utils_get_monotonic_timestamp_sec() at startup. + */ priv->last_rs = G_MININT32; } diff --git a/src/ndisc/tests/test-ndisc-fake.c b/src/ndisc/tests/test-ndisc-fake.c index a0ee50242c..729478292f 100644 --- a/src/ndisc/tests/test-ndisc-fake.c +++ b/src/ndisc/tests/test-ndisc-fake.c @@ -396,9 +396,9 @@ test_preference_changed(void) guint id; /* Test that when a low-preference and medium gateway send advertisements, - * that if the low-preference gateway switches to high-preference, we do - * not get duplicates in the gateway list. - */ + * that if the low-preference gateway switches to high-preference, we do + * not get duplicates in the gateway list. + */ id = nm_fake_ndisc_add_ra(ndisc, 1, NM_NDISC_DHCP_LEVEL_NONE, 4, 1500); g_assert(id); @@ -459,9 +459,9 @@ test_dns_solicit_loop_rs_sent(NMFakeNDisc *ndisc, TestData *data) } /* On all but the first solicitation, which should be triggered by the - * DNS servers reaching 1/2 lifetime, emit a new RA without the DNS - * servers again. - */ + * DNS servers reaching 1/2 lifetime, emit a new RA without the DNS + * servers again. + */ id = nm_fake_ndisc_add_ra(ndisc, 0, NM_NDISC_DHCP_LEVEL_NONE, 4, 1500); g_assert(id); nm_fake_ndisc_add_gateway(ndisc, id, "fe80::1", now, 10, NM_ICMPV6_ROUTER_PREF_MEDIUM); @@ -485,11 +485,11 @@ test_dns_solicit_loop(void) guint id; /* Ensure that no solicitation loop happens when DNS servers or domains - * stop being sent in advertisements. This can happen if two routers - * send RAs, but the one sending DNS info stops responding, or if one - * router removes the DNS info from the RA without zero-lifetiming them - * first. - */ + * stop being sent in advertisements. This can happen if two routers + * send RAs, but the one sending DNS info stops responding, or if one + * router removes the DNS info from the RA without zero-lifetiming them + * first. + */ id = nm_fake_ndisc_add_ra(ndisc, 1, NM_NDISC_DHCP_LEVEL_NONE, 4, 1500); g_assert(id); diff --git a/src/nm-act-request.c b/src/nm-act-request.c index 0e428b9b36..6afae138e1 100644 --- a/src/nm-act-request.c +++ b/src/nm-act-request.c @@ -378,19 +378,19 @@ device_state_changed(NMActiveConnection *active, NMActiveConnectionStateReason ac_state_reason = NM_ACTIVE_CONNECTION_STATE_REASON_UNKNOWN; /* Decide which device state changes to handle when this active connection - * is not the device's current request. Two cases here: (a) the AC is - * pending and not yet active, and (b) the AC was active but the device is - * entering DISCONNECTED state (which clears the device's current AC before - * emitting the state change signal). - */ + * is not the device's current request. Two cases here: (a) the AC is + * pending and not yet active, and (b) the AC was active but the device is + * entering DISCONNECTED state (which clears the device's current AC before + * emitting the state change signal). + */ if (NM_ACTIVE_CONNECTION(nm_device_get_act_request(device)) != active) { /* Some other request is activating; this one must be pending */ if (new_state >= NM_DEVICE_STATE_PREPARE) return; else if (new_state == NM_DEVICE_STATE_DISCONNECTED) { /* This request hasn't started activating yet; the device is - * disconnecting and cleaning up a previous activation request. - */ + * disconnecting and cleaning up a previous activation request. + */ if (cur_ac_state < NM_ACTIVE_CONNECTION_STATE_ACTIVATING) return; diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c index 903ce035a4..f7ce0ef32d 100644 --- a/src/nm-active-connection.c +++ b/src/nm-active-connection.c @@ -43,9 +43,9 @@ typedef struct _NMActiveConnectionPrivate { NMActivationType activation_type : 3; /* capture the original reason why the connection was activated. - * For example with NM_ACTIVATION_REASON_ASSUME, the connection - * will later change to become fully managed. But the original - * reason never changes. */ + * For example with NM_ACTIVATION_REASON_ASSUME, the connection + * will later change to become fully managed. But the original + * reason never changes. */ NMActivationReason activation_reason : 4; NMAuthSubject * subject; @@ -175,18 +175,18 @@ _settings_connection_updated(NMSettingsConnection *sett_conn, NMActiveConnection *self = user_data; /* we don't know which properties actually changed. Just to be sure, - * notify about all possible properties. After all, an update of a - * connection is a rare event. */ + * notify about all possible properties. After all, an update of a + * connection is a rare event. */ _notify(self, PROP_ID); /* it's a bit odd to update the TYPE of an active connection. But the alternative - * is unexpected too. */ + * is unexpected too. */ _notify(self, PROP_TYPE); /* currently, the UUID and the exported CONNECTION path cannot change. Later, we might - * want to support a re-link operation, which associates an active-connection with a different - * settings-connection. */ + * want to support a re-link operation, which associates an active-connection with a different + * settings-connection. */ } static void @@ -257,15 +257,15 @@ nm_active_connection_set_state(NMActiveConnection * self, if (new_state > NM_ACTIVE_CONNECTION_STATE_ACTIVATED) { /* once we are about to deactivate, we don't need the keep-alive instance - * anymore. Freeze/disarm it. */ + * anymore. Freeze/disarm it. */ nm_keep_alive_disarm(priv->keep_alive); } if (new_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED && priv->activation_type == NM_ACTIVATION_TYPE_ASSUME) { /* assuming connections mean to gracefully take over an externally - * configured device. Once activation is complete, an assumed - * activation *is* the same as a full activation. */ + * configured device. Once activation is complete, an assumed + * activation *is* the same as a full activation. */ _set_activation_type_managed(self); } @@ -305,9 +305,9 @@ nm_active_connection_set_state(NMActiveConnection * self, auth_complete(self, FALSE, "Authorization request cancelled"); /* Device is no longer relevant when deactivated. So remove it and - * emit property change notification so clients re-read the value, - * which will be NULL due to conditions in get_property(). - */ + * emit property change notification so clients re-read the value, + * which will be NULL due to conditions in get_property(). + */ _device_cleanup(self); _notify(self, PROP_DEVICES); } @@ -406,8 +406,8 @@ nm_active_connection_get_settings_connection(NMActiveConnection *self) sett_conn = _nm_active_connection_get_settings_connection(self); /* Only call this function on an active-connection that is already - * fully set-up (i.e. that has a settings-connection). Other uses - * indicate a bug. */ + * fully set-up (i.e. that has a settings-connection). Other uses + * indicate a bug. */ g_return_val_if_fail(sett_conn, NULL); return sett_conn; } @@ -422,8 +422,8 @@ nm_active_connection_get_applied_connection(NMActiveConnection *self) connection = NM_ACTIVE_CONNECTION_GET_PRIVATE(self)->applied_connection; /* Only call this function on an active-connection that is already - * fully set-up (i.e. that has a settings-connection). Other uses - * indicate a bug. */ + * fully set-up (i.e. that has a settings-connection). Other uses + * indicate a bug. */ g_return_val_if_fail(connection, NULL); return connection; } @@ -443,7 +443,7 @@ _set_applied_connection_take(NMActiveConnection *self, NMConnection *applied_con nm_connection_clear_secrets(priv->applied_connection); /* we determine whether the connection is a master/slave, based solely - * on the connection properties itself. */ + * on the connection properties itself. */ s_con = nm_connection_get_setting_connection(priv->applied_connection); if (nm_setting_connection_get_master(s_con)) flags_val |= NM_ACTIVATION_STATE_FLAG_IS_SLAVE; @@ -472,12 +472,12 @@ nm_active_connection_set_settings_connection(NMActiveConnection * self, g_return_if_fail(!priv->applied_connection); /* Can't change connection after the ActiveConnection is exported over D-Bus. - * - * Later, we want to change the settings-connection of an activated connection. - * When doing that, this changes the assumption that the settings-connection - * never changes (once it's set). That has effects for NMVpnConnection and - * NMActivationRequest. - * For example, we'd have to cancel all pending seret requests. */ + * + * Later, we want to change the settings-connection of an activated connection. + * When doing that, this changes the assumption that the settings-connection + * never changes (once it's set). That has effects for NMVpnConnection and + * NMActivationRequest. + * For example, we'd have to cancel all pending seret requests. */ g_return_if_fail(!nm_dbus_object_is_exported(NM_DBUS_OBJECT(self))); _set_settings_connection(self, sett_conn); @@ -538,8 +538,8 @@ nm_active_connection_set_specific_object(NMActiveConnection *self, const char *s NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE(self); /* Nothing that calls this function should be using paths from D-Bus, - * where NM uses "/" to mean NULL. - */ + * where NM uses "/" to mean NULL. + */ nm_assert(!nm_streq0(specific_object, "/")); if (nm_streq0(priv->specific_object, specific_object)) @@ -728,8 +728,8 @@ nm_active_connection_set_device(NMActiveConnection *self, NMDevice *device) } } else { /* The ActiveConnection's device can only be cleared after the - * connection is activated. - */ + * connection is activated. + */ g_warn_if_fail(priv->state > NM_ACTIVE_CONNECTION_STATE_UNKNOWN); priv->device = NULL; } @@ -772,10 +772,10 @@ check_master_ready(NMActiveConnection *self) gboolean signalling = FALSE; /* ActiveConnetions don't enter the ACTIVATING state until they have a - * NMDevice in PREPARE or higher states, so the master active connection's - * device will be ready to accept slaves when the master is in ACTIVATING - * or higher states. - */ + * NMDevice in PREPARE or higher states, so the master active connection's + * device will be ready to accept slaves when the master is in ACTIVATING + * or higher states. + */ if (!priv->master_ready && priv->master && priv->state == NM_ACTIVE_CONNECTION_STATE_ACTIVATING && NM_IN_SET(nm_active_connection_get_state(priv->master), NM_ACTIVE_CONNECTION_STATE_ACTIVATING, @@ -798,9 +798,9 @@ check_master_ready(NMActiveConnection *self) _notify(self, PROP_INT_MASTER_READY); /* Also notify clients to recheck the exported 'master' property to - * ensure that if the master connection was created without a device - * that we notify clients when the master device is known. - */ + * ensure that if the master connection was created without a device + * that we notify clients when the master device is known. + */ _notify(self, PROP_MASTER); } } @@ -1127,9 +1127,9 @@ auth_done(NMAuthManager * auth_mgr, nm_assert(auth_call_id == priv->auth.call_id_wifi_shared_permission); if (result != NM_AUTH_CALL_RESULT_YES) { /* we don't fail right away. Instead, we mark that wifi-shared-permissions - * are missing. We prefer to report the failure about network-control. - * Below, we will wait longer for call_id_network_control (if it's still - * pending). */ + * are missing. We prefer to report the failure about network-control. + * Below, we will wait longer for call_id_network_control (if it's still + * pending). */ priv->auth.call_id_wifi_shared_permission = AUTH_CALL_ID_SHARED_WIFI_PERMISSION_FAILED; } else priv->auth.call_id_wifi_shared_permission = NULL; @@ -1275,13 +1275,13 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) switch (prop_id) { /* note that while priv->settings_connection.obj might not be set initially, - * it will be set before the object is exported on D-Bus. Hence, - * nobody is calling these property getters before the object is - * exported, at which point we will have a valid settings-connection. - * - * Therefore, intentionally not check whether priv->settings_connection.obj - * is set, to get an assertion failure if somebody tries to access the - * getters at the wrong time. */ + * it will be set before the object is exported on D-Bus. Hence, + * nobody is calling these property getters before the object is + * exported, at which point we will have a valid settings-connection. + * + * Therefore, intentionally not check whether priv->settings_connection.obj + * is set, to get an assertion failure if somebody tries to access the + * getters at the wrong time. */ case PROP_CONNECTION: g_value_set_string(value, nm_dbus_track_obj_path_get(&priv->settings_connection)); break; @@ -1311,8 +1311,8 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) g_value_set_uint(value, priv->state); else { /* When the AC has just been created, its externally-visible state should - * be "ACTIVATING", even though internally it is "UNKNOWN". - */ + * be "ACTIVATING", even though internally it is "UNKNOWN". + */ g_value_set_uint(value, NM_ACTIVE_CONNECTION_STATE_ACTIVATING); } break; @@ -1380,11 +1380,11 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps acon = g_value_get_object(value); if (acon) { /* we don't call _set_applied_connection_take() yet, because the instance - * is not yet fully initialized. We are currently in the process of setting - * the constructor properties. - * - * For now, just piggyback the connection, but call _set_applied_connection_take() - * in constructed(). */ + * is not yet fully initialized. We are currently in the process of setting + * the constructor properties. + * + * For now, just piggyback the connection, but call _set_applied_connection_take() + * in constructed(). */ priv->applied_connection = g_object_ref(acon); } break; @@ -1491,10 +1491,10 @@ constructed(GObject *object) if (priv->applied_connection) { /* priv->applied_connection was set during the construction of the object. - * It's not yet fully initialized, so do that now. - * - * We delayed that, because we may log in _set_applied_connection_take(), and the - * first logging line should be "constructed" above). */ + * It's not yet fully initialized, so do that now. + * + * We delayed that, because we may log in _set_applied_connection_take(), and the + * first logging line should be "constructed" above). */ _set_applied_connection_take(self, g_steal_pointer(&priv->applied_connection)); } diff --git a/src/nm-active-connection.h b/src/nm-active-connection.h index ed87df4f45..f85545c6f8 100644 --- a/src/nm-active-connection.h +++ b/src/nm-active-connection.h @@ -64,7 +64,7 @@ struct _NMActiveConnection { struct _NMActiveConnectionPrivate *_priv; /* active connection can be tracked in a list by NMManager. This is - * the list node. */ + * the list node. */ CList active_connections_lst; }; @@ -72,8 +72,8 @@ typedef struct { NMDBusObjectClass parent; /* re-emits device state changes as a convenience for subclasses for - * device states >= DISCONNECTED. - */ + * device states >= DISCONNECTED. + */ void (*device_state_changed)(NMActiveConnection *connection, NMDevice * device, NMDeviceState new_state, diff --git a/src/nm-auth-manager.c b/src/nm-auth-manager.c index 4ed83b6dc5..20992a3269 100644 --- a/src/nm-auth-manager.c +++ b/src/nm-auth-manager.c @@ -160,7 +160,7 @@ _call_id_free(NMAuthManagerCallId *call_id) if (call_id->dbus_cancellable) { /* we have a pending D-Bus call. We keep the call-id instance alive - * for _call_check_authorize_cb() */ + * for _call_check_authorize_cb() */ g_cancellable_cancel(call_id->dbus_cancellable); return; } @@ -212,10 +212,10 @@ _call_check_authorize_cb(GObject *proxy, GAsyncResult *res, gpointer user_data) gboolean is_challenge = FALSE; /* we need to clear the cancelable, to signal for _call_id_free() that we - * are not in a pending call. - * - * Note how _call_id_free() kept call-id alive, even if the request was - * already cancelled. */ + * are not in a pending call. + * + * Note how _call_id_free() kept call-id alive, even if the request was + * already cancelled. */ g_clear_object(&call_id->dbus_cancellable); self = call_id->self; @@ -225,20 +225,20 @@ _call_check_authorize_cb(GObject *proxy, GAsyncResult *res, gpointer user_data) if (nm_utils_error_is_cancelled(error)) { /* call_id was cancelled externally, but _call_id_free() kept call_id - * alive (and it has still the reference on @self. */ + * alive (and it has still the reference on @self. */ if (!priv->main_cancellable) { /* we do a forced shutdown. There is no more time for cancelling... */ _call_id_free(call_id); /* this shouldn't really happen, because: - * nm_auth_manager_check_authorization() only scheduled the D-Bus request at a time when - * main_cancellable was still set. It means, somebody called force-shutdown - * after call-id was schedule. - * force-shutdown should only be called after: - * - cancel all pending requests - * - give enough time to cancel the request and schedule a D-Bus call - * to CancelCheckAuthorization (below), before issuing force-shutdown. */ + * nm_auth_manager_check_authorization() only scheduled the D-Bus request at a time when + * main_cancellable was still set. It means, somebody called force-shutdown + * after call-id was schedule. + * force-shutdown should only be called after: + * - cancel all pending requests + * - give enough time to cancel the request and schedule a D-Bus call + * to CancelCheckAuthorization (below), before issuing force-shutdown. */ g_return_if_reached(); } @@ -541,28 +541,28 @@ nm_auth_manager_force_shutdown(NMAuthManager *self) priv = NM_AUTH_MANAGER_GET_PRIVATE(self); /* FIXME(shutdown): ensure we properly call this API during shutdown as - * described next. */ + * described next. */ /* while we have pending requests (NMAuthManagerCallId), the instance - * is kept alive. - * - * Even if the caller cancels all pending call-ids, we still need to keep - * a reference to self, in order to handle pending CancelCheckAuthorization - * requests. - * - * To do a coordinated shutdown, do the following: - * - cancel all pending NMAuthManagerCallId requests. - * - ensure everybody unrefs the NMAuthManager instance. If by that, the instance - * gets destroyed, the shutdown already completed successfully. - * - Otherwise, the object is kept alive by pending CancelCheckAuthorization requests. - * wait a certain timeout (1 second) for all requests to complete (by watching - * for destruction of NMAuthManager). - * - if that doesn't happen within timeout, issue nm_auth_manager_force_shutdown() and - * wait longer. After that, soon the instance should be destroyed and you - * did a successful shutdown. - * - if the instance was still not destroyed within a short timeout, you leaked - * resources. You cannot properly shutdown. - */ + * is kept alive. + * + * Even if the caller cancels all pending call-ids, we still need to keep + * a reference to self, in order to handle pending CancelCheckAuthorization + * requests. + * + * To do a coordinated shutdown, do the following: + * - cancel all pending NMAuthManagerCallId requests. + * - ensure everybody unrefs the NMAuthManager instance. If by that, the instance + * gets destroyed, the shutdown already completed successfully. + * - Otherwise, the object is kept alive by pending CancelCheckAuthorization requests. + * wait a certain timeout (1 second) for all requests to complete (by watching + * for destruction of NMAuthManager). + * - if that doesn't happen within timeout, issue nm_auth_manager_force_shutdown() and + * wait longer. After that, soon the instance should be destroyed and you + * did a successful shutdown. + * - if the instance was still not destroyed within a short timeout, you leaked + * resources. You cannot properly shutdown. + */ priv->shutting_down = TRUE; nm_clear_g_cancellable(&priv->main_cancellable); diff --git a/src/nm-auth-utils.c b/src/nm-auth-utils.c index 476b4c3aba..9d10d56510 100644 --- a/src/nm-auth-utils.c +++ b/src/nm-auth-utils.c @@ -150,8 +150,8 @@ nm_auth_chain_set_cancellable(NMAuthChain *self, GCancellable *cancellable) g_return_if_fail(G_IS_CANCELLABLE(cancellable)); /* after the chain is started, the cancellable can no longer be changed. - * No need to handle the complexity of swapping the cancellable *after* - * requests are already started. */ + * No need to handle the complexity of swapping the cancellable *after* + * requests are already started. */ g_return_if_fail(!self->is_started); nm_assert(c_list_is_empty(&self->auth_call_lst_head)); @@ -240,9 +240,9 @@ nm_auth_chain_steal_data(NMAuthChain *self, const char *tag) return NULL; /* Make sure the destroy handler isn't called when freeing. - * - * We don't bother to really remove the element from the array. - * Just mark the entry as unused by clearing the tag. */ + * + * We don't bother to really remove the element from the array. + * Just mark the entry as unused by clearing the tag. */ chain_data->destroy = NULL; chain_data->tag = NULL; return chain_data->data; @@ -274,15 +274,15 @@ nm_auth_chain_set_data_unsafe(NMAuthChain * self, g_return_if_fail(tag); /* The tag must not yet exist. Otherwise, we'd have to first search the - * list for an existing entry. That usage pattern is not supported. */ + * list for an existing entry. That usage pattern is not supported. */ nm_assert(!_get_data(self, tag)); if (!data) { /* we don't track user data of %NULL. - * - * In the past this had also the meaning of removing a user-data. But since - * nm_auth_chain_set_data() does not allow being called more than once - * for the same tag, we don't need to remove anything. */ + * + * In the past this had also the meaning of removing a user-data. But since + * nm_auth_chain_set_data() does not allow being called more than once + * for the same tag, we don't need to remove anything. */ return; } @@ -313,14 +313,14 @@ nm_auth_chain_get_result(NMAuthChain *self, const char *permission) g_return_val_if_fail(permission, NM_AUTH_CALL_RESULT_UNKNOWN); /* it is a bug to request the result other than from the done_func() - * callback. You are not supposed to poll for the result but request - * it upon notification. */ + * callback. You are not supposed to poll for the result but request + * it upon notification. */ nm_assert(self->is_finishing); auth_call = _find_auth_call(self, permission); /* it is a bug to request a permission result that was not - * previously requested or which did not complete yet. */ + * previously requested or which did not complete yet. */ if (!auth_call) g_return_val_if_reached(NM_AUTH_CALL_RESULT_UNKNOWN); @@ -328,7 +328,7 @@ nm_auth_chain_get_result(NMAuthChain *self, const char *permission) if (self->cancellable_idle_source) { /* already cancelled. We always return unknown (even if we happen to - * have already received the response. */ + * have already received the response. */ return NM_AUTH_CALL_RESULT_UNKNOWN; } @@ -390,7 +390,7 @@ pk_call_cb(NMAuthManager * auth_manager, if (call->chain->num_pending_auth_calls == 0) { /* we are on an idle-handler or a clean call-stack (non-reentrant) so it's safe - * to invoke the callback right away. */ + * to invoke the callback right away. */ _done_and_destroy(self); } } @@ -427,7 +427,7 @@ nm_auth_chain_add_call_unsafe(NMAuthChain *self, const char *permission, gboolea NM_AUTH_SUBJECT_TYPE_INTERNAL)); /* duplicate permissions are not supported, also because nm_auth_chain_get_result() - * can only return one-permission. */ + * can only return one-permission. */ nm_assert(!_find_auth_call(self, permission)); if (!self->is_started) { @@ -457,8 +457,8 @@ nm_auth_chain_add_call_unsafe(NMAuthChain *self, const char *permission, gboolea }; /* above we assert that no duplicate permissions are added. Still, track the - * new request to the front of the list so that it would shadow an earlier - * call. */ + * new request to the front of the list so that it would shadow an earlier + * call. */ c_list_link_front(&self->auth_call_lst_head, &call->auth_call_lst); if (self->cancellable_idle_source) { @@ -478,8 +478,8 @@ nm_auth_chain_add_call_unsafe(NMAuthChain *self, const char *permission, gboolea _ASSERT_call(call); /* we track auth-calls in a linked list. If we end up requesting too many permissions this - * becomes inefficient. If that ever happens, consider a more efficient data structure for - * a large number of requests. */ + * becomes inefficient. If that ever happens, consider a more efficient data structure for + * a large number of requests. */ nm_assert(c_list_length(&self->auth_call_lst_head) < 25); G_STATIC_ASSERT_EXPR(NM_CLIENT_PERMISSION_LAST < 25); } @@ -579,9 +579,9 @@ _auth_chain_destroy(NMAuthChain *self) nm_clear_g_source_inst(&self->cancellable_idle_source); /* we must first destroy all AuthCall instances before ChainData. The reason is - * that AuthData.permission is not cloned and the lifetime of the string must - * be ensured by the caller. A sensible thing to do for the caller is attach the - * permission string via nm_auth_chain_set_data(). Hence, first free the AuthCall. */ + * that AuthData.permission is not cloned and the lifetime of the string must + * be ensured by the caller. A sensible thing to do for the caller is attach the + * permission string via nm_auth_chain_set_data(). Hence, first free the AuthCall. */ while ((call = c_list_first_entry(&self->auth_call_lst_head, AuthCall, auth_call_lst))) auth_call_free(call); @@ -634,8 +634,8 @@ nm_auth_is_subject_in_acl(NMConnection *connection, NMAuthSubject *subject, char s_con = nm_connection_get_setting_connection(connection); if (!s_con) { /* This can only happen when called from AddAndActivate, so we know - * the user will be authorized when the connection is completed. - */ + * the user will be authorized when the connection is completed. + */ return TRUE; } diff --git a/src/nm-checkpoint-manager.c b/src/nm-checkpoint-manager.c index fbd9e7cd07..23aa39491d 100644 --- a/src/nm-checkpoint-manager.c +++ b/src/nm-checkpoint-manager.c @@ -82,7 +82,7 @@ rollback_checkpoint(NMCheckpointManager *self, NMCheckpoint *checkpoint) iter = iter->next; if (nm_checkpoint_includes_devices_of(cp, checkpoint)) { /* the younger checkpoint has overlapping devices and gets obsoleted. - * Destroy it. */ + * Destroy it. */ destroy_checkpoint(self, cp, TRUE); } } @@ -124,7 +124,7 @@ nm_checkpoint_manager_create(NMCheckpointManager * self, nm_manager_for_each_device (manager, device, tmp_lst) { /* FIXME: there is no strong reason to skip over unrealized devices. - * Also, NMCheckpoint anticipates to handle them (in parts). */ + * Also, NMCheckpoint anticipates to handle them (in parts). */ if (!nm_device_is_real(device)) continue; nm_assert(nm_dbus_object_get_path(NM_DBUS_OBJECT(device))); @@ -327,11 +327,11 @@ nm_checkpoint_manager_new(NMManager *manager, GParamSpec *spec) self = g_slice_new0(NMCheckpointManager); /* the NMCheckpointManager instance is actually owned by NMManager. - * Thus, we cannot take a reference to it, and we also don't bother - * taking a weak-reference. Instead let GET_MANAGER() assert that - * self->_manager is alive -- which we always expect as the lifetime - * of NMManager shall surpass the lifetime of the NMCheckpointManager - * instance. */ + * Thus, we cannot take a reference to it, and we also don't bother + * taking a weak-reference. Instead let GET_MANAGER() assert that + * self->_manager is alive -- which we always expect as the lifetime + * of NMManager shall surpass the lifetime of the NMCheckpointManager + * instance. */ self->_manager = manager; self->property_spec = spec; c_list_init(&self->checkpoints_lst_head); diff --git a/src/nm-checkpoint.c b/src/nm-checkpoint.c index 7706dddf9b..d8bc5d9d80 100644 --- a/src/nm-checkpoint.c +++ b/src/nm-checkpoint.c @@ -112,8 +112,8 @@ nm_checkpoint_set_timeout_callback(NMCheckpoint * self, NMCheckpointPrivate *priv = NM_CHECKPOINT_GET_PRIVATE(self); /* in glib world, we would have a GSignal for this. But as there - * is only one subscriber, it's simpler to just set and unset(!) - * the callback this way. */ + * is only one subscriber, it's simpler to just set and unset(!) + * the callback this way. */ priv->timeout_cb = callback; priv->timeout_data = user_data; } @@ -217,11 +217,11 @@ restore_and_activate_connection(NMCheckpoint *self, DeviceCheckpoint *dev_checkp connection = find_settings_connection(self, dev_checkpoint, &need_update, &need_activation); /* FIXME: we need to ensure to re-create/update the profile for the - * same settings plugin. E.g. if it was a keyfile in /run or /etc, - * it must be again. If it was previously handled by a certain settings plugin, - * so it must again. - * - * FIXME: preserve and restore the right settings flags (volatile, nm-generated). */ + * same settings plugin. E.g. if it was a keyfile in /run or /etc, + * it must be again. If it was previously handled by a certain settings plugin, + * so it must again. + * + * FIXME: preserve and restore the right settings flags (volatile, nm-generated). */ sett_flags = NM_SETTINGS_CONNECTION_INT_FLAGS_NONE; sett_mask = NM_SETTINGS_CONNECTION_INT_FLAGS_NONE; @@ -276,8 +276,8 @@ restore_and_activate_connection(NMCheckpoint *self, DeviceCheckpoint *dev_checkp subject = nm_auth_subject_new_internal(); /* Disconnect the device if needed. This necessary because now - * the manager prevents the reactivation of the same connection by - * an internal subject. */ + * the manager prevents the reactivation of the same connection by + * an internal subject. */ if (nm_device_get_state(dev_checkpoint->device) > NM_DEVICE_STATE_DISCONNECTED && nm_device_get_state(dev_checkpoint->device) < NM_DEVICE_STATE_DEACTIVATING) { nm_device_state_changed(dev_checkpoint->device, @@ -595,11 +595,11 @@ nm_checkpoint_adjust_rollback_timeout(NMCheckpoint *self, guint32 add_timeout) rollback_timeout_ms = (now_ms - priv->created_at_ms) + add_timeout_ms; /* round to nearest integer second. Since NM_CHECKPOINT_ROLLBACK_TIMEOUT is - * in units seconds, it will be able to exactly express the timeout. */ + * in units seconds, it will be able to exactly express the timeout. */ rollback_timeout_s = NM_MIN((rollback_timeout_ms + 500) / 1000, (gint64) G_MAXUINT32); /* we expect the timeout to be positive, because add_timeout_ms is positive. - * We cannot accept a zero, because it means "infinity". */ + * We cannot accept a zero, because it means "infinity". */ nm_assert(rollback_timeout_s > 0); priv->timeout_id = @@ -702,8 +702,8 @@ nm_checkpoint_new(NMManager * manager, NMDevice *device = devices->pdata[i]; /* As long as the check point instance exists, it will keep a reference - * to the device also if the device gets removed (by rmmod or by deleting - * a connection profile for a software device). */ + * to the device also if the device gets removed (by rmmod or by deleting + * a connection profile for a software device). */ g_hash_table_insert(priv->devices, device, device_checkpoint_create(self, device)); } diff --git a/src/nm-config-data.c b/src/nm-config-data.c index d8ccafd532..f4c6ba3b37 100644 --- a/src/nm-config-data.c +++ b/src/nm-config-data.c @@ -21,8 +21,8 @@ typedef struct { gboolean stop_match; struct { /* have a separate boolean field @has, because a @spec with - * value %NULL does not necessarily mean, that the property - * "match-device" was unspecified. */ + * value %NULL does not necessarily mean, that the property + * "match-device" was unspecified. */ gboolean has; GSList * spec; } match_device; @@ -63,11 +63,11 @@ typedef struct { GKeyFile *keyfile_intern; /* A zero-terminated list of pre-processed information from the - * [connection] sections. This is to speed up lookup. */ + * [connection] sections. This is to speed up lookup. */ MatchSectionInfo *connection_infos; /* A zero-terminated list of pre-processed information from the - * [device] sections. This is to speed up lookup. */ + * [device] sections. This is to speed up lookup. */ MatchSectionInfo *device_infos; struct { @@ -523,9 +523,9 @@ nm_config_data_is_intern_atomic_group(const NMConfigData *self, const char *grou return FALSE; /* we have a .was entry for the section. That means that the section would be overwritten - * from user configuration. But it doesn't mean that the merged configuration contains this - * groups, because the internal setting could hide the user section. - * Only return TRUE, if we actually have such a group in the merged configuration.*/ + * from user configuration. But it doesn't mean that the merged configuration contains this + * groups, because the internal setting could hide the user section. + * Only return TRUE, if we actually have such a group in the merged configuration.*/ return g_key_file_has_group(priv->keyfile, group); } @@ -550,7 +550,7 @@ _merge_keyfiles(GKeyFile *keyfile_user, GKeyFile *keyfile_intern) return keyfile; /* we must reverse the order of the connection settings so that we - * have lowest priority last. */ + * have lowest priority last. */ _nm_config_sort_groups(groups, ngroups); for (g = 0; groups[g]; g++) { const char * group = groups[g]; @@ -1395,12 +1395,12 @@ _match_section_infos_lookup(const MatchSectionInfo *match_section_infos, gboolean match; /* FIXME: Here we use g_key_file_get_string(). This should be in sync with what keyfile-reader - * does. - * - * Unfortunately that is currently not possible because keyfile-reader does the two steps - * string_to_value(keyfile_to_string(keyfile)) in one. Optimally, keyfile library would - * expose both functions, and we would return here keyfile_to_string(keyfile). - * The caller then could convert the string to the proper value via string_to_value(value). */ + * does. + * + * Unfortunately that is currently not possible because keyfile-reader does the two steps + * string_to_value(keyfile_to_string(keyfile)) in one. Optimally, keyfile library would + * expose both functions, and we would return here keyfile_to_string(keyfile). + * The caller then could convert the string to the proper value via string_to_value(value). */ value = g_key_file_get_string(keyfile, match_section_infos->group_name, property, NULL); if (!value && !match_section_infos->stop_match) continue; @@ -1588,10 +1588,10 @@ _match_section_infos_construct(GKeyFile *keyfile, const char *prefix) MatchSectionInfo *match_section_infos = NULL; /* get the list of existing [connection.\+]/[device.\+] sections. - * - * We expect the sections in their right order, with lowest priority - * first. Only exception is the (literal) [connection] section, which - * we will always reorder to the end. */ + * + * We expect the sections in their right order, with lowest priority + * first. Only exception is the (literal) [connection] section, which + * we will always reorder to the end. */ groups = g_key_file_get_groups(keyfile, &ngroups); if (!groups) return NULL; @@ -1865,7 +1865,7 @@ constructed(GObject *object) g_free(str); /* On missing config value, fallback to 300. On invalid value, disable connectivity checking by setting - * the interval to zero. */ + * the interval to zero. */ str = g_key_file_get_string(priv->keyfile, NM_CONFIG_KEYFILE_GROUP_CONNECTIVITY, NM_CONFIG_KEYFILE_KEY_CONNECTIVITY_INTERVAL, diff --git a/src/nm-config-data.h b/src/nm-config-data.h index 489c9211f5..404e9c2a17 100644 --- a/src/nm-config-data.h +++ b/src/nm-config-data.h @@ -20,8 +20,8 @@ typedef enum { NM_AUTH_POLKIT_MODE_ALLOW_ALL, /* use PolicyKit to authorize requests. Root user (uid 0) always - * gets a free pass, without consulting PolicyKit. If PolicyKit is not - * running, authorization will fail for non root users. */ + * gets a free pass, without consulting PolicyKit. If PolicyKit is not + * running, authorization will fail for non root users. */ NM_AUTH_POLKIT_MODE_USE_POLKIT, } NMAuthPolkitMode; @@ -61,7 +61,7 @@ typedef enum { /*< flags >*/ NM_CONFIG_GET_VALUE_NO_EMPTY = (1LL << 2), /* special flag to read device spec. You want to use this before passing the - * value to nm_match_spec_split(). */ + * value to nm_match_spec_split(). */ NM_CONFIG_GET_VALUE_TYPE_SPEC = NM_CONFIG_GET_VALUE_RAW, } NMConfigGetValueFlags; @@ -69,8 +69,8 @@ typedef enum { /*< flags >*/ NM_CONFIG_CHANGE_NONE = 0, /************************************************************************** - * The external cause which triggered the reload/configuration-change - *************************************************************************/ + * The external cause which triggered the reload/configuration-change + *************************************************************************/ NM_CONFIG_CHANGE_CAUSE_SIGHUP = (1L << 0), NM_CONFIG_CHANGE_CAUSE_SIGUSR1 = (1L << 1), @@ -84,8 +84,8 @@ typedef enum { /*< flags >*/ NM_CONFIG_CHANGE_CAUSES = ((1L << 8) - 1), /************************************************************************** - * Following flags describe which property of the configuration changed: - *************************************************************************/ + * Following flags describe which property of the configuration changed: + *************************************************************************/ /* main-file or config-description changed */ NM_CONFIG_CHANGE_CONFIG_FILES = (1L << 10), diff --git a/src/nm-config.c b/src/nm-config.c index 95b8b280fa..4f2a0f72e9 100644 --- a/src/nm-config.c +++ b/src/nm-config.c @@ -42,18 +42,18 @@ struct NMConfigCmdLineOptions { char * connectivity_uri; /* We store interval as signed internally to track whether it's - * set or not via GOptionEntry - */ + * set or not via GOptionEntry + */ int connectivity_interval; char *connectivity_response; /* @first_start is not provided by command line. It is a convenient hack - * to pass in an argument to NMConfig. This makes NMConfigCmdLineOptions a - * misnomer. - * - * It is true, if NM is started the first time -- contrary to a restart - * during the same boot up. That is determined by the content of the - * /run/NetworManager state directory. */ + * to pass in an argument to NMConfig. This makes NMConfigCmdLineOptions a + * misnomer. + * + * It is true, if NM is started the first time -- contrary to a restart + * during the same boot up. That is determined by the content of the + * /run/NetworManager state directory. */ bool first_start; }; @@ -91,24 +91,24 @@ typedef struct { char **atomic_section_prefixes; /* The state. This is actually a mutable data member and it makes sense: - * The regular config is immutable (NMConfigData) and can old be swapped - * as a whole (via nm_config_set_values() or during reload). Thus, it can - * be changed, but it is still immutable and is swapped atomically as a - * whole. Also, we emit a config-changed signal on that occasion. - * - * For state, there are no events. You can query it and set it. - * It only gets read *once* at startup, and later is cached and only - * written out to disk. Hence, no need for the immutable dance here - * because the state changes only on explicit actions from the daemon - * itself. */ + * The regular config is immutable (NMConfigData) and can old be swapped + * as a whole (via nm_config_set_values() or during reload). Thus, it can + * be changed, but it is still immutable and is swapped atomically as a + * whole. Also, we emit a config-changed signal on that occasion. + * + * For state, there are no events. You can query it and set it. + * It only gets read *once* at startup, and later is cached and only + * written out to disk. Hence, no need for the immutable dance here + * because the state changes only on explicit actions from the daemon + * itself. */ State *state; /* the hash table of device states. It is only loaded from disk - * once and kept immutable afterwards. - * - * We also read all state file at once. We don't want to support - * that they are changed outside of NM (at least not while NM is running). - * Hence, we read them once, that's it. */ + * once and kept immutable afterwards. + * + * We also read all state file at once. We don't want to support + * that they are changed outside of NM (at least not while NM is running). + * Hence, we read them once, that's it. */ GHashTable *device_states; char **warnings; @@ -236,7 +236,7 @@ nm_config_keyfile_set_string_list(GKeyFile * keyfile, g_key_file_set_string_list(keyfile, group, key, strv, len); /* g_key_file_set_string_list() appends a trailing separator to the value. - * We don't like that, get rid of it. */ + * We don't like that, get rid of it. */ new_value = g_key_file_get_value(keyfile, group, key, NULL); if (!new_value) @@ -245,8 +245,8 @@ nm_config_keyfile_set_string_list(GKeyFile * keyfile, l = strlen(new_value); if (l > 0 && new_value[l - 1] == NM_CONFIG_KEYFILE_LIST_SEPARATOR) { /* Maybe we should check that value doesn't end with "\\,", i.e. - * with an escaped separator. But the way g_key_file_set_string_list() - * is implemented (currently), it always adds a trailing separator. */ + * with an escaped separator. But the way g_key_file_set_string_list() + * is implemented (currently), it always adds a trailing separator. */ new_value[l - 1] = '\0'; g_key_file_set_value(keyfile, group, key, new_value); } @@ -344,8 +344,8 @@ no_auto_default_from_file(const char *no_auto_default_file) } /* The returned buffer here is not at all compact. That means, it has additional - * memory allocations and is larger than needed. That means, you should not keep - * this result around, only process it further and free it. */ + * memory allocations and is larger than needed. That means, you should not keep + * this result around, only process it further and free it. */ return (char **) list; } @@ -417,9 +417,9 @@ nm_config_set_no_auto_default_for_device(NMConfig *self, NMDevice *device) if (is_fake) { /* A fake MAC address, no point in storing it to the file. - * Also, nm_match_spec_device() would ignore fake MAC addresses. - * - * Instead, try the interface-name... */ + * Also, nm_match_spec_device() would ignore fake MAC addresses. + * + * Instead, try the interface-name... */ ifname = nm_device_get_ip_iface(device); if (!nm_utils_ifname_valid_kernel(ifname, NULL)) return; @@ -442,7 +442,7 @@ nm_config_set_no_auto_default_for_device(NMConfig *self, NMDevice *device) NULL); if (idx >= 0) { /* @spec is already blocked. We don't have to update our in-memory representation. - * Maybe we should write to no_auto_default_file anew, but let's save that too. */ + * Maybe we should write to no_auto_default_file anew, but let's save that too. */ return; } @@ -712,7 +712,7 @@ ignore_config_snippet(GKeyFile *keyfile, gboolean is_base_config) return FALSE; /* first, let's try to parse the value as plain boolean. If that is possible, we don't treat - * the value as match-spec. */ + * the value as match-spec. */ as_bool = nm_config_keyfile_get_boolean(keyfile, NM_CONFIG_KEYFILE_GROUP_CONFIG, NM_CONFIG_KEYFILE_KEY_CONFIG_ENABLE, @@ -751,16 +751,16 @@ _sort_groups_cmp(const char **pa, const char **pb, gpointer dummy) if (a_is_connection != b_is_connection) { /* one is a [connection*] entry, the other not. We sort [connection*] entries - * after. */ + * after. */ if (a_is_connection) return 1; return -1; } if (a_is_connection) { /* both are [connection.\+] entries. Reverse their order. - * One of the sections might be literally [connection]. That section - * is special and its order will be fixed later. It doesn't actually - * matter here how it compares with [connection.\+] sections. */ + * One of the sections might be literally [connection]. That section + * is special and its order will be fixed later. It doesn't actually + * matter here how it compares with [connection.\+] sections. */ return pa > pb ? -1 : 1; } @@ -769,16 +769,16 @@ _sort_groups_cmp(const char **pa, const char **pb, gpointer dummy) if (a_is_device != b_is_device) { /* one is a [device*] entry, the other not. We sort [device*] entries - * after. */ + * after. */ if (a_is_device) return 1; return -1; } if (a_is_device) { /* both are [device.\+] entries. Reverse their order. - * One of the sections might be literally [device]. That section - * is special and its order will be fixed later. It doesn't actually - * matter here how it compares with [device.\+] sections. */ + * One of the sections might be literally [device]. That section + * is special and its order will be fixed later. It doesn't actually + * matter here how it compares with [device.\+] sections. */ return pa > pb ? -1 : 1; } @@ -1002,8 +1002,8 @@ read_config(GKeyFile * keyfile, return TRUE; /* the config-group is internal to every configuration snippets. It doesn't make sense - * to merge it into the global configuration, and it doesn't make sense to preserve the - * group beyond this point. */ + * to merge it into the global configuration, and it doesn't make sense to preserve the + * group beyond this point. */ g_key_file_remove_group(kf, NM_CONFIG_KEYFILE_GROUP_CONFIG, NULL); /* Override the current settings with the new ones */ @@ -1012,13 +1012,13 @@ read_config(GKeyFile * keyfile, ngroups = 0; /* Within one file we reverse the order of the '[connection.\+] sections. - * Here we merge the current file (@kf) into @keyfile. As we merge multiple - * files, earlier sections (with lower priority) will be added first. - * But within one file, we want a top-to-bottom order. This means we - * must reverse the order within each file. - * At the very end, we will revert the order of all sections again and - * get thus the right behavior. This final reversing is done in - * NMConfigData:_get_connection_infos(). */ + * Here we merge the current file (@kf) into @keyfile. As we merge multiple + * files, earlier sections (with lower priority) will be added first. + * But within one file, we want a top-to-bottom order. This means we + * must reverse the order within each file. + * At the very end, we will revert the order of all sections again and + * get thus the right behavior. This final reversing is done in + * NMConfigData:_get_connection_infos(). */ _nm_config_sort_groups(groups, ngroups); for (g = 0; groups && groups[g]; g++) { @@ -1105,7 +1105,7 @@ read_config(GKeyFile * keyfile, nm_auto_free_slist GSList *new_specs = nm_match_spec_split(new_sval); /* the key is a device spec. This is a special kind of string-list, that - * we must split differently. */ + * we must split differently. */ old_val = _nm_utils_slist_to_strv(old_specs, FALSE); new_val = _nm_utils_slist_to_strv(new_specs, FALSE); } @@ -1152,7 +1152,7 @@ read_config(GKeyFile * keyfile, } } else { /* For any other settings we don't support extending the option with +/-. - * Just drop the key. */ + * Just drop the key. */ } continue; } @@ -1197,11 +1197,11 @@ read_base_config(GKeyFile * keyfile, } /* Even though we prefer NetworkManager.conf, we need to check the - * old nm-system-settings.conf first to preserve compat with older - * setups. In package managed systems dropping a NetworkManager.conf - * onto the system would make NM use it instead of nm-system-settings.conf, - * changing behavior during an upgrade. We don't want that. - */ + * old nm-system-settings.conf first to preserve compat with older + * setups. In package managed systems dropping a NetworkManager.conf + * onto the system would make NM use it instead of nm-system-settings.conf, + * changing behavior during an upgrade. We don't want that. + */ /* Try deprecated nm-system-settings.conf first */ if (read_config(keyfile, TRUE, NULL, DEFAULT_CONFIG_MAIN_FILE_OLD, warnings, &my_error)) { @@ -1228,8 +1228,8 @@ read_base_config(GKeyFile * keyfile, g_clear_error(&my_error); /* If for some reason no config file exists, use the default - * config file path. - */ + * config file path. + */ *out_config_main_file = g_strdup(DEFAULT_CONFIG_MAIN_FILE); _LOGI("No config file found or given; using %s", DEFAULT_CONFIG_MAIN_FILE); return TRUE; @@ -1366,12 +1366,12 @@ read_entire_config(const NMConfigCmdLineOptions *cli, } /* Merge settings from command line. They overwrite everything read from - * config files. */ + * config files. */ if (cli) { if (cli->plugins) { /* plugins is a string list. Set the value directly, so the user has to do proper escaping - * on the command line. */ + * on the command line. */ g_key_file_set_value(keyfile, NM_CONFIG_KEYFILE_GROUP_MAIN, "plugins", cli->plugins); } @@ -1597,8 +1597,8 @@ intern_config_read(const char * filename, continue; } /* we must set the "was" marker in our keyfile, so that we know that the section - * from user config is overwritten. The value doesn't matter, it's just a marker - * that this section is present. */ + * from user config is overwritten. The value doesn't matter, it's just a marker + * that this section is present. */ g_key_file_set_value(keyfile_intern, group, NM_CONFIG_KEYFILE_KEY_ATOMIC_SECTION_WAS, @@ -1631,9 +1631,9 @@ intern_config_read(const char * filename, if (!nm_streq0(value_conf, value_was)) { /* if value_was is no longer the same as @value_conf, it means the user - * changed the configuration since the last write. In this case, we - * drop the value. It also means our file is out-of-date, and we should - * rewrite it. */ + * changed the configuration since the last write. In this case, we + * drop the value. It also means our file is out-of-date, and we should + * rewrite it. */ needs_rewrite = TRUE; continue; } @@ -1657,16 +1657,16 @@ intern_config_read(const char * filename, if (!nm_streq0(value_conf, value_was)) { /* if value_was is no longer the same as @value_conf, it means the user - * changed the configuration since the last write. In this case, we - * don't overwrite the user-provided value. It also means our file is - * out-of-date, and we should rewrite it. */ + * changed the configuration since the last write. In this case, we + * don't overwrite the user-provided value. It also means our file is + * out-of-date, and we should rewrite it. */ needs_rewrite = TRUE; continue; } has_intern = TRUE; /* signal the absence of the value. That means, we must propagate the - * "was" key to NMConfigData, so that it knows to hide the corresponding - * user key. */ + * "was" key to NMConfigData, so that it knows to hide the corresponding + * user key. */ g_key_file_set_value(keyfile_intern, group, key, ""); } else needs_rewrite = TRUE; @@ -1675,11 +1675,11 @@ intern_config_read(const char * filename, out: /* - * If user configuration specifies global DNS options, the DNS - * options in internal configuration must be deleted. Otherwise, a - * deletion of options from user configuration may cause the - * internal options to appear again. - */ + * If user configuration specifies global DNS options, the DNS + * options in internal configuration must be deleted. Otherwise, a + * deletion of options from user configuration may cause the + * internal options to appear again. + */ if (nm_config_keyfile_has_global_dns_config(keyfile_conf, FALSE)) { if (g_key_file_remove_group(keyfile_intern, NM_CONFIG_KEYFILE_GROUP_INTERN_GLOBAL_DNS, @@ -1790,8 +1790,8 @@ intern_config_write(const char * filename, || (!keys[1] && strcmp(keys[0], NM_CONFIG_KEYFILE_KEY_ATOMIC_SECTION_WAS) == 0)) && !g_key_file_has_group(keyfile_conf, group)) { /* we are about to save an atomic section. However, we don't have any additional - * keys on our own and there is no user-provided (overlapping) section either. - * We don't have to write an empty section (i.e. skip the useless ".was=0#"). */ + * keys on our own and there is no user-provided (overlapping) section either. + * We don't have to write an empty section (i.e. skip the useless ".was=0#"). */ continue; } else { gs_free char *conf_section_is = NULL; @@ -1828,8 +1828,8 @@ intern_config_write(const char * filename, if (NM_STR_HAS_PREFIX_WITH_MORE(key, NM_CONFIG_KEYFILE_KEYPREFIX_SET)) { /* Setting a key with .set prefix has no meaning, as these keys - * are protected. Just set the value you want to set instead. - * Why did this happen?? */ + * are protected. Just set the value you want to set instead. + * Why did this happen?? */ g_warn_if_reached(); } else if (NM_STR_HAS_PREFIX_WITH_MORE(key, NM_CONFIG_KEYFILE_KEYPREFIX_WAS)) { const char *key_base = &key[NM_STRLEN(NM_CONFIG_KEYFILE_KEYPREFIX_WAS)]; @@ -1842,7 +1842,7 @@ intern_config_write(const char * filename, if (g_key_file_has_key(keyfile_intern, group, key_base, NULL)) { /* There is also a matching key_base entry. Skip processing - * the .was. key ad handle the key_base in the other else branch. */ + * the .was. key ad handle the key_base in the other else branch. */ continue; } @@ -1856,7 +1856,7 @@ intern_config_write(const char * filename, value_was = g_key_file_get_value(keyfile_conf, group, key, NULL); if (nm_streq0(value_set, value_was)) { /* there is no point in storing the identical value as we have via - * user configuration. Skip it. */ + * user configuration. Skip it. */ continue; } if (value_was) { @@ -1933,8 +1933,8 @@ nm_config_get_match_spec(const GKeyFile *keyfile, gs_free char *value = NULL; /* nm_match_spec_split() already supports full escaping and is basically - * a modified version of g_key_file_parse_value_as_string(). So we first read - * the raw value (g_key_file_get_value()), and do the parsing ourselves. */ + * a modified version of g_key_file_parse_value_as_string(). So we first read + * the raw value (g_key_file_get_value()), and do the parsing ourselves. */ value = g_key_file_get_value((GKeyFile *) keyfile, group, key, NULL); if (out_has_key) *out_has_key = !!value; @@ -2120,12 +2120,12 @@ nm_config_set_values(NMConfig *self, if (allow_write && (new_data || force_rewrite)) { /* We write the internal config file based on the user configuration from - * the last load/reload. That is correct, because the intern properties might - * be in accordance to what NM thinks is currently configured. Even if the files - * on disk changed in the meantime. - * But if they changed, on the next reload with might throw away our just - * written data. That is correct, because from NM's point of view, those - * changes on disk happened in any case *after* now. */ + * the last load/reload. That is correct, because the intern properties might + * be in accordance to what NM thinks is currently configured. Even if the files + * on disk changed in the meantime. + * But if they changed, on the next reload with might throw away our just + * written data. That is correct, because from NM's point of view, those + * changes on disk happened in any case *after* now. */ if (*priv->intern_config_file) { keyfile_user = _nm_config_data_get_keyfile_user(priv->config_data); if (!intern_config_write(priv->intern_config_file, @@ -2155,7 +2155,7 @@ static const char * state_get_filename(const NMConfigCmdLineOptions *cli) { /* For an empty filename, we assume the user wants to disable - * state. NMConfig will not try to read it nor write it out. */ + * state. NMConfig will not try to read it nor write it out. */ if (!cli->state_file) return DEFAULT_STATE_FILE; return cli->state_file[0] ? cli->state_file : NULL; @@ -2229,11 +2229,11 @@ nm_config_state_get(NMConfig *self) if (G_UNLIKELY(!priv->state)) { /* read the state from file lazy on first access. The reason is that - * we want to log a failure to read the file via nm-logging. - * - * So we cannot read the state during construction of NMConfig, - * because at that time nm-logging is not yet configured. - */ + * we want to log a failure to read the file via nm-logging. + * + * So we cannot read the state during construction of NMConfig, + * because at that time nm-logging is not yet configured. + */ priv->state = state_new_from_file(state_get_filename(&priv->cli)); } @@ -2275,7 +2275,7 @@ state_write(NMConfig *self) _LOGD("state: error writing state file \"%s\": %s", filename, error->message); g_clear_error(&error); /* we leave the state dirty. That potentially means, that we try to - * write the file over and over again, although it isn't possible. */ + * write the file over and over again, although it isn't possible. */ priv->state->p.dirty = TRUE; } else priv->state->p.dirty = FALSE; @@ -2299,8 +2299,8 @@ _nm_config_state_set(NMConfig *self, gboolean allow_persist, gboolean force_pers va_start(ap, force_persist); /* We expect that the NMConfigRunStatePropertyType is an integer type <= sizeof (int). - * Smaller would be fine, since the variadic arguments get promoted to int. - * Larger would be a problem, also, because we want that "0" is a valid sentinel. */ + * Smaller would be fine, since the variadic arguments get promoted to int. + * Larger would be a problem, also, because we want that "0" is a valid sentinel. */ G_STATIC_ASSERT_EXPR(sizeof(NMConfigRunStatePropertyType) <= sizeof(int)); while ((property_type = va_arg(ap, int)) != NM_CONFIG_STATE_PROPERTY_NONE) { @@ -2412,7 +2412,7 @@ _config_device_state_data_new(int ifindex, GKeyFile *kf) NM_TERNARY_DEFAULT); /* metric zero is not a valid metric. While zero valid for IPv4, for IPv6 it is an alias - * for 1024. Since we handle here IPv4 and IPv6 the same, we cannot allow zero. */ + * for 1024. Since we handle here IPv4 and IPv6 the same, we cannot allow zero. */ route_metric_default_effective = nm_config_keyfile_get_int64( kf, DEVICE_RUN_STATE_KEYFILE_GROUP_DEVICE, @@ -2770,9 +2770,9 @@ nm_config_reload(NMConfig *self, NMConfigChangeFlags reload_flags, gboolean emit warnings = g_ptr_array_new_with_free_func(g_free); /* pass on the original command line options. This means, that - * options specified at command line cannot ever be reloaded from - * file. That seems desirable. - */ + * options specified at command line cannot ever be reloaded from + * file. That seems desirable. + */ keyfile = read_entire_config(&priv->cli, priv->config_dir, priv->system_config_dir, @@ -2917,7 +2917,7 @@ nm_config_setup(const NMConfigCmdLineOptions *cli, char **atomic_section_prefixe nm_singleton_instance_register(); /* usually, you would not see this logging line because when creating the - * NMConfig instance, the logging is not yet set up to print debug message. */ + * NMConfig instance, the logging is not yet set up to print debug message. */ nm_log_dbg(LOGD_CORE, "setup %s singleton (" NM_HASH_OBFUSCATE_PTR_FMT ")", "NMConfig", diff --git a/src/nm-config.h b/src/nm-config.h index aa9a6eaec0..bd38d3d082 100644 --- a/src/nm-config.h +++ b/src/nm-config.h @@ -238,13 +238,13 @@ struct _NMConfigDeviceStateData { guint32 route_metric_default_effective; /* the UUID of the last settings-connection active - * on the device. */ + * on the device. */ const char *connection_uuid; const char *perm_hw_addr_fake; /* whether the device was nm-owned (0/1) or -1 for - * non-software devices. */ + * non-software devices. */ NMTernary nm_owned : 3; }; diff --git a/src/nm-connectivity.c b/src/nm-connectivity.c index 60c5f3c21f..bedcb508ab 100644 --- a/src/nm-connectivity.c +++ b/src/nm-connectivity.c @@ -213,7 +213,7 @@ cb_data_complete(NMConnectivityCheckHandle *cb_data, self = cb_data->self; /* mark the handle as completing. After this point, nm_connectivity_check_cancel() - * is no longer possible. */ + * is no longer possible. */ cb_data->self = NULL; c_list_unlink_stale(&cb_data->handles_lst); @@ -221,12 +221,12 @@ cb_data_complete(NMConnectivityCheckHandle *cb_data, #if WITH_CONCHECK if (cb_data->concheck.curl_ehandle) { /* Contrary to what cURL manual claim it is *not* safe to remove - * the easy handle "at any moment"; specifically it's not safe to - * remove *any* handle from within a libcurl callback. That is - * why we queue completed handles in this case. - * - * cb_data_complete() is however only called *not* from within a - * libcurl callback. So, this is fine. */ + * the easy handle "at any moment"; specifically it's not safe to + * remove *any* handle from within a libcurl callback. That is + * why we queue completed handles in this case. + * + * cb_data_complete() is however only called *not* from within a + * libcurl callback. So, this is fine. */ curl_easy_setopt(cb_data->concheck.curl_ehandle, CURLOPT_WRITEFUNCTION, NULL); curl_easy_setopt(cb_data->concheck.curl_ehandle, CURLOPT_WRITEDATA, NULL); curl_easy_setopt(cb_data->concheck.curl_ehandle, CURLOPT_HEADERFUNCTION, NULL); @@ -252,8 +252,8 @@ cb_data_complete(NMConnectivityCheckHandle *cb_data, cb_data->callback(self, cb_data, state, cb_data->user_data); /* Note: self might be a danling pointer at this point. It must not be used - * after this point, and all callers must either take a reference first, or - * not use the self pointer too. */ + * after this point, and all callers must either take a reference first, or + * not use the self pointer too. */ #if WITH_CONCHECK _con_config_unref(cb_data->concheck.con_config); @@ -368,8 +368,8 @@ _con_curl_check_connectivity(CURLM *mhandle, int sockfd, int ev_bitmask) == CURLE_OK)) { if (response_code == 204) { /* We expected an empty response, and we got a 204 response code (no content). - * We may or may not have received any content (we would ignore it). - * Anyway, the response_code 204 means we are good. */ + * We may or may not have received any content (we would ignore it). + * Anyway, the response_code 204 means we are good. */ cb_data_queue_completed(cb_data, NM_CONNECTIVITY_FULL, "no content, as expected", @@ -388,16 +388,16 @@ _con_curl_check_connectivity(CURLM *mhandle, int sockfd, int ev_bitmask) } /* If we get here, it means that easy_write_cb() didn't read enough - * bytes to be able to do a match, or that we were asking for no content - * (204 response code) and we actually got some. Either way, that is - * an indication of a captive portal */ + * bytes to be able to do a match, or that we were asking for no content + * (204 response code) and we actually got some. Either way, that is + * an indication of a captive portal */ cb_data_queue_completed(cb_data, NM_CONNECTIVITY_PORTAL, "unexpected short response", NULL); } /* if we return a failure, we don't know what went wrong. It's likely serious, because - * a failure here is not expected. Return FALSE, so that we stop polling the file descriptor. - * Worst case, this leaves the pending connectivity check unhandled, until our regular - * time-out kicks in. */ + * a failure here is not expected. Return FALSE, so that we stop polling the file descriptor. + * Worst case, this leaves the pending connectivity check unhandled, until our regular + * time-out kicks in. */ return success; } @@ -428,10 +428,10 @@ typedef struct { GSource *source; /* this is a very simplistic weak-pointer. If ConCurlSockData gets - * destroyed, it will set *destroy_notify to TRUE. - * - * _con_curl_socketevent_cb() uses this to detect whether it can - * safely access @fdp after _con_curl_check_connectivity(). */ + * destroyed, it will set *destroy_notify to TRUE. + * + * _con_curl_socketevent_cb() uses this to detect whether it can + * safely access @fdp after _con_curl_check_connectivity(). */ gboolean *destroy_notify; } ConCurlSockData; @@ -459,7 +459,7 @@ _con_curl_socketevent_cb(int fd, GIOCondition condition, gpointer user_data) if (fdp_destroyed) { /* hups. fdp got invalidated during _con_curl_check_connectivity(). That's fine, - * just don't touch it. */ + * just don't touch it. */ } else { nm_assert(fdp->destroy_notify == &fdp_destroyed); fdp->destroy_notify = NULL; @@ -566,24 +566,24 @@ easy_write_cb(void *buffer, size_t size, size_t nmemb, void *userdata) if (response[0] == '\0') { /* no response expected. We are however graceful and accept any - * extra response that we might receive. We determine the empty - * response based on the status code 204. - * - * Continue receiving... */ + * extra response that we might receive. We determine the empty + * response based on the status code 204. + * + * Continue receiving... */ cb_data->concheck.response_good_cnt += len; if (cb_data->concheck.response_good_cnt > (gsize)(100 * 1024)) { /* we expect an empty response. We accept either - * 1) status code 204 and any response - * 2) status code 200 and an empty response. - * - * Here, we want to continue receiving data, to see whether we have - * case 1). Arguably, the server shouldn't send us 204 with a non-empty - * response, but we accept that also with a non-empty response, so - * keep receiving. - * - * However, if we get an excessive amount of data, we put a stop on it - * and fail. */ + * 1) status code 204 and any response + * 2) status code 200 and an empty response. + * + * Here, we want to continue receiving data, to see whether we have + * case 1). Arguably, the server shouldn't send us 204 with a non-empty + * response, but we accept that also with a non-empty response, so + * keep receiving. + * + * However, if we get an excessive amount of data, we put a stop on it + * and fail. */ cb_data_queue_completed(cb_data, NM_CONNECTIVITY_PORTAL, "unexpected non-empty response", @@ -887,23 +887,23 @@ nm_connectivity_check_start(NMConnectivity * self, } /* note that we pick up support for systemd-resolved right away when we need it. - * We don't need to remember the setting, because we can (cheaply) check anew - * on each request. - * - * Yes, this makes NMConnectivity singleton dependent on NMDnsManager singleton. - * Well, not really: it makes connectivity-check-start dependent on NMDnsManager - * which merely means, not to start a connectivity check, late during shutdown. - * - * NMDnsSystemdResolved tries to D-Bus activate systemd-resolved only once, - * to not spam syslog with failures messages from dbus-daemon. - * Note that unless NMDnsSystemdResolved tried and failed to start systemd-resolved, - * it guesses that systemd-resolved is activatable and returns %TRUE here. That - * means, while NMDnsSystemdResolved would not try to D-Bus activate systemd-resolved - * more than once, NMConnectivity might -- until NMDnsSystemdResolved tried itself - * and noticed that systemd-resolved is not available. - * This is relatively cumbersome to avoid, because we would have to go through - * NMDnsSystemdResolved trying to asynchronously start the service, to ensure there - * is only one attempt to start the service. */ + * We don't need to remember the setting, because we can (cheaply) check anew + * on each request. + * + * Yes, this makes NMConnectivity singleton dependent on NMDnsManager singleton. + * Well, not really: it makes connectivity-check-start dependent on NMDnsManager + * which merely means, not to start a connectivity check, late during shutdown. + * + * NMDnsSystemdResolved tries to D-Bus activate systemd-resolved only once, + * to not spam syslog with failures messages from dbus-daemon. + * Note that unless NMDnsSystemdResolved tried and failed to start systemd-resolved, + * it guesses that systemd-resolved is activatable and returns %TRUE here. That + * means, while NMDnsSystemdResolved would not try to D-Bus activate systemd-resolved + * more than once, NMConnectivity might -- until NMDnsSystemdResolved tried itself + * and noticed that systemd-resolved is not available. + * This is relatively cumbersome to avoid, because we would have to go through + * NMDnsSystemdResolved trying to asynchronously start the service, to ensure there + * is only one attempt to start the service. */ has_systemd_resolved = nm_dns_manager_has_systemd_resolved(nm_dns_manager_get()); if (has_systemd_resolved) { @@ -912,8 +912,8 @@ nm_connectivity_check_start(NMConnectivity * self, dbus_connection = NM_MAIN_DBUS_CONNECTION_GET; if (!dbus_connection) { /* we have no D-Bus connection? That might happen in configure and quit mode. - * - * Anyway, something is very odd, just fail connectivity check. */ + * + * Anyway, something is very odd, just fail connectivity check. */ _LOG2D("start fake request (fail due to no D-Bus connection)"); cb_data->completed_state = NM_CONNECTIVITY_ERROR; cb_data->completed_reason = "no D-Bus connection"; diff --git a/src/nm-core-utils.c b/src/nm-core-utils.c index 123545df0c..3e3b3db213 100644 --- a/src/nm-core-utils.c +++ b/src/nm-core-utils.c @@ -78,7 +78,7 @@ again: } /* Accessing nm_utils_get_testing() causes us to set the flags to initialized. - * Detecting running tests also based on g_test_initialized(). */ + * Detecting running tests also based on g_test_initialized(). */ flags = _NM_UTILS_TEST_INITIALIZED; if (g_test_initialized()) flags |= _NM_UTILS_TEST_GENERAL; @@ -86,7 +86,7 @@ again: g_atomic_int_compare_and_exchange(&_nm_utils_testing, 0, (int) flags); /* regardless of whether we won the race of initializing _nm_utils_testing, - * go back and read the value again. It must be non-zero by now. */ + * go back and read the value again. It must be non-zero by now. */ goto again; } @@ -100,7 +100,7 @@ _nm_utils_set_testing(NMUtilsTestFlags flags) if (!g_atomic_int_compare_and_exchange(&_nm_utils_testing, 0, (int) flags)) { /* We only allow setting _nm_utils_set_testing() once, before fetching the - * value with nm_utils_get_testing(). */ + * value with nm_utils_get_testing(). */ g_return_if_reached(); } } @@ -146,7 +146,7 @@ _nm_singleton_instance_register_destruction(GObject *instance) g_return_if_fail(G_IS_OBJECT(instance)); /* Don't allow registration after shutdown. We only destroy the singletons - * once. */ + * once. */ g_return_if_fail(!_singletons_shutdown); g_object_weak_ref(instance, _nm_singleton_instance_weak_cb, NULL); @@ -267,7 +267,7 @@ nm_utils_array_remove_at_indexes(GArray *array, const guint *indexes_to_delete, mm_len++; else { /* we require indexes_to_delete to contain non-repeated, ascending - * indexes. Otherwise, we would need to presort the indexes. */ + * indexes. Otherwise, we would need to presort the indexes. */ while (TRUE) { guint dd; @@ -866,7 +866,7 @@ nm_utils_kill_child_sync(pid_t pid, sleep_time = MIN(wait_until - now, sleep_duration_usec); if (loop_count < 20) { /* At the beginning we expect the process to die fast. - * Limit the sleep time, the limit doubles with every iteration. */ + * Limit the sleep time, the limit doubles with every iteration. */ sleep_time = MIN(sleep_time, (((guint64) 1) << loop_count) * G_USEC_PER_SEC / 2000); loop_count++; } @@ -1104,8 +1104,8 @@ nm_utils_kill_process_sync(pid_t pid, if (max_wait_until != 0 && now >= max_wait_until) { if (wait_until_sigkill != 0) { /* wait_before_kill_msec is not larger then max_wait_until but we did not yet send - * SIGKILL. Although we already reached our timeout, we don't want to skip sending - * the signal. Even if we don't wait for the process to disappear. */ + * SIGKILL. Although we already reached our timeout, we don't want to skip sending + * the signal. Even if we don't wait for the process to disappear. */ nm_log_dbg(log_domain, LOG_NAME_PROCESS_FMT ": sending SIGKILL", LOG_NAME_ARGS); kill(pid, SIGKILL); } @@ -1180,7 +1180,7 @@ nm_utils_kill_process_sync(pid_t pid, if (loop_count < 20) { /* At the beginning we expect the process to die fast. - * Limit the sleep time, the limit doubles with every iteration. */ + * Limit the sleep time, the limit doubles with every iteration. */ sleep_time = MIN(sleep_time, (((guint64) 1) << loop_count) * G_USEC_PER_SEC / 2000); loop_count++; } @@ -1241,10 +1241,10 @@ nm_utils_read_link_absolute(const char *link_file, GError **error) gs_free char *current_dir = g_get_current_dir(); /* @link_file argument was not an absolute path in the first place. - * That actually may be a bug, because the CWD is not well defined - * in most cases. Anyway, apparently we were able to load the file - * even from a relative path. So, when making the link absolute, we - * also need to prepend the CWD. */ + * That actually may be a bug, because the CWD is not well defined + * in most cases. Anyway, apparently we were able to load the file + * even from a relative path. So, when making the link absolute, we + * also need to prepend the CWD. */ ln_abs = g_build_filename(current_dir, dirname, ln, NULL); } else ln_abs = g_build_filename(dirname, ln, NULL); @@ -1312,8 +1312,8 @@ match_device_s390_subchannels_parse(const char *s390_subchannels, if (!g_ascii_isxdigit(ch) && ch != '.') { if (ch == ',') { /* FIXME: currently we consider the first channel and ignore - * everything after the first ',' separator. Maybe we should - * validate all present channels? */ + * everything after the first ',' separator. Maybe we should + * validate all present channels? */ break; } return FALSE; /* Invalid chars */ @@ -1420,11 +1420,11 @@ _match_result(gboolean has_except, nm_assert(!has_match); if (has_match_except) { /* one of the "except:" matches matched. The result is an explicit - * negative match. */ + * negative match. */ return NM_MATCH_SPEC_NEG_MATCH; } else { /* none of the "except:" matches matched. The result is a positive match, - * despite there being no positive match. */ + * despite there being no positive match. */ return NM_MATCH_SPEC_MATCH; } } @@ -1486,20 +1486,20 @@ match_device_eval(const char *spec_str, gboolean allow_fuzzy, MatchDeviceData *m return FALSE; /* support: - * 1) "${DRIVER}" - * In this case, DRIVER may not contain a '/' character. - * It matches any driver version. - * 2) "${DRIVER}/${DRIVER_VERSION}" - * In this case, DRIVER may contains '/' but DRIVER_VERSION - * may not. A '/' in DRIVER_VERSION may be replaced by '?'. - * - * It follows, that "${DRIVER}/""*" is like 1), but allows - * '/' inside DRIVER. - * - * The fields match to what `nmcli -f GENERAL.DRIVER,GENERAL.DRIVER-VERSION device show` - * gives. However, DRIVER matches literally, while DRIVER_VERSION is a glob - * supporting ? and *. - */ + * 1) "${DRIVER}" + * In this case, DRIVER may not contain a '/' character. + * It matches any driver version. + * 2) "${DRIVER}/${DRIVER_VERSION}" + * In this case, DRIVER may contains '/' but DRIVER_VERSION + * may not. A '/' in DRIVER_VERSION may be replaced by '?'. + * + * It follows, that "${DRIVER}/""*" is like 1), but allows + * '/' inside DRIVER. + * + * The fields match to what `nmcli -f GENERAL.DRIVER,GENERAL.DRIVER-VERSION device show` + * gives. However, DRIVER matches literally, while DRIVER_VERSION is a glob + * supporting ? and *. + */ t = strrchr(spec_str, '/'); @@ -1748,7 +1748,7 @@ nm_match_spec_split(const char *value) return NULL; /* Copied from glibs g_key_file_parse_value_as_string() function - * and adjusted. */ + * and adjusted. */ string_value = g_new(char, strlen(value) + 1); @@ -2103,12 +2103,12 @@ nm_utils_new_infiniband_name(char *name, const char *parent_name, int p_key) g_return_val_if_fail(strlen(parent_name) < IFNAMSIZ, NULL); /* technically, p_key of 0x0000 and 0x8000 is not allowed either. But we don't - * want to assert against that in nm_utils_new_infiniband_name(). So be more - * resilient here, and accept those. */ + * want to assert against that in nm_utils_new_infiniband_name(). So be more + * resilient here, and accept those. */ g_return_val_if_fail(p_key >= 0 && p_key <= 0xffff, NULL); /* If parent+suffix is too long, kernel would just truncate - * the name. We do the same. See ipoib_vlan_add(). */ + * the name. We do the same. See ipoib_vlan_add(). */ g_snprintf(name, IFNAMSIZ, "%s.%04x", parent_name, p_key); return name; } @@ -2240,7 +2240,7 @@ _log_connection_sort_names_fcn(gconstpointer a, gconstpointer b) const LogConnectionSettingItem *v2 = b; /* we want to first show the items, that disappeared, then the one that changed and - * then the ones that were added. */ + * then the ones that were added. */ if ((v1->diff_result & NM_SETTING_DIFF_RESULT_IN_A) != (v2->diff_result & NM_SETTING_DIFF_RESULT_IN_A)) @@ -2383,7 +2383,7 @@ nm_utils_log_connection_diff(NMConnection *connection, } /* FIXME: it doesn't nicely show the content of NMSettingVpn, because nm_connection_diff() does not - * expand the hash values. */ + * expand the hash values. */ sorted_hashes = _log_connection_sort_hashes(connection, diff_base, connection_diff); if (sorted_hashes->len <= 0) @@ -2679,11 +2679,11 @@ typedef struct { _nul_sentinel; /* just for safety, if somebody accidentally uses the binary in a string context. */ /* depending on whether the string is packed or not (with/without hyphens), - * it's 32 or 36 characters long (plus the trailing NUL). - * - * The difference is that boot-id is a valid RFC 4211 UUID and represented - * as a 36 ascii string (with hyphens). The machine-id technically is not - * a UUID, but just a 32 byte sequence of hexchars. */ + * it's 32 or 36 characters long (plus the trailing NUL). + * + * The difference is that boot-id is a valid RFC 4211 UUID and represented + * as a 36 ascii string (with hyphens). The machine-id technically is not + * a UUID, but just a 32 byte sequence of hexchars. */ char str[37]; bool is_fake; } UuidData; @@ -2726,9 +2726,9 @@ again: NMUuid uuid; /* Get the machine ID from /etc/machine-id; it's always in /etc no matter - * where our configured SYSCONFDIR is. Alternatively, it might be in - * LOCALSTATEDIR /lib/dbus/machine-id. - */ + * where our configured SYSCONFDIR is. Alternatively, it might be in + * LOCALSTATEDIR /lib/dbus/machine-id. + */ if (nm_utils_file_get_contents(-1, "/etc/machine-id", 100 * 1024, @@ -2769,29 +2769,29 @@ again: if (!allow_fake) { /* we don't allow generating (and memorizing) a fake key. - * Signal that no valid machine-id exists. */ + * Signal that no valid machine-id exists. */ return NULL; } if (nm_utils_host_id_get(&seed_bin, &seed_len)) { /* We have no valid machine-id but we have a valid secrey_key. - * Generate a fake machine ID by hashing the secret-key. The secret_key - * is commonly persisted, so it should be stable across reboots (despite - * having a broken system without proper machine-id). - * - * Note that we access the host-id here, which is based on secret_key. - * Also not that the secret_key may be generated based on the machine-id, - * so we have to be careful that they don't depend on each other (and - * no infinite recursion happens. This is done correctly, because the secret-key - * will call _machine_id_get(FALSE), so it won't allow accessing a fake - * machine-id, thus avoiding the problem. */ + * Generate a fake machine ID by hashing the secret-key. The secret_key + * is commonly persisted, so it should be stable across reboots (despite + * having a broken system without proper machine-id). + * + * Note that we access the host-id here, which is based on secret_key. + * Also not that the secret_key may be generated based on the machine-id, + * so we have to be careful that they don't depend on each other (and + * no infinite recursion happens. This is done correctly, because the secret-key + * will call _machine_id_get(FALSE), so it won't allow accessing a fake + * machine-id, thus avoiding the problem. */ fake_type = "secret-key"; hash_seed = "ab085f06-b629-46d1-a553-84eeba5683b6"; } else { /* the secret-key is not valid/persistent either. That happens when we fail - * to read/write the secret-key to disk. Fallback to boot-id. The boot-id - * itself may be fake and randomly generated ad-hoc, but that is as best - * as it gets. */ + * to read/write the secret-key to disk. Fallback to boot-id. The boot-id + * itself may be fake and randomly generated ad-hoc, but that is as best + * as it gets. */ seed_bin = (const guint8 *) nm_utils_boot_id_bin(); seed_len = sizeof(NMUuid); fake_type = "boot-id"; @@ -2799,7 +2799,7 @@ again: } /* the fake machine-id is based on secret-key/boot-id, but we hash it - * again, so that they are not literally the same. */ + * again, so that they are not literally the same. */ nm_utils_uuid_generate_from_string_bin(&uuid, (const char *) seed_bin, seed_len, @@ -2862,25 +2862,25 @@ _host_id_read_timestamp(gboolean use_secret_key_file, if (use_secret_key_file && stat(SECRET_KEY_FILE, &st) == 0) { /* don't check for overflow or timestamps in the future. We get whatever - * (bogus) date is on the file. */ + * (bogus) date is on the file. */ *out_timestamp_ns = nm_utils_timespec_to_nsec(&st.st_mtim); return TRUE; } /* generate a fake timestamp based on the host-id. - * - * This really should never happen under normal circumstances. We already - * are in a code path, where the system has a problem (unable to get good randomness - * and/or can't access the secret_key). In such a scenario, a fake timestamp is the - * least of our problems. - * - * At least, generate something sensible so we don't have to worry about the - * timestamp. It is wrong to worry about using a fake timestamp (which is tied to - * the secret_key) if we are unable to access the secret_key file in the first place. - * - * Pick a random timestamp from the past two years. Yes, this timestamp - * is not stable across restarts, but apparently neither is the host-id - * nor the secret_key itself. */ + * + * This really should never happen under normal circumstances. We already + * are in a code path, where the system has a problem (unable to get good randomness + * and/or can't access the secret_key). In such a scenario, a fake timestamp is the + * least of our problems. + * + * At least, generate something sensible so we don't have to worry about the + * timestamp. It is wrong to worry about using a fake timestamp (which is tied to + * the secret_key) if we are unable to access the secret_key file in the first place. + * + * Pick a random timestamp from the past two years. Yes, this timestamp + * is not stable across restarts, but apparently neither is the host-id + * nor the secret_key itself. */ #define EPOCH_TWO_YEARS (G_GINT64_CONSTANT(2 * 365 * 24 * 3600) * NM_UTILS_NSEC_PER_SEC) @@ -2952,18 +2952,18 @@ _host_id_read(guint8 **out_host_id, gsize *out_host_id_len) && memcmp(file_content.bin, SECRET_KEY_V2_PREFIX, NM_STRLEN(SECRET_KEY_V2_PREFIX)) == 0) { /* for this type of secret key, we require a prefix followed at least SECRET_KEY_LEN (32) bytes. We - * (also) do that, because older versions of NetworkManager wrote exactly 32 bytes without - * prefix, so we won't wrongly interpret such legacy keys as v2 (if they accidentally have - * a SECRET_KEY_V2_PREFIX prefix, they'll still have the wrong size). - * - * Note that below we generate the random seed in base64 encoding. But that is only done - * to write an ASCII file. There is no base64 decoding and the ASCII is hashed as-is. - * We would accept any binary data just as well (provided a suitable prefix and at least - * 32 bytes). - * - * Note that when hashing the v2 content, we also hash the prefix. There is no strong reason, - * except that it seems simpler not to distinguish between the v2 prefix and the content. - * It's all just part of the seed. */ + * (also) do that, because older versions of NetworkManager wrote exactly 32 bytes without + * prefix, so we won't wrongly interpret such legacy keys as v2 (if they accidentally have + * a SECRET_KEY_V2_PREFIX prefix, they'll still have the wrong size). + * + * Note that below we generate the random seed in base64 encoding. But that is only done + * to write an ASCII file. There is no base64 decoding and the ASCII is hashed as-is. + * We would accept any binary data just as well (provided a suitable prefix and at least + * 32 bytes). + * + * Note that when hashing the v2 content, we also hash the prefix. There is no strong reason, + * except that it seems simpler not to distinguish between the v2 prefix and the content. + * It's all just part of the seed. */ secret_arr = _host_id_hash_v2(file_content.bin, file_content.len, sha256_digest); secret_len = NM_UTILS_CHECKSUM_LENGTH_SHA256; @@ -2984,7 +2984,7 @@ _host_id_read(guint8 **out_host_id, gsize *out_host_id_len) goto out; } else { /* the secret key is borked. Log a warning, but proceed below to generate - * a new one. */ + * a new one. */ nm_log_warn(LOGD_CORE, "secret-key: too short secret key in \"%s\" (generate new key)", SECRET_KEY_FILE); @@ -3002,10 +3002,10 @@ _host_id_read(guint8 **out_host_id, gsize *out_host_id_len) success = nm_utils_random_bytes(rnd_buf, sizeof(rnd_buf)); /* Our key is really binary data. But since we anyway generate a random seed - * (with 32 random bytes), don't write it in binary, but instead create - * an pure ASCII (base64) representation. Note that the ASCII will still be taken - * as-is (no base64 decoding is done). The sole purpose is to write a ASCII file - * instead of a binary. The content is gibberish either way. */ + * (with 32 random bytes), don't write it in binary, but instead create + * an pure ASCII (base64) representation. Note that the ASCII will still be taken + * as-is (no base64 decoding is done). The sole purpose is to write a ASCII file + * instead of a binary. The content is gibberish either way. */ memcpy(new_content, SECRET_KEY_V2_PREFIX, NM_STRLEN(SECRET_KEY_V2_PREFIX)); len = NM_STRLEN(SECRET_KEY_V2_PREFIX); len += g_base64_encode_step(rnd_buf, @@ -3252,8 +3252,8 @@ nm_utils_arp_type_detect_from_hwaddrlen(gsize hwaddr_len) return ARPHRD_INFINIBAND; default: /* Note: if you ever support anything but ethernet and infiniband, - * make sure to look at all callers. They assert that it's one of - * these two. */ + * make sure to look at all callers. They assert that it's one of + * these two. */ return -EINVAL; } } @@ -3361,9 +3361,9 @@ nm_utils_get_ipv6_interface_identifier(NMLinkType link_type, switch (link_type) { case NM_LINK_TYPE_INFINIBAND: /* Use the port GUID per http://tools.ietf.org/html/rfc4391#section-8, - * making sure to set the 'u' bit to 1. The GUID is the lower 64 bits - * of the IPoIB interface's hardware address. - */ + * making sure to set the 'u' bit to 1. The GUID is the lower 64 bits + * of the IPoIB interface's hardware address. + */ g_return_val_if_fail(hwaddr_len == INFINIBAND_ALEN, FALSE); memcpy(out_iid->id_u8, hwaddr + INFINIBAND_ALEN - 8, 8); out_iid->id_u8[0] |= 0x02; @@ -3386,9 +3386,9 @@ nm_utils_get_ipv6_interface_identifier(NMLinkType link_type, default: if (hwaddr_len == ETH_ALEN) { /* Translate 48-bit MAC address to a 64-bit Modified EUI-64. See - * http://tools.ietf.org/html/rfc4291#appendix-A and the Linux - * kernel's net/ipv6/addrconf.c::ipv6_generate_eui64() function. - */ + * http://tools.ietf.org/html/rfc4291#appendix-A and the Linux + * kernel's net/ipv6/addrconf.c::ipv6_generate_eui64() function. + */ out_iid->id_u8[0] = hwaddr[0]; out_iid->id_u8[1] = hwaddr[1]; out_iid->id_u8[2] = hwaddr[2]; @@ -3512,9 +3512,9 @@ nm_utils_stable_id_generated_complete(const char *stable_id_generated) char * base64; /* for NM_UTILS_STABLE_TYPE_GENERATED we generate a possibly long string - * by doing text-substitutions in nm_utils_stable_id_parse(). - * - * Let's shorten the (possibly) long stable_id to something more compact. */ + * by doing text-substitutions in nm_utils_stable_id_parse(). + * + * Let's shorten the (possibly) long stable_id to something more compact. */ g_return_val_if_fail(stable_id_generated, NULL); @@ -3523,8 +3523,8 @@ nm_utils_stable_id_generated_complete(const char *stable_id_generated) nm_utils_checksum_get_digest(sum, buf); /* we don't care to use the sha1 sum in common hex representation. - * Use instead base64, it's 27 chars (stripping the padding) vs. - * 40. */ + * Use instead base64, it's 27 chars (stripping the padding) vs. + * 40. */ base64 = g_base64_encode((guchar *) buf, sizeof(buf)); nm_assert(strlen(base64) == 28); @@ -3561,41 +3561,41 @@ nm_utils_stable_id_parse(const char *stable_id, } /* the stable-id allows for some dynamic by performing text-substitutions - * of ${...} patterns. - * - * At first, it looks a bit like bash parameter substitution. - * In contrast however, the process is unambiguous so that the resulting - * effective id differs if: - * - the original, untranslated stable-id differs - * - or any of the subsitutions differs. - * - * The reason for that is, for example if you specify "${CONNECTION}" in the - * stable-id, then the resulting ID should be always(!) unique for this connection. - * There should be no way another connection could specify any stable-id that results - * in the same addresses to be generated (aside hash collisions). - * - * - * For example: say you have a connection with UUID - * "123e4567-e89b-12d3-a456-426655440000" which happens also to be - * the current boot-id. - * Then: - * (1) connection.stable-id = <NULL> - * (2) connection.stable-id = "123e4567-e89b-12d3-a456-426655440000" - * (3) connection.stable-id = "${CONNECTION}" - * (3) connection.stable-id = "${BOOT}" - * will all generate different addresses, although in one way or the - * other, they all mangle the uuid "123e4567-e89b-12d3-a456-426655440000". - * - * For example, with stable-id="${FOO}${BAR}" the substitutions - * - FOO="ab", BAR="c" - * - FOO="a", BAR="bc" - * should give a different effective id. - * - * For example, with FOO="x" and BAR="x", the stable-ids - * - "${FOO}${BAR}" - * - "${BAR}${FOO}" - * should give a different effective id. - */ + * of ${...} patterns. + * + * At first, it looks a bit like bash parameter substitution. + * In contrast however, the process is unambiguous so that the resulting + * effective id differs if: + * - the original, untranslated stable-id differs + * - or any of the subsitutions differs. + * + * The reason for that is, for example if you specify "${CONNECTION}" in the + * stable-id, then the resulting ID should be always(!) unique for this connection. + * There should be no way another connection could specify any stable-id that results + * in the same addresses to be generated (aside hash collisions). + * + * + * For example: say you have a connection with UUID + * "123e4567-e89b-12d3-a456-426655440000" which happens also to be + * the current boot-id. + * Then: + * (1) connection.stable-id = <NULL> + * (2) connection.stable-id = "123e4567-e89b-12d3-a456-426655440000" + * (3) connection.stable-id = "${CONNECTION}" + * (3) connection.stable-id = "${BOOT}" + * will all generate different addresses, although in one way or the + * other, they all mangle the uuid "123e4567-e89b-12d3-a456-426655440000". + * + * For example, with stable-id="${FOO}${BAR}" the substitutions + * - FOO="ab", BAR="c" + * - FOO="a", BAR="bc" + * should give a different effective id. + * + * For example, with FOO="x" and BAR="x", the stable-ids + * - "${FOO}${BAR}" + * - "${BAR}${FOO}" + * should give a different effective id. + */ idx_start = 0; for (i = 0; stable_id[i];) { @@ -3628,30 +3628,30 @@ nm_utils_stable_id_parse(const char *stable_id, _stable_id_append(str, hwaddr); else if (g_str_has_prefix(&stable_id[i], "${RANDOM}")) { /* RANDOM makes not so much sense for cloned-mac-address - * as the result is similar to specifying "cloned-mac-address=random". - * It makes however sense for RFC 7217 Stable Privacy IPv6 addresses - * where this is effectively the only way to generate a different - * (random) host identifier for each connect. - * - * With RANDOM, the user can switch the lifetime of the - * generated cloned-mac-address and IPv6 host identifier - * by toggling only the stable-id property of the connection. - * With RANDOM being the most short-lived, ~non-stable~ variant. - */ + * as the result is similar to specifying "cloned-mac-address=random". + * It makes however sense for RFC 7217 Stable Privacy IPv6 addresses + * where this is effectively the only way to generate a different + * (random) host identifier for each connect. + * + * With RANDOM, the user can switch the lifetime of the + * generated cloned-mac-address and IPv6 host identifier + * by toggling only the stable-id property of the connection. + * With RANDOM being the most short-lived, ~non-stable~ variant. + */ if (str) g_string_free(str, TRUE); *out_generated = NULL; return NM_UTILS_STABLE_TYPE_RANDOM; } else { /* The text following the '$' is not recognized as valid - * substitution pattern. Treat it verbatim. */ + * substitution pattern. Treat it verbatim. */ i++; /* Note that using unrecognized substitution patterns might - * yield different results with future versions. Avoid that, - * by not using '$' (except for actual substitutions) or escape - * it as "$$" (which is guaranteed to be treated verbatim - * in future). */ + * yield different results with future versions. Avoid that, + * by not using '$' (except for actual substitutions) or escape + * it as "$$" (which is guaranteed to be treated verbatim + * in future). */ if (stable_id[i] == '$') i++; } @@ -3682,8 +3682,8 @@ _is_reserved_ipv6_iid(const guint8 *iid) return TRUE; /* 0200:5EFF:FE00:0000 - 0200:5EFF:FE00:5212 (Reserved IPv6 Interface Identifiers corresponding to the IANA Ethernet Block [RFC4291]) - * 0200:5EFF:FE00:5213 (Proxy Mobile IPv6 [RFC6543]) - * 0200:5EFF:FE00:5214 - 0200:5EFF:FEFF:FFFF (Reserved IPv6 Interface Identifiers corresponding to the IANA Ethernet Block [RFC4291]) */ + * 0200:5EFF:FE00:5213 (Proxy Mobile IPv6 [RFC6543]) + * 0200:5EFF:FE00:5214 - 0200:5EFF:FEFF:FFFF (Reserved IPv6 Interface Identifiers corresponding to the IANA Ethernet Block [RFC4291]) */ if (memcmp(iid, (const guint8[]){0x02, 0x00, 0x5E, 0xFF, 0xFE}, 5) == 0) return TRUE; @@ -3724,14 +3724,14 @@ _set_stable_privacy(NMUtilsStableType stable_type, stable_type_uint8 = (guint8) stable_type; /* Preferably, we would always like to include the stable-type, - * but for backward compatibility reasons, we cannot for UUID. - * - * That is no real problem and it is still impossible to - * force a collision here, because of how the remaining - * fields are hashed. That is, as we also hash @host_id_len - * and the terminating '\0' of @network_id, it is unambiguously - * possible to revert the process and deduce the @stable_type. - */ + * but for backward compatibility reasons, we cannot for UUID. + * + * That is no real problem and it is still impossible to + * force a collision here, because of how the remaining + * fields are hashed. That is, as we also hash @host_id_len + * and the terminating '\0' of @network_id, it is unambiguously + * possible to revert the process and deduce the @stable_type. + */ g_checksum_update(sum, &stable_type_uint8, sizeof(stable_type_uint8)); } @@ -3832,11 +3832,11 @@ _hw_addr_eth_complete(struct ether_addr *addr, guint i; /* the second LSB of the first octet means - * "globally unique, OUI enforced, BIA (burned-in-address)" - * vs. "locally-administered". By default, set it to - * generate locally-administered addresses. - * - * Maybe be overwritten by a mask below. */ + * "globally unique, OUI enforced, BIA (burned-in-address)" + * vs. "locally-administered". By default, set it to + * generate locally-administered addresses. + * + * Maybe be overwritten by a mask below. */ addr->ether_addr_octet[0] |= 2; if (!generate_mac_address_mask || !*generate_mac_address_mask) @@ -3851,7 +3851,7 @@ _hw_addr_eth_complete(struct ether_addr *addr, nm_assert((ouis == NULL) ^ (ouis_len != 0)); if (ouis) { /* g_random_int() is good enough here. It uses a static GRand instance - * that is seeded from /dev/urandom. */ + * that is seeded from /dev/urandom. */ oui = ouis[g_random_int() % ouis_len]; g_free(ouis); } else { @@ -3869,7 +3869,7 @@ _hw_addr_eth_complete(struct ether_addr *addr, out: /* The LSB of the first octet must always be cleared, - * it means Unicast vs. Multicast */ + * it means Unicast vs. Multicast */ addr->ether_addr_octet[0] &= ~1; } @@ -4025,14 +4025,14 @@ nm_utils_create_dhcp_iaid(gboolean legacy_unstable_byteorder, u32 = (u64 & 0xffffffffu) ^ (u64 >> 32); if (legacy_unstable_byteorder) { /* legacy systemd code dhcp_identifier_set_iaid() generates the iaid - * dependent on the host endianness. Since this function returns the IAID - * in native-byte order, we need to account for that. - * - * On little endian systems, we want the legacy-behavior is identical to - * the endianness-agnostic behavior. So, we need to swap the bytes on - * big-endian systems. - * - * (https://github.com/systemd/systemd/pull/10614). */ + * dependent on the host endianness. Since this function returns the IAID + * in native-byte order, we need to account for that. + * + * On little endian systems, we want the legacy-behavior is identical to + * the endianness-agnostic behavior. So, we need to swap the bytes on + * big-endian systems. + * + * (https://github.com/systemd/systemd/pull/10614). */ return htole32(u32); } else { /* we return the value as-is, in native byte order. */ @@ -4153,11 +4153,11 @@ nm_utils_generate_duid_uuid(const NMUuid *uuid) nm_assert(uuid); /* Generate a DHCP Unique Identifier for DHCPv6 using the - * DUID-UUID method (see RFC 6355 section 4). Format is: - * - * u16: type (DUID-UUID = 4) - * u8[16]: UUID bytes - */ + * DUID-UUID method (see RFC 6355 section 4). Format is: + * + * u16: type (DUID-UUID = 4) + * u8[16]: UUID bytes + */ G_STATIC_ASSERT_EXPR(sizeof(duid_type) == 2); G_STATIC_ASSERT_EXPR(sizeof(*uuid) == 16); duid_buffer = g_malloc(18); @@ -4185,9 +4185,9 @@ again: machine_id = nm_utils_machine_id_bin(); /* Hash the machine ID so it's not leaked to the network. - * - * Optimally, we would choose an use case specific seed, but for historic - * reasons we didn't. */ + * + * Optimally, we would choose an use case specific seed, but for historic + * reasons we didn't. */ sum = g_checksum_new(G_CHECKSUM_SHA256); g_checksum_update(sum, (const guchar *) machine_id, sizeof(*machine_id)); nm_utils_checksum_get_digest(sum, digest.sha256); @@ -4289,12 +4289,12 @@ nm_utils_lifetime_rebase_relative_time_on_now(guint32 timestamp, guint32 duratio if (timestamp == 0) { /* if the @timestamp is zero, assume it was just left unset and that the relative - * @duration starts counting from @now. This is convenient to construct an address - * and print it in nm_platform_ip4_address_to_string(). - * - * In general it does not make sense to set the @duration without anchoring at - * @timestamp because you don't know the absolute expiration time when looking - * at the address at a later moment. */ + * @duration starts counting from @now. This is convenient to construct an address + * and print it in nm_platform_ip4_address_to_string(). + * + * In general it does not make sense to set the @duration without anchoring at + * @timestamp because you don't know the absolute expiration time when looking + * at the address at a later moment. */ timestamp = now; } @@ -4321,10 +4321,10 @@ nm_utils_lifetime_get(guint32 timestamp, if (timestamp == 0 && lifetime == 0) { /* We treat lifetime==0 && timestamp==0 addresses as permanent addresses to allow easy - * creation of such addresses (without requiring to set the lifetime fields to - * NM_PLATFORM_LIFETIME_PERMANENT). The real lifetime==0 addresses (E.g. DHCP6 telling us - * to drop an address will have timestamp set. - */ + * creation of such addresses (without requiring to set the lifetime fields to + * NM_PLATFORM_LIFETIME_PERMANENT). The real lifetime==0 addresses (E.g. DHCP6 telling us + * to drop an address will have timestamp set. + */ NM_SET_OUT(out_preferred, NM_PLATFORM_LIFETIME_PERMANENT); g_return_val_if_fail(preferred == 0, NM_PLATFORM_LIFETIME_PERMANENT); return NM_PLATFORM_LIFETIME_PERMANENT; @@ -4344,9 +4344,9 @@ nm_utils_lifetime_get(guint32 timestamp, NM_SET_OUT(out_preferred, MIN(t_preferred, t_lifetime)); /* Assert that non-permanent addresses have a (positive) @timestamp. nm_utils_lifetime_rebase_relative_time_on_now() - * treats addresses with timestamp 0 as *now*. Addresses passed to _address_get_lifetime() always - * should have a valid @timestamp, otherwise on every re-sync, their lifetime will be extended anew. - */ + * treats addresses with timestamp 0 as *now*. Addresses passed to _address_get_lifetime() always + * should have a valid @timestamp, otherwise on every re-sync, their lifetime will be extended anew. + */ g_return_val_if_fail(timestamp != 0 || (lifetime == NM_PLATFORM_LIFETIME_PERMANENT && preferred == NM_PLATFORM_LIFETIME_PERMANENT), @@ -4948,8 +4948,8 @@ get_max_rate_ht(const guint8 *bytes, guint len, guint32 *out_maxrate) guint32 rate; /* http://standards.ieee.org/getieee802/download/802.11-2012.pdf - * https://mrncciew.com/2014/10/19/cwap-ht-capabilities-ie/ - */ + * https://mrncciew.com/2014/10/19/cwap-ht-capabilities-ie/ + */ if (len != 26) return FALSE; @@ -4985,7 +4985,7 @@ get_max_rate_vht(const guint8 *bytes, guint len, guint32 *out_maxrate) guint8 vht_cap, tx_map; /* https://tda802dot11.blogspot.it/2014/10/vht-capabilities-element-vht.html - * http://chimera.labs.oreilly.com/books/1234000001739/ch03.html#management_frames */ + * http://chimera.labs.oreilly.com/books/1234000001739/ch03.html#management_frames */ if (len != 12) return FALSE; @@ -5002,7 +5002,7 @@ get_max_rate_vht(const guint8 *bytes, guint len, guint32 *out_maxrate) mcs = 7; /* Check for 160Mhz wide channel support and - * spatial stream support */ + * spatial stream support */ if (vht_cap & (1 << 2)) { if (tx_map & 0x30) m = get_max_rate_vht_160_ss3(mcs); diff --git a/src/nm-core-utils.h b/src/nm-core-utils.h index f12b2cacab..ca1c483b89 100644 --- a/src/nm-core-utils.h +++ b/src/nm-core-utils.h @@ -67,15 +67,15 @@ void _nm_singleton_instance_register_destruction(GObject *instance); _nm_unused static void _nmtst_##GETTER##_reset(TYPE *instance) \ { \ /* usually, the singleton can only be created once (and further instantiations - * are guarded by an assert). For testing, we need to reset the singleton to - * allow multiple instantiations. */ \ + * are guarded by an assert). For testing, we need to reset the singleton to + * allow multiple instantiations. */ \ g_assert(G_IS_OBJECT(instance)); \ g_assert(instance == singleton_instance); \ g_assert(_already_created_##GETTER); \ g_object_unref(instance); \ \ /* require that the last unref also destroyed the singleton. If this fails, - * somebody still keeps a reference. Fix your test! */ \ + * somebody still keeps a reference. Fix your test! */ \ g_assert(!singleton_instance); \ _already_created_##GETTER = FALSE; \ } @@ -388,11 +388,11 @@ gboolean nm_utils_get_ipv6_interface_identifier(NMLinkType link_type, typedef enum { /* The stable type. Note that this value is encoded in the - * generated addresses, thus the numbers MUST not change. - * - * Also note, if we ever allocate ID 255, we must take care - * that nm_utils_ipv6_addr_set_stable_privacy() extends the - * uint8 encoding of this value. */ + * generated addresses, thus the numbers MUST not change. + * + * Also note, if we ever allocate ID 255, we must take care + * that nm_utils_ipv6_addr_set_stable_privacy() extends the + * uint8 encoding of this value. */ NM_UTILS_STABLE_TYPE_UUID = 0, NM_UTILS_STABLE_TYPE_STABLE_ID = 1, NM_UTILS_STABLE_TYPE_GENERATED = 2, diff --git a/src/nm-dbus-manager.c b/src/nm-dbus-manager.c index f54090723b..5fa565346f 100644 --- a/src/nm-dbus-manager.c +++ b/src/nm-dbus-manager.c @@ -153,13 +153,13 @@ typedef struct { GDBusServer *server; /* With peer bus connections, we'll get a new connection for each - * client. For each connection we create an ObjectManager for - * that connection to handle exporting our objects. - * - * Note that even for connections that don't export any objects - * we'll still create GDBusObjectManager since that's where we store - * the pointer to the GDBusConnection. - */ + * client. For each connection we create an ObjectManager for + * that connection to handle exporting our objects. + * + * Note that even for connections that don't export any objects + * we'll still create GDBusObjectManager since that's where we store + * the pointer to the GDBusConnection. + */ CList object_mgr_lst_head; NMDBusManager *manager; @@ -214,9 +214,9 @@ close_connection_in_idle(gpointer user_data) info->connection); /* FIXME: there's a bug (754730) in GLib for which the connection - * is marked as closed when the remote peer vanishes but its - * resources are not cleaned up. Work around it by explicitly - * closing the connection in that case. */ + * is marked as closed when the remote peer vanishes but its + * resources are not cleaned up. Work around it by explicitly + * closing the connection in that case. */ if (info->remote_peer_vanished) g_dbus_connection_close(info->connection, NULL, NULL, NULL); @@ -261,7 +261,7 @@ private_server_closed_connection(GDBusConnection *conn, g_object_ref(s->manager); /* Delay the close of connection to ensure that D-Bus signals - * are handled */ + * are handled */ g_idle_add(close_connection_in_idle, info); } @@ -292,10 +292,10 @@ private_server_new_connection(GDBusServer *server, GDBusConnection *conn, gpoint NM_HASH_OBFUSCATE_PTR(conn)); /* Emit this for the manager. - * - * It is essential to do this from the "new-connection" signal handler, as - * at that point no messages from the connection are yet processed - * (which avoids races with registering objects). */ + * + * It is essential to do this from the "new-connection" signal handler, as + * at that point no messages from the connection are yet processed + * (which avoids races with registering objects). */ g_signal_emit(s->manager, signals[PRIVATE_CONNECTION_NEW], s->detail, conn, manager); return TRUE; } @@ -527,12 +527,12 @@ _get_caller_info_ensure(NMDBusManager *self, #define CALLER_INFO_MAX_AGE (NM_UTILS_NSEC_PER_SEC * 1) /* Linear search the cache for the sender. - * - * The number of cached caller-infos is limited. Hence, it's O(1) and - * the list is reasonably short. - * Also, the entire caching assumes that we repeatedly ask for the - * same sender. That means, we expect to find the right caller info - * at the front of the list. */ + * + * The number of cached caller-infos is limited. Hence, it's O(1) and + * the list is reasonably short. + * Also, the entire caching assumes that we repeatedly ask for the + * same sender. That means, we expect to find the right caller info + * at the front of the list. */ num = 1; caller_info = NULL; c_list_for_each_entry (ci, &priv->caller_info_lst_head, caller_info_lst) { @@ -911,7 +911,7 @@ static const GDBusInterfaceVTable dbus_vtable = { .get_property = dbus_vtable_get_property, /* set_property is handled via method_call as well. We need to authenticate - * which requires an asynchronous handler. */ + * which requires an asynchronous handler. */ .set_property = NULL, }; @@ -947,11 +947,11 @@ _obj_register(NMDBusManager *self, NMDBusObject *obj) if (prev_interface_infos == klass->interface_infos) { /* derived classes inherrit the interface-infos from the parent class. - * For convenience, we allow the subclass to leave interface-infos untouched, - * but it means we must ignore the parent's interface, because we already - * handled it. - * - * Note that the loop goes from the parent classes to child classes */ + * For convenience, we allow the subclass to leave interface-infos untouched, + * but it means we must ignore the parent's interface, because we already + * handled it. + * + * Note that the loop goes from the parent classes to child classes */ continue; } prev_interface_infos = klass->interface_infos; @@ -993,18 +993,18 @@ _obj_register(NMDBusManager *self, NMDBusObject *obj) nm_assert(!c_list_is_empty(&obj->internal.registration_lst_head)); /* Currently, the interfaces of an object do not changed and strictly depend on the object glib type. - * We don't need more flexibility, and it simplifies the code. Hence, now emit interface-added - * signal for the new object. - * - * Warning: note that if @obj's notify signal is currently blocked via g_object_freeze_notify(), - * we might emit properties with an inconsistent (internal) state. There is no easy solution, - * because we have to emit the signal now, and we don't know what the correct desired state - * of the properties is. - * Another problem is, upon unfreezing the signals, we immediately send PropertiesChanged - * notifications out. Which is a bit odd, as we just export the object. - * - * In general, it's ok to export an object with frozen signals. But you better make sure - * that all properties are in a self-consistent state when exporting the object. */ + * We don't need more flexibility, and it simplifies the code. Hence, now emit interface-added + * signal for the new object. + * + * Warning: note that if @obj's notify signal is currently blocked via g_object_freeze_notify(), + * we might emit properties with an inconsistent (internal) state. There is no easy solution, + * because we have to emit the signal now, and we don't know what the correct desired state + * of the properties is. + * Another problem is, upon unfreezing the signals, we immediately send PropertiesChanged + * notifications out. Which is a bit odd, as we just export the object. + * + * In general, it's ok to export an object with frozen signals. But you better make sure + * that all properties are in a self-consistent state when exporting the object. */ g_dbus_connection_emit_signal(priv->main_dbus_connection, NULL, OBJECT_MANAGER_SERVER_BASE_PATH, @@ -1167,12 +1167,12 @@ _nm_dbus_manager_obj_notify(NMDBusObject *obj, guint n_pspecs, const GParamSpec } /* do a naive search for the matching NMDBusPropertyInfoExtended infos. Since the number of - * (interfaces x properties) is static and possibly small, this naive search is effectively - * O(1). We might wanna introduce some index to lookup the properties in question faster. - * - * The nice part of this implementation is however, that the order in which properties - * are added to the GVariant is strictly defined to be the order in which the D-Bus property-info - * is declared. Getting a defined ordering with some smart lookup would be hard. */ + * (interfaces x properties) is static and possibly small, this naive search is effectively + * O(1). We might wanna introduce some index to lookup the properties in question faster. + * + * The nice part of this implementation is however, that the order in which properties + * are added to the GVariant is strictly defined to be the order in which the D-Bus property-info + * is declared. Getting a defined ordering with some smart lookup would be hard. */ c_list_for_each_entry (reg_data, &obj->internal.registration_lst_head, registration_lst) { const NMDBusInterfaceInfoExtended *interface_info = _reg_data_get_interface_info(reg_data); gboolean has_properties = FALSE; @@ -1223,7 +1223,7 @@ _nm_dbus_manager_obj_notify(NMDBusObject *obj, guint n_pspecs, const GParamSpec if (G_UNLIKELY(interface_info == &nm_interface_info_device_statistics)) { /* we treat the Device.Statistics signal special, because we need to - * emit a signal also for it (below). */ + * emit a signal also for it (below). */ nm_assert(!device_statistics_args); device_statistics_args = g_variant_ref_sink(args); } @@ -1241,8 +1241,8 @@ _nm_dbus_manager_obj_notify(NMDBusObject *obj, guint n_pspecs, const GParamSpec if (G_UNLIKELY(device_statistics_args)) { /* this is a special interface: it has a legacy PropertiesChanged signal, - * however, contrary to other interfaces with ~regular~ legacy signals, - * we only notify about properties that actually belong to this interface. */ + * however, contrary to other interfaces with ~regular~ legacy signals, + * we only notify about properties that actually belong to this interface. */ g_dbus_connection_emit_signal(priv->main_dbus_connection, NULL, obj->internal.path, @@ -1257,22 +1257,22 @@ _nm_dbus_manager_obj_notify(NMDBusObject *obj, guint n_pspecs, const GParamSpec gs_unref_variant GVariant *args = NULL; /* The legacy PropertyChanged signal on the NetworkManager D-Bus interface is - * deprecated for the standard signal on org.freedesktop.DBus.Properties. However, - * for backward compatibility, we still need to emit it. - * - * Due to a bug in dbus-glib in NetworkManager <= 1.0, the signal would - * not only notify about properties that were actually on the corresponding - * D-Bus interface. Instead, it would notify about all relevant properties - * on all interfaces that had such a signal. - * - * For example, "HwAddress" gets emitted both on "fdo.NM.Device.Ethernet" - * and "fdo.NM.Device.Veth" for veth interfaces, although only the former - * actually has such a property. - * Also note that "fdo.NM.Device" interface has no legacy signal. All notifications - * about its properties are instead emitted on the interfaces of the subtypes. - * - * See bgo#770629 and commit bef26a2e69f51259095fa080221db73de09fd38d. - */ + * deprecated for the standard signal on org.freedesktop.DBus.Properties. However, + * for backward compatibility, we still need to emit it. + * + * Due to a bug in dbus-glib in NetworkManager <= 1.0, the signal would + * not only notify about properties that were actually on the corresponding + * D-Bus interface. Instead, it would notify about all relevant properties + * on all interfaces that had such a signal. + * + * For example, "HwAddress" gets emitted both on "fdo.NM.Device.Ethernet" + * and "fdo.NM.Device.Veth" for veth interfaces, although only the former + * actually has such a property. + * Also note that "fdo.NM.Device" interface has no legacy signal. All notifications + * about its properties are instead emitted on the interfaces of the subtypes. + * + * See bgo#770629 and commit bef26a2e69f51259095fa080221db73de09fd38d. + */ args = g_variant_ref_sink(g_variant_new("(a{sv})", &legacy_builder)); c_list_for_each_entry (reg_data, &obj->internal.registration_lst_head, registration_lst) { const NMDBusInterfaceInfoExtended *interface_info = @@ -1399,10 +1399,10 @@ dbus_vtable_objmgr_method_call(GDBusConnection * connection, GVariantBuilder interfaces_builder; /* note that we are called on an idle handler. Hence, all properties are - * supposed to be in a consistent state. That is true, if you always - * g_object_thaw_notify() before returning to the mainloop. Keeping - * signals frozen between while returning from the current call stack - * is anyway a very fragile thing, easy to get wrong. Don't do that. */ + * supposed to be in a consistent state. That is true, if you always + * g_object_thaw_notify() before returning to the mainloop. Keeping + * signals frozen between while returning from the current call stack + * is anyway a very fragile thing, easy to get wrong. Don't do that. */ g_variant_builder_add(&array_builder, "{oa{sa{sv}}}", obj->internal.path, @@ -1489,10 +1489,10 @@ nm_dbus_manager_acquire_bus(NMDBusManager *self, gboolean request_name) priv = NM_DBUS_MANAGER_GET_PRIVATE(self); /* Create the D-Bus connection and registering the name synchronously. - * That is necessary because we need to exit right away if we can't - * acquire the name despite connecting to the bus successfully. - * It means that something is gravely broken -- such as another NetworkManager - * instance running. */ + * That is necessary because we need to exit right away if we can't + * acquire the name despite connecting to the bus successfully. + * It means that something is gravely broken -- such as another NetworkManager + * instance running. */ priv->main_dbus_connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error); if (!priv->main_dbus_connection) { _LOGE("cannot connect to D-Bus: %s", error->message); @@ -1564,9 +1564,9 @@ nm_dbus_manager_stop(NMDBusManager *self) priv->shutting_down = TRUE; /* during shutdown we also clear the set-property-handler. It's no longer - * possible to set a property, because doing so would require authorization, - * which is async, which is just complicated to get right. No more property - * setting from now on. */ + * possible to set a property, because doing so would require authorization, + * which is async, which is just complicated to get right. No more property + * setting from now on. */ priv->set_property_handler = NULL; priv->set_property_handler_data = NULL; } @@ -1602,7 +1602,7 @@ dispose(GObject *object) CallerInfo * caller_info; /* All exported NMDBusObject instances keep the manager alive, so we don't - * expect any remaining objects. */ + * expect any remaining objects. */ nm_assert(!priv->objects_by_path || g_hash_table_size(priv->objects_by_path) == 0); nm_assert(c_list_is_empty(&priv->objects_lst_head)); @@ -1691,8 +1691,8 @@ _new_unix_process(GDBusMethodInvocation *context, g_return_val_if_fail(dbus_sender && *dbus_sender, NULL); /* polkit glib library stores uid and pid as int. There might be some - * pitfalls if the id ever happens to be larger then that. Just assert against - * it here. */ + * pitfalls if the id ever happens to be larger then that. Just assert against + * it here. */ g_return_val_if_fail(uid <= MIN(G_MAXINT, G_MAXINT32), NULL); g_return_val_if_fail(pid > 0 && pid <= MIN(G_MAXINT, G_MAXINT32), NULL); @@ -1700,8 +1700,8 @@ _new_unix_process(GDBusMethodInvocation *context, if (nm_auth_subject_get_subject_type(self) != NM_AUTH_SUBJECT_TYPE_UNIX_PROCESS) { /* this most likely happened because the process is gone (start_time==0). - * Either that is not assert-worthy, or constructed() already asserted. - * Just return NULL. */ + * Either that is not assert-worthy, or constructed() already asserted. + * Just return NULL. */ g_clear_object(&self); } return self; diff --git a/src/nm-dbus-object.c b/src/nm-dbus-object.c index a763ebf4c9..b71111cfd7 100644 --- a/src/nm-dbus-object.c +++ b/src/nm-dbus-object.c @@ -127,16 +127,16 @@ nm_dbus_object_unexport(gpointer /* (NMDBusObject *) */ self) _LOGT("unexport: \"%s\"", self1->internal.path); /* note that we emit the signal *before* actually unexporting the object. - * The reason is, that listeners want to use this signal to know that - * the object goes away, and clear their D-Bus path to this object. - * - * But this must happen before we actually unregister the object, so - * that we first emit a D-Bus signal that other objects no longer - * reference this object, before finally unregistering the object itself. - * - * The inconvenient part is, that at this point nm_dbus_object_get_path() - * still returns the path. So, the callee needs to handle that. Possibly - * by using "nm_dbus_object_get_path_still_exported()". */ + * The reason is, that listeners want to use this signal to know that + * the object goes away, and clear their D-Bus path to this object. + * + * But this must happen before we actually unregister the object, so + * that we first emit a D-Bus signal that other objects no longer + * reference this object, before finally unregistering the object itself. + * + * The inconvenient part is, that at this point nm_dbus_object_get_path() + * still returns the path. So, the callee needs to handle that. Possibly + * by using "nm_dbus_object_get_path_still_exported()". */ self1->internal.is_unexporting = TRUE; _emit_exported_changed(self1); @@ -171,9 +171,9 @@ nm_dbus_object_unexport_on_idle(gpointer /* (NMDBusObject *) */ self_take) g_return_if_fail(self->internal.path); /* There is no mechanism to cancel or abort the unexport. It will always - * gonna happen. - * - * However, we register it to block shutdown, so that we ensure that it will happen. */ + * gonna happen. + * + * However, we register it to block shutdown, so that we ensure that it will happen. */ nm_shutdown_wait_obj_register_object(self, "unexport-dbus-obj-on-idle"); @@ -277,18 +277,18 @@ constructed(GObject *object) nm_dbus_object_export((NMDBusObject *) object); /* NMDBusObject types should be very careful when overwriting notify(). - * It is possible to do, but this is a reminder that it's probably not - * a good idea. - * - * It's not a good idea, because NMDBusObject uses dispatch_properties_changed() - * to emit signals about a bunch of property changes. So, we want to make - * use of g_object_freeze_notify() / g_object_thaw_notify() to combine multiple - * property changes in one signal on D-Bus. Note that notify() is not invoked - * while the signal is frozen, that means, whatever you do inside notify() - * will not make it into the same batch of PropertiesChanged signal. That is - * confusing, and probably not what you want. - * - * Simple solution: don't overwrite notify(). */ + * It is possible to do, but this is a reminder that it's probably not + * a good idea. + * + * It's not a good idea, because NMDBusObject uses dispatch_properties_changed() + * to emit signals about a bunch of property changes. So, we want to make + * use of g_object_freeze_notify() / g_object_thaw_notify() to combine multiple + * property changes in one signal on D-Bus. Note that notify() is not invoked + * while the signal is frozen, that means, whatever you do inside notify() + * will not make it into the same batch of PropertiesChanged signal. That is + * confusing, and probably not what you want. + * + * Simple solution: don't overwrite notify(). */ nm_assert(!G_OBJECT_CLASS(klass)->notify); } @@ -298,8 +298,8 @@ dispose(GObject *object) NMDBusObject *self = NM_DBUS_OBJECT(object); /* Objects should have already been unexported by their owner, unless - * we are quitting, where many objects stick around until exit. - */ + * we are quitting, where many objects stick around until exit. + */ if (self->internal.path) { if (!nm_dbus_manager_is_stopping(nm_dbus_object_get_manager(self))) g_warn_if_reached(); diff --git a/src/nm-dbus-object.h b/src/nm-dbus-object.h index a3afeff863..5cccc6ca41 100644 --- a/src/nm-dbus-object.h +++ b/src/nm-dbus-object.h @@ -17,13 +17,13 @@ typedef struct { const char *path; /* if path is of type NM_DBUS_EXPORT_PATH_NUMBERED(), we need a - * per-class counter when generating a new numbered path. - * - * Each NMDBusObjectClass instance has a shallow clone of the NMDBusObjectClass parent - * instance in every derived type. Hence we cannot embed the counter there directly, - * because it must be shared, e.g. between NMDeviceBond and NMDeviceEthernet. - * Make int_counter a pointer to the actual counter that is used by ever sibling - * class. */ + * per-class counter when generating a new numbered path. + * + * Each NMDBusObjectClass instance has a shallow clone of the NMDBusObjectClass parent + * instance in every derived type. Hence we cannot embed the counter there directly, + * because it must be shared, e.g. between NMDeviceBond and NMDeviceEthernet. + * Make int_counter a pointer to the actual counter that is used by ever sibling + * class. */ long long unsigned *int_counter; } NMDBusExportPath; @@ -76,11 +76,11 @@ struct _NMDBusObjectInternal { CList registration_lst_head; /* we perform asynchronous operation on exported objects. For example, we receive - * a Set property call, and asynchronously validate the operation. We must make - * sure that when the authentication is complete, that we are still looking at - * the same (exported) object. In the meantime, the object could have been - * unexported, or even re-exported afterwards. If that happens, we want - * to fail the request. For that, we keep track of a version id. */ + * a Set property call, and asynchronously validate the operation. We must make + * sure that when the authentication is complete, that we are still looking at + * the same (exported) object. In the meantime, the object could have been + * unexported, or even re-exported afterwards. If that happens, we want + * to fail the request. For that, we keep track of a version id. */ guint64 export_version_id; bool is_unexporting : 1; }; @@ -157,7 +157,7 @@ nm_dbus_object_get_path_still_exported(NMDBusObject *self) g_return_val_if_fail(NM_IS_DBUS_OBJECT(self), NULL); /* like nm_dbus_object_get_path(), however, while unexporting - * (exported-changed signal), returns %NULL instead of the path. */ + * (exported-changed signal), returns %NULL instead of the path. */ return self->internal.is_unexporting ? NULL : self->internal.path; } diff --git a/src/nm-dbus-utils.c b/src/nm-dbus-utils.c index 5afbe33479..2be198599d 100644 --- a/src/nm-dbus-utils.c +++ b/src/nm-dbus-utils.c @@ -26,7 +26,7 @@ nm_dbus_utils_interface_info_lookup_property(const GDBusInterfaceInfo *interface nm_assert(property_name); /* there is also g_dbus_interface_info_lookup_property(), however that makes use - * of a global cache. */ + * of a global cache. */ if (interface_info->properties) { for (i = 0; interface_info->properties[i]; i++) { GDBusPropertyInfo *info = interface_info->properties[i]; @@ -51,7 +51,7 @@ nm_dbus_utils_interface_info_lookup_method(const GDBusInterfaceInfo *interface_i nm_assert(method_name); /* there is also g_dbus_interface_info_lookup_property(), however that makes use - * of a global cache. */ + * of a global cache. */ if (interface_info->methods) { for (i = 0; interface_info->methods[i]; i++) { GDBusMethodInfo *info = interface_info->methods[i]; @@ -221,7 +221,7 @@ void nm_dbus_track_obj_path_deinit(NMDBusTrackObjPath *track) { /* we allow deinit() to be called multiple times (e.g. from - * dispose(), which must be re-entrant). */ + * dispose(), which must be re-entrant). */ nm_assert(track); nm_assert(!track->_notify_target || G_IS_OBJECT(track->_notify_target)); diff --git a/src/nm-dbus-utils.h b/src/nm-dbus-utils.h index e3f8fa7745..ad953c6bc6 100644 --- a/src/nm-dbus-utils.h +++ b/src/nm-dbus-utils.h @@ -16,8 +16,8 @@ struct _NMDBusPropertyInfoExtendedBase { const char * property_name; /* Whether the properties needs to be notified on the legacy - * PropertyChanged signal. This is only to preserve API, new - * properties should not use this. */ + * PropertyChanged signal. This is only to preserve API, new + * properties should not use this. */ bool include_in_legacy_property_changed; }; @@ -25,7 +25,7 @@ struct _NMDBusPropertyInfoExtendedReadWritable { struct _NMDBusPropertyInfoExtendedBase _base; /* this is the polkit permission type for authenticating setting - * the property. */ + * the property. */ const char *permission; /* this is the audit operation type for writing the property. */ @@ -39,14 +39,14 @@ typedef struct { struct _NMDBusPropertyInfoExtendedReadWritable writable; /* duplicate the base structure in the union, so that the common fields - * are accessible directly in the parent struct. */ + * are accessible directly in the parent struct. */ struct { GDBusPropertyInfo parent; const char * property_name; /* Whether the properties needs to be notified on the legacy - * PropertyChanged signal. This is only to preserve API, new - * properties should not use this. */ + * PropertyChanged signal. This is only to preserve API, new + * properties should not use this. */ bool include_in_legacy_property_changed; }; }; @@ -150,7 +150,7 @@ typedef struct _NMDBusInterfaceInfoExtended { GDBusInterfaceInfo parent; /* Whether the interface has a legacy property changed signal (@nm_signal_info_property_changed_legacy). - * New interfaces should not use this. */ + * New interfaces should not use this. */ bool legacy_property_changed : 1; } NMDBusInterfaceInfoExtended; diff --git a/src/nm-dcb.c b/src/nm-dcb.c index e42320047a..268bbc4297 100644 --- a/src/nm-dcb.c +++ b/src/nm-dcb.c @@ -216,8 +216,8 @@ _dcb_setup(const char * iface, return FALSE; } else { /* Ignore disable failure since lldpad <= 0.9.46 does not support disabling - * priority groups without specifying an entire PG config. - */ + * priority groups without specifying an entire PG config. + */ (void) do_helper(iface, DCBTOOL, run_func, user_data, error, "pg e:0"); } @@ -359,11 +359,11 @@ carrier_wait(const char *iface, guint secs, gboolean up) ifindex = nm_platform_link_get_ifindex(NM_PLATFORM_GET, iface); if (ifindex > 0) { /* To work around driver quirks and lldpad handling of carrier status, - * we must wait a short period of time to see if the carrier goes - * down, and then wait for the carrier to come back up again. Otherwise - * subsequent lldpad calls may fail with "Device not found, link down - * or DCB not enabled" errors. - */ + * we must wait a short period of time to see if the carrier goes + * down, and then wait for the carrier to come back up again. Otherwise + * subsequent lldpad calls may fail with "Device not found, link down + * or DCB not enabled" errors. + */ nm_log_dbg(LOGD_DCB, "(%s): cleanup waiting for carrier %s", iface, up ? "up" : "down"); g_usleep(G_USEC_PER_SEC / 4); while (nm_platform_link_is_connected(NM_PLATFORM_GET, ifindex) != up && count-- > 0) { @@ -380,8 +380,8 @@ nm_dcb_cleanup(const char *iface, GError **error) _fcoe_cleanup(iface, run_helper, GUINT_TO_POINTER(FCOEADM), NULL); /* Must pause a bit to wait for carrier-up since disabling FCoE may - * cause the device to take the link down, making lldpad return errors. - */ + * cause the device to take the link down, making lldpad return errors. + */ carrier_wait(iface, 2, FALSE); carrier_wait(iface, 4, TRUE); diff --git a/src/nm-dispatcher.c b/src/nm-dispatcher.c index 8b12b8bd65..fc88ec6cc9 100644 --- a/src/nm-dispatcher.c +++ b/src/nm-dispatcher.c @@ -942,8 +942,8 @@ nm_dispatcher_call_cancel(NMDispatcherCallId *call_id) g_return_if_reached(); /* Canceling just means the callback doesn't get called, so set the - * DispatcherInfo's callback to NULL. - */ + * DispatcherInfo's callback to NULL. + */ _LOG3D(call_id, "cancelling dispatcher callback action"); call_id->callback = NULL; } diff --git a/src/nm-firewall-manager.c b/src/nm-firewall-manager.c index a4debff015..f203f25c71 100644 --- a/src/nm-firewall-manager.c +++ b/src/nm-firewall-manager.c @@ -150,10 +150,10 @@ static gboolean _get_running(NMFirewallManagerPrivate *priv) { /* when starting, we need to asynchronously check whether there is - * a name owner. During that time we optimistically assume that the - * service is indeed running. That is the time when we queue the - * requests, and they will be started once the get-name-owner call - * returns. */ + * a name owner. During that time we optimistically assume that the + * service is indeed running. That is the time when we queue the + * requests, and they will be started once the get-name-owner call + * returns. */ return priv->running || (priv->dbus_connection && !priv->dbus_inited); } @@ -243,8 +243,8 @@ _handle_idle_start(NMFirewallManager *self, NMFirewallManagerCallId *call_id) { if (!call_id->callback) { /* if the user did not provide a callback and firewalld is not running, - * there is no point in scheduling an idle-request to fake success. Just - * return right away. */ + * there is no point in scheduling an idle-request to fake success. Just + * return right away. */ _LOGD(call_id, "complete: drop request simulating success"); _cb_info_complete(call_id, NULL); return FALSE; @@ -295,7 +295,7 @@ _handle_dbus_cb(GObject *source, GAsyncResult *result, gpointer user_data) _LOGD(call_id, "complete: request failed with a non-error (%s)", error->message); /* The operation failed with an error reason that we don't want - * to propagate. Instead, signal success. */ + * to propagate. Instead, signal success. */ g_clear_error(&error); } else _LOGW(call_id, "complete: request failed (%s)", error->message); @@ -385,18 +385,18 @@ _start_request(NMFirewallManager * self, _handle_dbus_start(self, call_id); if (!call_id->callback) { /* if the user did not provide a callback, the call_id is useless. - * Especially, the user cannot use the call-id to cancel the request, - * because he cannot know whether the request is still pending. - * - * Hence, returning %NULL doesn't mean that the request could not be started - * (this function never fails and always starts a request). */ + * Especially, the user cannot use the call-id to cancel the request, + * because he cannot know whether the request is still pending. + * + * Hence, returning %NULL doesn't mean that the request could not be started + * (this function never fails and always starts a request). */ return NULL; } } else { if (!_handle_idle_start(self, call_id)) { /* if the user did not provide a callback and firewalld is not running, - * there is no point in scheduling an idle-request to fake success. Just - * return right away. */ + * there is no point in scheduling an idle-request to fake success. Just + * return right away. */ return NULL; } } @@ -484,13 +484,13 @@ name_owner_changed(NMFirewallManager *self, const char *owner) NMFirewallManagerCallId *call_id; /* We kick of the requests that we have pending. Note that this is - * entirely asynchronous and also we don't invoke any callbacks for - * the user. - * Even _handle_idle_start() just schedules an idle handler. That is, - * because we don't want to callback to the user before emitting the - * DISCONNECTED signal below. Also, emitting callbacks means the user - * can call back to modify the list of pending-calls and we'd have - * to handle reentrancy. */ + * entirely asynchronous and also we don't invoke any callbacks for + * the user. + * Even _handle_idle_start() just schedules an idle handler. That is, + * because we don't want to callback to the user before emitting the + * DISCONNECTED signal below. Also, emitting callbacks means the user + * can call back to modify the list of pending-calls and we'd have + * to handle reentrancy. */ c_list_for_each_entry_safe (call_id, call_id_safe, &priv->pending_calls, lst) { nm_assert(!call_id->is_idle); nm_assert(call_id->dbus.arg); @@ -500,9 +500,9 @@ name_owner_changed(NMFirewallManager *self, const char *owner) _handle_dbus_start(self, call_id); } else { /* we don't want to invoke callbacks to the user right away. That is because - * the user might schedule/cancel more calls, which messes up the order. - * - * Instead, convert the pending calls to idle requests... */ + * the user might schedule/cancel more calls, which messes up the order. + * + * Instead, convert the pending calls to idle requests... */ nm_clear_pointer(&call_id->dbus.arg, g_variant_unref); call_id->is_idle = TRUE; _LOGD(call_id, "initializing: fake success on idle"); @@ -591,7 +591,7 @@ dispose(GObject *object) NMFirewallManagerPrivate *priv = NM_FIREWALL_MANAGER_GET_PRIVATE(self); /* as every pending operation takes a reference to the manager, - * we don't expect pending operations at this point. */ + * we don't expect pending operations at this point. */ nm_assert(c_list_is_empty(&priv->pending_calls)); nm_clear_g_dbus_connection_signal(priv->dbus_connection, &priv->name_owner_changed_id); diff --git a/src/nm-hostname-manager.c b/src/nm-hostname-manager.c index 0a75dd7957..2680f70e70 100644 --- a/src/nm-hostname-manager.c +++ b/src/nm-hostname-manager.c @@ -368,9 +368,9 @@ nm_hostname_manager_write_hostname(NMHostnameManager *self, const char *hostname } /* If the hostname file is a symbolic link, follow it to find where the - * real file is located, otherwise g_file_set_contents will attempt to - * replace the link with a plain file. - */ + * real file is located, otherwise g_file_set_contents will attempt to + * replace the link with a plain file. + */ if (lstat(file, &file_stat) == 0 && S_ISLNK(file_stat.st_mode) && (link_path = nm_utils_read_link_absolute(file, NULL))) file = link_path; diff --git a/src/nm-iface-helper.c b/src/nm-iface-helper.c index 6d4f41df3b..cb11b1cc98 100644 --- a/src/nm-iface-helper.c +++ b/src/nm-iface-helper.c @@ -181,9 +181,9 @@ ndisc_config_changed(NMNDisc * ndisc, guint32 ifa_flags; /* Check, whether kernel is recent enough to help user space handling RA. - * If it's not supported, we have no ipv6-privacy and must add autoconf - * addresses as /128. The reason for the /128 is to prevent the kernel - * from adding a prefix route for this address. */ + * If it's not supported, we have no ipv6-privacy and must add autoconf + * addresses as /128. The reason for the /128 is to prevent the kernel + * from adding a prefix route for this address. */ ifa_flags = 0; if (nm_platform_kernel_support_get(NM_PLATFORM_KERNEL_SUPPORT_TYPE_EXTENDED_IFA_FLAGS)) { ifa_flags |= IFA_F_NOPREFIXROUTE; @@ -641,7 +641,7 @@ main(int argc, char *argv[]) if (global_opt.dhcp4_clientid) { /* this string is just a plain hex-string. Unlike ipv4.dhcp-client-id, which - * is parsed via nm_dhcp_utils_client_id_string_to_bytes(). */ + * is parsed via nm_dhcp_utils_client_id_string_to_bytes(). */ client_id = nm_utils_hexstr2bin(global_opt.dhcp4_clientid); if (!client_id || g_bytes_get_size(client_id) < 2) { fprintf(stderr, @@ -703,8 +703,8 @@ main(int argc, char *argv[]) && (global_opt.stable_id[0] >= '0' && global_opt.stable_id[0] <= '9') && global_opt.stable_id[1] == ' ') { /* strict parsing of --stable-id, which is the numeric stable-type - * and the ID, joined with one space. For now, only support stable-types - * from 0 to 9. */ + * and the ID, joined with one space. For now, only support stable-types + * from 0 to 9. */ stable_type = (global_opt.stable_id[0] - '0'); stable_id = &global_opt.stable_id[2]; } @@ -769,7 +769,7 @@ main(int argc, char *argv[]) const NMDhcpClientFactory *const _nm_dhcp_manager_factories[6] = { /* For nm-iface-helper there is no option to choose a DHCP plugin. - * It just uses the "internal" one. */ + * It just uses the "internal" one. */ &_nm_dhcp_client_factory_internal, }; diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c index f7338eea66..33bbc61139 100644 --- a/src/nm-ip4-config.c +++ b/src/nm-ip4-config.c @@ -95,7 +95,7 @@ _nm_ip_config_add_obj(NMDedupMultiIndex * multi_idx, nm_assert(ifindex > 0); /* we go through extra lengths to accept a full obj_new object. That one, - * can be reused by increasing the ref-count. */ + * can be reused by increasing the ref-count. */ if (!obj_new) { nm_assert(pl_new); obj_new = nmp_object_stackinit(&obj_new_stackinit, idx_type->obj_type, pl_new); @@ -123,16 +123,16 @@ _nm_ip_config_add_obj(NMDedupMultiIndex * multi_idx, } /* if @merge, we merge the new object with the existing one. - * Otherwise, we replace it entirely. */ + * Otherwise, we replace it entirely. */ if (merge) { switch (idx_type->obj_type) { case NMP_OBJECT_TYPE_IP4_ADDRESS: case NMP_OBJECT_TYPE_IP6_ADDRESS: /* for addresses that we read from the kernel, we keep the timestamps as defined - * by the previous source (item_old). The reason is, that the other source configured the lifetimes - * with "what should be" and the kernel values are "what turned out after configuring it". - * - * For other sources, the longer lifetime wins. */ + * by the previous source (item_old). The reason is, that the other source configured the lifetimes + * with "what should be" and the kernel values are "what turned out after configuring it". + * + * For other sources, the longer lifetime wins. */ if ((obj_new->ip_address.addr_source == NM_IP_CONFIG_SOURCE_KERNEL && obj_old->ip_address.addr_source != NM_IP_CONFIG_SOURCE_KERNEL) || nm_platform_ip_address_cmp_expiry(NMP_OBJECT_CAST_IP_ADDRESS(obj_old), @@ -403,7 +403,7 @@ _nm_ip_config_best_default_route_find_better(const NMPObject *obj_cur, const NMP nm_assert(!obj_cur || nmp_object_ip_route_is_best_defaut_route(obj_cur)); /* assumes that @obj_cur is already the best default route (or NULL). It checks whether - * @obj_cmp is also a default route and returns the best of both. */ + * @obj_cmp is also a default route and returns the best of both. */ if (obj_cmp && nmp_object_ip_route_is_best_defaut_route(obj_cmp)) { guint32 metric_cur, metric_cmp; @@ -420,9 +420,9 @@ _nm_ip_config_best_default_route_find_better(const NMPObject *obj_cur, const NMP int c; /* Routes have the same metric. We still want to deterministically - * prefer one or the other. It's important to consistently choose one - * or the other, so that the order doesn't matter how routes are added - * (and merged). */ + * prefer one or the other. It's important to consistently choose one + * or the other, so that the order doesn't matter how routes are added + * (and merged). */ c = nmp_object_cmp(obj_cur, obj_cmp); if (c != 0) return c < 0 ? obj_cur : obj_cmp; @@ -628,7 +628,7 @@ nm_ip4_config_add_dependent_routes(NMIP4Config *self, g_return_if_fail(ifindex > 0); /* For IPv6 slaac, we explicitly add the device-routes (onlink) to NMIP6Config. - * As we don't do that for IPv4 (and manual IPv6 addresses), add them explicitly. */ + * As we don't do that for IPv4 (and manual IPv6 addresses), add them explicitly. */ nm_ip_config_iter_ip4_address_for_each (&iter, self, &my_addr) { nm_auto_nmpobj NMPObject *r = NULL; @@ -663,13 +663,13 @@ nm_ip4_config_add_dependent_routes(NMIP4Config *self, if (nm_utils_ip4_address_is_zeronet(network)) { /* Kernel doesn't add device-routes for destinations that - * start with 0.x.y.z. Skip them. */ + * start with 0.x.y.z. Skip them. */ continue; } if (my_addr->plen == 32 && my_addr->address == my_addr->peer_address) { /* Kernel doesn't add device-routes for /32 addresses unless - * they have a peer. */ + * they have a peer. */ continue; } @@ -1293,8 +1293,8 @@ nm_ip4_config_subtract(NMIP4Config * dst, NMPlatformIP4Route *rr; /* the default route was penalized when merging it to the combined ip-config. - * When subtracting the routes, we must re-do that process when comparing - * the routes. */ + * When subtracting the routes, we must re-do that process when comparing + * the routes. */ o_lookup = nmp_object_stackinit_obj(&o_lookup_copy, o_src); rr = NMP_OBJECT_CAST_IP4_ROUTE(&o_lookup_copy); rr->metric = @@ -1443,8 +1443,8 @@ _nm_ip4_config_intersect_helper(NMIP4Config * dst, NMPlatformIP4Route *rr; /* the default route was penalized when merging it to the combined ip-config. - * When intersecting the routes, we must re-do that process when comparing - * the routes. */ + * When intersecting the routes, we must re-do that process when comparing + * the routes. */ o_lookup = nmp_object_stackinit_obj(&o_lookup_copy, o_dst); rr = NMP_OBJECT_CAST_IP4_ROUTE(&o_lookup_copy); rr->metric = @@ -1858,7 +1858,7 @@ nm_ip4_config_replace(NMIP4Config *dst, const NMIP4Config *src, gboolean *releva #if NM_MORE_ASSERTS /* config_equal does not compare *all* the fields, therefore, we might have has_minor_changes - * regardless of config_equal. But config_equal must correspond to has_relevant_changes. */ + * regardless of config_equal. But config_equal must correspond to has_relevant_changes. */ nm_assert(config_equal == !has_relevant_changes); #endif @@ -2877,15 +2877,15 @@ nm_ip4_config_hash(const NMIP4Config *self, GChecksum *sum, gboolean dns_only) g_checksum_update(sum, (const guint8 *) &val, sizeof(val)); /* FIXME(ip-config-checksum): the DNS priority should be considered relevant - * and added into the checksum as well, but this can't be done right now - * because in the DNS manager we rely on the fact that an empty - * configuration (i.e. just created) has a zero checksum. This is needed to - * avoid rewriting resolv.conf when there is no change. - * - * The DNS priority initial value depends on the connection type (VPN or - * not), so it's a bit difficult to add it to checksum maintaining the - * assumption of checksum(empty)=0 - */ + * and added into the checksum as well, but this can't be done right now + * because in the DNS manager we rely on the fact that an empty + * configuration (i.e. just created) has a zero checksum. This is needed to + * avoid rewriting resolv.conf when there is no change. + * + * The DNS priority initial value depends on the connection type (VPN or + * not), so it's a bit difficult to add it to checksum maintaining the + * assumption of checksum(empty)=0 + */ } /** diff --git a/src/nm-ip4-config.h b/src/nm-ip4-config.h index b5eed5fd7d..bfdb681c93 100644 --- a/src/nm-ip4-config.h +++ b/src/nm-ip4-config.h @@ -20,7 +20,7 @@ typedef enum _NMIPConfigFlags { NM_IP_CONFIG_FLAG_NONE = 0, /* if set, then the merge flag NM_IP_CONFIG_MERGE_NO_DEFAULT_ROUTES gets - * ignored during merge. */ + * ignored during merge. */ NM_IP_CONFIG_FLAGS_IGNORE_MERGE_NO_DEFAULT_ROUTES = (1ull << 0), } NMIPConfigFlags; diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c index e5a1925709..5ebb46a84f 100644 --- a/src/nm-ip6-config.c +++ b/src/nm-ip6-config.c @@ -371,9 +371,9 @@ nm_ip6_config_add_dependent_routes(NMIP6Config *self, g_return_if_fail(ifindex > 0); /* For IPv6 addresses received via SLAAC/autoconf, we explicitly add the - * device-routes (onlink) to NMIP6Config. - * - * For manually added IPv6 routes, add the device routes explicitly. */ + * device-routes (onlink) to NMIP6Config. + * + * For manually added IPv6 routes, add the device routes explicitly. */ /* Pre-generate multicast route */ { @@ -424,7 +424,7 @@ nm_ip6_config_add_dependent_routes(NMIP6Config *self, has_peer = !IN6_IS_ADDR_UNSPECIFIED(&my_addr->peer_address); /* If we have an IPv6 peer, we add two /128 routes - * (unless, both addresses are identical). */ + * (unless, both addresses are identical). */ routes_n = (has_peer && !IN6_ARE_ADDR_EQUAL(&my_addr->address, &my_addr->peer_address)) ? 2 : 1; @@ -973,8 +973,8 @@ nm_ip6_config_subtract(NMIP6Config * dst, NMPlatformIP6Route *rr; /* the default route was penalized when merging it to the combined ip-config. - * When subtracting the routes, we must re-do that process when comparing - * the routes. */ + * When subtracting the routes, we must re-do that process when comparing + * the routes. */ o_lookup = nmp_object_stackinit_obj(&o_lookup_copy, o_src); rr = NMP_OBJECT_CAST_IP6_ROUTE(&o_lookup_copy); rr->metric = @@ -1093,8 +1093,8 @@ _nm_ip6_config_intersect_helper(NMIP6Config * dst, NMPlatformIP6Route *rr; /* the default route was penalized when merging it to the combined ip-config. - * When intersecting the routes, we must re-do that process when comparing - * the routes. */ + * When intersecting the routes, we must re-do that process when comparing + * the routes. */ o_lookup = nmp_object_stackinit_obj(&o_lookup_copy, o_dst); rr = NMP_OBJECT_CAST_IP6_ROUTE(&o_lookup_copy); rr->metric = @@ -1450,7 +1450,7 @@ nm_ip6_config_replace(NMIP6Config *dst, const NMIP6Config *src, gboolean *releva #if NM_MORE_ASSERTS /* config_equal does not compare *all* the fields, therefore, we might have has_minor_changes - * regardless of config_equal. But config_equal must correspond to has_relevant_changes. */ + * regardless of config_equal. But config_equal must correspond to has_relevant_changes. */ nm_assert(config_equal == !has_relevant_changes); #endif @@ -1778,8 +1778,8 @@ nm_ip6_config_reset_routes_ndisc(NMIP6Config * self, if (first_pref != gateways[i].preference && !kernel_support_rta_pref) { /* We are unable to configure a router preference. Hence, we skip all gateways - * with a different preference from the first gateway. Note, that the gateways - * are sorted in order of highest to lowest preference. */ + * with a different preference from the first gateway. Note, that the gateways + * are sorted in order of highest to lowest preference. */ break; } } diff --git a/src/nm-keep-alive.c b/src/nm-keep-alive.c index 7dc52f9db2..b24fac3e8e 100644 --- a/src/nm-keep-alive.c +++ b/src/nm-keep-alive.c @@ -73,14 +73,14 @@ _is_alive(NMKeepAlive *self) if (priv->dbus_client_watching) { if (_is_alive_dbus_client(self)) { /* no matter what, the keep-alive is alive, because there is a D-Bus client - * still around keeping it alive. */ + * still around keeping it alive. */ return TRUE; } /* the D-Bus client is gone. The only other binding (below) for the connection's - * visibility cannot keep the instance alive. - * - * As such, a D-Bus client watch is authoritative and overrules other conditions (that - * we have so far). */ + * visibility cannot keep the instance alive. + * + * As such, a D-Bus client watch is authoritative and overrules other conditions (that + * we have so far). */ return FALSE; } @@ -88,11 +88,11 @@ _is_alive(NMKeepAlive *self) && !NM_FLAGS_HAS(nm_settings_connection_get_flags(priv->connection), NM_SETTINGS_CONNECTION_INT_FLAGS_VISIBLE)) { /* note that we only declare the keep-alive as dead due to invisible - * connection, if - * (1) we monitor a connection, obviously - * (2) the connection was visible earlier and is no longer. It was - * was invisible all the time, it does not suffice. - */ + * connection, if + * (1) we monitor a connection, obviously + * (2) the connection was visible earlier and is no longer. It was + * was invisible all the time, it does not suffice. + */ return FALSE; } @@ -134,16 +134,16 @@ connection_flags_changed(NMSettingsConnection *connection, NMKeepAlive *self) && NM_FLAGS_HAS(nm_settings_connection_get_flags(priv->connection), NM_SETTINGS_CONNECTION_INT_FLAGS_VISIBLE)) { /* the profile was never visible but now it becomes visible. - * Remember that. - * - * Before this happens (that is, if the device was invisible all along), - * the keep alive instance is considered alive (w.r.t. watching the connection). - * - * The reason is to allow a user to manually activate an invisible profile and keep - * it alive. At least, as long until the user logs out the first time (which is the - * first time, the profiles changes from visible to invisible). - * - * Yes, that is odd. How to improve? */ + * Remember that. + * + * Before this happens (that is, if the device was invisible all along), + * the keep alive instance is considered alive (w.r.t. watching the connection). + * + * The reason is to allow a user to manually activate an invisible profile and keep + * it alive. At least, as long until the user logs out the first time (which is the + * first time, the profiles changes from visible to invisible). + * + * Yes, that is odd. How to improve? */ priv->connection_was_visible = TRUE; } _notify_alive(self); @@ -223,8 +223,8 @@ _is_alive_dbus_client(NMKeepAlive *self) if (!priv->dbus_client_confirmed) { /* it's unconfirmed that the D-Bus client is really alive. - * It looks like it is, but as we are claiming that to be - * the case, issue an async GetNameOwner call to make sure. */ + * It looks like it is, but as we are claiming that to be + * the case, issue an async GetNameOwner call to make sure. */ priv->dbus_client_confirmed = TRUE; priv->dbus_client_confirm_cancellable = g_cancellable_new(); @@ -439,18 +439,18 @@ _nm_keep_alive_set_owner(NMKeepAlive *self, GObject *owner) nm_assert(!owner || G_IS_OBJECT(owner)); /* it's bad style to reset the owner object. You are supposed to - * set it once, and clear it once. That's it. */ + * set it once, and clear it once. That's it. */ nm_assert(!owner || !priv->owner); /* optimally, we would take a reference to @owner. But the - * owner already owns a reference to the keep-alive, so we cannot - * just own a reference back. - * - * We could register a weak-pointer here. But instead, declare that - * owner is required to set itself as owner when creating the - * keep-alive instance, and unset itself when it lets go of the - * keep-alive instance (at latest, when the owner itself gets destroyed). - */ + * owner already owns a reference to the keep-alive, so we cannot + * just own a reference back. + * + * We could register a weak-pointer here. But instead, declare that + * owner is required to set itself as owner when creating the + * keep-alive instance, and unset itself when it lets go of the + * keep-alive instance (at latest, when the owner itself gets destroyed). + */ priv->owner = owner; } diff --git a/src/nm-l3-config-data.c b/src/nm-l3-config-data.c index 323e6236b3..81565136b6 100644 --- a/src/nm-l3-config-data.c +++ b/src/nm-l3-config-data.c @@ -705,10 +705,10 @@ nm_l3_config_data_unref(const NML3ConfigData *self) nm_assert(_NM_IS_L3_CONFIG_DATA(self, TRUE)); /* NML3ConfigData aims to be an immutable, ref-counted type. The mode of operation - * is to create/initialize the instance once, then seal it and pass around the reference. - * - * That means, also ref/unref operate on const pointers (otherwise, you'd have to cast all - * the time). Hence, we cast away the constness during ref/unref/seal operations. */ + * is to create/initialize the instance once, then seal it and pass around the reference. + * + * That means, also ref/unref operate on const pointers (otherwise, you'd have to cast all + * the time). Hence, we cast away the constness during ref/unref/seal operations. */ mutable = (NML3ConfigData *) self; @@ -860,7 +860,7 @@ nm_l3_config_data_lookup_address_6(const NML3ConfigData *self, const struct in6_ nm_assert(_NM_IS_L3_CONFIG_DATA(self, TRUE)); /* this works only, because the primary key for a Ipv6 address is the - * ifindex and the "struct in6_addr". */ + * ifindex and the "struct in6_addr". */ nmp_object_stackinit_id_ip6_address(&obj_stack, self->ifindex, addr); head = nm_l3_config_data_lookup_obj(self, &obj_stack); @@ -924,7 +924,7 @@ nm_l3_config_data_has_routes_with_type_local(const NML3ConfigData *self, int add } /* the value gets accumulated and cached. Doing that is also permissible to a - * const/sealed instance. Hence, we cast the const-ness away. */ + * const/sealed instance. Hence, we cast the const-ness away. */ self_mutable = (NML3ConfigData *) self; if (IS_IPv4) { self_mutable->has_routes_with_type_local_4_set = TRUE; @@ -1024,7 +1024,7 @@ _l3_config_data_add_obj(NMDedupMultiIndex * multi_idx, NMP_OBJECT_TYPE_IP6_ADDRESS, NMP_OBJECT_TYPE_IP6_ROUTE)); /* we go through extra lengths to accept a full obj_new object. That one, - * can be reused by increasing the ref-count. */ + * can be reused by increasing the ref-count. */ if (!obj_new) { nm_assert(pl_new); obj_new = nmp_object_stackinit(&obj_new_stackinit, idx_type->obj_type, pl_new); @@ -1061,10 +1061,10 @@ _l3_config_data_add_obj(NMDedupMultiIndex * multi_idx, case NMP_OBJECT_TYPE_IP4_ADDRESS: case NMP_OBJECT_TYPE_IP6_ADDRESS: /* for addresses that we read from the kernel, we keep the timestamps as defined - * by the previous source (item_old). The reason is, that the other source configured the lifetimes - * with "what should be" and the kernel values are "what turned out after configuring it". - * - * For other sources, the longer lifetime wins. */ + * by the previous source (item_old). The reason is, that the other source configured the lifetimes + * with "what should be" and the kernel values are "what turned out after configuring it". + * + * For other sources, the longer lifetime wins. */ if ((obj_new->ip_address.addr_source == NM_IP_CONFIG_SOURCE_KERNEL && obj_old->ip_address.addr_source != NM_IP_CONFIG_SOURCE_KERNEL) || nm_platform_ip_address_cmp_expiry(NMP_OBJECT_CAST_IP_ADDRESS(obj_old), @@ -1153,7 +1153,7 @@ _l3_config_best_default_route_find_better(const NMPObject *obj_cur, const NMPObj nm_assert(!obj_cur || nmp_object_ip_route_is_best_defaut_route(obj_cur)); /* assumes that @obj_cur is already the best default route (or NULL). It checks whether - * @obj_cmp is also a default route and returns the best of both. */ + * @obj_cmp is also a default route and returns the best of both. */ if (obj_cmp && nmp_object_ip_route_is_best_defaut_route(obj_cmp)) { guint32 metric_cur, metric_cmp; @@ -1173,9 +1173,9 @@ _l3_config_best_default_route_find_better(const NMPObject *obj_cur, const NMPObj int c; /* Routes have the same metric. We still want to deterministically - * prefer one or the other. It's important to consistently choose one - * or the other, so that the order doesn't matter how routes are added - * (and merged). */ + * prefer one or the other. It's important to consistently choose one + * or the other, so that the order doesn't matter how routes are added + * (and merged). */ c = nmp_object_cmp(obj_cur, obj_cmp); if (c != 0) return c < 0 ? obj_cur : obj_cmp; @@ -1850,11 +1850,11 @@ nm_l3_config_data_cmp(const NML3ConfigData *a, const NML3ConfigData *b) NM_CMP_FIELD(a, b, source); /* these fields are not considered by cmp(): - * - * - multi_idx - * - ref_count - * - is_sealed - */ + * + * - multi_idx + * - ref_count + * - is_sealed + */ return 0; } @@ -1938,8 +1938,8 @@ nm_l3_config_data_get_blacklisted_ip4_routes(const NML3ConfigData *self, gboolea nm_assert(_NM_IS_L3_CONFIG_DATA(self, FALSE)); /* For IPv6 slaac, we explicitly add the device-routes (onlink). - * As we don't do that for IPv4 and manual IPv6 addresses. Add them here - * as dependent routes. */ + * As we don't do that for IPv4 and manual IPv6 addresses. Add them here + * as dependent routes. */ nm_l3_config_data_iter_obj_for_each(&iter, self, &my_addr_obj, NMP_OBJECT_TYPE_IP4_ADDRESS) { @@ -1958,13 +1958,13 @@ nm_l3_config_data_get_blacklisted_ip4_routes(const NML3ConfigData *self, gboolea if (nm_utils_ip4_address_is_zeronet(network_4)) { /* Kernel doesn't add device-routes for destinations that - * start with 0.x.y.z. Skip them. */ + * start with 0.x.y.z. Skip them. */ continue; } if (my_addr->plen == 32 && my_addr->address == my_addr->peer_address) { /* Kernel doesn't add device-routes for /32 addresses unless - * they have a peer. */ + * they have a peer. */ continue; } @@ -2017,8 +2017,8 @@ nm_l3_config_data_add_dependent_routes(NML3ConfigData *self, nm_assert_addr_family(addr_family); /* For IPv6 slaac, we explicitly add the device-routes (onlink). - * As we don't do that for IPv4 and manual IPv6 addresses. Add them here - * as dependent routes. */ + * As we don't do that for IPv4 and manual IPv6 addresses. Add them here + * as dependent routes. */ if (!IS_IPv4) { /* Pre-generate multicast route */ @@ -2083,13 +2083,13 @@ nm_l3_config_data_add_dependent_routes(NML3ConfigData *self, if (nm_utils_ip4_address_is_zeronet(network_4)) { /* Kernel doesn't add device-routes for destinations that - * start with 0.x.y.z. Skip them. */ + * start with 0.x.y.z. Skip them. */ continue; } if (my_addr->a4.plen == 32 && my_addr->a4.address == my_addr->a4.peer_address) { /* Kernel doesn't add device-routes for /32 addresses unless - * they have a peer. */ + * they have a peer. */ continue; } } else { @@ -2115,7 +2115,7 @@ nm_l3_config_data_add_dependent_routes(NML3ConfigData *self, int routes_i; /* If we have an IPv6 peer, we add two /128 routes - * (unless, both addresses are identical). */ + * (unless, both addresses are identical). */ for (routes_i = 0; routes_i < 2; routes_i++) { struct in6_addr a6_stack; const struct in6_addr *a6; @@ -2660,7 +2660,7 @@ nm_l3_config_data_new_clone(const NML3ConfigData *src, int ifindex) nm_assert(_NM_IS_L3_CONFIG_DATA(src, TRUE)); /* pass 0, to use the original ifindex. You can also use this function to - * copy the configuration for a different ifindex. */ + * copy the configuration for a different ifindex. */ nm_assert(ifindex >= 0); if (ifindex <= 0) ifindex = src->ifindex; diff --git a/src/nm-l3-config-data.h b/src/nm-l3-config-data.h index a0cd76dba4..f32b1ceb69 100644 --- a/src/nm-l3-config-data.h +++ b/src/nm-l3-config-data.h @@ -13,7 +13,7 @@ typedef enum { NM_L3_CONFIG_DAT_FLAGS_NONE = 0, /* if set, then the merge flag NM_L3_CONFIG_MERGE_FLAGS_NO_DEFAULT_ROUTES gets - * ignored during merge. */ + * ignored during merge. */ NM_L3_CONFIG_DAT_FLAGS_IGNORE_MERGE_NO_DEFAULT_ROUTES = (1ull << 0), NM_L3_CONFIG_DAT_FLAGS_HAS_DNS_PRIORITY_4 = (1ull << 1), @@ -28,18 +28,18 @@ typedef enum { NM_L3_CONFIG_ADD_FLAGS_NONE = 0, /* If the object does not yet exist, it will be added. If it already exists, - * by default the object will be replaced. With this flag, the new object will - * be merged with the existing one. */ + * by default the object will be replaced. With this flag, the new object will + * be merged with the existing one. */ NM_L3_CONFIG_ADD_FLAGS_MERGE = (1ull << 0), /* If the object does not yet exist, it will be added. If it already exists, - * by default the object will be replaced. With this flag, the add will have - * no effect and the existing object will be kept. */ + * by default the object will be replaced. With this flag, the add will have + * no effect and the existing object will be kept. */ NM_L3_CONFIG_ADD_FLAGS_EXCLUSIVE = (1ull << 1), /* A new object gets appended by default. If the object already exists, - * by default it will not be moved. With APPEND-FORCE, we will always move - * an existing object to the end of the list. */ + * by default it will not be moved. With APPEND-FORCE, we will always move + * an existing object to the end of the list. */ NM_L3_CONFIG_ADD_FLAGS_APPEND_FORCE = (1ull << 2), } NML3ConfigAddFlags; @@ -165,11 +165,11 @@ static inline gboolean NM_IS_L3_CONFIG_DATA(const NML3ConfigData *self) { /* NML3ConfigData is not an NMObject/GObject, so we cannot ask which type it has. - * This check here is really only useful for assertions, and there it is - * enough to check whether the pointer is not NULL. - * - * Additionally, also call nm_l3_config_data_get_ifindex(), which does more - * checks during nm_assert(). */ + * This check here is really only useful for assertions, and there it is + * enough to check whether the pointer is not NULL. + * + * Additionally, also call nm_l3_config_data_get_ifindex(), which does more + * checks during nm_assert(). */ nm_assert(nm_l3_config_data_get_ifindex(self) > 0); return !!self; } diff --git a/src/nm-l3cfg.c b/src/nm-l3cfg.c index 31a320328b..b76c30e4b8 100644 --- a/src/nm-l3cfg.c +++ b/src/nm-l3cfg.c @@ -73,8 +73,8 @@ typedef struct { in_addr_t addr; /* This is only relevant while in state ACD_STATE_PROBING. It's the - * duration for how long we probe, and @probing_timestamp_msec is the - * timestamp when we start probing. */ + * duration for how long we probe, and @probing_timestamp_msec is the + * timestamp when we start probing. */ guint32 probing_timeout_msec; CList acd_lst; @@ -95,7 +95,7 @@ typedef struct { AcdState acd_state; /* The probe result. This is only relevant if @acd_state is ACD_STATE_PROBE_DONE. - * In state ACD_STATE_ANNOUNCING the @probe_result must be TRUE. */ + * In state ACD_STATE_ANNOUNCING the @probe_result must be TRUE. */ bool probe_result : 1; bool announcing_failed_is_retrying : 1; @@ -362,9 +362,9 @@ _l3_acd_ipv4_addresses_on_link_update(NML3Cfg * self, } /* when we remove an IPv4 address from kernel, we cannot know whether the same address is still - * present (with a different prefix length or peer). So we cannot be sure whether we removed - * the only address, or whether more are still present. All we can do is forget about the - * cached addresses, and fetch them new the next time we need the information. */ + * present (with a different prefix length or peer). So we cannot be sure whether we removed + * the only address, or whether more are still present. All we can do is forget about the + * cached addresses, and fetch them new the next time we need the information. */ nm_clear_pointer(&self->priv.p->acd_ipv4_addresses_on_link, g_hash_table_unref); self->priv.p->acd_ipv4_addresses_on_link_has = FALSE; if (acd_data) @@ -472,9 +472,9 @@ _l3cfg_externally_removed_objs_drop_unused(NML3Cfg *self) while (g_hash_table_iter_next(&h_iter, (gpointer *) &obj, NULL)) { if (!nm_l3_config_data_lookup_route_obj(self->priv.p->combined_l3cd_commited, obj)) { /* The object is no longer tracked in the configuration. - * The externally_removed_objs_hash is to prevent adding entires that were - * removed externally, so if we don't plan to add the entry, we no longer need to track - * it. */ + * The externally_removed_objs_hash is to prevent adding entires that were + * removed externally, so if we don't plan to add the entry, we no longer need to track + * it. */ (*(_l3cfg_externally_removed_objs_counter(self, NMP_OBJECT_GET_TYPE(obj))))--; g_hash_table_iter_remove(&h_iter); _LOGD("externally-removed: untrack %s", @@ -818,7 +818,7 @@ nm_l3cfg_property_emit_unregister(NML3Cfg * self, if (target_property) { /* if a target-property is given, we don't have another entry in - * the list. */ + * the list. */ return; } } @@ -924,10 +924,10 @@ static void _l3_acd_platform_commit_acd_update(NML3Cfg *self) { /* The idea with NML3Cfg is that multiple users (NMDevice/NMVpnConnection) share one layer 3 configuration - * and push their (portion of) IP configuration to it. That implies, that any user may issue nm_l3cfg_platform_commit() - * at any time, in order to say that a new configuration is ready. - * - * This makes the mechanism also suitable for internally triggering a commit when ACD completes. */ + * and push their (portion of) IP configuration to it. That implies, that any user may issue nm_l3cfg_platform_commit() + * at any time, in order to say that a new configuration is ready. + * + * This makes the mechanism also suitable for internally triggering a commit when ACD completes. */ _LOGT("acd: acd update now"); nm_l3cfg_platform_commit(self, NM_L3_CFG_COMMIT_TYPE_AUTO); } @@ -1017,8 +1017,8 @@ _l3_acd_nacd_event(int fd, GIOCondition condition, gpointer user_data) char sbuf_addr[NM_UTILS_INET_ADDRSTRLEN]; /* since we announce with N_ACD_DEFEND_ALWAYS, we don't actually expect any - * conflict reported and don't handle it. It would be complicated to de-configure - * the address. */ + * conflict reported and don't handle it. It would be complicated to de-configure + * the address. */ nm_assert(event->event == N_ACD_EVENT_DEFENDED); n_acd_probe_get_userdata(event->_acd_event_payload.probe, (void **) &acd_data); @@ -1067,7 +1067,7 @@ _l3_acd_nacd_event(int fd, GIOCondition condition, gpointer user_data) out: if (!success) { /* Something is seriously wrong with our nacd instance. We handle that by resetting the - * ACD instance. */ + * ACD instance. */ _l3_acd_nacd_instance_reset(self, NM_TERNARY_TRUE, TRUE); } @@ -1156,7 +1156,7 @@ again: if (self->priv.p->nacd_instance_ensure_retry) { /* we just tried to create an instance and failed. We are rate-limited, - * don't yet try again. */ + * don't yet try again. */ NM_SET_OUT(out_acd_not_supported, self->priv.p->nacd_acd_not_supported); return NULL; } @@ -1192,11 +1192,11 @@ again: failed_create_acd: /* is-internal-error means that we failed to create the NAcd instance. Most likely due - * to being unable to create a file descriptor. Anyway, something is seriously wrong here. - * - * Otherwise, the MAC address might just not be suitable (ETH_ALEN) or we might have - * not NMPlatformLink. In that case, it means the interface is currently not ready to - * do acd. */ + * to being unable to create a file descriptor. Anyway, something is seriously wrong here. + * + * Otherwise, the MAC address might just not be suitable (ETH_ALEN) or we might have + * not NMPlatformLink. In that case, it means the interface is currently not ready to + * do acd. */ self->priv.p->nacd_acd_not_supported = acd_not_supported; _l3_acd_nacd_instance_reset(self, NM_TERNARY_TRUE, FALSE); goto again; @@ -1246,7 +1246,7 @@ _l3_acd_data_free_trackers(NML3Cfg *self, AcdData *acd_data, gboolean all /* or &acd_data->acd_track_lst_head, acd_track_lst) { /* If not "all" is requested, we only delete the dirty ones - * (and mark the survivors as dirty right away). */ + * (and mark the survivors as dirty right away). */ if (!all && !acd_track->acd_dirty) { acd_track->acd_dirty = TRUE; continue; @@ -1300,7 +1300,7 @@ _l3_acd_data_add(NML3Cfg * self, if (acd_timeout_msec > ACD_MAX_TIMEOUT_MSEC) { /* we limit the maximum timeout. Otherwise we have to handle integer overflow - * when adding timeouts. */ + * when adding timeouts. */ acd_timeout_msec = ACD_MAX_TIMEOUT_MSEC; } @@ -1376,9 +1376,9 @@ _l3_acd_data_add_all(NML3Cfg *self, const L3ConfigData *const *infos, guint info } /* Then we do a pre-flight check, whether some of the acd_data entries can already - * move forward to automatically pass ACD. That is the case if acd_timeout_msec - * is zero (to disable ACD) or if the address is already configured on the - * interface. */ + * move forward to automatically pass ACD. That is the case if acd_timeout_msec + * is zero (to disable ACD) or if the address is already configured on the + * interface. */ c_list_for_each_entry (acd_data, &self->priv.p->acd_lst_head, acd_lst) _l3_acd_data_state_change(self, acd_data, ACD_STATE_CHANGE_MODE_INIT, NULL); } @@ -1605,20 +1605,20 @@ _l3_acd_data_state_change(NML3Cfg * self, gboolean was_probing; /* Keeping track of ACD inevitably requires keeping (and mutating) state. Then a multitude of - * things can happen, and depending on the state, we need to do something. - * - * Here, all the state for one address that we probe/announce is tracked in AcdData/acd_data. - * - * The acd_data has a list of AcdTrackData/acd_track_lst_head, which are configuration items - * that are interested in configuring this address. The "owners" of the ACD check for a certain - * address. - * - * We try to do all the state changes in this _l3_acd_data_state_change() function, where -- - * depending on the @state_change_mode -- we progress the state. - * - * It is complicated, but I think this is not really avoidable if you want to handle all - * the special things (state-changes) that can happen. - */ + * things can happen, and depending on the state, we need to do something. + * + * Here, all the state for one address that we probe/announce is tracked in AcdData/acd_data. + * + * The acd_data has a list of AcdTrackData/acd_track_lst_head, which are configuration items + * that are interested in configuring this address. The "owners" of the ACD check for a certain + * address. + * + * We try to do all the state changes in this _l3_acd_data_state_change() function, where -- + * depending on the @state_change_mode -- we progress the state. + * + * It is complicated, but I think this is not really avoidable if you want to handle all + * the special things (state-changes) that can happen. + */ nm_assert(NM_IS_L3CFG(self)); nm_assert(acd_data); @@ -1633,15 +1633,15 @@ _l3_acd_data_state_change(NML3Cfg * self, gboolean any_no_timeout; /* we are called from _l3_acd_data_add_all(), and we do a fast check whether - * newly tracked entries already passed ACD so that we can use the address - * right away. */ + * newly tracked entries already passed ACD so that we can use the address + * right away. */ if (_l3_acd_ipv4_addresses_on_link_contains(self, acd_data->addr)) { /* the address is already configured on the link. It is an automatic pass. */ if (_acd_data_collect_tracks_data(acd_data, FALSE, NM_TERNARY_DEFAULT, NULL) <= 0) { /* The entry has no non-dirty trackers, that means, it's no longer referenced - * and will be removed during the next _l3_acd_data_prune(). We can ignore - * this entry. */ + * and will be removed during the next _l3_acd_data_prune(). We can ignore + * this entry. */ return; } log_reason = "address initially already configured"; @@ -1649,10 +1649,10 @@ _l3_acd_data_state_change(NML3Cfg * self, } /* we are called at the end of _l3_acd_data_add_all(). We updated the list of a - * all tracked IP addresses before we actually collect the addresses that are - * ready. We don't do regular handling of ACD states at this point, however, - * we check whether ACD for new elements is disabled entirely, so we can signal - * the address are ready right away (without going through another hop). */ + * all tracked IP addresses before we actually collect the addresses that are + * ready. We don't do regular handling of ACD states at this point, however, + * we check whether ACD for new elements is disabled entirely, so we can signal + * the address are ready right away (without going through another hop). */ if (acd_data->acd_state != ACD_STATE_INIT) { /* this element is not new and we don't perform the quick-check. */ @@ -1671,14 +1671,14 @@ _l3_acd_data_state_change(NML3Cfg * self, } if (!any_no_timeout) { /* there are elements that request the address, but they all specify - * an ACD timeout. We cannot progress the state. */ + * an ACD timeout. We cannot progress the state. */ return; } /* ACD is disabled, we can artificially moving the state further to - * ACD_STATE_PROBE_DONE and configure the address right away. This avoids - * that we go through another hop. - */ + * ACD_STATE_PROBE_DONE and configure the address right away. This avoids + * that we go through another hop. + */ log_reason = "ACD disabled by configuration from the start"; goto handle_probing_acd_good; } @@ -1732,10 +1732,10 @@ _l3_acd_data_state_change(NML3Cfg * self, } /* probing started (with the original timeout. Note that acd_data->probing_time*_msec - * no longer corresponds to the actual timeout of the nacd_probe. This is not a problem - * because at this point we only trust the internal timer from nacd_probe to get - * it right. Instead, we keep acd_data->probing_time*_msec unchanged, to remember when - * we originally wanted to start. */ + * no longer corresponds to the actual timeout of the nacd_probe. This is not a problem + * because at this point we only trust the internal timer from nacd_probe to get + * it right. Instead, we keep acd_data->probing_time*_msec unchanged, to remember when + * we originally wanted to start. */ _LOGT_acd(acd_data, "state: probing started (after retry, timeout %u msec)", acd_data->probing_timeout_msec); @@ -1744,7 +1744,7 @@ _l3_acd_data_state_change(NML3Cfg * self, if (acd_data->acd_state == ACD_STATE_PROBE_DONE && !acd_data->probe_result) { /* Probing is done, but previously we detected a conflict. After a restart, we retry to - * probe. */ + * probe. */ nm_assert(!acd_data->nacd_probe); nm_assert(!acd_data->announcing_failed_is_retrying); @@ -1806,26 +1806,26 @@ _l3_acd_data_state_change(NML3Cfg * self, case ACD_STATE_CHANGE_MODE_EXTERNAL_REMOVED: /* The address got removed. Either we ourself removed it or it was removed externally. - * In either case, it's not clear what we should do about that, regardless in which - * ACD state we are, so ignore it. */ + * In either case, it's not clear what we should do about that, regardless in which + * ACD state we are, so ignore it. */ _LOGT_acd(acd_data, "state: address was externally removed. Ignore"); return; case ACD_STATE_CHANGE_MODE_NACD_DOWN: if (acd_data->acd_state < ACD_STATE_PROBE_DONE) { /* we are probing, but the probe has a problem that the link went down. Maybe - * we need to restart. */ + * we need to restart. */ nm_assert(acd_data->acd_state == ACD_STATE_PROBING); if (!acd_data->nacd_probe) { /* we are in probing state, but currently not really probing. A timer is - * running, and we will handle this situation that way. */ + * running, and we will handle this situation that way. */ return; } /* We abort the probing, but we also schedule a timer to restart it. Let - * the regular re-start handling handle this. */ + * the regular re-start handling handle this. */ _LOGT_acd(acd_data, "state: interface-down. Probing aborted but we keep waiting to retry"); acd_data->nacd_probe = n_acd_probe_free(acd_data->nacd_probe); @@ -1834,9 +1834,9 @@ _l3_acd_data_state_change(NML3Cfg * self, } /* We already completed a probe and acted accordingly (by either configuring the address - * already or by rejecting it). We cannot (easily) re-evaluate what to do now. Should - * we later restart probing? But what about the decisions we already made?? - * Ignore the situation. */ + * already or by rejecting it). We cannot (easily) re-evaluate what to do now. Should + * we later restart probing? But what about the decisions we already made?? + * Ignore the situation. */ return; case ACD_STATE_CHANGE_MODE_LINK_NOW_UP: @@ -1855,7 +1855,7 @@ _l3_acd_data_state_change(NML3Cfg * self, if (!acd_data->nacd_probe) { /* We currently are waiting to restart probing. We don't handle the link-up - * event here, we only trigger a timeout right away. */ + * event here, we only trigger a timeout right away. */ _LOGT_acd(acd_data, "state: ignore link up event while we are waiting to start probing"); _l3_acd_data_timeout_schedule(acd_data, now_msec, now_msec, TRUE); @@ -1864,7 +1864,7 @@ _l3_acd_data_state_change(NML3Cfg * self, if (acd_data->probing_timestamp_msec + ACD_WAIT_PROBING_RESTART_TIME_MSEC >= now_msec) { /* This probe was already started quite a while ago. We ignore the link-up event - * and let it complete regularly. This is to avoid restarting to probing indefinitely. */ + * and let it complete regularly. This is to avoid restarting to probing indefinitely. */ _LOGT_acd(acd_data, "state: ignore link up event for a probe started long ago"); return; } @@ -1886,13 +1886,13 @@ _l3_acd_data_state_change(NML3Cfg * self, NM_SWAP(&probe, &acd_data->nacd_probe); /* We just restarted probing. Note that we don't touch the original acd_data->probing_time*_msec - * times, otherwise a repeated link up/down cycle could extend the probing indefinitely. - * - * This is despite the new probe just started counting now. So, at this point, the - * timestamp/timeout of acd_data no longer corresponds to the internal timestamp of - * acd_data->nacd_probe. But since we don't run our own timer against the internal timer of - * acd_data->nacd_probe, that is not a problem. - */ + * times, otherwise a repeated link up/down cycle could extend the probing indefinitely. + * + * This is despite the new probe just started counting now. So, at this point, the + * timestamp/timeout of acd_data no longer corresponds to the internal timestamp of + * acd_data->nacd_probe. But since we don't run our own timer against the internal timer of + * acd_data->nacd_probe, that is not a problem. + */ _LOGT_acd(acd_data, "state: probing restarted (after link up, new timeout %u msec)", acd_data->probing_timeout_msec); @@ -1900,7 +1900,7 @@ _l3_acd_data_state_change(NML3Cfg * self, } /* we are already done with the ACD state. Bringing up an interface has - * no further consequence w.r.t. the ACD state. */ + * no further consequence w.r.t. the ACD state. */ return; case ACD_STATE_CHANGE_MODE_INSTANCE_RESET: @@ -1935,7 +1935,7 @@ _l3_acd_data_state_change(NML3Cfg * self, handle_post_commit: /* we just did a commit of the IP configuration and now visit all ACD states - * and kick off the necessary actions... */ + * and kick off the necessary actions... */ if (_l3_acd_ipv4_addresses_on_link_contains(self, acd_data->addr)) { log_reason = "address already configured"; goto handle_probing_acd_good; @@ -2006,15 +2006,15 @@ handle_post_commit: if (!acd_data->nacd_probe) { /* we are currently waiting for restarting a probe. At this point, at most we have - * to adjust the timeout/timestamp and let the regular timeouts handle this. */ + * to adjust the timeout/timestamp and let the regular timeouts handle this. */ if (new_expiry_msec >= old_expiry_msec) { /* the running timeout expires before the new timeout. We don't update the timestamp/timerout, - * because we don't want to prolong the overall probing time. */ + * because we don't want to prolong the overall probing time. */ return; } /* update the timers after out timeout got reduced. Also, reschedule the timeout - * so that it expires immediately. */ + * so that it expires immediately. */ acd_data->probing_timestamp_msec = now_msec; acd_data->probing_timeout_msec = acd_timeout_msec; _l3_acd_data_timeout_schedule(acd_data, now_msec, now_msec, TRUE); @@ -2023,7 +2023,7 @@ handle_post_commit: if (new_expiry_msec >= old_expiry_msec) { /* we already have ACD running with a timeout that expires before the requested one. There - * is nothing to do at this time. */ + * is nothing to do at this time. */ return; } @@ -2057,8 +2057,8 @@ handle_post_commit: } /* We update the timestamps (after also restarting the probe). - * - * Note that we only reduced the overall expiry. */ + * + * Note that we only reduced the overall expiry. */ acd_data->probing_timestamp_msec = now_msec; acd_data->probing_timeout_msec = acd_timeout_msec; _LOGT_acd(acd_data, "state: restart probing (timeout %u msec)", acd_timeout_msec); @@ -2116,7 +2116,7 @@ handle_probe_done: nm_assert(acd_data->acd_state == ACD_STATE_PROBE_DONE); nm_assert(!acd_data->nacd_probe); /* we just completed probing with negative result. - * Emit a signal, but also reschedule a timer to restart. */ + * Emit a signal, but also reschedule a timer to restart. */ if (was_probing) { _LOGT_acd(acd_data, "state: acd probe failed; signal failure"); acd_data->probing_timestamp_msec = @@ -2146,7 +2146,7 @@ handle_probe_done: if (acd_data->announcing_failed_is_retrying) { /* we already failed to create a probe. We are ratelimited to retry, but - * we have a timer pending... */ + * we have a timer pending... */ return; } @@ -2158,7 +2158,7 @@ handle_probe_done: &failure_reason); if (!probe) { /* we failed to create a probe for announcing the address. We log a (rate limited) - * warning and start a timer to retry. */ + * warning and start a timer to retry. */ _LOGT_acd(acd_data, "state: start announcing failed to create probe (%s)", failure_reason); @@ -2248,11 +2248,11 @@ _l3_config_datas_get_sorted_cmp(gconstpointer p_a, gconstpointer p_b, gpointer u nm_assert(nm_l3_config_data_get_ifindex(a->l3cd) == nm_l3_config_data_get_ifindex(b->l3cd)); /* we sort the entries with higher priority (more important, lower numerical value) - * first. */ + * first. */ NM_CMP_FIELD(a, b, priority); /* if the priority is not unique, we sort them in the order they were added, - * with the oldest first (lower numerical value). */ + * with the oldest first (lower numerical value). */ NM_CMP_FIELD(a, b, pseudo_timestamp); return nm_assert_unreachable_val(0); @@ -2646,8 +2646,8 @@ _routes_temporary_not_available_timeout(gpointer user_data) return G_SOURCE_REMOVE; /* we check the timeouts again. That is, because we allow to remove - * entries from routes_temporary_not_available_hash, without rescheduling - * out timeouts. */ + * entries from routes_temporary_not_available_hash, without rescheduling + * out timeouts. */ now_msec = nm_utils_get_monotonic_timestamp_msec(); @@ -2666,7 +2666,7 @@ _routes_temporary_not_available_timeout(gpointer user_data) if (any_expired) { /* a route expired. We emit a signal, but we don't schedule it again. That will - * only happen if the user calls nm_l3cfg_platform_commit() again. */ + * only happen if the user calls nm_l3cfg_platform_commit() again. */ _nm_l3cfg_emit_signal_notify( self, NM_L3_CONFIG_NOTIFY_TYPE_ROUTES_TEMPORARY_NOT_AVAILABLE_EXPIRED, @@ -2827,7 +2827,7 @@ _platform_commit(NML3Cfg * self, if (changed_combined_l3cd) { /* our combined configuration changed. We may track entries in externally_removed_objs_hash, - * which are not longer to be considered by our configuration. We need to forget about them. */ + * which are not longer to be considered by our configuration. We need to forget about them. */ _l3cfg_externally_removed_objs_drop_unused(self); } @@ -2880,9 +2880,9 @@ _platform_commit(NML3Cfg * self, route_table_sync); } else if (commit_type == NM_L3_CFG_COMMIT_TYPE_UPDATE) { /* during update, we do a cross with the previous configuration. - * - * Of course, if an entry is both to be pruned and to be added, then - * the latter wins. So, this works just nicely. */ + * + * Of course, if an entry is both to be pruned and to be added, then + * the latter wins. So, this works just nicely. */ if (l3cd_old) { const NMDedupMultiHeadEntry *head_entry; @@ -2943,8 +2943,8 @@ nm_l3cfg_platform_commit(NML3Cfg *self, NML3CfgCommitType commit_type) switch (commit_type) { case NM_L3_CFG_COMMIT_TYPE_AUTO: /* if in "AUTO" mode we currently have commit-type "UPDATE", that - * causes also the following update to still be "UPDATE". Either - * the same commit */ + * causes also the following update to still be "UPDATE". Either + * the same commit */ commit_type_detected = TRUE; commit_type = nm_l3cfg_commit_type_get(self); if (commit_type == NM_L3_CFG_COMMIT_TYPE_UPDATE) @@ -3129,12 +3129,12 @@ nm_l3cfg_has_commited_ip6_addresses_pending_dad(NML3Cfg *self) return FALSE; /* we iterate over all addresses in platform, and check whether the tentative - * addresses are tracked by our l3cd. Not the other way around, because we assume - * that there are few addresses in platform that are still tentative, so - * we only need to lookup few platform addresses in l3cd. - * - * Of course, all lookups are O(1) anyway, so in any case the operation is - * O(n) (once "n" being the addresses in platform, and once in l3cd). */ + * addresses are tracked by our l3cd. Not the other way around, because we assume + * that there are few addresses in platform that are still tentative, so + * we only need to lookup few platform addresses in l3cd. + * + * Of course, all lookups are O(1) anyway, so in any case the operation is + * O(n) (once "n" being the addresses in platform, and once in l3cd). */ nmp_lookup_init_object(&plat_lookup, NMP_OBJECT_TYPE_IP6_ADDRESS, self->priv.ifindex); diff --git a/src/nm-l3cfg.h b/src/nm-l3cfg.h index 3b76d43607..0129554fee 100644 --- a/src/nm-l3cfg.h +++ b/src/nm-l3cfg.h @@ -27,9 +27,9 @@ typedef enum { NM_L3_CONFIG_NOTIFY_TYPE_POST_COMMIT, /* NML3Cfg hooks to the NMPlatform signals for link, addresses and routes. - * It re-emits the signal on an idle handler. The purpose is for something - * like NMDevice which is already subscribed to these signals, it can get the - * notifications without also subscribing directly to the platform. */ + * It re-emits the signal on an idle handler. The purpose is for something + * like NMDevice which is already subscribed to these signals, it can get the + * notifications without also subscribing directly to the platform. */ NM_L3_CONFIG_NOTIFY_TYPE_PLATFORM_CHANGE_ON_IDLE, _NM_L3_CONFIG_NOTIFY_TYPE_NUM, @@ -191,26 +191,26 @@ gboolean nm_l3cfg_remove_config_all(NML3Cfg *self, gconstpointer tag, gboolean o typedef enum _nm_packed { /* the NML3Cfg instance tracks with nm_l3cfg_commit_setup_register() the requested commit type. - * Use _NM_L3_CFG_COMMIT_TYPE_AUTO to automatically choose the level as requested. */ + * Use _NM_L3_CFG_COMMIT_TYPE_AUTO to automatically choose the level as requested. */ NM_L3_CFG_COMMIT_TYPE_AUTO, /* Don't touch the interface. */ NM_L3_CFG_COMMIT_TYPE_NONE, /* ASSUME means to keep any pre-existing extra routes/addresses, while - * also not adding routes/addresses that are not present yet. This is to - * gracefully take over after restart, where the existing IP configuration - * should not change. */ + * also not adding routes/addresses that are not present yet. This is to + * gracefully take over after restart, where the existing IP configuration + * should not change. */ NM_L3_CFG_COMMIT_TYPE_ASSUME, /* UPDATE means to add new addresses/routes, while also removing addresses/routes - * that are no longer present (but were previously configured by NetworkManager). - * Routes/addresses that were removed externally won't be re-added, and routes/addresses - * that are added externally won't be removed. */ + * that are no longer present (but were previously configured by NetworkManager). + * Routes/addresses that were removed externally won't be re-added, and routes/addresses + * that are added externally won't be removed. */ NM_L3_CFG_COMMIT_TYPE_UPDATE, /* This is a full sync. It configures the IP addresses/routes that are indicated, - * while removing the existing ones from the interface. */ + * while removing the existing ones from the interface. */ NM_L3_CFG_COMMIT_TYPE_REAPPLY, } NML3CfgCommitType; diff --git a/src/nm-logging.c b/src/nm-logging.c index 35229221e8..f261e7c9e8 100644 --- a/src/nm-logging.c +++ b/src/nm-logging.c @@ -99,11 +99,11 @@ typedef struct { const char *syslog_identifier; /* before we setup syslog (during start), the backend defaults to GLIB, meaning: - * we use g_log() for all logging. At that point, the application is not yet supposed - * to do any logging and doing so indicates a bug. - * - * Afterwards, the backend is either SYSLOG or JOURNAL. From that point, also - * g_log() is redirected to this backend via a logging handler. */ + * we use g_log() for all logging. At that point, the application is not yet supposed + * to do any logging and doing so indicates a bug. + * + * Afterwards, the backend is either SYSLOG or JOURNAL. From that point, also + * g_log() is redirected to this backend via a logging handler. */ LogBackend log_backend; } Global; @@ -117,8 +117,8 @@ static GlobalMain gl_main = {}; static union { /* a union with an immutable and a mutable alias for the Global. - * Since nm-logging must be thread-safe, we must take care at which - * places we only read value ("imm") and where we modify them ("mut"). */ + * Since nm-logging must be thread-safe, we must take care at which + * places we only read value ("imm") and where we modify them ("mut"). */ Global mut; const Global imm; } gl = { @@ -134,9 +134,9 @@ static union { NMLogDomain _nm_logging_enabled_state[_LOGL_N_REAL] = { /* nm_logging_setup ("INFO", LOGD_DEFAULT_STRING, NULL, NULL); - * - * Note: LOGD_VPN_PLUGIN is special and must be disabled for - * DEBUG and TRACE levels. */ + * + * Note: LOGD_VPN_PLUGIN is special and must be disabled for + * DEBUG and TRACE levels. */ [LOGL_INFO] = LOGD_DEFAULT, [LOGL_WARN] = LOGD_DEFAULT, [LOGL_ERR] = LOGD_DEFAULT, @@ -305,8 +305,8 @@ nm_logging_setup(const char *level, const char *domains, char **bad_domains, GEr NMLogDomain bits; /* LOGD_VPN_PLUGIN is protected, that is, when setting ALL or DEFAULT, - * it does not enable the verbose levels DEBUG and TRACE, because that - * may expose sensitive data. */ + * it does not enable the verbose levels DEBUG and TRACE, because that + * may expose sensitive data. */ NMLogDomain protect = LOGD_NONE; p = strchr(s, ':'); @@ -321,8 +321,8 @@ nm_logging_setup(const char *level, const char *domains, char **bad_domains, GEr if (domains_free) { /* The caller didn't provide any domains to set (`nmcli general logging level DEBUG`). - * We reset all domains that were previously set, but we still want to protect - * VPN_PLUGIN domain. */ + * We reset all domains that were previously set, but we still want to protect + * VPN_PLUGIN domain. */ protect = LOGD_VPN_PLUGIN; } @@ -401,8 +401,8 @@ nm_logging_setup(const char *level, const char *domains, char **bad_domains, GEr if (had_platform_debug && !_nm_logging_enabled_lockfree(LOGL_DEBUG, LOGD_PLATFORM)) { /* when debug logging is enabled, platform will cache all access to - * sysctl. When the user disables debug-logging, we want to clear that - * cache right away. */ + * sysctl. When the user disables debug-logging, we want to clear that + * cache right away. */ _nm_logging_clear_platform_logging_cache(); } @@ -462,8 +462,8 @@ _domains_to_string(gboolean include_level_override, int i; /* We don't just return g_strdup() the logging domains that were set during - * nm_logging_setup(), because we want to expand "DEFAULT" and "ALL". - */ + * nm_logging_setup(), because we want to expand "DEFAULT" and "ALL". + */ str = g_string_sized_new(75); for (diter = &domain_desc[0]; diter->name; diter++) { @@ -532,7 +532,7 @@ again: nm_utils_strbuf_append_str(&buf_p, &buf_l, LOGD_ALL_STRING); /* Did you modify the logging domains (or their names)? Adjust the size of - * _all_logging_domains_to_str buffer above to have the exact size. */ + * _all_logging_domains_to_str buffer above to have the exact size. */ nm_assert(strlen(_all_logging_domains_to_str) == sizeof(_all_logging_domains_to_str) - 1); nm_assert(buf_l == 1); @@ -669,8 +669,8 @@ _nm_log_impl(const char *file, if (G_UNLIKELY(mt_require_locking)) { G_LOCK(log); /* we evaluate logging-enabled under lock. There is still a race that - * we might log the message below *after* logging was disabled. That means, - * when disabling logging, we might still log messages. */ + * we might log the message below *after* logging was disabled. That means, + * when disabling logging, we might still log messages. */ if (!_nm_logging_enabled_lockfree(level, domain)) { G_UNLOCK(log); return; @@ -858,7 +858,7 @@ nm_log_handler(const char *log_domain, GLogLevelFlags level, const char *message } /* we don't need any locking here. The glib log handler gets only registered - * once during nm_logging_init() and the global data is not modified afterwards. */ + * once during nm_logging_init() and the global data is not modified afterwards. */ nm_assert(gl.imm.init_done); if (gl.imm.debug_stderr) @@ -913,8 +913,8 @@ void nm_logging_init_pre(const char *syslog_identifier, char *prefix_take) { /* this function may be called zero or one times, and only - * - on the main thread - * - not after nm_logging_init(). */ + * - on the main thread + * - not after nm_logging_init(). */ NM_ASSERT_ON_MAIN_THREAD(); @@ -951,7 +951,7 @@ nm_logging_init(const char *logging_backend, gboolean debug) LogBackend x_log_backend; /* this function may be called zero or one times, and only on the - * main thread. */ + * main thread. */ NM_ASSERT_ON_MAIN_THREAD(); @@ -967,11 +967,11 @@ nm_logging_init(const char *logging_backend, gboolean debug) if (nm_streq(logging_backend, NM_LOG_CONFIG_BACKEND_DEBUG)) { /* "debug" was wrongly documented as a valid logging backend. It makes no sense however, - * because printing to stderr only makes sense when not demonizing. Whether to daemonize - * is only controlled via command line arguments (--no-daemon, --debug) and not via the - * logging backend from configuration. - * - * Fall back to the default. */ + * because printing to stderr only makes sense when not demonizing. Whether to daemonize + * is only controlled via command line arguments (--no-daemon, --debug) and not via the + * logging backend from configuration. + * + * Fall back to the default. */ logging_backend = "" NM_CONFIG_DEFAULT_LOGGING_BACKEND; obsolete_debug_backend = TRUE; } @@ -983,7 +983,7 @@ nm_logging_init(const char *logging_backend, gboolean debug) x_log_backend = LOG_BACKEND_JOURNAL; /* We only log the monotonic-timestamp with structured logging (journal). - * Only in this case, fetch the timestamp. */ + * Only in this case, fetch the timestamp. */ fetch_monotonic_timestamp = TRUE; } else #endif @@ -1006,7 +1006,7 @@ nm_logging_init(const char *logging_backend, gboolean debug) if (fetch_monotonic_timestamp) { /* ensure we read a monotonic timestamp. Reading the timestamp the first - * time causes a logging message. We don't want to do that during _nm_log_impl. */ + * time causes a logging message. We don't want to do that during _nm_log_impl. */ nm_utils_get_monotonic_timestamp_nsec(); } diff --git a/src/nm-manager.c b/src/nm-manager.c index a31ce013f7..e86d16c22d 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -401,8 +401,8 @@ _connection_is_vpn(NMConnection *connection) return nm_streq(type, NM_SETTING_VPN_SETTING_NAME); /* we have an incomplete (invalid) connection at hand. That can only - * happen during AddAndActivate. Determine whether it's VPN type based - * on the existence of a [vpn] section. */ + * happen during AddAndActivate. Determine whether it's VPN type based + * on the existence of a [vpn] section. */ return !!nm_connection_get_setting_vpn(connection); } @@ -587,9 +587,9 @@ _device_route_metric_data_new(int ifindex, guint32 aspired_metric, guint32 effec nm_assert(ifindex > 0); /* For IPv4, metrics can use the entire uint32 bit range. For IPv6, - * zero is treated like 1024. Since we handle IPv4 and IPv6 identically, - * we cannot allow a zero metric here. - */ + * zero is treated like 1024. Since we handle IPv4 and IPv6 identically, + * we cannot allow a zero metric here. + */ nm_assert(aspired_metric > 0); nm_assert(effective_metric == 0 || aspired_metric <= effective_metric); @@ -677,8 +677,8 @@ _device_route_metric_get(NMManager * self, continue; if (!nm_platform_link_get(priv->platform, device_state->ifindex)) { /* we have the entry in the state file, but (currently) no such - * ifindex exists in platform. Most likely the entry is obsolete, - * hence we skip it. */ + * ifindex exists in platform. Most likely the entry is obsolete, + * hence we skip it. */ continue; } if (!g_hash_table_add( @@ -707,13 +707,13 @@ initited: n_links = all_links_head ? all_links_head->len : 0; /* on systems where a lot of devices are created and go away, the index contains - * a lot of stale entries. We must from time to time clean them up. - * - * Do do this cleanup, whenever we have more entries then 2 times the number of links. */ + * a lot of stale entries. We must from time to time clean them up. + * + * Do do this cleanup, whenever we have more entries then 2 times the number of links. */ if (G_UNLIKELY(g_hash_table_size(priv->device_route_metrics) > NM_MAX(20, n_links * 2))) { /* from time to time, we need to do some house-keeping and prune stale entries. - * Otherwise, on a system where interfaces frequently come and go (docker), we - * keep growing this cache for ifindexes that no longer exist. */ + * Otherwise, on a system where interfaces frequently come and go (docker), we + * keep growing this cache for ifindexes that no longer exist. */ g_hash_table_iter_init(&h_iter, priv->device_route_metrics); while (g_hash_table_iter_next(&h_iter, NULL, (gpointer *) &d2)) { if (!nm_platform_link_get(priv->platform, d2->ifindex)) @@ -727,13 +727,13 @@ initited: _device_route_metric_data_new(ifindex, nm_device_get_route_metric_default(device_type), 0); /* unfortunately, there is no stright forward way to lookup all reserved metrics. - * Note, that we don't only have to know which metrics are currently reserved, - * but also, which metrics are now seemingly un-used but caused another reserved - * metric to be bumped. Hence, the naive O(n^2) search :( - * - * Well, technically, since we limit bumping the metric to 50, this entire - * loop runs at most 50 times, so it's still O(n). Let's just say, it's not - * very efficient. */ + * Note, that we don't only have to know which metrics are currently reserved, + * but also, which metrics are now seemingly un-used but caused another reserved + * metric to be bumped. Hence, the naive O(n^2) search :( + * + * Well, technically, since we limit bumping the metric to 50, this entire + * loop runs at most 50 times, so it's still O(n). Let's just say, it's not + * very efficient. */ again: g_hash_table_iter_init(&h_iter, priv->device_route_metrics); while (g_hash_table_iter_next(&h_iter, NULL, (gpointer *) &d2)) { @@ -744,28 +744,28 @@ again: } if (!cleaned && !nm_platform_link_get(priv->platform, d2->ifindex)) { /* the metric seems taken, but there is no such interface. This entry - * is stale, forget about it. */ + * is stale, forget about it. */ g_hash_table_iter_remove(&h_iter); continue; } if (d2->effective_metric == G_MAXUINT32) { /* we cannot bump the metric any further. Done. - * - * Actually, this can currently not happen because the aspired_metric - * are small numbers and we limit the bumping to 50. Still, for - * completeness... */ + * + * Actually, this can currently not happen because the aspired_metric + * are small numbers and we limit the bumping to 50. Still, for + * completeness... */ data->effective_metric = G_MAXUINT32; break; } if (d2->effective_metric - data->aspired_metric >= 50) { /* as one active interface reserves an entire range of metrics - * (from aspired_metric to effective_metric), that means if you - * alternatingly activate two interfaces, their metric will - * bump each other. - * - * Limit this, bump the metric at most 50 points. */ + * (from aspired_metric to effective_metric), that means if you + * alternatingly activate two interfaces, their metric will + * bump each other. + * + * Limit this, bump the metric at most 50 points. */ data->effective_metric = data->aspired_metric + 50; break; } @@ -905,10 +905,10 @@ active_connection_state_changed(NMActiveConnection *active, GParamSpec *pspec, N state = nm_active_connection_get_state(active); if (state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) { /* Destroy active connections from an idle handler to ensure that - * their last property change notifications go out, which wouldn't - * happen if we destroyed them immediately when their state was set - * to DEACTIVATED. - */ + * their last property change notifications go out, which wouldn't + * happen if we destroyed them immediately when their state was set + * to DEACTIVATED. + */ if (!priv->ac_cleanup_id) priv->ac_cleanup_id = g_idle_add(_active_connection_cleanup, self); @@ -1017,11 +1017,11 @@ active_connection_find( return NULL; /* as an optimization, we only allocate out_all_matching, if there are more - * than one result. If there is only one result, we only return the single - * element and don't bother allocating an array. That's the common case. - * - * Also, in case we have multiple results, we return the *first* one - * as @best_ac. */ + * than one result. If there is only one result, we only return the single + * element and don't bother allocating an array. That's the common case. + * + * Also, in case we have multiple results, we return the *first* one + * as @best_ac. */ nm_assert(!all || (all->len >= 2 && all->pdata[0] == best_ac)); *out_all_matching = all; @@ -1043,7 +1043,7 @@ active_connection_find_by_connection(NMManager * self, || connection == nm_settings_connection_get_connection(sett_conn)); /* Depending on whether connection is a settings connection, - * either lookup by object-identity of @connection, or compare the UUID */ + * either lookup by object-identity of @connection, or compare the UUID */ return active_connection_find(self, sett_conn, sett_conn ? NULL : nm_connection_get_uuid(connection), @@ -1077,7 +1077,7 @@ _get_activatable_connections_filter(NMSettings * settings, return TRUE; /* the connection is activatable, if it has no active-connections that are in state - * activated, activating, or waiting to be activated. */ + * activated, activating, or waiting to be activated. */ return !active_connection_find(d->self, sett_conn, NULL, @@ -1528,12 +1528,12 @@ manager_device_state_changed(NMDevice * device, G_STATIC_ASSERT_EXPR(DEVICE_STATE_PRUNE_RATELIMIT_MAX < G_MAXUINT8); if (priv->device_state_prune_ratelimit_count++ > DEVICE_STATE_PRUNE_RATELIMIT_MAX) { /* We write the device state to /run. The state files are named after the - * ifindex (which is assumed to be unique and not repeat -- in practice - * it may repeat). So from time to time, we prune device state files - * for interfaces that no longer exist. - * - * Otherwise, the files might pile up if you create (and destroy) a large - * number of software devices. */ + * ifindex (which is assumed to be unique and not repeat -- in practice + * it may repeat). So from time to time, we prune device state files + * for interfaces that no longer exist. + * + * Otherwise, the files might pile up if you create (and destroy) a large + * number of software devices. */ priv->device_state_prune_ratelimit_count = 0; nm_config_device_state_prune_stale(NULL, priv->platform); } @@ -1570,20 +1570,20 @@ check_if_startup_complete(NMManager *self) } /* All NMDevice must be ready. But also NMSettings tracks profiles that wait for - * ready devices via "connection.wait-device-timeout". - * - * Note that we only re-check nm_settings_get_startup_complete_blocked_reason() when - * all of the devices become ready (again). - * - * For example, assume we have device "eth1" and "profile-eth2" which waits for "eth2". - * If "eth1" is ready (no pending action), we only need to re-evaluate "profile-eth2" - * if we have another device ("eth2"), that becomes non-ready (had pending actions) - * and again become ready. We don't need to check "profile-eth2" until "eth2" becomes - * non-ready. - * That is why nm_settings_get_startup_complete_blocked_reason() only has any significance - * if all devices are ready too. It allows us to cut down the number of checks whether - * NMSettings is ready. That's because we don't need to re-evaluate on minor changes of - * a device, only when all devices become managed and ready. */ + * ready devices via "connection.wait-device-timeout". + * + * Note that we only re-check nm_settings_get_startup_complete_blocked_reason() when + * all of the devices become ready (again). + * + * For example, assume we have device "eth1" and "profile-eth2" which waits for "eth2". + * If "eth1" is ready (no pending action), we only need to re-evaluate "profile-eth2" + * if we have another device ("eth2"), that becomes non-ready (had pending actions) + * and again become ready. We don't need to check "profile-eth2" until "eth2" becomes + * non-ready. + * That is why nm_settings_get_startup_complete_blocked_reason() only has any significance + * if all devices are ready too. It allows us to cut down the number of checks whether + * NMSettings is ready. That's because we don't need to re-evaluate on minor changes of + * a device, only when all devices become managed and ready. */ g_signal_handlers_block_by_func(priv->settings, settings_startup_complete_changed, self); reason = nm_settings_get_startup_complete_blocked_reason(priv->settings, TRUE); @@ -1598,7 +1598,7 @@ check_if_startup_complete(NMManager *self) priv->startup = FALSE; /* we no longer care about these signals. Startup-complete only - * happens once. */ + * happens once. */ g_signal_handlers_disconnect_by_func(priv->settings, G_CALLBACK(settings_startup_complete_changed), self); @@ -1638,7 +1638,7 @@ again: c_list_for_each_entry (candidate, &priv->devices_lst_head, devices_lst) { if (nm_device_parent_notify_changed(candidate, device, device_removed)) { /* in the unlikely event that this changes anything, we start iterating - * again, to be sure that the device list is up-to-date. */ + * again, to be sure that the device list is up-to-date. */ goto again; } } @@ -1708,20 +1708,20 @@ remove_device(NMManager *self, NMDevice *device, gboolean quitting) gboolean unconfigure_ip_config = !quitting || unmanage; /* When we don't unmanage the device on shutdown, we want to preserve the DNS - * configuration in resolv.conf. For that, we must leak the configuration - * in NMPolicy/NMDnsManager. We do that, by emitting the device-removed signal - * with device's ip-config object still uncleared. In that case, NMPolicy - * never learns to unconfigure the ip-config objects and does not remove them - * from DNS on shutdown (which is ugly, because we don't cleanup the memory - * properly). - * - * Control that by passing @unconfigure_ip_config. */ + * configuration in resolv.conf. For that, we must leak the configuration + * in NMPolicy/NMDnsManager. We do that, by emitting the device-removed signal + * with device's ip-config object still uncleared. In that case, NMPolicy + * never learns to unconfigure the ip-config objects and does not remove them + * from DNS on shutdown (which is ugly, because we don't cleanup the memory + * properly). + * + * Control that by passing @unconfigure_ip_config. */ nm_device_removed(device, unconfigure_ip_config); _emit_device_added_removed(self, device, FALSE); } else { /* unrealize() does not release a slave device from master and - * clear IP configurations, do it here */ + * clear IP configurations, do it here */ nm_device_removed(device, TRUE); } @@ -1796,8 +1796,8 @@ find_parent_device_for_connection(NMManager * self, return NULL; /* Check if the parent connection is currently activated or is compatible - * with some known device. - */ + * with some known device. + */ c_list_for_each_entry (candidate, &priv->devices_lst_head, devices_lst) { /* Unmanaged devices are not compatible with any connection */ if (!nm_device_get_managed(candidate, FALSE)) @@ -2033,8 +2033,8 @@ system_create_virtual_device(NMManager *self, NMConnection *connection) } /* Add device takes a reference that NMManager still owns, so it's - * safe to unref here and still return @device. - */ + * safe to unref here and still return @device. + */ g_object_unref(device); } @@ -2151,8 +2151,8 @@ connection_changed(NMManager *self, NMSettingsConnection *sett_conn) return; /* Maybe the device that was created was needed by some other - * connection's device (parent of a VLAN). Let the connections - * can use the newly created device as a parent know. */ + * connection's device (parent of a VLAN). Let the connections + * can use the newly created device as a parent know. */ retry_connections_for_parent_device(self, device); } @@ -2217,7 +2217,7 @@ connection_flags_changed(NMSettings *settings, NMSettingsConnection *connection, NM_ACTIVE_CONNECTION_STATE_DEACTIVATED, NULL)) { /* the connection still has an active-connection. It will be purged - * when the active connection(s) get(s) removed. */ + * when the active connection(s) get(s) removed. */ return; } @@ -2363,10 +2363,10 @@ manager_rfkill_update_one_type(NMManager *self, RadioState *rstate, RfKillType r } /* And finally update the actual device radio state itself; respect the - * daemon state here because this is never called from user-triggered - * radio changes and we only want to ignore the daemon enabled state when - * handling user radio change requests. - */ + * daemon state here because this is never called from user-triggered + * radio changes and we only want to ignore the daemon enabled state when + * handling user radio change requests. + */ new_enabled = radio_enabled_for_rstate(rstate, TRUE); if (new_enabled != old_enabled) manager_update_radio_enabled(self, rstate, new_enabled); @@ -2579,9 +2579,9 @@ get_existing_connection(NMManager *self, NMDevice *device, gboolean *out_generat int master_ifindex = nm_platform_link_get_master(priv->platform, ifindex); /* Check that the master is activating before assuming a - * slave connection. However, ignore ovs-system master as - * we never manage it. - */ + * slave connection. However, ignore ovs-system master as + * we never manage it. + */ if (master_ifindex && nm_platform_link_get_type(priv->platform, master_ifindex) != NM_LINK_TYPE_OPENVSWITCH) { @@ -2607,16 +2607,16 @@ get_existing_connection(NMManager *self, NMDevice *device, gboolean *out_generat } /* The core of the API is nm_device_generate_connection() function and - * update_connection() virtual method and the convenient connection_type - * class attribute. Subclasses supporting the new API must have - * update_connection() implemented, otherwise nm_device_generate_connection() - * returns NULL. - */ + * update_connection() virtual method and the convenient connection_type + * class attribute. Subclasses supporting the new API must have + * update_connection() implemented, otherwise nm_device_generate_connection() + * returns NULL. + */ connection = nm_device_generate_connection(device, master, &maybe_later, &gen_error); if (!connection) { if (maybe_later) { /* The device can generate a connection, but it failed for now. - * Give it a chance to match a connection from the state file. */ + * Give it a chance to match a connection from the state file. */ only_by_uuid = TRUE; } else { nm_device_assume_state_reset(device); @@ -2631,14 +2631,14 @@ get_existing_connection(NMManager *self, NMDevice *device, gboolean *out_generat nm_device_assume_state_get(device, &assume_state_guess_assume, &assume_state_connection_uuid); /* Now we need to compare the generated connection to each configured - * connection. The comparison function is the heart of the connection - * assumption implementation and it must compare the connections very - * carefully to sort out various corner cases. Also, the comparison is - * not entirely symmetric. - * - * When no configured connection matches the generated connection, we keep - * the generated connection instead. - */ + * connection. The comparison function is the heart of the connection + * assumption implementation and it must compare the connections very + * carefully to sort out various corner cases. Also, the comparison is + * not entirely symmetric. + * + * When no configured connection matches the generated connection, we keep + * the generated connection instead. + */ if (assume_state_connection_uuid && (connection_checked = nm_settings_get_connection_by_uuid(priv->settings, assume_state_connection_uuid)) @@ -2673,7 +2673,7 @@ get_existing_connection(NMManager *self, NMDevice *device, gboolean *out_generat guint len, i, j; /* the state file doesn't indicate a connection UUID to assume. Search the - * persistent connections for a matching candidate. */ + * persistent connections for a matching candidate. */ sett_conns = nm_manager_get_activatable_connections(self, FALSE, FALSE, &len); if (len > 0) { for (i = 0, j = 0; i < len; i++) { @@ -2849,11 +2849,11 @@ recheck_assume_connection(NMManager *self, NMDevice *device) if (copy_lease(initramfs_lease, connection_lease)) { unlink(initramfs_lease); /* - * We've managed to steal the lease used by initramfs before it - * killed off the dhclient. We need to take ownership of the configured - * connection and act like the device was configured by us. - * Otherwise, the address would just expire. - */ + * We've managed to steal the lease used by initramfs before it + * killed off the dhclient. We need to take ownership of the configured + * connection and act like the device was configured by us. + * Otherwise, the address would just expire. + */ _LOG2I(LOGD_DEVICE, device, "assume: taking over an initramfs-configured connection"); activation_type_assume = TRUE; @@ -2906,16 +2906,16 @@ recheck_assume_connection(NMManager *self, NMDevice *device) subject = nm_auth_subject_new_internal(); /* Note: the lifetime of the activation connection is always bound to the profiles visibility - * via NM_ACTIVATION_STATE_FLAG_LIFETIME_BOUND_TO_PROFILE_VISIBILITY. - * - * This only makes a difference, if the profile actually has "connection.permissions" - * set to limit visibility (which is not the case for externally managed, generated profiles). - * - * If we assume a previously active connection whose lifetime was unbound, we now bind it - * after restart. That is not correct, and can mean that the profile becomes subject to - * deactivation after restart (if the user logs out). - * - * This should be improved, but it's unclear how. */ + * via NM_ACTIVATION_STATE_FLAG_LIFETIME_BOUND_TO_PROFILE_VISIBILITY. + * + * This only makes a difference, if the profile actually has "connection.permissions" + * set to limit visibility (which is not the case for externally managed, generated profiles). + * + * If we assume a previously active connection whose lifetime was unbound, we now bind it + * after restart. That is not correct, and can mean that the profile becomes subject to + * deactivation after restart (if the user logs out). + * + * This should be improved, but it's unclear how. */ active = _new_active_connection( self, FALSE, @@ -2995,10 +2995,10 @@ device_ip_iface_changed(NMDevice *device, GParamSpec *pspec, NMManager *self) NMDevice * candidate; /* Remove NMDevice objects that are actually child devices of others, - * when the other device finally knows its IP interface name. For example, - * remove the PPP interface that's a child of a WWAN device, since it's - * not really a standalone NMDevice. - */ + * when the other device finally knows its IP interface name. For example, + * remove the PPP interface that's a child of a WWAN device, since it's + * not really a standalone NMDevice. + */ c_list_for_each_entry (candidate, &priv->devices_lst_head, devices_lst) { if (candidate != device && nm_streq0(nm_device_get_iface(candidate), ip_iface) && nm_device_get_device_type(candidate) == device_type @@ -3013,8 +3013,8 @@ static void device_iface_changed(NMDevice *device, GParamSpec *pspec, NMManager *self) { /* Virtual connections may refer to the new device name as - * parent device, retry to activate them. - */ + * parent device, retry to activate them. + */ retry_connections_for_parent_device(self, device); } @@ -3048,7 +3048,7 @@ _get_best_connectivity(NMManager *self, int addr_family) best_state = _get_best_connectivity(self, AF_INET); if (nm_connectivity_state_cmp(best_state, NM_CONNECTIVITY_FULL) >= 0) { /* already FULL IPv4 connectivity. No need to check IPv6, it doesn't get - * better. */ + * better. */ return best_state; } return NM_MAX_WITH_CMP(nm_connectivity_state_cmp, @@ -3070,13 +3070,13 @@ _get_best_connectivity(NMManager *self, int addr_family) metric = NMP_OBJECT_CAST_IP_ROUTE(r)->metric; else { /* if all devices have no default-route, we still include the best - * of all connectivity state of all the devices. */ + * of all connectivity state of all the devices. */ metric = G_MAXINT64; } if (metric > best_metric) { /* we already have a default route with better metric. The connectivity state - * of this device is irreleavnt. */ + * of this device is irreleavnt. */ continue; } @@ -3142,7 +3142,7 @@ _device_realize_finish(NMManager *self, NMDevice *device, const NMPlatformLink * return; /* if we failed to assume a connection for the managed device, but the device - * is still unavailable. Set UNAVAILABLE state again, this time with NOW_MANAGED. */ + * is still unavailable. Set UNAVAILABLE state again, this time with NOW_MANAGED. */ nm_device_state_changed(device, NM_DEVICE_STATE_UNAVAILABLE, NM_DEVICE_STATE_REASON_NOW_MANAGED); @@ -3181,12 +3181,12 @@ add_device(NMManager *self, NMDevice *device, GError **error) } /* Remove existing devices owned by the new device; eg remove ethernet - * ports that are owned by a WWAN modem, since udev may announce them - * before the modem is fully discovered. - * - * FIXME: use parent/child device relationships instead of removing - * the child NMDevice entirely - */ + * ports that are owned by a WWAN modem, since udev may announce them + * before the modem is fully discovered. + * + * FIXME: use parent/child device relationships instead of removing + * the child NMDevice entirely + */ c_list_for_each_entry (candidate, &priv->devices_lst_head, devices_lst) { if (nm_device_is_real(candidate) && (iface = nm_device_get_ip_iface(candidate)) && nm_device_owns_iface(device, iface)) @@ -3246,9 +3246,9 @@ add_device(NMManager *self, NMDevice *device, GError **error) } /* Update global rfkill state for this device type with the device's - * rfkill state, and then set this device's rfkill state based on the - * global state. - */ + * rfkill state, and then set this device's rfkill state based on the + * global state. + */ rtype = nm_device_get_rfkill_type(device); if (rtype != RFKILL_TYPE_UNKNOWN) { nm_manager_rfkill_update(self, rtype); @@ -3358,15 +3358,15 @@ platform_link_added(NMManager * self, if (nm_device_is_real(candidate)) { /* There's already a realized device with the link's name - * and a different ifindex. - */ + * and a different ifindex. + */ if (nm_device_get_ifindex(candidate) <= 0) nm_device_update_from_platform_link(candidate, plink); else { /* The ifindex of a device can't be changed after - * initialization because it is used as a key by - * the dns-manager. - */ + * initialization because it is used as a key by + * the dns-manager. + */ _LOGD(LOGD_DEVICE, "(%s): removing old device %p after ifindex change from %d to %d", plink->name, @@ -3685,31 +3685,31 @@ nm_manager_get_best_device_for_connection(NMManager * self, flags = NM_DEVICE_CHECK_CON_AVAILABLE_NONE; else { /* if the profile is multi-connect=single, we also consider devices which - * are marked as unmanaged. And explicit user-request shows sufficient user - * intent to make the device managed. - * That is also, because we expect that such profile is suitably tied - * to the intended device. So when an unmanaged device matches, the user's - * intent is clear. - * - * For multi-connect != single devices that is different. The profile - * is not restricted to a particular device. - * For that reason, plain `nmcli connection up "$MULIT_PROFILE"` seems - * less suitable for multi-connect profiles, because the target device is - * left unspecified. Anyway, if a user issues - * - * $ nmcli device set "$DEVICE" managed no - * $ nmcli connection up "$MULIT_PROFILE" - * - * then it is reasonable for multi-connect profiles to not consider - * the device a suitable candidate. - * - * This may be seen inconsistent, but I think that it makes a lot of - * sense. Also note that "connection.multi-connect" work quite differently - * in aspects like activation. E.g. `nmcli connection up` of multi-connect - * "single" profile, will deactivate the profile if it is active already. - * That is different from multi-connect profiles, where it will aim to - * activate the profile one more time on an hitherto disconnected device. - */ + * are marked as unmanaged. And explicit user-request shows sufficient user + * intent to make the device managed. + * That is also, because we expect that such profile is suitably tied + * to the intended device. So when an unmanaged device matches, the user's + * intent is clear. + * + * For multi-connect != single devices that is different. The profile + * is not restricted to a particular device. + * For that reason, plain `nmcli connection up "$MULIT_PROFILE"` seems + * less suitable for multi-connect profiles, because the target device is + * left unspecified. Anyway, if a user issues + * + * $ nmcli device set "$DEVICE" managed no + * $ nmcli connection up "$MULIT_PROFILE" + * + * then it is reasonable for multi-connect profiles to not consider + * the device a suitable candidate. + * + * This may be seen inconsistent, but I think that it makes a lot of + * sense. Also note that "connection.multi-connect" work quite differently + * in aspects like activation. E.g. `nmcli connection up` of multi-connect + * "single" profile, will deactivate the profile if it is active already. + * That is different from multi-connect profiles, where it will aim to + * activate the profile one more time on an hitherto disconnected device. + */ if (multi_connect == NM_CONNECTION_MULTI_CONNECT_SINGLE) flags = NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST; else @@ -3724,12 +3724,12 @@ nm_manager_get_best_device_for_connection(NMManager * self, NM_ACTIVE_CONNECTION_STATE_DEACTIVATING, &all_ac_arr))) { /* if we have a profile which may activate on only one device (multi-connect single), then - * we prefer the device on which the profile is already active. It means to reactivate - * the profile on the same device. - * - * If the profile can be activated on multiple devices, we don't do this. In fact, the - * check below for the DeviceActivationPrio will prefer devices which are not already - * activated (with this or another) profile. */ + * we prefer the device on which the profile is already active. It means to reactivate + * the profile on the same device. + * + * If the profile can be activated on multiple devices, we don't do this. In fact, the + * check below for the DeviceActivationPrio will prefer devices which are not already + * activated (with this or another) profile. */ ac_device = nm_active_connection_get_device(ac); if (ac_device @@ -3766,7 +3766,7 @@ nm_manager_get_best_device_for_connection(NMManager * self, if (ac_state == ac_state2) { /* active-connections are in their list in the order in which they are connected. - * If we have two with same state, the later (newer) one is preferred. */ + * If we have two with same state, the later (newer) one is preferred. */ goto found_better; } @@ -3816,23 +3816,23 @@ found_better: continue; /* determine the priority of this device. Currently, this priority is independent - * of the profile (connection) and the device's details (aside the state). - * - * Maybe nm_device_check_connection_available() should instead return a priority, - * as it has more information available. - * - * For example, if you have multiple Wi-Fi devices, currently a user-request would - * also select the device if the AP is not visible. Optimally, if one of the two - * devices sees the AP and the other one doesn't, the former would be preferred. - * For that, the priority would need to be determined by nm_device_check_connection_available(). */ + * of the profile (connection) and the device's details (aside the state). + * + * Maybe nm_device_check_connection_available() should instead return a priority, + * as it has more information available. + * + * For example, if you have multiple Wi-Fi devices, currently a user-request would + * also select the device if the AP is not visible. Optimally, if one of the two + * devices sees the AP and the other one doesn't, the former would be preferred. + * For that, the priority would need to be determined by nm_device_check_connection_available(). */ prio = _device_get_activation_prio(device); if (prio <= best.prio && best.device) { /* we already have a matching device with a better priority. This candidate - * cannot be better. Skip the check. - * - * Also note, that below we collect the best error message @local_best. - * Since we already have best.device, the error message does not matter - * either, and we can skip nm_device_check_connection_available() altogether. */ + * cannot be better. Skip the check. + * + * Also note, that below we collect the best error message @local_best. + * Since we already have best.device, the error message does not matter + * either, and we can skip nm_device_check_connection_available() altogether. */ continue; } @@ -3843,7 +3843,7 @@ found_better: error ? &local : NULL)) { if (prio == _DEVICE_ACTIVATION_PRIO_BEST) { /* this device already has the best priority. It cannot get better - * and finish the search. */ + * and finish the search. */ return device; } best.prio = prio; @@ -4174,14 +4174,14 @@ ensure_master_active_connection(NMManager * self, NM_ACTIVATION_STATE_FLAG_LIFETIME_BOUND_TO_PROFILE_VISIBILITY); /* If the master device isn't activated then we need to activate it using - * compatible connection. If it's already activating we can just proceed. - */ + * compatible connection. If it's already activating we can just proceed. + */ if (master_device) { NMSettingsConnection *device_connection = nm_device_get_settings_connection(master_device); /* If we're passed a connection and a device, we require that connection - * be already activated on the device, eg returned from find_master(). - */ + * be already activated on the device, eg returned from find_master(). + */ g_assert(!master_connection || master_connection == device_connection); if (device_connection && !is_compatible_with_slave(nm_settings_connection_get_connection(device_connection), @@ -4211,8 +4211,8 @@ ensure_master_active_connection(NMManager * self, } /* If the device is disconnected, find a compatible connection and - * activate it on the device. - */ + * activate it on the device. + */ if (master_state == NM_DEVICE_STATE_DISCONNECTED || !nm_device_is_real(master_device)) { gs_free NMSettingsConnection **connections = NULL; guint i; @@ -4226,8 +4226,8 @@ ensure_master_active_connection(NMManager * self, NMConnection * cand_conn = nm_settings_connection_get_connection(candidate); /* Ensure eg bond/team slave and the candidate master is a - * bond/team master - */ + * bond/team master + */ if (!is_compatible_with_slave(cand_conn, connection)) continue; @@ -4357,9 +4357,9 @@ find_slaves(NMManager * manager, devices = g_hash_table_new(nm_direct_hash, NULL); /* Search through all connections, not only inactive ones, because - * even if a slave was already active, it might be deactivated during - * master reactivation. - */ + * even if a slave was already active, it might be deactivated during + * master reactivation. + */ all_connections = nm_settings_get_connections_clone( priv->settings, &n_all_connections, @@ -4390,7 +4390,7 @@ find_slaves(NMManager * manager, if (!slaves) { /* what we allocate is quite likely much too large. Don't bother, it is only - * a temporary buffer. */ + * a temporary buffer. */ slaves = g_new(SlaveConnectionInfo, n_all_connections); } @@ -4497,9 +4497,9 @@ autoconnect_slaves(NMManager * self, const char * uuid; /* To avoid loops when autoconnecting slaves, we propagate - * the UUID of the initial connection down to slaves until - * the same connection is found. - */ + * the UUID of the initial connection down to slaves until + * the same connection is found. + */ uuid = g_object_get_qdata(G_OBJECT(master_connection), autoconnect_root_quark()); if (nm_streq0(nm_settings_connection_get_uuid(slave->connection), uuid)) { _LOGI(LOGD_CORE, @@ -4586,9 +4586,9 @@ static void unmanaged_to_disconnected(NMDevice *device) { /* when creating the software device, it can happen that the device is - * still unmanaged by NM_UNMANAGED_PLATFORM_INIT because we didn't yet - * get the udev event. At this point, we can no longer delay the activation - * and force the device to be managed. */ + * still unmanaged by NM_UNMANAGED_PLATFORM_INIT because we didn't yet + * get the udev event. At this point, we can no longer delay the activation + * and force the device to be managed. */ nm_device_set_unmanaged_by_flags(device, NM_UNMANAGED_PLATFORM_INIT, FALSE, @@ -4628,27 +4628,27 @@ _activation_bind_lifetime_to_profile_visibility(NMAuthSubject *subject) } /* if the activation was not done by internal decision nor root, there - * are the following cases: - * - * - the connection has "connection.permissions" unset and the profile - * is not restricted to a user and commonly always visible. It does - * not hurt to bind the lifetime, because we expect the profile to be - * visible at the moment. If the profile changes (while still being active), - * we want to pick-up changes to the visibility and possibly disconnect. - * - * - the connection has "connection.permissions" set, and the current user - * is the owner: - * - * - Usually, we would expect that the profile is visible at the moment, - * and of course we want to bind the lifetime. The moment the user - * logs out, the connection becomes invisible and disconnects. - * - * - the profile at this time could already be invisible (e.g. if the - * user didn't create a proper session (sudo) and manually activates - * an invisible profile. In this case, we still want to bind the - * lifetime, and it will disconnect after the user logs in and logs - * out again. NMKeepAlive takes care of that. - */ + * are the following cases: + * + * - the connection has "connection.permissions" unset and the profile + * is not restricted to a user and commonly always visible. It does + * not hurt to bind the lifetime, because we expect the profile to be + * visible at the moment. If the profile changes (while still being active), + * we want to pick-up changes to the visibility and possibly disconnect. + * + * - the connection has "connection.permissions" set, and the current user + * is the owner: + * + * - Usually, we would expect that the profile is visible at the moment, + * and of course we want to bind the lifetime. The moment the user + * logs out, the connection becomes invisible and disconnects. + * + * - the profile at this time could already be invisible (e.g. if the + * user didn't create a proper session (sudo) and manually activates + * an invisible profile. In this case, we still want to bind the + * lifetime, and it will disconnect after the user logs in and logs + * out again. NMKeepAlive takes care of that. + */ return NM_ACTIVATION_STATE_FLAG_LIFETIME_BOUND_TO_PROFILE_VISIBILITY; } @@ -4727,10 +4727,10 @@ _internal_activate_device(NMManager *self, NMActiveConnection *active, GError ** applied = nm_active_connection_get_applied_connection(active); /* If the device is active and its connection is not visible to the - * user that's requesting this new activation, fail, since other users - * should not be allowed to implicitly deactivate private connections - * by activating a connection of their own. - */ + * user that's requesting this new activation, fail, since other users + * should not be allowed to implicitly deactivate private connections + * by activating a connection of their own. + */ existing_connection = nm_device_get_applied_connection(device); subject = nm_active_connection_get_subject(active); if (existing_connection @@ -4858,8 +4858,8 @@ _internal_activate_device(NMManager *self, NMActiveConnection *active, GError ** } /* Ensure there's a master active connection the new connection we're - * activating can depend on. - */ + * activating can depend on. + */ if (master_connection || master_device) { if (master_connection) { _LOGD(LOGD_CORE, @@ -4912,9 +4912,9 @@ _internal_activate_device(NMManager *self, NMActiveConnection *active, GError ** } /* Now that we're activating a slave for that master, make sure the master just - * decides to go unmanaged while we're activating (perhaps because other slaves - * go away leaving him with no kids). - */ + * decides to go unmanaged while we're activating (perhaps because other slaves + * go away leaving him with no kids). + */ if (master_device) { nm_device_set_unmanaged_by_flags(master_device, NM_UNMANAGED_EXTERNAL_DOWN, @@ -4953,7 +4953,7 @@ _internal_activate_device(NMManager *self, NMActiveConnection *active, GError ** guint i, n_all; /* Disconnect the connection if already connected or queued for activation. - * The connection cannot be active multiple times (at the same time). */ + * The connection cannot be active multiple times (at the same time). */ ac = active_connection_find(self, sett_conn, NULL, @@ -4975,7 +4975,7 @@ _internal_activate_device(NMManager *self, NMActiveConnection *active, GError ** if (!nm_device_get_managed(device, FALSE)) { /* Unexpectedly, the device is still unmanaged. That can happen for example, - * if the device is forcibly unmanaged due to NM_UNMANAGED_USER_SETTINGS. */ + * if the device is forcibly unmanaged due to NM_UNMANAGED_USER_SETTINGS. */ g_set_error_literal(error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_DEPENDENCY_FAILED, @@ -4997,8 +4997,8 @@ _internal_activate_generic(NMManager *self, NMActiveConnection *active, GError * gboolean success = FALSE; /* Ensure activation request is still valid, eg that its device hasn't gone - * away or that some other dependency has not failed. - */ + * away or that some other dependency has not failed. + */ if (nm_active_connection_get_state(active) >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) { g_set_error_literal(error, NM_MANAGER_ERROR, @@ -5014,12 +5014,12 @@ _internal_activate_generic(NMManager *self, NMActiveConnection *active, GError * if (success) { /* Force an update of the Manager's activating-connection property. - * The device changes state before the AC gets exported, which causes - * the manager's 'activating-connection' property to be NULL since the - * AC only gets a D-Bus path when it's exported. So now that the AC - * is exported, make sure the manager's activating-connection property - * is up-to-date. - */ + * The device changes state before the AC gets exported, which causes + * the manager's 'activating-connection' property to be NULL since the + * AC only gets a D-Bus path when it's exported. So now that the AC + * is exported, make sure the manager's activating-connection property + * is up-to-date. + */ policy_activating_ac_changed(G_OBJECT(priv->policy), NULL, self); } @@ -5059,8 +5059,8 @@ _new_active_connection(NMManager * self, NMActiveConnection *parent; /* FIXME: for VPN connections, we don't allow re-activating an - * already active connection. It's a bug, and should be fixed together - * when reworking VPN handling. */ + * already active connection. It's a bug, and should be fixed together + * when reworking VPN handling. */ if (active_connection_find_by_connection(self, sett_conn, incompl_conn, @@ -5151,10 +5151,10 @@ _internal_activation_auth_done(NMManager * self, goto fail; /* Don't continue with an autoconnect-activation if a more important activation - * already exists. - * We also check this earlier, but there we may fail to detect a duplicate - * if the existing active connection was undergoing authorization. - */ + * already exists. + * We also check this earlier, but there we may fail to detect a duplicate + * if the existing active connection was undergoing authorization. + */ if (NM_IN_SET(nm_active_connection_get_activation_reason(active), NM_ACTIVATION_REASON_EXTERNAL, NM_ACTIVATION_REASON_ASSUME, @@ -5242,10 +5242,10 @@ nm_manager_activate_connection(NMManager * self, return NULL; /* Look for a active connection that's equivalent and is already pending authorization - * and eventual activation. This is used to de-duplicate concurrent activations which would - * otherwise race and cause the device to disconnect and reconnect repeatedly. - * In particular, this allows the master and multiple slaves to concurrently auto-activate - * while all the slaves would use the same active-connection. */ + * and eventual activation. This is used to de-duplicate concurrent activations which would + * otherwise race and cause the device to disconnect and reconnect repeatedly. + * In particular, this allows the master and multiple slaves to concurrently auto-activate + * while all the slaves would use the same active-connection. */ c_list_for_each_entry (async_op_data, &priv->async_op_lst_head, async_op_lst) { if (async_op_data->async_op_type != ASYNC_OP_TYPE_AC_AUTH_ACTIVATE_INTERNAL) continue; @@ -5377,7 +5377,7 @@ validate_activation_request(NMManager * self, gs_free char *iface = NULL; /* VPN and software-device connections don't need a device yet, - * but non-virtual connections do ... */ + * but non-virtual connections do ... */ if (!nm_connection_is_virtual(connection)) { g_set_error(error, NM_MANAGER_ERROR, @@ -5487,10 +5487,10 @@ impl_manager_activate_connection(NMDBusObject * obj, device_path = nm_dbus_path_not_empty(device_path); /* If the connection path is given and valid, that connection is activated. - * Otherwise, the "best" connection for the device is chosen and activated, - * regardless of whether that connection is autoconnect-enabled or not - * (since this is an explicit request, not an auto-activation request). - */ + * Otherwise, the "best" connection for the device is chosen and activated, + * regardless of whether that connection is autoconnect-enabled or not + * (since this is an explicit request, not an auto-activation request). + */ if (connection_path) { sett_conn = nm_settings_get_connection_by_path(priv->settings, connection_path); if (!sett_conn) { @@ -5670,8 +5670,8 @@ _add_and_activate_auth_done(NMManager * self, priv = NM_MANAGER_GET_PRIVATE(self); /* FIXME(shutdown): nm_settings_add_connection_dbus() cannot be cancelled. It should be made - * cancellable and tracked via AsyncOpData to be able to do a clean - * shutdown. */ + * cancellable and tracked via AsyncOpData to be able to do a clean + * shutdown. */ nm_settings_add_connection_dbus( priv->settings, connection, @@ -5791,12 +5791,12 @@ impl_manager_add_and_activate_connection(NMDBusObject * obj, device_path = nm_dbus_path_not_empty(device_path); /* Try to create a new connection with the given settings. - * We allow empty settings for AddAndActivateConnection(). In that case, - * the connection will be completed in nm_utils_complete_generic() or - * nm_device_complete_connection() below. Just make sure we don't expect - * specific data being in the connection till then (especially in - * validate_activation_request()). - */ + * We allow empty settings for AddAndActivateConnection(). In that case, + * the connection will be completed in nm_utils_complete_generic() or + * nm_device_complete_connection() below. Just make sure we don't expect + * specific data being in the connection till then (especially in + * validate_activation_request()). + */ incompl_conn = nm_simple_connection_new(); if (settings && g_variant_n_children(settings)) _nm_connection_replace_settings(incompl_conn, @@ -6069,7 +6069,7 @@ sleep_devices_add(NMManager *self, NMDevice *device, gboolean suspending) if (g_hash_table_lookup_extended(priv->sleep_devices, device, NULL, (gpointer *) &handle)) { if (suspending) { /* if we are suspending, always insert a new handle in sleep_devices. - * Even if we had an old handle, it might be stale by now. */ + * Even if we had an old handle, it might be stale by now. */ g_hash_table_insert(priv->sleep_devices, device, nm_sleep_monitor_inhibit_take(priv->sleep_monitor)); @@ -6163,15 +6163,15 @@ do_sleep_wake(NMManager *self, gboolean sleeping_changed) _LOGD(LOGD_SUSPEND, "sleep: %s...", suspending ? "sleeping" : "disabling"); /* FIXME: are there still hardware devices that need to be disabled around - * suspend/resume? - */ + * suspend/resume? + */ c_list_for_each_entry (device, &priv->devices_lst_head, devices_lst) { if (nm_device_is_software(device)) { /* If a user disables networking we consider that as an - * indication that also software devices must be disconnected. - * But we don't want to destroy them for external events as - * a system suspend. - */ + * indication that also software devices must be disconnected. + * But we don't want to destroy them for external events as + * a system suspend. + */ if (suspending) continue; } @@ -6211,8 +6211,8 @@ do_sleep_wake(NMManager *self, gboolean sleeping_changed) continue; /* Belatedly take down Wake-on-LAN devices; ideally we wouldn't have to do this - * but for now it's the only way to make sure we re-check their connectivity. - */ + * but for now it's the only way to make sure we re-check their connectivity. + */ if (device_is_wake_on_lan(priv->platform, device)) nm_device_set_unmanaged_by_flags(device, NM_UNMANAGED_SLEEPING, @@ -6220,9 +6220,9 @@ do_sleep_wake(NMManager *self, gboolean sleeping_changed) NM_DEVICE_STATE_REASON_SLEEPING); /* Check if the device is unmanaged but the state transition is still pending. - * If so, change state now so that later we re-manage the device forcing a - * re-check of available connections. - */ + * If so, change state now so that later we re-manage the device forcing a + * re-check of available connections. + */ if (!nm_device_get_managed(device, FALSE) && nm_device_get_state(device) != NM_DEVICE_STATE_UNMANAGED) { nm_device_state_changed(device, @@ -6233,8 +6233,8 @@ do_sleep_wake(NMManager *self, gboolean sleeping_changed) } /* Ensure rfkill state is up-to-date since we don't respond to state - * changes during sleep. - */ + * changes during sleep. + */ nm_manager_rfkill_update(self, RFKILL_TYPE_UNKNOWN); /* Re-manage managed devices */ @@ -6244,14 +6244,14 @@ do_sleep_wake(NMManager *self, gboolean sleeping_changed) if (nm_device_is_software(device) && !nm_device_get_unmanaged_flags(device, NM_UNMANAGED_SLEEPING)) { /* DHCP leases of software devices could have gone stale - * so we need to renew them. */ + * so we need to renew them. */ nm_device_update_dynamic_ip_setup(device); continue; } /* enable/disable wireless devices since that we don't respond - * to killswitch changes during sleep. - */ + * to killswitch changes during sleep. + */ for (i = 0; i < RFKILL_TYPE_MAX; i++) { RadioState *rstate = &priv->radio_states[i]; gboolean enabled = radio_enabled_for_rstate(rstate, TRUE); @@ -6338,13 +6338,13 @@ impl_manager_sleep(NMDBusObject * obj, } /* Unconditionally allow the request. Previously it was polkit protected - * but unfortunately that doesn't work for short-lived processes like - * pm-utils. It uses dbus-send without --print-reply, which quits - * immediately after sending the request, and NM is unable to obtain the - * sender's UID as dbus-send has already dropped off the bus. Thus NM - * fails the request. Instead, don't validate the request, but rely on - * D-Bus permissions to restrict the call to root. - */ + * but unfortunately that doesn't work for short-lived processes like + * pm-utils. It uses dbus-send without --print-reply, which quits + * immediately after sending the request, and NM is unable to obtain the + * sender's UID as dbus-send has already dropped off the bus. Thus NM + * fails the request. Instead, don't validate the request, but rely on + * D-Bus permissions to restrict the call to root. + */ _internal_sleep(self, do_sleep); nm_audit_log_control_op(NM_AUDIT_OP_SLEEP_CONTROL, do_sleep ? "on" : "off", @@ -6556,9 +6556,9 @@ impl_manager_set_logging(NMDBusObject * obj, const char *domains; /* The permission is already enforced by the D-Bus daemon, but we ensure - * that the caller is still alive so that clients are forced to wait and - * we'll be able to switch to polkit without breaking behavior. - */ + * that the caller is still alive so that clients are forced to wait and + * we'll be able to switch to polkit without breaking behavior. + */ if (!nm_dbus_manager_ensure_uid(nm_dbus_object_get_manager(NM_DBUS_OBJECT(self)), invocation, G_MAXULONG, @@ -6626,15 +6626,15 @@ device_connectivity_done(NMDevice * device, || (state == NM_CONNECTIVITY_FULL && priv->connectivity_state == NM_CONNECTIVITY_FULL))) { /* despite having a @handle and @state returned by the requests, we always - * return the current connectivity_state. That is, because the connectivity_state - * and the answer to the connectivity check shall agree. - * - * However, if one of the requests (early) returns full connectivity and agrees with - * the accumulated connectivity state, we no longer have to wait. The result is set. - * - * This also works well, because NMDevice first emits change signals to its own - * connectivity state, which is then taken into account for the accumulated global - * state. All this happens, before the callback is invoked. */ + * return the current connectivity_state. That is, because the connectivity_state + * and the answer to the connectivity check shall agree. + * + * However, if one of the requests (early) returns full connectivity and agrees with + * the accumulated connectivity state, we no longer have to wait. The result is set. + * + * This also works well, because NMDevice first emits change signals to its own + * connectivity state, which is then taken into account for the accumulated global + * state. All this happens, before the callback is invoked. */ g_dbus_method_invocation_return_value( g_steal_pointer(&data->context), g_variant_new("(u)", (guint) priv->connectivity_state)); @@ -6920,17 +6920,17 @@ nm_manager_stop(NMManager *self) NMDevice * device; /* FIXME(shutdown): we don't do a proper shutdown yet: - * - need to ensure that all pending async operations are cancelled - * - e.g. operations in priv->async_op_lst_head - * - need to ensure that no more asynchronous requests are started, - * or that they complete quickly, or that they fail quickly. - * - note that cancelling some operations is not possible synchronously. - * Hence, stop() only prepares shutdown and tells everybody to not - * accept new work, and to complete in a timely manner. - * We need to still iterate the mainloop for a bit, to give everybody - * the chance to complete. - * - e.g. see comment at nm_auth_manager_force_shutdown() - */ + * - need to ensure that all pending async operations are cancelled + * - e.g. operations in priv->async_op_lst_head + * - need to ensure that no more asynchronous requests are started, + * or that they complete quickly, or that they fail quickly. + * - note that cancelling some operations is not possible synchronously. + * Hence, stop() only prepares shutdown and tells everybody to not + * accept new work, and to complete in a timely manner. + * We need to still iterate the mainloop for a bit, to give everybody + * the chance to complete. + * - e.g. see comment at nm_auth_manager_force_shutdown() + */ nm_dbus_manager_stop(nm_dbus_object_get_manager(NM_DBUS_OBJECT(self))); @@ -7008,9 +7008,9 @@ policy_default_ac_changed(GObject *object, GParamSpec *pspec, gpointer user_data NMActiveConnection *ac; /* Note: this assumes that it's not possible for the IP4 default - * route to be going over the default-ip6-device. If that changes, - * we need something more complicated here. - */ + * route to be going over the default-ip6-device. If that changes, + * we need something more complicated here. + */ ac = nm_policy_get_default_ip4_ac(priv->policy); if (!ac) ac = nm_policy_get_default_ip6_ac(priv->policy); @@ -7048,12 +7048,12 @@ policy_activating_ac_changed(GObject *object, GParamSpec *pspec, gpointer user_d NMActiveConnection *activating, *best; /* We only look at activating-ip6-ac if activating-ip4-ac - * AND default-ip4-ac are NULL; if default-ip4-ac is - * non-NULL, then activating-ip6-ac is irrelevant, since while - * that AC might become the new default-ip6-ac, it can't - * become primary-connection while default-ip4-ac is set to - * something else. - */ + * AND default-ip4-ac are NULL; if default-ip4-ac is + * non-NULL, then activating-ip6-ac is irrelevant, since while + * that AC might become the new default-ip6-ac, it can't + * become primary-connection while default-ip4-ac is set to + * something else. + */ activating = nm_policy_get_activating_ip4_ac(priv->policy); best = nm_policy_get_default_ip4_ac(priv->policy); if (!activating && !best) @@ -7517,14 +7517,14 @@ manager_radio_user_toggled(NMManager *self, RadioState *rstate, gboolean enabled nm_config_state_set(priv->config, TRUE, FALSE, rstate->key, enabled); /* When the user toggles the radio, their request should override any - * daemon (like ModemManager) enabled state that can be changed. For WWAN - * for example, we want the WwanEnabled property to reflect the daemon state - * too so that users can toggle the modem powered, but we don't want that - * daemon state to affect whether or not the user *can* turn it on, which is - * what the kernel rfkill state does. So we ignore daemon enabled state - * when determining what the new state should be since it shouldn't block - * the user's request. - */ + * daemon (like ModemManager) enabled state that can be changed. For WWAN + * for example, we want the WwanEnabled property to reflect the daemon state + * too so that users can toggle the modem powered, but we don't want that + * daemon state to affect whether or not the user *can* turn it on, which is + * what the kernel rfkill state does. So we ignore daemon enabled state + * when determining what the new state should be since it shouldn't block + * the user's request. + */ old_enabled = radio_enabled_for_rstate(rstate, TRUE); rstate->user_enabled = enabled; new_enabled = radio_enabled_for_rstate(rstate, FALSE); @@ -7665,10 +7665,10 @@ constructed(GObject *object) self); /* - * Do not delete existing virtual devices to keep connectivity up. - * Virtual devices are reused when NetworkManager is restarted. - * Hence, don't react on NM_SETTINGS_SIGNAL_CONNECTION_REMOVED. - */ + * Do not delete existing virtual devices to keep connectivity up. + * Virtual devices are reused when NetworkManager is restarted. + * Hence, don't react on NM_SETTINGS_SIGNAL_CONNECTION_REMOVED. + */ priv->policy = nm_policy_new(self, priv->settings); g_signal_connect(priv->policy, @@ -7708,10 +7708,10 @@ constructed(GObject *object) self); /* Force kernel Wi-Fi/WWAN rfkill state to follow NM saved Wi-Fi/WWAN state - * in case the BIOS doesn't save rfkill state, and to be consistent with user - * changes to the WirelessEnabled/WWANEnabled properties which toggle kernel - * rfkill. - */ + * in case the BIOS doesn't save rfkill state, and to be consistent with user + * changes to the WirelessEnabled/WWANEnabled properties which toggle kernel + * rfkill. + */ rfkill_change(self, priv->radio_states[RFKILL_TYPE_WLAN].desc, RFKILL_TYPE_WLAN, @@ -8509,12 +8509,12 @@ nm_manager_class_init(NMManagerClass *manager_class) G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); /** - * NMManager:metered: - * - * Whether the connectivity is metered. - * - * Since: 1.2 - **/ + * NMManager:metered: + * + * Whether the connectivity is metered. + * + * Since: 1.2 + **/ obj_properties[PROP_METERED] = g_param_spec_uint(NM_MANAGER_METERED, "", "", @@ -8524,12 +8524,12 @@ nm_manager_class_init(NMManagerClass *manager_class) G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); /** - * NMManager:global-dns-configuration: - * - * The global DNS configuration. - * - * Since: 1.2 - **/ + * NMManager:global-dns-configuration: + * + * The global DNS configuration. + * + * Since: 1.2 + **/ obj_properties[PROP_GLOBAL_DNS_CONFIGURATION] = g_param_spec_variant(NM_MANAGER_GLOBAL_DNS_CONFIGURATION, "", @@ -8539,12 +8539,12 @@ nm_manager_class_init(NMManagerClass *manager_class) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); /** - * NMManager:all-devices: - * - * All devices, including those that are not realized. - * - * Since: 1.2 - **/ + * NMManager:all-devices: + * + * All devices, including those that are not realized. + * + * Since: 1.2 + **/ obj_properties[PROP_ALL_DEVICES] = g_param_spec_boxed(NM_MANAGER_ALL_DEVICES, "", @@ -8588,7 +8588,7 @@ nm_manager_class_init(NMManagerClass *manager_class) G_TYPE_OBJECT); /* emitted only for realized devices when a device - * becomes unrealized or removed */ + * becomes unrealized or removed */ signals[DEVICE_REMOVED] = g_signal_new(NM_MANAGER_DEVICE_REMOVED, G_OBJECT_CLASS_TYPE(object_class), G_SIGNAL_RUN_FIRST, diff --git a/src/nm-netns.c b/src/nm-netns.c index f07bb1c498..b4e28fa3ab 100644 --- a/src/nm-netns.c +++ b/src/nm-netns.c @@ -179,12 +179,12 @@ _platform_signal_on_idle_cb(gpointer user_data) priv->signal_pending_idle_id = 0; /* we emit all queued signals together. However, we don't want to hook the - * main loop for longer than the currently queued elements. - * - * If we catch more change events, they will be queued and processed by a future - * idle handler. - * - * Hence, move the list to a temporary list. Isn't CList great? */ + * main loop for longer than the currently queued elements. + * + * If we catch more change events, they will be queued and processed by a future + * idle handler. + * + * Hence, move the list to a temporary list. Isn't CList great? */ c_list_init(&work_list); c_list_splice(&work_list, &priv->l3cfg_signal_pending_lst_head); @@ -385,21 +385,21 @@ constructed(GObject *object) priv->rules_manager = nmp_rules_manager_new(priv->platform); /* Weakly track the default rules with a dummy user-tag. These - * rules are always weekly tracked... */ + * rules are always weekly tracked... */ nmp_rules_manager_track_default(priv->rules_manager, AF_UNSPEC, 0, nm_netns_parent_class /* static dummy user-tag */); /* Also weakly track all existing rules. These were added before NetworkManager - * starts, so they are probably none of NetworkManager's business. - * - * However note that during service restart, devices may stay up and rules kept. - * That means, after restart such rules may have been added by a previous run - * of NetworkManager, we just don't know. - * - * For that reason, whenever we will touch such rules later one, we make them - * fully owned and no longer weekly tracked. See %NMP_RULES_MANAGER_EXTERN_WEAKLY_TRACKED_USER_TAG. */ + * starts, so they are probably none of NetworkManager's business. + * + * However note that during service restart, devices may stay up and rules kept. + * That means, after restart such rules may have been added by a previous run + * of NetworkManager, we just don't know. + * + * For that reason, whenever we will touch such rules later one, we make them + * fully owned and no longer weekly tracked. See %NMP_RULES_MANAGER_EXTERN_WEAKLY_TRACKED_USER_TAG. */ nmp_rules_manager_track_from_platform(priv->rules_manager, NULL, AF_UNSPEC, diff --git a/src/nm-pacrunner-manager.c b/src/nm-pacrunner-manager.c index 8a7de486f4..ac403f2d79 100644 --- a/src/nm-pacrunner-manager.c +++ b/src/nm-pacrunner-manager.c @@ -460,17 +460,17 @@ nm_pacrunner_manager_remove(NMPacrunnerConfId *conf_id) if (!conf_id->path) { /* There is no ID to destroy the configuration. - * - * That can happen because: - * - * - pacrunner D-Bus service is not running (no name owner) and we didn't call CreateProxyConfiguration. - * - CreateProxyConfiguration failed. - * - CreateProxyConfiguration is in progress. - * - * In all cases there is nothing to do. Note that if CreateProxyConfiguration is in progress - * it has a reference on the conf-id and it will automatically destroy the configuration - * when it completes. - */ + * + * That can happen because: + * + * - pacrunner D-Bus service is not running (no name owner) and we didn't call CreateProxyConfiguration. + * - CreateProxyConfiguration failed. + * - CreateProxyConfiguration is in progress. + * + * In all cases there is nothing to do. Note that if CreateProxyConfiguration is in progress + * it has a reference on the conf-id and it will automatically destroy the configuration + * when it completes. + */ return; } @@ -596,9 +596,9 @@ dispose(GObject *object) nm_assert(c_list_is_empty(&priv->conf_id_lst_head)); /* we cancel all pending operations. Note that pacrunner automatically - * removes all configuration once NetworkManager disconnects from - * the bus -- which happens soon after we destroy the pacrunner manager. - */ + * removes all configuration once NetworkManager disconnects from + * the bus -- which happens soon after we destroy the pacrunner manager. + */ nm_clear_g_cancellable(&priv->cancellable); nm_clear_g_dbus_connection_signal(priv->dbus_connection, &priv->name_owner_changed_id); diff --git a/src/nm-policy.c b/src/nm-policy.c index d610354e2a..202cbf47e2 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -172,7 +172,7 @@ _clear_ip6_subnet(gpointer key, gpointer value, gpointer user_data) if (device) { /* We can not remove a subnet we already started announcing. - * Just un-prefer it. */ + * Just un-prefer it. */ subnet->preferred = 0; nm_device_use_ip6_subnet(device, subnet); } @@ -244,10 +244,10 @@ ip6_subnet_from_delegation(IP6PrefixDelegation *delegation, NMDevice *device) delegation->prefix.address.s6_addr32[1] | htonl(delegation->next_subnet); /* Out subnet pool management is pretty unsophisticated. We only add - * the subnets and index them by ifindex. That keeps the implementation - * simple and the dead entries make it easy to reuse the same subnet on - * subsequent activations. On the other hand they may waste the subnet - * space. */ + * the subnets and index them by ifindex. That keeps the implementation + * simple and the dead entries make it easy to reuse the same subnet on + * subsequent activations. On the other hand they may waste the subnet + * space. */ delegation->next_subnet++; } @@ -355,9 +355,9 @@ device_ip6_prefix_delegated(NMDevice *device, NMPlatformIP6Address *prefix, gpoi delegation->prefix = *prefix; /* The newly activated connections are added to the list beginning, - * so traversing it from the beginning makes it likely for newly - * activated connections that have no subnet assigned to be served - * first. That is a simple yet fair policy, which is good. */ + * so traversing it from the beginning makes it likely for newly + * activated connections that have no subnet assigned to be served + * first. That is a simple yet fair policy, which is good. */ nm_manager_for_each_active_connection (priv->manager, ac, tmp_list) { NMDevice *to_device; @@ -414,7 +414,7 @@ get_best_active_connection(NMPolicy *self, int addr_family, gboolean fully_activ nm_assert(NM_IN_SET(addr_family, AF_INET, AF_INET6)); /* we prefer the current AC in case of identical metric. - * Hence, try that one first. */ + * Hence, try that one first. */ prev_ac = addr_family == AF_INET ? (fully_activated ? priv->default_ac4 : priv->activating_ac4) : (fully_activated ? priv->default_ac6 : priv->activating_ac6); best_ac = NULL; @@ -437,10 +437,10 @@ get_best_active_connection(NMPolicy *self, int addr_family, gboolean fully_activ r = nm_device_get_best_default_route(device, addr_family); if (r) { /* NOTE: the best route might have rt_source NM_IP_CONFIG_SOURCE_VPN, - * which means it was injected by a VPN, not added by device. - * - * In this case, is it really the best device? Why do we even need the best - * device?? */ + * which means it was injected by a VPN, not added by device. + * + * In this case, is it really the best device? Why do we even need the best + * device?? */ metric = NMP_OBJECT_CAST_IP_ROUTE(r)->metric; is_fully_activated = TRUE; } else if (!fully_activated && (connection = nm_device_get_applied_connection(device)) @@ -463,8 +463,8 @@ get_best_active_connection(NMPolicy *self, int addr_family, gboolean fully_activ if (!fully_activated && best_ac && best_is_fully_activated) { /* There's a best activating AC only if the best device - * among all activating and already-activated devices is a - * still-activating one. */ + * among all activating and already-activated devices is a + * still-activating one. */ return NULL; } @@ -533,8 +533,8 @@ _get_hostname(NMPolicy *self) int errsv; /* If there is an in-progress hostname change, return - * the last hostname set as would be set soon... - */ + * the last hostname set as would be set soon... + */ if (priv->changing_hostname) { _LOGT(LOGD_DNS, "get-hostname: \"%s\" (last on set)", priv->last_hostname); return g_strdup(priv->last_hostname); @@ -578,27 +578,27 @@ _set_hostname(NMPolicy *self, const char *new_hostname, const char *msg) const char * name; /* The incoming hostname *can* be NULL, which will get translated to - * 'localhost.localdomain' or such in the hostname policy code, but we - * keep cur_hostname = NULL in the case because we need to know that - * there was no valid hostname to start with. - */ + * 'localhost.localdomain' or such in the hostname policy code, but we + * keep cur_hostname = NULL in the case because we need to know that + * there was no valid hostname to start with. + */ /* Clear lookup addresses if we have a hostname, so that we don't - * restart the reverse lookup thread later. - */ + * restart the reverse lookup thread later. + */ if (new_hostname) g_clear_object(&priv->lookup.addr); /* Update the DNS only if the hostname is actually - * going to change. - */ + * going to change. + */ if (!nm_streq0(priv->cur_hostname, new_hostname)) { g_free(priv->cur_hostname); priv->cur_hostname = g_strdup(new_hostname); /* Notify the DNS manager of the hostname change so that the domain part, if - * present, can be added to the search list. - */ + * present, can be added to the search list. + */ nm_dns_manager_set_hostname(priv->dns_manager, priv->cur_hostname, all_devices_not_active(self)); @@ -627,7 +627,7 @@ _set_hostname(NMPolicy *self, const char *new_hostname, const char *msg) _LOGI(LOGD_DNS, "set-hostname: set hostname to '%s' (%s)", name, msg); /* Ask NMSettings to update the transient hostname using its - * systemd-hostnamed proxy */ + * systemd-hostnamed proxy */ nm_hostname_manager_set_transient_hostname(priv->hostname_manager, name, settings_set_hostname_cb, @@ -698,8 +698,8 @@ update_system_hostname(NMPolicy *self, const char *msg) nm_clear_g_cancellable(&priv->lookup.cancellable); /* Check if the hostname was set externally to NM, so that in that case - * we can avoid to fallback to the one we got when we started. - * Consider "not specific" hostnames as equal. */ + * we can avoid to fallback to the one we got when we started. + * Consider "not specific" hostnames as equal. */ if ((temp_hostname = _get_hostname(self)) && !nm_streq0(temp_hostname, priv->last_hostname) && (nm_utils_is_specific_hostname(temp_hostname) || nm_utils_is_specific_hostname(priv->last_hostname))) { @@ -722,13 +722,13 @@ update_system_hostname(NMPolicy *self, const char *msg) } /* Hostname precedence order: - * - * 1) a configured hostname (from settings) - * 2) automatic hostname from the default device's config (DHCP, VPN, etc) - * 3) the last hostname set outside NM - * 4) reverse-DNS of the best device's IPv4 address - * - */ + * + * 1) a configured hostname (from settings) + * 2) automatic hostname from the default device's config (DHCP, VPN, etc) + * 3) the last hostname set outside NM + * 4) reverse-DNS of the best device's IPv4 address + * + */ /* Try a persistent hostname first */ configured_hostname = nm_hostname_manager_get_hostname(priv->hostname_manager); @@ -782,10 +782,10 @@ update_system_hostname(NMPolicy *self, const char *msg) if (priv->hostname_mode == NM_POLICY_HOSTNAME_MODE_DHCP) { /* In dhcp hostname-mode, the hostname is updated only if it comes from - * a DHCP host-name option: if last set was from a host-name option and - * we are here than that connection is gone (with its host-name option), - * so reset the hostname to the previous value - */ + * a DHCP host-name option: if last set was from a host-name option and + * we are here than that connection is gone (with its host-name option), + * so reset the hostname to the previous value + */ if (priv->dhcp_hostname) { _set_hostname(self, priv->orig_hostname, "reset dhcp hostname"); priv->dhcp_hostname = FALSE; @@ -797,23 +797,23 @@ update_system_hostname(NMPolicy *self, const char *msg) if (!priv->default_ac4 && !priv->default_ac6) { /* No best device; fall back to the last hostname set externally - * to NM or if there wasn't one, 'localhost.localdomain' - */ + * to NM or if there wasn't one, 'localhost.localdomain' + */ _set_hostname(self, priv->orig_hostname, "no default device"); return; } /* If no automatically-configured hostname, try using the last hostname - * set externally to NM - */ + * set externally to NM + */ if (priv->orig_hostname) { _set_hostname(self, priv->orig_hostname, "from system startup"); return; } /* No configured hostname, no automatically determined hostname, and no - * bootup hostname. Start reverse DNS of the current IPv4 or IPv6 address. - */ + * bootup hostname. Start reverse DNS of the current IPv4 or IPv6 address. + */ device = get_default_device(self, AF_INET); ip4_config = device ? nm_device_get_ip4_config(device) : NULL; @@ -845,9 +845,9 @@ update_default_ac(NMPolicy *self, int addr_family, NMActiveConnection *best) NMActiveConnection *ac; /* Clear the 'default[6]' flag on all active connections that aren't the new - * default active connection. We'll set the new default after; this ensures - * we don't ever have two marked 'default[6]' simultaneously. - */ + * default active connection. We'll set the new default after; this ensures + * we don't ever have two marked 'default[6]' simultaneously. + */ nm_manager_for_each_active_connection (priv->manager, ac, tmp_list) { if (ac != best) nm_active_connection_set_default(ac, addr_family, FALSE); @@ -957,8 +957,8 @@ update_ip4_routing(NMPolicy *self, gboolean force_update) NMActiveConnection *ac; /* Note that we might have an IPv4 VPN tunneled over an IPv6-only device, - * so we can get (vpn != NULL && best == NULL). - */ + * so we can get (vpn != NULL && best == NULL). + */ if (!get_best_ip_config(self, AF_INET, &ip_iface, &best_ac, &best, &vpn)) { if (nm_clear_g_object(&priv->default_ac4)) { _LOGt(LOGD_DNS, "set-default-ac-4: %p", NULL); @@ -1020,8 +1020,8 @@ update_ip6_routing(NMPolicy *self, gboolean force_update) const CList * tmp_list; /* Note that we might have an IPv6 VPN tunneled over an IPv4-only device, - * so we can get (vpn != NULL && best == NULL). - */ + * so we can get (vpn != NULL && best == NULL). + */ if (!get_best_ip_config(self, AF_INET6, &ip_iface, &best_ac, &best, &vpn)) { if (nm_clear_g_object(&priv->default_ac6)) { _LOGt(LOGD_DNS, "set-default-ac-6: %p", NULL); @@ -1071,8 +1071,8 @@ update_ip_dns(NMPolicy *self, int addr_family, NMDevice *changed_device) ip_config = get_best_ip_config(self, addr_family, &ip_iface, NULL, &device, &vpn); if (ip_config) { /* Tell the DNS manager this config is preferred by re-adding it with - * a different IP config type. - */ + * a different IP config type. + */ _dns_manager_set_ip_config(NM_POLICY_GET_PRIVATE(self)->dns_manager, ip_config, (vpn || (device && nm_device_is_vpn(device))) @@ -1160,7 +1160,7 @@ pending_ac_gone(gpointer data, GObject *where_the_object_was) NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE(self); /* Active connections should reach the DEACTIVATED state - * before disappearing. */ + * before disappearing. */ nm_assert_not_reached(); if (g_hash_table_remove(priv->pending_active_connections, where_the_object_was)) @@ -1175,10 +1175,10 @@ pending_ac_state_changed(NMActiveConnection *ac, guint state, guint reason, NMPo if (state >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) { /* The AC is being deactivated before the device had a chance - * to move to PREPARE. Schedule a new auto-activation on the - * device, but block the current connection to avoid an activation - * loop. - */ + * to move to PREPARE. Schedule a new auto-activation on the + * device, but block the current connection to avoid an activation + * loop. + */ if (reason != NM_ACTIVE_CONNECTION_STATE_REASON_DEVICE_DISCONNECTED) { con = nm_active_connection_get_settings_connection(ac); nm_settings_connection_autoconnect_blocked_reason_set( @@ -1289,9 +1289,9 @@ auto_activate_device(NMPolicy *self, NMDevice *device) } /* Subscribe to AC state-changed signal to detect when the - * activation fails in early stages without changing device - * state. - */ + * activation fails in early stages without changing device + * state. + */ if (g_hash_table_add(priv->pending_active_connections, ac)) { g_signal_connect(ac, NM_ACTIVE_CONNECTION_STATE_CHANGED, @@ -1463,8 +1463,8 @@ reset_autoconnect_all( NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_NO_SECRETS, FALSE)) { /* maybe the connection is still blocked afterwards for other reasons - * and in the larger picture nothing changed. But it's too complicated - * to find out exactly. Just assume, something changed to be sure. */ + * and in the larger picture nothing changed. But it's too complicated + * to find out exactly. Just assume, something changed to be sure. */ if (!nm_settings_connection_autoconnect_is_blocked(sett_conn)) changed = TRUE; } @@ -1779,10 +1779,10 @@ device_state_changed(NMDevice * device, case NM_DEVICE_STATE_REASON_SIM_PIN_INCORRECT: case NM_DEVICE_STATE_REASON_GSM_APN_FAILED: /* Block autoconnection at settings level if there is any settings-specific - * error reported by the modem (e.g. wrong SIM-PIN or wrong APN). Do not block - * autoconnection at settings level for errors in the device domain (e.g. - * a missing SIM or wrong modem initialization). - */ + * error reported by the modem (e.g. wrong SIM-PIN or wrong APN). Do not block + * autoconnection at settings level for errors in the device domain (e.g. + * a missing SIM or wrong modem initialization). + */ if (sett_conn) { nm_settings_connection_autoconnect_blocked_reason_set( sett_conn, @@ -1797,8 +1797,8 @@ device_state_changed(NMDevice * device, switch (new_state) { case NM_DEVICE_STATE_FAILED: /* Mark the connection invalid if it failed during activation so that - * it doesn't get automatically chosen over and over and over again. - */ + * it doesn't get automatically chosen over and over and over again. + */ if (sett_conn && old_state >= NM_DEVICE_STATE_PREPARE && old_state <= NM_DEVICE_STATE_ACTIVATED) { gboolean blocked = FALSE; @@ -1807,18 +1807,18 @@ device_state_changed(NMDevice * device, if (nm_device_state_reason_check(reason) == NM_DEVICE_STATE_REASON_NO_SECRETS) { /* we want to block the connection from auto-connect if it failed due to no-secrets. - * However, if a secret-agent registered, since the connection made the last - * secret-request, we do not block it. The new secret-agent might not yet - * been consulted, and it may be able to provide the secrets. - * - * We detect this by using a version-id of the agent-manager, which increments - * whenever new agents register. Note that the agent-manager's version-id is - * never zero and strictly increasing. - * - * A connection's version-id of zero means that the connection never tried to request secrets. - * That can happen when nm_settings_connection_get_secrets() fails early without actually - * consulting any agents. - */ + * However, if a secret-agent registered, since the connection made the last + * secret-request, we do not block it. The new secret-agent might not yet + * been consulted, and it may be able to provide the secrets. + * + * We detect this by using a version-id of the agent-manager, which increments + * whenever new agents register. Note that the agent-manager's version-id is + * never zero and strictly increasing. + * + * A connection's version-id of zero means that the connection never tried to request secrets. + * That can happen when nm_settings_connection_get_secrets() fails early without actually + * consulting any agents. + */ con_v = nm_settings_connection_get_last_secret_agent_version_id(sett_conn); if (con_v == 0 || con_v == nm_agent_manager_get_agent_version_id(priv->agent_mgr)) { _LOGD(LOGD_DEVICE, @@ -1833,13 +1833,13 @@ device_state_changed(NMDevice * device, } else if (nm_device_state_reason_check(reason) == NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED) { /* A connection that fails due to dependency-failed is not - * able to reconnect until the master connection activates - * again; when this happens, the master clears the blocked - * reason for all its slaves in activate_slave_connections() - * and tries to reconnect them. For this to work, the slave - * should be marked as blocked when it fails with - * dependency-failed. - */ + * able to reconnect until the master connection activates + * again; when this happens, the master clears the blocked + * reason for all its slaves in activate_slave_connections() + * and tries to reconnect them. For this to work, the slave + * should be marked as blocked when it fails with + * dependency-failed. + */ _LOGD(LOGD_DEVICE, "connection '%s' now blocked from autoconnect due to failed dependency", nm_settings_connection_get_id(sett_conn)); @@ -1874,8 +1874,8 @@ device_state_changed(NMDevice * device, nm_settings_connection_autoconnect_retries_reset(sett_conn); /* And clear secrets so they will always be requested from the - * settings service when the next connection is made. - */ + * settings service when the next connection is made. + */ nm_settings_connection_clear_secrets(sett_conn, FALSE, FALSE); } @@ -1935,8 +1935,8 @@ device_state_changed(NMDevice * device, break; case NM_DEVICE_STATE_DISCONNECTED: /* Reset retry counts for a device's connections when carrier on; if cable - * was unplugged and plugged in again, we should try to reconnect. - */ + * was unplugged and plugged in again, we should try to reconnect. + */ if (nm_device_state_reason_check(reason) == NM_DEVICE_STATE_REASON_CARRIER && old_state == NM_DEVICE_STATE_UNAVAILABLE) reset_autoconnect_all(self, device, FALSE); @@ -1950,11 +1950,11 @@ device_state_changed(NMDevice * device, case NM_DEVICE_STATE_PREPARE: /* Reset auto-connect retries of all slaves and schedule them for - * activation. */ + * activation. */ activate_slave_connections(self, device); /* Now that the device state is progressing, we don't care - * anymore for the AC state. */ + * anymore for the AC state. */ ac = (NMActiveConnection *) nm_device_get_act_request(device); if (ac && g_hash_table_remove(priv->pending_active_connections, ac)) { g_signal_handlers_disconnect_by_func(ac, pending_ac_state_changed, self); @@ -2020,10 +2020,10 @@ device_ip_config_changed(NMDevice * device, nm_dns_manager_begin_updates(priv->dns_manager, __func__); /* We catch already all the IP events registering on the device state changes but - * the ones where the IP changes but the device state keep stable (i.e., activated): - * ignore IP config changes but when the device is in activated state. - * Prevents unnecessary changes to DNS information. - */ + * the ones where the IP changes but the device state keep stable (i.e., activated): + * ignore IP config changes but when the device is in activated state. + * Prevents unnecessary changes to DNS information. + */ if (nm_device_get_state(device) == NM_DEVICE_STATE_ACTIVATED) { if (old_config != new_config) { if (new_config) @@ -2138,7 +2138,7 @@ device_removed(NMManager *manager, NMDevice *device, gpointer user_data) ActivateData * data; /* TODO: is this needed? The delegations are cleaned up - * on transition to deactivated too. */ + * on transition to deactivated too. */ ip6_remove_device_prefix_delegations(self, device); /* Clear any idle callbacks for this device */ @@ -2150,8 +2150,8 @@ device_removed(NMManager *manager, NMDevice *device, gpointer user_data) devices_list_unregister(self, device); /* Don't update routing and DNS here as we've already handled that - * for devices that need it when the device's state changed to UNMANAGED. - */ + * for devices that need it when the device's state changed to UNMANAGED. + */ } /*****************************************************************************/ @@ -2369,7 +2369,7 @@ schedule_activate_all(NMPolicy *self) NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE(self); /* always restart the idle handler. That way, we settle - * all other events before restarting to activate them. */ + * all other events before restarting to activate them. */ nm_clear_g_source(&priv->schedule_activate_all_id); priv->schedule_activate_all_id = g_idle_add(schedule_activate_all_cb, self); } @@ -2393,8 +2393,8 @@ firewall_state_changed(NMFirewallManager *manager, gboolean initialized_now, gpo if (initialized_now) { /* the firewall manager was initializing, but all requests - * so fare were queued and are already sent. No need to - * re-update the firewall zone of the devices. */ + * so fare were queued and are already sent. No need to + * re-update the firewall zone of the devices. */ return; } @@ -2413,9 +2413,9 @@ dns_config_changed(NMDnsManager *dns_manager, gpointer user_data) NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE(self); /* Restart a thread for reverse-DNS lookup after we are signalled that - * DNS changed. Because the result from a previous run may not be right - * (race in updating DNS and doing the reverse lookup). - */ + * DNS changed. Because the result from a previous run may not be right + * (race in updating DNS and doing the reverse lookup). + */ nm_clear_g_cancellable(&priv->lookup.cancellable); @@ -2520,9 +2520,9 @@ secret_agent_registered(NMSettings *settings, NMSecretAgent *agent, gpointer use NMPolicy *self = NM_POLICY(user_data); /* The registered secret agent may provide some missing secrets. Thus we - * reset retries count here and schedule activation, so that the - * connections failed due to missing secrets may re-try auto-connection. - */ + * reset retries count here and schedule activation, so that the + * connections failed due to missing secrets may re-try auto-connection. + */ if (reset_autoconnect_all(self, NULL, TRUE)) schedule_activate_all(self); } @@ -2797,9 +2797,9 @@ dispose(GObject *object) } /* The manager should have disposed of ActiveConnections already, which - * will have called active_connection_removed() and thus we don't need - * to clean anything up. Assert that this is TRUE. - */ + * will have called active_connection_removed() and thus we don't need + * to clean anything up. Assert that this is TRUE. + */ nm_assert(c_list_is_empty(nm_manager_get_active_connections(priv->manager))); nm_clear_g_source(&priv->reset_retries_id); @@ -2819,10 +2819,10 @@ dispose(GObject *object) g_clear_object(&priv->settings); /* we don't clear priv->manager as we don't own a reference to it, - * that is, NMManager must outlive NMPolicy anyway. - * - * Hence, we unsubscribe the signals here together with the signals - * for settings. */ + * that is, NMManager must outlive NMPolicy anyway. + * + * Hence, we unsubscribe the signals here together with the signals + * for settings. */ g_signal_handlers_disconnect_by_data(priv->manager, priv); } diff --git a/src/nm-proxy-config.c b/src/nm-proxy-config.c index 9e26c39f54..6c114bd9c5 100644 --- a/src/nm-proxy-config.c +++ b/src/nm-proxy-config.c @@ -73,8 +73,8 @@ nm_proxy_config_merge_setting(NMProxyConfig *config, NMSettingProxy *setting) priv->method = NM_PROXY_CONFIG_METHOD_AUTO; /* Free DHCP Obtained PAC Url (i.e Option 252) - * only when libnm overrides it. - */ + * only when libnm overrides it. + */ tmp = nm_setting_proxy_get_pac_url(setting); if (tmp) { g_free(priv->pac_url); diff --git a/src/nm-rfkill-manager.c b/src/nm-rfkill-manager.c index 879f8fafd0..7c3d0c86f0 100644 --- a/src/nm-rfkill-manager.c +++ b/src/nm-rfkill-manager.c @@ -217,8 +217,8 @@ recheck_killswitches(NMRfkillManager *self) for (i = 0; i < RFKILL_TYPE_MAX; i++) { if (platform_checked[i] == TRUE) { /* blocked platform switch state overrides device state, otherwise - * let the device state stand. (bgo #655773) - */ + * let the device state stand. (bgo #655773) + */ if (platform_states[i] != RFKILL_UNBLOCKED) poll_states[i] = platform_states[i]; } diff --git a/src/nm-rfkill-manager.h b/src/nm-rfkill-manager.h index 24ebd5d877..8298591292 100644 --- a/src/nm-rfkill-manager.h +++ b/src/nm-rfkill-manager.h @@ -18,9 +18,9 @@ typedef enum { /*< skip >*/ RFKILL_TYPE_WWAN = 1, /* UNKNOWN and MAX should always be 1 more than - * the last rfkill type since RFKILL_TYPE_MAX is - * used as an array size. - */ + * the last rfkill type since RFKILL_TYPE_MAX is + * used as an array size. + */ RFKILL_TYPE_UNKNOWN, /* KEEP LAST */ RFKILL_TYPE_MAX = RFKILL_TYPE_UNKNOWN } RfKillType; diff --git a/src/nm-session-monitor.c b/src/nm-session-monitor.c index 7d189b7c16..a9573c0b3c 100644 --- a/src/nm-session-monitor.c +++ b/src/nm-session-monitor.c @@ -345,11 +345,11 @@ nm_session_monitor_class_init(NMSessionMonitorClass *klass) gobject_class->finalize = finalize; /** - * NMSessionMonitor::changed: - * @monitor: A #NMSessionMonitor - * - * Emitted when something changes. - */ + * NMSessionMonitor::changed: + * @monitor: A #NMSessionMonitor + * + * Emitted when something changes. + */ signals[CHANGED] = g_signal_new(NM_SESSION_MONITOR_CHANGED, NM_TYPE_SESSION_MONITOR, G_SIGNAL_RUN_LAST, diff --git a/src/nm-types.h b/src/nm-types.h index 92fab52ad5..f9cba476ec 100644 --- a/src/nm-types.h +++ b/src/nm-types.h @@ -59,12 +59,12 @@ typedef enum { NM_ACTIVATION_TYPE_MANAGED = 0, /* gracefully/seamlessly take over the device. This leaves additional - * IP addresses and does not restore missing manual addresses. */ + * IP addresses and does not restore missing manual addresses. */ NM_ACTIVATION_TYPE_ASSUME = 1, /* external activation. This device is not managed by NM, instead - * a in-memory connection is generated and NM pretends the device - * to be active, but it doesn't do anything really. */ + * a in-memory connection is generated and NM pretends the device + * to be active, but it doesn't do anything really. */ NM_ACTIVATION_TYPE_EXTERNAL = 2, } NMActivationType; @@ -83,7 +83,7 @@ typedef enum { NM_IP_CONFIG_SOURCE_UNKNOWN = 0, /* for routes, the source is mapped to the uint8 field rtm_protocol. - * Reserve the range [1,0x100] for native RTPROT values. */ + * Reserve the range [1,0x100] for native RTPROT values. */ NM_IP_CONFIG_SOURCE_RTPROT_UNSPEC = 1 + 0, NM_IP_CONFIG_SOURCE_RTPROT_REDIRECT = 1 + 1, diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index 7e7e3d404b..8724c59178 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -377,7 +377,7 @@ typedef enum { typedef enum { /* Negative values are errors from kernel. Add dummy member to - * make enum signed. */ + * make enum signed. */ _WAIT_FOR_NL_RESPONSE_RESULT_SYSTEM_ERROR = G_MININT, WAIT_FOR_NL_RESPONSE_RESULT_UNKNOWN = 0, @@ -434,11 +434,11 @@ typedef struct { struct { /* which delayed actions are scheduled, as marked in @flags. - * Some types have additional arguments in the fields below. */ + * Some types have additional arguments in the fields below. */ DelayedActionType flags; /* counter that a refresh all action is in progress, separated - * by type. */ + * by type. */ int refresh_all_in_progress[_REFRESH_ALL_TYPE_NUM]; GPtrArray *list_master_connected; @@ -623,19 +623,19 @@ typedef struct { const char *type_string; /* IFLA_INFO_KIND / rtnl_link_get_type() where applicable; the rtnl type - * should only be specified if the device type can be created without - * additional parameters, and if the device type can be determined from - * the rtnl_type. eg, tun/tap should not be specified since both - * tun and tap devices use "tun", and InfiniBand should not be - * specified because a PKey is required at creation. Drivers set this - * value from their 'struct rtnl_link_ops' structure. - */ + * should only be specified if the device type can be created without + * additional parameters, and if the device type can be determined from + * the rtnl_type. eg, tun/tap should not be specified since both + * tun and tap devices use "tun", and InfiniBand should not be + * specified because a PKey is required at creation. Drivers set this + * value from their 'struct rtnl_link_ops' structure. + */ const char *rtnl_type; /* uevent DEVTYPE where applicable, from /sys/class/net/<ifname>/uevent; - * drivers set this value from their SET_NETDEV_DEV() call and the - * 'struct device_type' name member. - */ + * drivers set this value from their SET_NETDEV_DEV() call and the + * 'struct device_type' name member. + */ const char *devtype; } LinkDesc; @@ -900,13 +900,13 @@ _addrtime_timestamp_to_nm(guint32 timestamp, gint32 *out_now_nm) NM_SET_OUT(out_now_nm, now_nm / 1000); /* converting the timestamp into nm_utils_get_monotonic_timestamp_msec() scale is - * a good guess but fails in the following situations: - * - * - If the address existed before start of the process, the timestamp in nm scale would - * be negative or zero. In this case we default to 1. - * - during hibernation, the CLOCK_MONOTONIC/timestamp drifts from - * nm_utils_get_monotonic_timestamp_msec() scale. - */ + * a good guess but fails in the following situations: + * + * - If the address existed before start of the process, the timestamp in nm scale would + * be negative or zero. In this case we default to 1. + * - during hibernation, the CLOCK_MONOTONIC/timestamp drifts from + * nm_utils_get_monotonic_timestamp_msec() scale. + */ if (result <= 1000) return 1; @@ -1054,17 +1054,17 @@ _linktype_get_type(NMPlatform * platform, obj = _lookup_cached_link(cache, ifindex, completed_from_cache, link_cached); /* If we detected the link type before, we stick to that - * decision unless the "kind" or "name" changed. If "name" changed, - * it means that their type may not have been determined correctly - * due to race conditions while accessing sysfs. - * - * This way, we save additional ethtool/sysctl lookups, but moreover, - * we keep the linktype stable and don't change it as long as the link - * exists. - * - * Note that kernel *can* reuse the ifindex (on integer overflow, and - * when moving interface to other netns). Thus here there is a tiny potential - * of messing stuff up. */ + * decision unless the "kind" or "name" changed. If "name" changed, + * it means that their type may not have been determined correctly + * due to race conditions while accessing sysfs. + * + * This way, we save additional ethtool/sysctl lookups, but moreover, + * we keep the linktype stable and don't change it as long as the link + * exists. + * + * Note that kernel *can* reuse the ifindex (on integer overflow, and + * when moving interface to other netns). Thus here there is a tiny potential + * of messing stuff up. */ if (obj && obj->_link.netlink.is_in_netlink && !NM_IN_SET(obj->link.type, NM_LINK_TYPE_UNKNOWN, NM_LINK_TYPE_NONE) && nm_streq(ifname, obj->link.name) && (!kind || nm_streq0(kind, obj->link.kind))) { @@ -1075,10 +1075,10 @@ _linktype_get_type(NMPlatform * platform, } /* we intern kind to not require us to keep the pointer alive. Essentially - * leaking it in a global cache. That should be safe enough, because the - * kind comes only from kernel messages, which depend on the number of - * available drivers. So, there is not the danger that we leak uncontrolled - * many kinds. */ + * leaking it in a global cache. That should be safe enough, because the + * kind comes only from kernel messages, which depend on the number of + * available drivers. So, there is not the danger that we leak uncontrolled + * many kinds. */ *out_kind = g_intern_string(kind); if (kind) { @@ -1112,8 +1112,8 @@ _linktype_get_type(NMPlatform * platform, if (arptype == 256) { /* Some s390 CTC-type devices report 256 for the encapsulation type - * for some reason, but we need to call them Ethernet. - */ + * for some reason, but we need to call them Ethernet. + */ if (nm_streq(driver_info.driver, "ctcm")) return NM_LINK_TYPE_ETHERNET; } @@ -1136,8 +1136,8 @@ _linktype_get_type(NMPlatform * platform, if (link_type != NM_LINK_TYPE_NONE) { if (link_type == NM_LINK_TYPE_BNEP && arptype != ARPHRD_ETHER) { /* Both BNEP and 6lowpan use DEVTYPE=bluetooth, so we must - * use arptype to distinguish between them. - */ + * use arptype to distinguish between them. + */ } else return link_type; } @@ -1150,23 +1150,23 @@ _linktype_get_type(NMPlatform * platform, if (arptype == ARPHRD_ETHER) { /* Misc non-upstream WWAN drivers. rmnet is Qualcomm's proprietary - * modem interface, ccmni is MediaTek's. FIXME: these drivers should - * really set devtype=WWAN. - */ + * modem interface, ccmni is MediaTek's. FIXME: these drivers should + * really set devtype=WWAN. + */ if (g_str_has_prefix(ifname, "rmnet") || g_str_has_prefix(ifname, "rev_rmnet") || g_str_has_prefix(ifname, "ccmni")) return NM_LINK_TYPE_WWAN_NET; /* Standard wired ethernet interfaces don't report an rtnl_link_type, so - * only allow fallback to Ethernet if no type is given. This should - * prevent future virtual network drivers from being treated as Ethernet - * when they should be Generic instead. - */ + * only allow fallback to Ethernet if no type is given. This should + * prevent future virtual network drivers from being treated as Ethernet + * when they should be Generic instead. + */ if (!kind && !devtype) return NM_LINK_TYPE_ETHERNET; /* The USB gadget interfaces behave and look like ordinary ethernet devices - * aside from the DEVTYPE. */ + * aside from the DEVTYPE. */ if (nm_streq0(devtype, "gadget")) return NM_LINK_TYPE_ETHERNET; @@ -1264,8 +1264,8 @@ _parse_af_inet6(NMPlatform * platform, } /* Hack to detect support addrgenmode of the kernel. We only parse - * netlink messages that we receive from kernel, hence this check - * is valid. */ + * netlink messages that we receive from kernel, hence this check + * is valid. */ if (!_nm_platform_kernel_support_detected(NM_PLATFORM_KERNEL_SUPPORT_TYPE_USER_IPV6LL)) { /* IFLA_INET6_ADDR_GEN_MODE was added in kernel 3.17, dated 5 October, 2014. */ _nm_platform_kernel_support_init(NM_PLATFORM_KERNEL_SUPPORT_TYPE_USER_IPV6LL, @@ -1276,7 +1276,7 @@ _parse_af_inet6(NMPlatform * platform, i6_addr_gen_mode_inv = _nm_platform_uint8_inv(nla_get_u8(tb[IFLA_INET6_ADDR_GEN_MODE])); if (i6_addr_gen_mode_inv == 0) { /* an inverse addrgenmode of zero is unexpected. We need to reserve zero - * to signal "unset". */ + * to signal "unset". */ return FALSE; } addr_gen_mode_valid = TRUE; @@ -1341,7 +1341,7 @@ _parse_lnk_bridge(const char *kind, struct nlattr *info_data) if (!_nm_platform_kernel_support_detected( NM_PLATFORM_KERNEL_SUPPORT_TYPE_IFLA_BR_VLAN_STATS_ENABLED)) { /* IFLA_BR_VLAN_STATS_ENABLED was added in kernel 4.10 on April 30, 2016. - * See commit 6dada9b10a0818ba72c249526a742c8c41274a73. */ + * See commit 6dada9b10a0818ba72c249526a742c8c41274a73. */ _nm_platform_kernel_support_init(NM_PLATFORM_KERNEL_SUPPORT_TYPE_IFLA_BR_VLAN_STATS_ENABLED, tb[IFLA_BR_VLAN_STATS_ENABLED] ? 1 : -1); } @@ -1906,7 +1906,7 @@ _vlan_qos_mapping_from_nla(struct nlattr * nlattr, guint i, j; /* The sorting is necessary, because for egress mapping, kernel - * doesn't sent the items strictly sorted by the from field. */ + * doesn't sent the items strictly sorted by the from field. */ g_ptr_array_sort_with_data(array, _vlan_qos_mapping_cmp_from_ptr, NULL); list = g_new(NMVlanQosMapping, array->len); @@ -1917,8 +1917,8 @@ _vlan_qos_mapping_from_nla(struct nlattr * nlattr, map = array->pdata[i]; /* kernel doesn't really send us duplicates. Just be extra cautious - * because we want strong guarantees about the sort order and uniqueness - * of our mapping list (for simpler equality comparison). */ + * because we want strong guarantees about the sort order and uniqueness + * of our mapping list (for simpler equality comparison). */ if (j > 0 && list[j - 1].from == map->from) list[j - 1] = *map; else @@ -2209,7 +2209,7 @@ _wireguard_update_from_peers_nla(CList *peers, GArray **p_allowed_ips, struct nl NMP_WIREGUARD_PUBLIC_KEY_LEN)) { G_STATIC_ASSERT_EXPR(NMP_WIREGUARD_PUBLIC_KEY_LEN == sizeof(peer_c->data.public_key)); /* this message is a continuation of the previous peer. - * Only parse WGPEER_A_ALLOWEDIPS below. */ + * Only parse WGPEER_A_ALLOWEDIPS below. */ } else { /* otherwise, start a new peer */ peer_c = g_slice_new0(WireGuardPeerConstruct); @@ -2318,7 +2318,7 @@ _wireguard_get_device_cb(struct nl_msg *msg, void *arg) if (parse_data->obj) { /* we already have an object instance. This means the netlink message - * is a continuation, only providing more WGDEVICE_A_PEERS data below. */ + * is a continuation, only providing more WGDEVICE_A_PEERS data below. */ } else { NMPObject * obj; NMPlatformLnkWireGuard *props; @@ -2329,8 +2329,8 @@ _wireguard_get_device_cb(struct nl_msg *msg, void *arg) if (tb[WGDEVICE_A_PRIVATE_KEY]) { nla_memcpy(props->private_key, tb[WGDEVICE_A_PRIVATE_KEY], sizeof(props->private_key)); /* FIXME(netlink-bzero-secret): extend netlink library to wipe memory. For now, - * just hack it here (yes, this does not cover all places where the - * private key was copied). */ + * just hack it here (yes, this does not cover all places where the + * private key was copied). */ nm_explicit_bzero(nla_data(tb[WGDEVICE_A_PRIVATE_KEY]), nla_len(tb[WGDEVICE_A_PRIVATE_KEY])); } @@ -2353,8 +2353,8 @@ _wireguard_get_device_cb(struct nl_msg *msg, void *arg) &parse_data->allowed_ips, attr)) { /* we ignore the error of parsing one peer. - * _wireguard_update_from_peers_nla() leaves the @peers array in the - * desired state. */ + * _wireguard_update_from_peers_nla() leaves the @peers array in the + * desired state. */ } } } @@ -2406,7 +2406,7 @@ _wireguard_read_info(NMPlatform * platform /* used only as logging context */ c_list_init(&parse_data.peers); /* we ignore errors, and return whatever we could successfully - * parse. */ + * parse. */ nl_recvmsgs(genl, &((const struct nl_cb){ .valid_cb = _wireguard_get_device_cb, @@ -2427,32 +2427,32 @@ _wireguard_read_info(NMPlatform * platform /* used only as logging context */ } /* we receive peers/allowed-ips possibly in separate netlink messages. Hence, while - * parsing the dump, we don't know upfront how many peers/allowed-ips we will receive. - * - * We solve that, by collecting all peers with a CList. It's done this way, - * because a GArray would require growing the array, but we want to bzero() - * the preshared-key of each peer while reallocating. The CList apprach avoids - * that. - * - * For allowed-ips, we instead track one GArray, which are all appended - * there. The realloc/resize of the GArray is fine there. However, - * while we build the GArray, we don't yet have the final pointers. - * Hence, while constructing, we track the indexes with peer->_construct_idx_* - * fields. These indexes must be converted to actual pointers blow. - * - * This is all done during parsing. In the final NMPObjectLnkWireGuard we - * don't want the CList anymore and repackage the NMPObject tightly. The - * reason is, that NMPObject instances are immutable and long-living. Spend - * a bit effort below during construction to obtain a most suitable representation - * in this regard. */ + * parsing the dump, we don't know upfront how many peers/allowed-ips we will receive. + * + * We solve that, by collecting all peers with a CList. It's done this way, + * because a GArray would require growing the array, but we want to bzero() + * the preshared-key of each peer while reallocating. The CList apprach avoids + * that. + * + * For allowed-ips, we instead track one GArray, which are all appended + * there. The realloc/resize of the GArray is fine there. However, + * while we build the GArray, we don't yet have the final pointers. + * Hence, while constructing, we track the indexes with peer->_construct_idx_* + * fields. These indexes must be converted to actual pointers blow. + * + * This is all done during parsing. In the final NMPObjectLnkWireGuard we + * don't want the CList anymore and repackage the NMPObject tightly. The + * reason is, that NMPObject instances are immutable and long-living. Spend + * a bit effort below during construction to obtain a most suitable representation + * in this regard. */ obj->_lnk_wireguard.peers_len = c_list_length(&parse_data.peers); obj->_lnk_wireguard.peers = obj->_lnk_wireguard.peers_len > 0 ? g_new(NMPWireGuardPeer, obj->_lnk_wireguard.peers_len) : NULL; /* duplicate allowed_ips instead of using the pointer. The GArray possibly has more - * space allocated then we need, and we want to get rid of this excess buffer. - * Note that NMPObject instance is possibly put into the cache and long-living. */ + * space allocated then we need, and we want to get rid of this excess buffer. + * Note that NMPObject instance is possibly put into the cache and long-living. */ obj->_lnk_wireguard._allowed_ips_buf_len = allowed_ips ? allowed_ips->len : 0u; obj->_lnk_wireguard._allowed_ips_buf = obj->_lnk_wireguard._allowed_ips_buf_len > 0 @@ -2553,8 +2553,8 @@ _wireguard_refresh_link(NMPlatform *platform, int wireguard_family_id, int ifind return plink; /* we use nmp_cache_update_netlink() to re-inject the new object into the cache. - * For that, we need to clone it, and tweak it so that it's suitable. It's a bit - * of a hack, in particular that we need to clear driver and udev-device. */ + * For that, we need to clone it, and tweak it so that it's suitable. It's a bit + * of a hack, in particular that we need to clear driver and udev-device. */ obj = nmp_object_clone(plink, FALSE); obj->_link.wireguard_family_id = wireguard_family_id; nmp_object_unref(obj->_link.netlink.lnk); @@ -2610,15 +2610,15 @@ _wireguard_create_change_nlmsgs(NMPlatform * platfo G_STMT_END /* Adapted from LGPL-2.1+ code [1]. - * - * [1] https://git.zx2c4.com/WireGuard/tree/contrib/examples/embeddable-wg-library/wireguard.c?id=5e99a6d43fe2351adf36c786f5ea2086a8fe7ab8#n1073 */ + * + * [1] https://git.zx2c4.com/WireGuard/tree/contrib/examples/embeddable-wg-library/wireguard.c?id=5e99a6d43fe2351adf36c786f5ea2086a8fe7ab8#n1073 */ idx_peer_curr = IDX_NIL; idx_allowed_ips_curr = IDX_NIL; /* TODO: for the moment, we always reset all peers and allowed-ips (WGDEVICE_F_REPLACE_PEERS, WGPEER_F_REPLACE_ALLOWEDIPS). - * The platform API should be extended to also support partial updates. In particular, configuring the same configuration - * multiple times, should not clear and re-add all settings, but rather sync the existing settings with the desired configuration. */ + * The platform API should be extended to also support partial updates. In particular, configuring the same configuration + * multiple times, should not clear and re-add all settings, but rather sync the existing settings with the desired configuration. */ again: @@ -2680,7 +2680,7 @@ again: | NM_PLATFORM_WIREGUARD_CHANGE_PEER_FLAG_HAS_ALLOWEDIPS | NM_PLATFORM_WIREGUARD_CHANGE_PEER_FLAG_REPLACE_ALLOWEDIPS)) { /* no flags set. We take that as indication to skip configuring the peer - * entirely. */ + * entirely. */ nm_assert(p_flags == NM_PLATFORM_WIREGUARD_CHANGE_PEER_FLAG_NONE); continue; } @@ -2964,17 +2964,17 @@ _new_from_nl_link(NMPlatform * platform, if (!tb[IFLA_MTU]) { /* Kernel has two places that send RTM_GETLINK messages: - * net/core/rtnetlink.c and net/wireless/ext-core.c. - * Unfortunately ext-core.c sets only IFLA_WIRELESS and - * IFLA_IFNAME. This confuses code in this function, because - * it cannot get complete set of data for the interface and - * later incomplete object this function creates is used to - * overwrite existing data in NM's cache. - * Since ext-core.c doesn't set IFLA_MTU we can use it as a - * signal to ignore incoming message. - * To some extent this is a hack and correct approach is to - * merge objects per-field. - */ + * net/core/rtnetlink.c and net/wireless/ext-core.c. + * Unfortunately ext-core.c sets only IFLA_WIRELESS and + * IFLA_IFNAME. This confuses code in this function, because + * it cannot get complete set of data for the interface and + * later incomplete object this function creates is used to + * overwrite existing data in NM's cache. + * Since ext-core.c doesn't set IFLA_MTU we can use it as a + * signal to ignore incoming message. + * To some extent this is a hack and correct approach is to + * merge objects per-field. + */ return NULL; } obj->link.mtu = nla_get_u32(tb[IFLA_MTU]); @@ -3129,11 +3129,11 @@ _new_from_nl_link(NMPlatform * platform, && link_cached->_link.netlink.lnk && (!lnk_data || nmp_object_equal(lnk_data, link_cached->_link.netlink.lnk))) { /* We always try to look into the cache and reuse the object there. - * We do that, because we consider the lnk object as immutable and don't - * modify it after creating. Hence we can share it and reuse. - * - * Also, sometimes the info-data is missing for updates. In this case - * we want to keep the previously received lnk_data. */ + * We do that, because we consider the lnk object as immutable and don't + * modify it after creating. Hence we can share it and reuse. + * + * Also, sometimes the info-data is missing for updates. In this case + * we want to keep the previously received lnk_data. */ nmp_object_unref(lnk_data); lnk_data = nmp_object_ref(link_cached->_link.netlink.lnk); } @@ -3188,8 +3188,8 @@ _new_from_nl_link(NMPlatform * platform, struct nl_sock * genl = NM_LINUX_PLATFORM_GET_PRIVATE(platform)->genl; /* The WireGuard kernel module does not yet send link update - * notifications, so we don't actually update the cache. For - * now, always refetch link data here. */ + * notifications, so we don't actually update the cache. For + * now, always refetch link data here. */ _lookup_cached_link(cache, obj->link.ifindex, completed_from_cache, &link_cached); if (link_cached && link_cached->_link.netlink.is_in_netlink @@ -3266,7 +3266,7 @@ _new_from_nl_addr(struct nlmsghdr *nlh, gboolean id_only) _check_addr_or_return_null(tb, IFA_LOCAL, addr_len); if (is_v4) { /* For IPv4, kernel omits IFA_LOCAL/IFA_ADDRESS if (and only if) they - * are effectively 0.0.0.0 (all-zero). */ + * are effectively 0.0.0.0 (all-zero). */ if (tb[IFA_LOCAL]) memcpy(&obj->ip4_address.address, nla_data(tb[IFA_LOCAL]), addr_len); if (tb[IFA_ADDRESS]) @@ -3278,12 +3278,12 @@ _new_from_nl_addr(struct nlmsghdr *nlh, gboolean id_only) obj->ip4_address.use_ip4_broadcast_address = TRUE; } else { /* For IPv6, IFA_ADDRESS is always present. - * - * If IFA_LOCAL is missing, IFA_ADDRESS is @address and @peer_address - * is :: (all-zero). - * - * If unexpectedly IFA_ADDRESS is missing, make the best of it -- but it _should_ - * actually be there. */ + * + * If IFA_LOCAL is missing, IFA_ADDRESS is @address and @peer_address + * is :: (all-zero). + * + * If unexpectedly IFA_ADDRESS is missing, make the best of it -- but it _should_ + * actually be there. */ if (tb[IFA_ADDRESS] || tb[IFA_LOCAL]) { if (tb[IFA_LOCAL]) { memcpy(&obj->ip6_address.address, nla_data(tb[IFA_LOCAL]), addr_len); @@ -3375,8 +3375,8 @@ _new_from_nl_route(struct nlmsghdr *nlh, gboolean id_only) rtm = nlmsg_data(nlh); /***************************************************************** - * only handle ~supported~ routes. - *****************************************************************/ + * only handle ~supported~ routes. + *****************************************************************/ if (!NM_IN_SET(rtm->rtm_family, AF_INET, AF_INET6)) return NULL; @@ -3396,8 +3396,8 @@ _new_from_nl_route(struct nlmsghdr *nlh, gboolean id_only) return NULL; /***************************************************************** - * parse nexthops. Only handle routes with one nh. - *****************************************************************/ + * parse nexthops. Only handle routes with one nh. + *****************************************************************/ if (tb[RTA_MULTIPATH]) { size_t tlen = nla_len(tb[RTA_MULTIPATH]); @@ -3454,13 +3454,13 @@ rta_multipath_done:; if (!nh.is_present) { /* If no nexthops have been provided via RTA_MULTIPATH - * we add it as regular nexthop to maintain backwards - * compatibility */ + * we add it as regular nexthop to maintain backwards + * compatibility */ nh.ifindex = ifindex; nh.gateway = gateway; } else { /* Kernel supports new style nexthop configuration, - * verify that it is a duplicate and ignore old-style nexthop. */ + * verify that it is a duplicate and ignore old-style nexthop. */ if (nh.ifindex != ifindex || memcmp(&nh.gateway, &gateway, addr_len) != 0) return NULL; } @@ -3559,7 +3559,7 @@ rta_multipath_done:; if (!is_v4) { if (!_nm_platform_kernel_support_detected(NM_PLATFORM_KERNEL_SUPPORT_TYPE_RTA_PREF)) { /* Detect support for RTA_PREF by inspecting the netlink message. - * RTA_PREF was added in kernel 4.1, dated 21 June, 2015. */ + * RTA_PREF was added in kernel 4.1, dated 21 June, 2015. */ _nm_platform_kernel_support_init(NM_PLATFORM_KERNEL_SUPPORT_TYPE_RTA_PREF, tb[RTA_PREF] ? 1 : -1); } @@ -3753,17 +3753,17 @@ _new_from_nl_routing_rule(struct nlmsghdr *nlh, gboolean id_only) if (tb[FRA_L3MDEV]) { if (!_nm_platform_kernel_support_detected(NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_L3MDEV)) { /* support for FRA_L3MDEV was added in 96c63fa7393d0a346acfe5a91e0c7d4c7782641b, - * kernel 4.8, 3 October 2017. - * - * We can only detect support if the attribute is present. A missing attribute - * is not conclusive. */ + * kernel 4.8, 3 October 2017. + * + * We can only detect support if the attribute is present. A missing attribute + * is not conclusive. */ _nm_platform_kernel_support_init(NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_L3MDEV, 1); } /* actually, kernel only allows this attribute to be missing or - * "1". Still, encode it as full uint8. - * - * Note that FRA_L3MDEV and FRA_TABLE are mutally exclusive. */ + * "1". Still, encode it as full uint8. + * + * Note that FRA_L3MDEV and FRA_TABLE are mutally exclusive. */ props->l3mdev = nla_get_u8(tb[FRA_L3MDEV]); } @@ -3774,7 +3774,7 @@ _new_from_nl_routing_rule(struct nlmsghdr *nlh, gboolean id_only) if (!_nm_platform_kernel_support_detected(NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_PROTOCOL)) { /* FRA_PROTOCOL was added in kernel 4.17, dated 3 June, 2018. - * See commit 1b71af6053af1bd2f849e9fda4f71c1e3f145dcf. */ + * See commit 1b71af6053af1bd2f849e9fda4f71c1e3f145dcf. */ _nm_platform_kernel_support_init(NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_PROTOCOL, tb[FRA_PROTOCOL] ? 1 : -1); } @@ -3791,10 +3791,10 @@ _new_from_nl_routing_rule(struct nlmsghdr *nlh, gboolean id_only) if (!_nm_platform_kernel_support_detected(NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_IP_PROTO)) { /* support for FRA_IP_PROTO, FRA_SPORT_RANGE, and FRA_DPORT_RANGE was added together - * by bfff4862653bb96001ab57c1edd6d03f48e5f035, kernel 4.17, 4 June 2018. - * - * Unfortunately, a missing attribute does not tell us anything about support. - * We can only tell for sure when we have support, but not when we don't have. */ + * by bfff4862653bb96001ab57c1edd6d03f48e5f035, kernel 4.17, 4 June 2018. + * + * Unfortunately, a missing attribute does not tell us anything about support. + * We can only tell for sure when we have support, but not when we don't have. */ if (tb[FRA_IP_PROTO] || tb[FRA_SPORT_RANGE] || tb[FRA_DPORT_RANGE]) _nm_platform_kernel_support_init(NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_IP_PROTO, 1); } @@ -3806,10 +3806,10 @@ _new_from_nl_routing_rule(struct nlmsghdr *nlh, gboolean id_only) if (tb[FRA_UID_RANGE]) { if (!_nm_platform_kernel_support_detected(NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_UID_RANGE)) { /* support for FRA_UID_RANGE was added in 622ec2c9d52405973c9f1ca5116eb1c393adfc7d, - * kernel 4.10, 19 February 2017. - * - * We can only detect support if the attribute is present. A missing attribute - * is not conclusive. */ + * kernel 4.10, 19 February 2017. + * + * We can only detect support if the attribute is present. A missing attribute + * is not conclusive. */ _nm_platform_kernel_support_init(NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_UID_RANGE, 1); } @@ -4439,7 +4439,7 @@ _nl_msg_new_link_set_linkinfo_vlan(struct nl_msg * msg, nm_assert(msg); /* We must not create an empty IFLA_LINKINFO section. Otherwise, kernel - * rejects the request as invalid. */ + * rejects the request as invalid. */ if (flags_mask != 0 || vlan_id >= 0) has_any_vlan_properties = TRUE; if (!has_any_vlan_properties && ingress_qos && ingress_qos_len > 0) { @@ -4486,7 +4486,7 @@ _nl_msg_new_link_set_linkinfo_vlan(struct nl_msg * msg, for (i = 0; i < ingress_qos_len; i++) { /* Silently ignore invalid mappings. Kernel would truncate - * them and modify the wrong mapping. */ + * them and modify the wrong mapping. */ if (VLAN_XGRESS_PRIO_VALID(ingress_qos[i].from)) { if (!qos) { if (!(qos = nla_nest_start(msg, IFLA_VLAN_INGRESS_QOS))) @@ -4633,11 +4633,11 @@ _nl_msg_new_address(int nlmsg_type, if (flags & ~((guint32) 0xFF)) { /* only set the IFA_FLAGS attribute, if they actually contain additional - * flags that are not already set to am.ifa_flags. - * - * Older kernels refuse RTM_NEWADDR and RTM_NEWROUTE messages with EINVAL - * if they contain unknown netlink attributes. See net/core/rtnetlink.c, which - * was fixed by kernel commit 661d2967b3f1b34eeaa7e212e7b9bbe8ee072b59. */ + * flags that are not already set to am.ifa_flags. + * + * Older kernels refuse RTM_NEWADDR and RTM_NEWROUTE messages with EINVAL + * if they contain unknown netlink attributes. See net/core/rtnetlink.c, which + * was fixed by kernel commit 661d2967b3f1b34eeaa7e212e7b9bbe8ee072b59. */ NLA_PUT_U32(msg, IFA_FLAGS, flags); } @@ -4776,11 +4776,11 @@ _nl_msg_new_routing_rule(int nlmsg_type, int nlmsg_flags, const NMPlatformRoutin && routing_rule->action == FR_ACT_TO_TBL && routing_rule->l3mdev == 0 && table == RT_TABLE_UNSPEC) { /* for IPv6, this setting is invalid and rejected by kernel. That's fine. - * - * for IPv4, kernel will automatically assign an unused table. That's not - * fine, because we don't know what we will get. - * - * The caller must not allow that to happen. */ + * + * for IPv4, kernel will automatically assign an unused table. That's not + * fine, because we don't know what we will get. + * + * The caller must not allow that to happen. */ nm_assert_not_reached(); } @@ -5196,10 +5196,10 @@ sysctl_set_internal(NMPlatform *platform, _log_dbg_sysctl_set(platform, pathid, dirfd, path, value); /* Most sysfs and sysctl options don't care about a trailing LF, while some - * (like infiniband) do. So always add the LF. Also, neither sysfs nor - * sysctl support partial writes so the LF must be added to the string we're - * about to write. - */ + * (like infiniband) do. So always add the LF. Also, neither sysfs nor + * sysctl support partial writes so the LF must be added to the string we're + * about to write. + */ len = strlen(value) + 1; nm_assert(len > 0); if (len > 512) @@ -5231,7 +5231,7 @@ sysctl_set_internal(NMPlatform *platform, } else if (errsv == EINVAL && nm_utils_sysctl_ip_conf_is_path(AF_INET6, path, NULL, "mtu")) { /* setting the MTU can fail under regular conditions. Suppress - * logging a warning. */ + * logging a warning. */ level = LOGL_DEBUG; } @@ -5984,8 +5984,8 @@ delayed_action_handle_one(NMPlatform *platform) return FALSE; /* First process DELAYED_ACTION_TYPE_MASTER_CONNECTED actions. - * This type of action is entirely cache-internal and is here to resolve a - * cache inconsistency. It should be fixed right away. */ + * This type of action is entirely cache-internal and is here to resolve a + * cache inconsistency. It should be fixed right away. */ if (NM_FLAGS_HAS(priv->delayed_action.flags, DELAYED_ACTION_TYPE_MASTER_CONNECTED)) { nm_assert(priv->delayed_action.list_master_connected->len > 0); @@ -6006,7 +6006,7 @@ delayed_action_handle_one(NMPlatform *platform) nm_assert(priv->delayed_action.list_master_connected->len == 0); /* Next we prefer read-netlink, because the buffer size is limited and we want to process events - * from netlink early. */ + * from netlink early. */ if (NM_FLAGS_HAS(priv->delayed_action.flags, DELAYED_ACTION_TYPE_READ_NETLINK)) { _LOGt_delayed_action(DELAYED_ACTION_TYPE_READ_NETLINK, NULL, "handle"); priv->delayed_action.flags &= ~DELAYED_ACTION_TYPE_READ_NETLINK; @@ -6160,7 +6160,7 @@ cache_prune_one_type(NMPlatform *platform, const NMPLookup *lookup) const NMDedupMultiEntry *main_entry; /* we only track the dirty flag for the OBJECT-TYPE index. That means, - * for other lookup types we need to check the dirty flag of the main-entry. */ + * for other lookup types we need to check the dirty flag of the main-entry. */ main_entry = nmp_cache_reresolve_main_entry(cache, iter.current, lookup); if (!main_entry->dirty) continue; @@ -6291,9 +6291,9 @@ cache_on_change(NMPlatform * platform, int ifindex = -1; /* removal of a link could be caused by moving the link to another netns. - * In this case, we potentially have to update other links that have this link as parent. - * Currently, kernel misses to sent us a notification in this case - * (https://bugzilla.redhat.com/show_bug.cgi?id=1262908). */ + * In this case, we potentially have to update other links that have this link as parent. + * Currently, kernel misses to sent us a notification in this case + * (https://bugzilla.redhat.com/show_bug.cgi?id=1262908). */ if (cache_op == NMP_CACHE_OPS_REMOVED && obj_old /* <-- nonsensical, make coverity happy */ @@ -6329,8 +6329,8 @@ cache_on_change(NMPlatform * platform, || (NM_FLAGS_HAS(obj_old->link.n_ifi_flags, IFF_LOWER_UP) && !NM_FLAGS_HAS(obj_new->link.n_ifi_flags, IFF_LOWER_UP)))) { /* FIXME: I suspect that IFF_LOWER_UP must not be considered, and I - * think kernel does send RTM_DELROUTE events for IPv6 routes, so - * we might not need to refresh IPv6 routes. */ + * think kernel does send RTM_DELROUTE events for IPv6 routes, so + * we might not need to refresh IPv6 routes. */ delayed_action_schedule(platform, DELAYED_ACTION_TYPE_REFRESH_ALL_IP4_ROUTES | DELAYED_ACTION_TYPE_REFRESH_ALL_IP6_ROUTES, @@ -6358,33 +6358,33 @@ cache_on_change(NMPlatform * platform, NM_LINK_TYPE_VLAN, NM_LINK_TYPE_VXLAN)) { /* certain link-types also come with a IFLA_INFO_DATA/lnk_data. It may happen that - * kernel didn't send this notification, thus when we first learn about a link - * that lacks an lnk_data we re-request it again. - * - * For example https://bugzilla.redhat.com/show_bug.cgi?id=1284001 */ + * kernel didn't send this notification, thus when we first learn about a link + * that lacks an lnk_data we re-request it again. + * + * For example https://bugzilla.redhat.com/show_bug.cgi?id=1284001 */ re_request_link = TRUE; } else if (obj_new->link.type == NM_LINK_TYPE_TUN && obj_new->_link.netlink.lnk && (lnk_tun = &(obj_new->_link.netlink.lnk)->lnk_tun) && !lnk_tun->persist && lnk_tun->pi && !lnk_tun->vnet_hdr && !lnk_tun->multi_queue && !lnk_tun->owner_valid && !lnk_tun->group_valid) { /* kernel has/had a know issue that the first notification for TUN device would - * be sent with invalid parameters. The message looks like that kind, so refetch - * it. */ + * be sent with invalid parameters. The message looks like that kind, so refetch + * it. */ re_request_link = TRUE; } else if (obj_new->link.type == NM_LINK_TYPE_VETH && obj_new->link.parent == 0) { /* the initial notification when adding a veth pair can lack the parent/IFLA_LINK - * (https://bugzilla.redhat.com/show_bug.cgi?id=1285827). - * Request it again. */ + * (https://bugzilla.redhat.com/show_bug.cgi?id=1285827). + * Request it again. */ re_request_link = TRUE; } else if (obj_new->link.type == NM_LINK_TYPE_ETHERNET && obj_new->link.l_address.len == 0) { /* Due to a kernel bug, we sometimes receive spurious NEWLINK - * messages after a wifi interface has disappeared. Since the - * link is not present anymore we can't determine its type and - * thus it will show up as a Ethernet one, with no address - * specified. Request the link again to check if it really - * exists. https://bugzilla.redhat.com/show_bug.cgi?id=1302037 - */ + * messages after a wifi interface has disappeared. Since the + * link is not present anymore we can't determine its type and + * thus it will show up as a Ethernet one, with no address + * specified. Request the link again to check if it really + * exists. https://bugzilla.redhat.com/show_bug.cgi?id=1302037 + */ re_request_link = TRUE; } if (re_request_link) { @@ -6437,7 +6437,7 @@ cache_on_change(NMPlatform * platform, case NMP_OBJECT_TYPE_IP6_ADDRESS: { /* Address deletion is sometimes accompanied by route deletion. We need to - * check all routes belonging to the same interface. */ + * check all routes belonging to the same interface. */ if (cache_op == NMP_CACHE_OPS_REMOVED) { delayed_action_schedule(platform, (klass->obj_type == NMP_OBJECT_TYPE_IP4_ADDRESS) @@ -6457,8 +6457,8 @@ static guint32 _nlh_seq_next_get(NMLinuxPlatformPrivate *priv) { /* generate a new sequence number, but never return zero. - * Wrapping numbers are not a problem, because we don't rely - * on strictly increasing sequence numbers. */ + * Wrapping numbers are not a problem, because we don't rely + * on strictly increasing sequence numbers. */ return (++priv->nlh_seq_next) ?: (++priv->nlh_seq_next); } @@ -6682,9 +6682,9 @@ do_request_all_no_delayed_actions(NMPlatform *platform, DelayedActionType action action_type_prune = action_type; /* calling nmp_cache_dirty_set_all_main() with a non-main lookup-index requires an extra - * cache lookup for every entry. - * - * Avoid that, by special casing routing-rules here. */ + * cache lookup for every entry. + * + * Avoid that, by special casing routing-rules here. */ if (NM_FLAGS_ALL(action_type_prune, DELAYED_ACTION_TYPE_REFRESH_ALL_ROUTING_RULES_ALL)) { NMPLookup lookup; @@ -6819,10 +6819,10 @@ event_seq_check(NMPlatform * platform, if (data->seq_number == seq_number) { /* We potentially receive many parts partial responses for the same sequence number. - * Thus, we only remember the result, and collect it later. */ + * Thus, we only remember the result, and collect it later. */ if (data->seq_result < 0) { /* we already saw an error for this sequence number. - * Preserve it. */ + * Preserve it. */ } else if (seq_result != WAIT_FOR_NL_RESPONSE_RESULT_RESPONSE_UNKNOWN || data->seq_result == WAIT_FOR_NL_RESPONSE_RESULT_UNKNOWN) data->seq_result = seq_result; @@ -6857,18 +6857,18 @@ event_valid_msg(NMPlatform *platform, struct nl_msg *msg, gboolean handle_events if (!_nm_platform_kernel_support_detected(NM_PLATFORM_KERNEL_SUPPORT_TYPE_EXTENDED_IFA_FLAGS) && msghdr->nlmsg_type == RTM_NEWADDR) { /* IFA_FLAGS is set for IPv4 and IPv6 addresses. It was added first to IPv6, - * but if we encounter an IPv4 address with IFA_FLAGS, we surely have support. */ + * but if we encounter an IPv4 address with IFA_FLAGS, we surely have support. */ if (nlmsg_valid_hdr(msghdr, sizeof(struct ifaddrmsg)) && NM_IN_SET(((struct ifaddrmsg *) nlmsg_data(msghdr))->ifa_family, AF_INET, AF_INET6)) { /* see if the nl_msg contains the IFA_FLAGS attribute. If it does, - * we assume, that the kernel supports extended flags, IFA_F_MANAGETEMPADDR - * and IFA_F_NOPREFIXROUTE for IPv6. They were added together in kernel 3.14, - * dated 30 March, 2014. - * - * For IPv4, IFA_F_NOPREFIXROUTE was added later, but there is no easy - * way to detect kernel support. */ + * we assume, that the kernel supports extended flags, IFA_F_MANAGETEMPADDR + * and IFA_F_NOPREFIXROUTE for IPv6. They were added together in kernel 3.14, + * dated 30 March, 2014. + * + * For IPv4, IFA_F_NOPREFIXROUTE was added later, but there is no easy + * way to detect kernel support. */ _nm_platform_kernel_support_init( NM_PLATFORM_KERNEL_SUPPORT_TYPE_EXTENDED_IFA_FLAGS, !!nlmsg_find_attr(msghdr, sizeof(struct ifaddrmsg), IFA_FLAGS) ? 1 : -1); @@ -6886,7 +6886,7 @@ event_valid_msg(NMPlatform *platform, struct nl_msg *msg, gboolean handle_events RTM_DELQDISC, RTM_DELTFILTER)) { /* The event notifies about a deleted object. We don't need to initialize all - * fields of the object. */ + * fields of the object. */ is_del = TRUE; } @@ -6944,7 +6944,7 @@ event_valid_msg(NMPlatform *platform, struct nl_msg *msg, gboolean handle_events gboolean is_ipv6; /* IPv4 routes that are a response to RTM_GETROUTE must have - * the cloned flag while IPv6 routes don't have to. */ + * the cloned flag while IPv6 routes don't have to. */ is_ipv6 = NMP_OBJECT_GET_TYPE(obj) == NMP_OBJECT_TYPE_IP6_ROUTE; if (is_ipv6 || NM_FLAGS_HAS(obj->ip_route.r_rtm_flags, RTM_F_CLONED)) { nm_assert(is_ipv6 || !nmp_object_is_alive(obj)); @@ -6986,16 +6986,16 @@ event_valid_msg(NMPlatform *platform, struct nl_msg *msg, gboolean handle_events const NMDedupMultiEntry *entry_replace; /* we found an object that is to be replaced by the RTM_NEWROUTE message. - * While we invoke the signal, the platform cache might change and invalidate - * the findings. Mitigate that (for the most part), by marking the entry as - * dirty and only delete @obj_replace if it is still dirty afterwards. - * - * Yes, there is a tiny tiny chance for still getting it wrong. But in practice, - * the signal handlers do not cause to call the platform again, so the cache - * is not really changing. -- if they would, it would anyway be dangerous to overflow - * the stack and it's not ensured that the processing of netlink messages is - * reentrant (maybe it is). - */ + * While we invoke the signal, the platform cache might change and invalidate + * the findings. Mitigate that (for the most part), by marking the entry as + * dirty and only delete @obj_replace if it is still dirty afterwards. + * + * Yes, there is a tiny tiny chance for still getting it wrong. But in practice, + * the signal handlers do not cause to call the platform again, so the cache + * is not really changing. -- if they would, it would anyway be dangerous to overflow + * the stack and it's not ensured that the processing of netlink messages is + * reentrant (maybe it is). + */ entry_replace = nmp_cache_lookup_entry(cache, obj_replace); nm_assert(entry_replace && entry_replace->obj == obj_replace); nm_dedup_multi_entry_set_dirty(entry_replace, TRUE); @@ -7007,7 +7007,7 @@ event_valid_msg(NMPlatform *platform, struct nl_msg *msg, gboolean handle_events if (obj_replace) { /* the RTM_NEWROUTE message indicates that another route was replaced. - * Remove it now. */ + * Remove it now. */ cache_op = nmp_cache_remove(cache, obj_replace, TRUE, only_dirty, NULL); if (cache_op != NMP_CACHE_OPS_UNCHANGED) { nm_assert(cache_op == NMP_CACHE_OPS_REMOVED); @@ -7018,7 +7018,7 @@ event_valid_msg(NMPlatform *platform, struct nl_msg *msg, gboolean handle_events if (resync_required) { /* we'd like to avoid such resyncs as they are expensive and we should only rely on the - * netlink events. This needs investigation. */ + * netlink events. This needs investigation. */ _LOGT("schedule resync of routes after RTM_NEWROUTE"); delayed_action_schedule(platform, delayed_action_refresh_from_needle_object(obj), @@ -7146,12 +7146,12 @@ do_add_addrroute(NMPlatform * platform, if (NMP_OBJECT_GET_TYPE(obj_id) == NMP_OBJECT_TYPE_IP6_ADDRESS) { /* In rare cases, the object is not yet ready as we received the ACK from - * kernel. Need to refetch. - * - * We want to safe the expensive refetch, thus we look first into the cache - * whether the object exists. - * - * rh#1484434 */ + * kernel. Need to refetch. + * + * We want to safe the expensive refetch, thus we look first into the cache + * whether the object exists. + * + * rh#1484434 */ if (!nmp_cache_lookup_obj(nm_platform_get_cache(platform), obj_id)) do_request_one_type_by_needle_object(platform, obj_id); } @@ -7219,12 +7219,12 @@ do_delete_object(NMPlatform *platform, const NMPObject *obj_id, struct nl_msg *n NMP_OBJECT_TYPE_QDISC, NMP_OBJECT_TYPE_TFILTER)) { /* In rare cases, the object is still there after we receive the ACK from - * kernel. Need to refetch. - * - * We want to safe the expensive refetch, thus we look first into the cache - * whether the object exists. - * - * rh#1484434 */ + * kernel. Need to refetch. + * + * We want to safe the expensive refetch, thus we look first into the cache + * whether the object exists. + * + * rh#1484434 */ if (nmp_cache_lookup_obj(nm_platform_get_cache(platform), obj_id)) do_request_one_type_by_needle_object(platform, obj_id); } @@ -7273,7 +7273,7 @@ retry: } /* always refetch the link after changing it. There seems to be issues - * and we sometimes lack events. Nuke it from the orbit... */ + * and we sometimes lack events. Nuke it from the orbit... */ delayed_action_schedule(platform, DELAYED_ACTION_TYPE_REFRESH_LINK, GINT_TO_POINTER(ifindex)); delayed_action_handle_all(platform, FALSE); @@ -7305,7 +7305,7 @@ retry: data->set_address.length) == 0) { /* workaround ENFILE which may be wrongly returned (bgo #770456). - * If the MAC address is as expected, assume success? */ + * If the MAC address is as expected, assume success? */ log_result = "success"; log_detail = " (assume success changing address)"; result = 0; @@ -7344,12 +7344,12 @@ link_add(NMPlatform * platform, if (type == NM_LINK_TYPE_BOND) { /* When the kernel loads the bond module, either via explicit modprobe - * or automatically in response to creating a bond master, it will also - * create a 'bond0' interface. Since the bond we're about to create may - * or may not be named 'bond0' prevent potential confusion about a bond - * that the user didn't want by telling the bonding module not to create - * bond0 automatically. - */ + * or automatically in response to creating a bond master, it will also + * create a 'bond0' interface. Since the bond we're about to create may + * or may not be named 'bond0' prevent potential confusion about a bond + * that the user didn't want by telling the bonding module not to create + * bond0 automatically. + */ if (!g_file_test("/sys/class/net/bonding_masters", G_FILE_TEST_EXISTS)) (void) nm_utils_modprobe(NULL, TRUE, "bonding", "max_bonds=0", NULL); } @@ -7507,9 +7507,9 @@ link_supports_carrier_detect(NMPlatform *platform, int ifindex) return FALSE; /* We use netlink for the actual carrier detection, but netlink can't tell - * us whether the device actually supports carrier detection in the first - * place. We assume any device that does implements one of these two APIs. - */ + * us whether the device actually supports carrier detection in the first + * place. We assume any device that does implements one of these two APIs. + */ return nmp_utils_ethtool_supports_carrier_detect(ifindex) || nmp_utils_mii_supports_carrier_detect(ifindex); } @@ -7688,11 +7688,11 @@ link_set_sriov_params_async(NMPlatform * platform, } /* - * Take special care when setting new values: - * - don't touch anything if the right values are already set - * - to change the number of VFs or autoprobe we need to destroy existing VFs - * - the autoprobe setting is irrelevant when numvfs is zero - */ + * Take special care when setting new values: + * - don't touch anything if the right values are already set + * - to change the number of VFs or autoprobe we need to destroy existing VFs + * - the autoprobe setting is irrelevant when numvfs is zero + */ current_num = nm_platform_sysctl_get_int_checked( platform, NMP_SYSCTL_PATHID_NETDIR(dirfd, ifname, "device/sriov_numvfs"), @@ -7710,7 +7710,7 @@ link_set_sriov_params_async(NMPlatform * platform, if (current_autoprobe == -1 && errno == ENOENT) { /* older kernel versions don't have this sysctl. Assume the value is - * "1". */ + * "1". */ current_autoprobe = 1; } @@ -7814,9 +7814,9 @@ link_set_sriov_vfs(NMPlatform *platform, int ifindex, const NMPlatformVF *const } /* Kernel only supports one VLAN per VF now. If this - * changes in the future, we need to figure out how to - * clear existing VLANs and set new ones in one message - * with the new API.*/ + * changes in the future, we need to figure out how to + * clear existing VLANs and set new ones in one message + * with the new API.*/ if (vf->num_vlans > 1) { _LOGW("multiple VLANs per VF are not supported at the moment"); return FALSE; @@ -8031,14 +8031,14 @@ _vlan_change_vlan_qos_mapping_create(gboolean is_ingress_map, if (current_n_map) { if (is_ingress_map) { /* For the ingress-map, there are only 8 entries (0 to 7). - * When the user requests to reset all entries, we don't actually - * need the cached entries, we can just explicitly clear all possible - * ones. - * - * That makes only a real difference in case our cache is out-of-date. - * - * For the egress map we cannot do that, because there are far too - * many. There we can only clear the entries that we know about. */ + * When the user requests to reset all entries, we don't actually + * need the cached entries, we can just explicitly clear all possible + * ones. + * + * That makes only a real difference in case our cache is out-of-date. + * + * For the egress map we cannot do that, because there are far too + * many. There we can only clear the entries that we know about. */ for (i = 0; i < INGRESS_RANGE_LEN; i++) { map[i].from = i; map[i].to = 0; @@ -8751,12 +8751,12 @@ ip_route_get(NMPlatform * platform, delayed_action_handle_all(platform, FALSE); /* Retry, if we failed due to a cache resync. That can happen when the netlink - * socket fills up and we lost the response. */ + * socket fills up and we lost the response. */ } while (seq_result == WAIT_FOR_NL_RESPONSE_RESULT_FAILED_RESYNC && ++try_count < 10); if (seq_result < 0) { /* negative seq_result is an errno from kernel. Map it to negative - * int (which are also errno). */ + * int (which are also errno). */ return (int) seq_result; } @@ -8824,7 +8824,7 @@ qdisc_add(NMPlatform *platform, NMPNlmFlags flags, const NMPlatformQdisc *qdisc) nm_auto_nlmsg struct nl_msg *msg = NULL; /* Note: @qdisc must not be copied or kept alive because the lifetime of qdisc.kind - * is undefined. */ + * is undefined. */ msg = _nl_msg_new_qdisc(RTM_NEWQDISC, flags, qdisc); @@ -8868,7 +8868,7 @@ tfilter_add(NMPlatform *platform, NMPNlmFlags flags, const NMPlatformTfilter *tf nm_auto_nlmsg struct nl_msg *msg = NULL; /* Note: @tfilter must not be copied or kept alive because the lifetime of tfilter.kind - * and tfilter.action.kind is undefined. */ + * and tfilter.action.kind is undefined. */ msg = _nl_msg_new_tfilter(RTM_NEWTFILTER, flags, tfilter); @@ -8936,7 +8936,7 @@ continue_reading: int buf_size; /* the message receive buffer was too small. We lost one message, which - * is unfortunate. Try to double the buffer size for the next time. */ + * is unfortunate. Try to double the buffer size for the next time. */ buf_size = nl_socket_get_msg_buf_size(sk); if (buf_size < 512 * 1024) { buf_size *= 2; @@ -8985,10 +8985,10 @@ continue_reading: if (hdr->nlmsg_flags & NLM_F_DUMP_INTR) { /* - * We have to continue reading to clear - * all messages until a NLMSG_DONE is - * received and report the inconsistency. - */ + * We have to continue reading to clear + * all messages until a NLMSG_DONE is + * received and report the inconsistency. + */ interrupted = TRUE; } @@ -9001,20 +9001,20 @@ continue_reading: if (hdr->nlmsg_type == NLMSG_DONE) { /* messages terminates a multipart message, this is - * usually the end of a message and therefore we slip - * out of the loop by default. the user may overrule - * this action by skipping this packet. */ + * usually the end of a message and therefore we slip + * out of the loop by default. the user may overrule + * this action by skipping this packet. */ multipart = FALSE; seq_result = WAIT_FOR_NL_RESPONSE_RESULT_RESPONSE_OK; } else if (hdr->nlmsg_type == NLMSG_NOOP) { /* Message to be ignored, the default action is to - * skip this message if no callback is specified. The - * user may overrule this action by returning - * NL_PROCEED. */ + * skip this message if no callback is specified. The + * user may overrule this action by returning + * NL_PROCEED. */ } else if (hdr->nlmsg_type == NLMSG_OVERRUN) { /* Data got lost, report back to user. The default action is to - * quit parsing. The user may overrule this action by returning - * NL_SKIP or NL_PROCEED (dangerous) */ + * quit parsing. The user may overrule this action by returning + * NL_SKIP or NL_PROCEED (dangerous) */ err = -NME_NL_MSG_OVERFLOW; abort_parsing = TRUE; } else if (hdr->nlmsg_type == NLMSG_ERROR) { @@ -9023,9 +9023,9 @@ continue_reading: if (hdr->nlmsg_len < nlmsg_size(sizeof(*e))) { /* Truncated error message, the default action - * is to stop parsing. The user may overrule - * this action by returning NL_SKIP or - * NL_PROCEED (dangerous) */ + * is to stop parsing. The user may overrule + * this action by returning NL_SKIP or + * NL_PROCEED (dangerous) */ err = -NME_NL_MSG_TRUNC; abort_parsing = TRUE; } else if (e->error) { @@ -9067,18 +9067,18 @@ continue_reading: seq_number = nlmsg_hdr(msg)->nlmsg_seq; /* check whether the seq number is different from before, and - * whether the previous number (@nlh_seq_last_seen) is a pending - * refresh-all request. In that case, the pending request is thereby - * completed. - * - * We must do that before processing the message with event_valid_msg(), - * because we must track the completion of the pending request before that. */ + * whether the previous number (@nlh_seq_last_seen) is a pending + * refresh-all request. In that case, the pending request is thereby + * completed. + * + * We must do that before processing the message with event_valid_msg(), + * because we must track the completion of the pending request before that. */ event_seq_check_refresh_all(platform, seq_number); if (process_valid_msg) { /* Valid message (not checking for MULTIPART bit to - * get along with broken kernels. NL_SKIP has no - * effect on this. */ + * get along with broken kernels. NL_SKIP has no + * effect on this. */ event_valid_msg(platform, msg, handle_events); @@ -9101,8 +9101,8 @@ continue_reading: stop: if (!handle_events) { /* when we don't handle events, we want to drain all messages from the socket - * without handling the messages (but still check for sequence numbers). - * Repeat reading. */ + * without handling the messages (but still check for sequence numbers). + * Repeat reading. */ goto continue_reading; } @@ -9443,7 +9443,7 @@ constructed(GObject *_object) _LOGD("could not enable extended acks on netlink socket"); /* explicitly set the msg buffer size and disable MSG_PEEK. - * If we later encounter NME_NL_MSG_TRUNC, we will adjust the buffer size. */ + * If we later encounter NME_NL_MSG_TRUNC, we will adjust the buffer size. */ nl_socket_disable_msg_peek(priv->nlh); nle = nl_socket_set_msg_buf_size(priv->nlh, 32 * 1024); g_assert(!nle); diff --git a/src/platform/nm-netlink.c b/src/platform/nm-netlink.c index 00c9a8402f..0246da5455 100644 --- a/src/platform/nm-netlink.c +++ b/src/platform/nm-netlink.c @@ -426,10 +426,10 @@ nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize) size_t len; /* - Always writes @dstsize bytes to @dst - * - Copies the first non-NUL characters to @dst. - * Any characters after the first NUL bytes in @nla are ignored. - * - If the string @nla is longer than @dstsize, the string - * gets truncated. @dst will always be NUL terminated. */ + * - Copies the first non-NUL characters to @dst. + * Any characters after the first NUL bytes in @nla are ignored. + * - If the string @nla is longer than @dstsize, the string + * gets truncated. @dst will always be NUL terminated. */ if (G_UNLIKELY(dstsize <= 1)) { if (dstsize == 1) @@ -478,8 +478,8 @@ nla_memcpy(void *dst, const struct nlattr *nla, size_t dstsize) len = NM_MIN((size_t) srclen, dstsize); if (len > 0) { /* there is a crucial difference between nla_strlcpy() and nla_memcpy(). - * The former always write @dstsize bytes (akin to strncpy()), here, we only - * write the bytes that we actually have (leaving the remainder undefined). */ + * The former always write @dstsize bytes (akin to strncpy()), here, we only + * write the bytes that we actually have (leaving the remainder undefined). */ memcpy(dst, nla_data(nla), len); } @@ -553,9 +553,9 @@ _nest_end(struct nl_msg *msg, struct nlattr *start, int keep_empty) if (len > USHRT_MAX || (!keep_empty && len == NLA_HDRLEN)) { /* - * Max nlattr size exceeded or empty nested attribute, trim the - * attribute header again - */ + * Max nlattr size exceeded or empty nested attribute, trim the + * attribute header again + */ nla_nest_cancel(msg, start); /* Return error only if nlattr size was exceeded */ @@ -567,11 +567,11 @@ _nest_end(struct nl_msg *msg, struct nlattr *start, int keep_empty) pad = NLMSG_ALIGN(msg->nm_nlh->nlmsg_len) - msg->nm_nlh->nlmsg_len; if (pad > 0) { /* - * Data inside attribute does not end at a alignment boundary. - * Pad accordingly and account for the additional space in - * the message. nlmsg_reserve() may never fail in this situation, - * the allocate message buffer must be a multiple of NLMSG_ALIGNTO. - */ + * Data inside attribute does not end at a alignment boundary. + * Pad accordingly and account for the additional space in + * the message. nlmsg_reserve() may never fail in this situation, + * the allocate message buffer must be a multiple of NLMSG_ALIGNTO. + */ if (!nlmsg_reserve(msg, pad, 0)) g_return_val_if_reached(-NME_BUG); } @@ -1140,7 +1140,7 @@ nl_wait_for_ack(struct nl_sock *sk, const struct nl_cb *cb) \ if (_cb && _cb->type##_cb) { \ /* the returned value here must be either a negative - * netlink error number, or one of NL_SKIP, NL_STOP, NL_OK. */ \ + * netlink error number, or one of NL_SKIP, NL_STOP, NL_OK. */ \ nmerr = _cb->type##_cb((msg), _cb->type##_arg); \ switch (nmerr) { \ case NL_OK: \ @@ -1198,7 +1198,7 @@ continue_reading: if (hdr->nlmsg_type == NLMSG_DONE || hdr->nlmsg_type == NLMSG_ERROR || hdr->nlmsg_type == NLMSG_NOOP || hdr->nlmsg_type == NLMSG_OVERRUN) { /* We can't check for !NLM_F_MULTI since some netlink - * users in the kernel are broken. */ + * users in the kernel are broken. */ sk->s_seq_expect++; } @@ -1207,32 +1207,32 @@ continue_reading: if (hdr->nlmsg_flags & NLM_F_DUMP_INTR) { /* - * We have to continue reading to clear - * all messages until a NLMSG_DONE is - * received and report the inconsistency. - */ + * We have to continue reading to clear + * all messages until a NLMSG_DONE is + * received and report the inconsistency. + */ interrupted = 1; } /* messages terminates a multipart message, this is - * usually the end of a message and therefore we slip - * out of the loop by default. the user may overrule - * this action by skipping this packet. */ + * usually the end of a message and therefore we slip + * out of the loop by default. the user may overrule + * this action by skipping this packet. */ if (hdr->nlmsg_type == NLMSG_DONE) { multipart = 0; NL_CB_CALL(cb, finish, msg); } /* Message to be ignored, the default action is to - * skip this message if no callback is specified. The - * user may overrule this action by returning - * NL_PROCEED. */ + * skip this message if no callback is specified. The + * user may overrule this action by returning + * NL_PROCEED. */ else if (hdr->nlmsg_type == NLMSG_NOOP) goto skip; /* Data got lost, report back to user. The default action is to - * quit parsing. The user may overrule this action by returning - * NL_SKIP or NL_PROCEED (dangerous) */ + * quit parsing. The user may overrule this action by returning + * NL_SKIP or NL_PROCEED (dangerous) */ else if (hdr->nlmsg_type == NLMSG_OVERRUN) { nmerr = -NME_NL_MSG_OVERFLOW; goto out; @@ -1244,9 +1244,9 @@ continue_reading: if (hdr->nlmsg_len < nlmsg_size(sizeof(*e))) { /* Truncated error message, the default action - * is to stop parsing. The user may overrule - * this action by returning NL_SKIP or - * NL_PROCEED (dangerous) */ + * is to stop parsing. The user may overrule + * this action by returning NL_SKIP or + * NL_PROCEED (dangerous) */ nmerr = -NME_NL_MSG_TRUNC; goto out; } @@ -1254,7 +1254,7 @@ continue_reading: /* Error message reported back from kernel. */ if (cb && cb->err_cb) { /* the returned value here must be either a negative - * netlink error number, or one of NL_SKIP, NL_STOP, NL_OK. */ + * netlink error number, or one of NL_SKIP, NL_STOP, NL_OK. */ nmerr = cb->err_cb(&nla, e, cb->err_arg); if (nmerr < 0) goto out; @@ -1273,8 +1273,8 @@ continue_reading: NL_CB_CALL(cb, ack, msg); } else { /* Valid message (not checking for MULTIPART bit to - * get along with broken kernels. NL_SKIP has no - * effect on this. */ + * get along with broken kernels. NL_SKIP has no + * effect on this. */ NL_CB_CALL(cb, valid, msg); } skip: @@ -1332,8 +1332,8 @@ nl_send_iovec(struct nl_sock *sk, struct nl_msg *msg, struct iovec *iov, unsigne char buf[CMSG_SPACE(sizeof(struct ucred))]; /* Overwrite destination if specified in the message itself, defaults - * to the peer address of the socket. - */ + * to the peer address of the socket. + */ dst = nlmsg_get_dst(msg); if (dst->nl_family == AF_NETLINK) hdr.msg_name = dst; @@ -1467,8 +1467,8 @@ retry: } /* Provided buffer is not long enough, enlarge it - * to size of n (which should be total length of the message) - * and try again. */ + * to size of n (which should be total length of the message) + * and try again. */ iov.iov_base = g_realloc(iov.iov_base, n); iov.iov_len = n; flags = 0; diff --git a/src/platform/nm-netlink.h b/src/platform/nm-netlink.h index ec5a85824e..63f63c4899 100644 --- a/src/platform/nm-netlink.h +++ b/src/platform/nm-netlink.h @@ -81,8 +81,8 @@ struct nla_policy { G_STATIC_ASSERT_EXPR(G_N_ELEMENTS(tb) > 0); \ \ /* We allow @policy to be either a C array or NULL. The sizeof() - * must either match the expected array size or the sizeof(NULL), - * but not both. */ \ + * must either match the expected array size or the sizeof(NULL), + * but not both. */ \ G_STATIC_ASSERT_EXPR((sizeof(policy) == G_N_ELEMENTS(tb) * sizeof(struct nla_policy)) \ ^ (sizeof(policy) == sizeof(NULL))); \ } \ @@ -144,8 +144,8 @@ nla_data(const struct nlattr *nla) nm_assert(nla_len(_nla) >= sizeof(type)); \ \ /* note that casting the pointer is undefined behavior in C, if - * the data has wrong alignment. Netlink data is aligned to 4 bytes, - * that means, if the alignment is larger than 4, this is invalid. */ \ + * the data has wrong alignment. Netlink data is aligned to 4 bytes, + * that means, if the alignment is larger than 4, this is invalid. */ \ G_STATIC_ASSERT_EXPR(_nm_alignof(type) <= NLA_ALIGNTO); \ \ (type *) nla_data(_nla); \ @@ -237,8 +237,8 @@ size_t nla_memcpy(void *dst, const struct nlattr *nla, size_t dstsize); size_t _srcsize; \ \ /* assert that, if @nla is given, that it has the exact expected - * size. This implies that the caller previously verified the length - * of the attribute (via minlen/maxlen at nla_parse()). */ \ + * size. This implies that the caller previously verified the length + * of the attribute (via minlen/maxlen at nla_parse()). */ \ \ if (_nla) { \ _srcsize = nla_memcpy(_dst, _nla, _dstsize); \ diff --git a/src/platform/nm-platform-utils.c b/src/platform/nm-platform-utils.c index 6b78fc8fae..08b6a39fa8 100644 --- a/src/platform/nm-platform-utils.c +++ b/src/platform/nm-platform-utils.c @@ -143,7 +143,7 @@ _ioctl_call(const char * log_ioctl_type, } /* we might need to retry the request. Backup edata so that we can - * restore it on retry. */ + * restore it on retry. */ if (edata_size > 0) edata_backup = nm_memdup_maybe_a(500, edata, edata_size, &edata_backup_free); @@ -189,41 +189,41 @@ again: /* resolve the name again to see whether the ifindex still has the same name. */ if (!nmp_utils_if_indextoname(ifindex, known_ifnames[try_count % 2])) { /* we could not find the ifindex again. Probably the device just got - * removed. - * - * In both cases we return the error code we got from ioctl above. - * Either it failed because the device was gone already or it still - * managed to complete the call. In both cases, the error code is good. */ + * removed. + * + * In both cases we return the error code we got from ioctl above. + * Either it failed because the device was gone already or it still + * managed to complete the call. In both cases, the error code is good. */ failure_reason = "cannot resolve ifindex after ioctl call. Probably the device was just removed"; goto out; } /* check whether the ifname changed in the meantime. If yes, would render the result - * invalid. Note that this cannot detect every race regarding renames, for example: - * - * - if_indextoname(#10) gives eth0 - * - rename(#10) => eth0_tmp - * - rename(#11) => eth0 - * - ioctl(eth0) (wrongly fetching #11, formerly eth1) - * - rename(#11) => eth_something - * - rename(#10) => eth0 - * - if_indextoname(#10) gives eth0 - */ + * invalid. Note that this cannot detect every race regarding renames, for example: + * + * - if_indextoname(#10) gives eth0 + * - rename(#10) => eth0_tmp + * - rename(#11) => eth0 + * - ioctl(eth0) (wrongly fetching #11, formerly eth1) + * - rename(#11) => eth_something + * - rename(#10) => eth0 + * - if_indextoname(#10) gives eth0 + */ if (!nm_streq(known_ifnames[0], known_ifnames[1])) { gboolean retry; /* we detected a possible(!) rename. - * - * For getters it's straight forward to just retry the call. - * - * For setters we also always retry. If our previous call operated on the right device, - * calling it again should have no bad effect (just setting the same thing more than once). - * - * The only potential bad thing is if there was a race involving swapping names, and we just - * set the ioctl option on the wrong device. But then the bad thing already happenned and - * we cannot detect it (nor do anything about it). At least, we can retry and set the - * option on the right interface. */ + * + * For getters it's straight forward to just retry the call. + * + * For setters we also always retry. If our previous call operated on the right device, + * calling it again should have no bad effect (just setting the same thing more than once). + * + * The only potential bad thing is if there was a race involving swapping names, and we just + * set the ioctl option on the wrong device. But then the bad thing already happenned and + * we cannot detect it (nor do anything about it). At least, we can retry and set the + * option on the right interface. */ retry = (try_count < 5); nm_log_trace(LOGD_PLATFORM, @@ -388,7 +388,7 @@ ethtool_gstrings_find(const struct ethtool_gstrings *gstrings, const char *needl guint32 i; /* ethtool_get_stringset() always ensures NUL terminated strings at ETH_GSTRING_LEN. - * that means, we cannot possibly request longer names. */ + * that means, we cannot possibly request longer names. */ nm_assert(needle && strlen(needle) < ETH_GSTRING_LEN); for (i = 0; i < gstrings->len; i++) { @@ -404,7 +404,7 @@ ethtool_get_stringset_index(SocketHandle *shandle, int stringset_id, const char gs_free struct ethtool_gstrings *gstrings = NULL; /* ethtool_get_stringset() always ensures NUL terminated strings at ETH_GSTRING_LEN. - * that means, we cannot possibly request longer names. */ + * that means, we cannot possibly request longer names. */ nm_assert(needle && strlen(needle) < ETH_GSTRING_LEN); gstrings = ethtool_get_stringset(shandle, stringset_id); @@ -423,10 +423,10 @@ static const NMEthtoolFeatureInfo _ethtool_feature_infos[_NM_ETHTOOL_ID_FEATURE_ } /* the order does only matter for one thing: if it happens that more than one NMEthtoolID - * reference the same kernel-name, then the one that is mentioned *later* will win in - * case these NMEthtoolIDs are set. That mostly only makes sense for ethtool-ids which - * refer to multiple features ("feature-tso"), while also having more specific ids - * ("feature-tx-tcp-segmentation"). */ + * reference the same kernel-name, then the one that is mentioned *later* will win in + * case these NMEthtoolIDs are set. That mostly only makes sense for ethtool-ids which + * refer to multiple features ("feature-tso"), while also having more specific ids + * ("feature-tx-tcp-segmentation"). */ /* names from ethtool utility, which are aliases for multiple features. */ ETHT_FEAT(NM_ETHTOOL_ID_FEATURE_SG, "tx-scatter-gather", "tx-scatter-gather-fraglist"), @@ -766,8 +766,8 @@ nmp_utils_ethtool_set_features( if (do_set && (!s->available || s->never_changed) && (s->active != (requested[i] == NM_TERNARY_TRUE))) { /* we request to change a flag which kernel reported as fixed. - * While the ethtool operation will silently succeed, mark the request - * as failure. */ + * While the ethtool operation will silently succeed, mark the request + * as failure. */ success = FALSE; } @@ -1139,9 +1139,9 @@ nmp_utils_ethtool_get_permanent_address(int ifindex, guint8 *buf, size_t *length if (NM_IN_SET(pdata[0], 0, 0xFF)) { /* Some drivers might return a permanent address of all zeros. - * Reject that (rh#1264024) - * - * Some drivers return a permanent address of all ones. Reject that too */ + * Reject that (rh#1264024) + * + * Some drivers return a permanent address of all ones. Reject that too */ for (i = 1; i < edata.e.size; i++) { if (pdata[0] != pdata[i]) goto not_all_0or1; @@ -1163,9 +1163,9 @@ nmp_utils_ethtool_supports_carrier_detect(int ifindex) g_return_val_if_fail(ifindex > 0, FALSE); /* We ignore the result. If the ETHTOOL_GLINK call succeeded, then we - * assume the device supports carrier-detect, otherwise we assume it - * doesn't. - */ + * assume the device supports carrier-detect, otherwise we assume it + * doesn't. + */ return _ethtool_call_once(ifindex, &edata, sizeof(edata)) >= 0; } @@ -1349,8 +1349,8 @@ nmp_utils_ethtool_set_link_settings(int ifindex, return FALSE; /* FIXME: try first new ETHTOOL_GLINKSETTINGS/SLINKSETTINGS API - * https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3f1ac7a700d039c61d8d8b99f28d605d489a60cf - */ + * https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3f1ac7a700d039c61d8d8b99f28d605d489a60cf + */ /* then change the needed ones */ edata.cmd = ETHTOOL_SSET; @@ -1525,9 +1525,9 @@ nmp_utils_udev_get_driver(struct udev_device *udevice) driver = udev_device_get_driver(parent); if (!driver) { /* Try the grandparent if it's an ibmebus device or if the - * subsys is NULL which usually indicates some sort of - * platform device like a 'gadget' net interface. - */ + * subsys is NULL which usually indicates some sort of + * platform device like a 'gadget' net interface. + */ subsys = udev_device_get_subsystem(parent); if ((g_strcmp0(subsys, "ibmebus") == 0) || (subsys == NULL)) { grandparent = udev_device_get_parent(parent); @@ -1539,7 +1539,7 @@ nmp_utils_udev_get_driver(struct udev_device *udevice) out: /* Intern the string so we don't have to worry about memory - * management in NMPlatformLink. */ + * management in NMPlatformLink. */ return g_intern_string(driver); } @@ -1557,8 +1557,8 @@ NMIPConfigSource nmp_utils_ip_config_source_round_trip_rtprot(NMIPConfigSource source) { /* when adding a route to kernel for a give @source, the resulting route - * will be put into the cache with a source of NM_IP_CONFIG_SOURCE_RTPROT_*. - * This function returns that. */ + * will be put into the cache with a source of NM_IP_CONFIG_SOURCE_RTPROT_*. + * This function returns that. */ return nmp_utils_ip_config_source_from_rtprot( nmp_utils_ip_config_source_coerce_to_rtprot(source)); } @@ -1567,8 +1567,8 @@ guint8 nmp_utils_ip_config_source_coerce_to_rtprot(NMIPConfigSource source) { /* when adding a route to kernel, we coerce the @source field - * to rtm_protocol. This is not lossless as we map different - * source values to the same RTPROT uint8 value. */ + * to rtm_protocol. This is not lossless as we map different + * source values to the same RTPROT uint8 value. */ if (source <= NM_IP_CONFIG_SOURCE_UNKNOWN) return RTPROT_UNSPEC; @@ -1594,17 +1594,17 @@ NMIPConfigSource nmp_utils_ip_config_source_coerce_from_rtprot(NMIPConfigSource source) { /* When we receive a route from kernel and put it into the platform cache, - * we preserve the protocol field by converting it to a NMIPConfigSource - * via nmp_utils_ip_config_source_from_rtprot(). - * - * However, that is not the inverse of nmp_utils_ip_config_source_coerce_to_rtprot(). - * Instead, to go back to the original value, you need another step: - * nmp_utils_ip_config_source_coerce_from_rtprot (nmp_utils_ip_config_source_from_rtprot (rtprot)). - * - * This might partly restore the original source value, but of course that - * is not really possible because nmp_utils_ip_config_source_coerce_to_rtprot() - * is not injective. - * */ + * we preserve the protocol field by converting it to a NMIPConfigSource + * via nmp_utils_ip_config_source_from_rtprot(). + * + * However, that is not the inverse of nmp_utils_ip_config_source_coerce_to_rtprot(). + * Instead, to go back to the original value, you need another step: + * nmp_utils_ip_config_source_coerce_from_rtprot (nmp_utils_ip_config_source_from_rtprot (rtprot)). + * + * This might partly restore the original source value, but of course that + * is not really possible because nmp_utils_ip_config_source_coerce_to_rtprot() + * is not injective. + * */ switch (source) { case NM_IP_CONFIG_SOURCE_RTPROT_UNSPEC: return NM_IP_CONFIG_SOURCE_UNKNOWN; @@ -1753,8 +1753,8 @@ nmp_utils_sysctl_open_netdir(int ifindex, const char *ifname_guess, char *out_if g_return_val_if_reached(-1); /* we only retry, if the name changed since previous attempt. - * Hence, it is extremely unlikely that this loop runes until the - * end of the @try_count. */ + * Hence, it is extremely unlikely that this loop runes until the + * end of the @try_count. */ if (nm_streq(ifname, ifname_buf_last_try)) return -1; strcpy(ifname_buf_last_try, ifname); diff --git a/src/platform/nm-platform-utils.h b/src/platform/nm-platform-utils.h index cae1e07dee..1d0f32295f 100644 --- a/src/platform/nm-platform-utils.h +++ b/src/platform/nm-platform-utils.h @@ -34,7 +34,7 @@ gboolean nmp_utils_ethtool_get_permanent_address(int ifindex, guint8 *buf, size_ typedef struct { /* We don't want to include <linux/ethtool.h> in header files, - * thus create a ABI compatible version of struct ethtool_drvinfo.*/ + * thus create a ABI compatible version of struct ethtool_drvinfo.*/ guint32 _private_cmd; char driver[32]; char version[32]; @@ -57,8 +57,8 @@ typedef struct { guint8 n_kernel_names; /* one NMEthtoolID refers to one or more kernel_names. The reason for supporting this complexity - * (where one NMSettingEthtool option refers to multiple kernel features) is to follow what - * ethtool does, where "tx" is an alias for multiple features. */ + * (where one NMSettingEthtool option refers to multiple kernel features) is to follow what + * ethtool does, where "tx" is an alias for multiple features. */ const char *const *kernel_names; } NMEthtoolFeatureInfo; @@ -68,7 +68,7 @@ typedef struct { guint idx_ss_features; /* one NMEthtoolFeatureInfo references one or more kernel_names. This is the index - * of the matching info->kernel_names */ + * of the matching info->kernel_names */ guint8 idx_kernel_name; bool available : 1; diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index bfef88ac52..60484c74d0 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -474,13 +474,13 @@ nm_platform_process_events_ensure_link(NMPlatform *self, int ifindex, const char return NULL; /* we look into the cache, whether a link for given ifindex/ifname - * exits. If not, we poll the netlink socket, maybe the event - * with the link is waiting. - * - * Then we try again to find the object. - * - * If the link is already cached the first time, we avoid polling - * the netlink socket. */ + * exits. If not, we poll the netlink socket, maybe the event + * with the link is waiting. + * + * Then we try again to find the object. + * + * If the link is already cached the first time, we avoid polling + * the netlink socket. */ again: obj = nmp_cache_lookup_link_full( nm_platform_get_cache(self), @@ -524,8 +524,8 @@ nm_platform_sysctl_open_netdir(NMPlatform *self, int ifindex, char *out_ifname) g_return_val_if_fail(ifindex > 0, -1); /* we don't have an @ifname_guess argument to make the API nicer. - * But still do a cache-lookup first. Chances are good that we have - * the right ifname cached and save if_indextoname() */ + * But still do a cache-lookup first. Chances are good that we have + * the right ifname cached and save if_indextoname() */ ifname_guess = nm_platform_link_get_name(self, ifindex); return nmp_utils_sysctl_open_netdir(ifindex, ifname_guess, out_ifname); @@ -621,7 +621,7 @@ nm_platform_sysctl_ip_conf_set_ipv6_hop_limit_safe(NMPlatform *self, const char -1); /* only allow increasing the hop-limit to avoid DOS by an attacker - * setting a low hop-limit (CVE-2015-2924, rh#1209902) */ + * setting a low hop-limit (CVE-2015-2924, rh#1209902) */ if (value < cur) return FALSE; @@ -650,7 +650,7 @@ nm_platform_sysctl_ip_neigh_set_ipv6_reachable_time(NMPlatform *self, return TRUE; /* RFC 4861 says the value can't be greater than one hour. - * Also use a reasonable lower threshold. */ + * Also use a reasonable lower threshold. */ clamped = NM_CLAMP(value_ms, 100, 3600000); nm_sprintf_buf(path, "/proc/sys/net/ipv6/neigh/%s/base_reachable_time_ms", iface); nm_sprintf_buf(str, "%u", clamped); @@ -783,7 +783,7 @@ nm_platform_sysctl_get_int_checked(NMPlatform *self, value = nm_platform_sysctl_get(self, pathid, dirfd, path); if (!value) { /* nm_platform_sysctl_get() set errno to ENOENT if the file does not exist. - * Propagate/preserve that. */ + * Propagate/preserve that. */ if (errno != ENOENT) errno = EINVAL; return fallback; @@ -892,8 +892,8 @@ nm_platform_sysctl_ip_conf_get_rp_filter_ipv4(NMPlatform *self, return -1; /* the effectively used value is the rp_filter sysctl value of MAX(all,ifname). - * Note that this is the numerical MAX(), despite rp_filter "1" being more strict - * than "2". */ + * Note that this is the numerical MAX(), despite rp_filter "1" being more strict + * than "2". */ if (val < 2 && consider_all && !nm_streq(ifname, "all")) { val_all = nm_platform_sysctl_ip_conf_get_int_checked(self, AF_INET, @@ -974,7 +974,7 @@ nm_platform_link_get_all(NMPlatform *self, gboolean sort_by_name) return NULL; /* first sort the links by their ifindex or name. Below we will sort - * further by moving children/slaves to the end. */ + * further by moving children/slaves to the end. */ g_ptr_array_sort_with_data(links, _link_get_all_presort, GINT_TO_POINTER(sort_by_name)); unseen = g_hash_table_new(nm_direct_hash, NULL); @@ -1045,7 +1045,7 @@ skip: } else { nm_assert(first_idx != G_MAXUINT); /* There is a loop, pop the first (remaining) element from the list. - * This can happen for veth pairs where each peer is parent of the other end. */ + * This can happen for veth pairs where each peer is parent of the other end. */ item = NMP_OBJECT_CAST_LINK(links->pdata[first_idx]); nm_assert(item); g_hash_table_remove(unseen, GINT_TO_POINTER(item->ifindex)); @@ -1471,11 +1471,11 @@ nm_platform_link_get_type_name(NMPlatform *self, int ifindex) if (obj->link.type != NM_LINK_TYPE_UNKNOWN) { /* We could detect the @link_type. In this case the function returns - * our internal module names, which differs from rtnl_link_get_type(): - * - NM_LINK_TYPE_INFINIBAND (gives "infiniband", instead of "ipoib") - * - NM_LINK_TYPE_TAP (gives "tap", instead of "tun"). - * Note that this functions is only used by NMDeviceGeneric to - * set type_description. */ + * our internal module names, which differs from rtnl_link_get_type(): + * - NM_LINK_TYPE_INFINIBAND (gives "infiniband", instead of "ipoib") + * - NM_LINK_TYPE_TAP (gives "tap", instead of "tun"). + * Note that this functions is only used by NMDeviceGeneric to + * set type_description. */ return nm_link_type_to_string(obj->link.type); } /* Link type not detected. Fallback to rtnl_link_get_type()/IFLA_INFO_KIND. */ @@ -1581,7 +1581,7 @@ nm_platform_link_get_ifi_flags(NMPlatform *self, int ifindex, guint requested_fl return -ENODEV; /* Errors are signaled as negative values. That means, you cannot request - * the most significant bit (2^31) with this API. Assert against that. */ + * the most significant bit (2^31) with this API. Assert against that. */ nm_assert((int) requested_flags >= 0); nm_assert(requested_flags < (guint) G_MAXINT); @@ -2497,7 +2497,7 @@ nm_platform_link_tun_add(NMPlatform * self, g_return_val_if_fail(NM_IN_SET(props->type, IFF_TUN, IFF_TAP), -NME_BUG); /* creating a non-persistent device requires that the caller handles - * the file descriptor. */ + * the file descriptor. */ g_return_val_if_fail(props->persist || out_fd, -NME_BUG); NM_SET_OUT(out_fd, -1); @@ -2531,7 +2531,7 @@ nm_platform_link_6lowpan_get_properties(NMPlatform *self, int ifindex, int *out_ } /* As of 4.16 kernel does not expose the peer_ifindex as IFA_LINK. - * Find the WPAN device with the same MAC address. */ + * Find the WPAN device with the same MAC address. */ if (out_parent) { const NMPlatformLink *parent_plink; @@ -2861,7 +2861,7 @@ nm_platform_link_infiniband_get_properties(NMPlatform * self, } /* Could not get the link information via netlink. To support older kernels, - * fallback to reading sysfs. */ + * fallback to reading sysfs. */ dirfd = nm_platform_sysctl_open_netdir(self, ifindex, ifname_verified); if (dirfd < 0) @@ -2974,7 +2974,7 @@ nm_platform_link_tun_get_properties(NMPlatform *self, int ifindex, NMPlatformLnk nm_assert(NMP_OBJECT_GET_CLASS(pllnk)->lnk_link_type == NM_LINK_TYPE_TUN); /* recent kernels expose tun properties via netlink and thus we have them - * in the platform cache. */ + * in the platform cache. */ NM_SET_OUT(out_properties, pllnk->lnk_tun); return TRUE; } @@ -3741,9 +3741,9 @@ _addr_array_clean_expired(int addr_family, if (addr_family == AF_INET6 && NM_FLAGS_HAS(a->n_ifa_flags, IFA_F_TEMPORARY)) { /* temporary addresses are never added explicitly by NetworkManager but - * kernel adds them via mngtempaddr flag. - * - * We drop them from this list. */ + * kernel adds them via mngtempaddr flag. + * + * We drop them from this list. */ goto clear_and_next; } @@ -3855,7 +3855,7 @@ ip4_addr_subnets_build_index(const GPtrArray *addresses, g_ptr_array_insert(addr_list, position, p_address); } else { /* we only care about the primary. No need to track the secondaries - * as a GPtrArray. */ + * as a GPtrArray. */ nm_assert(ip4_addr_subnets_is_plain_address(addresses, p)); if (consider_flags && !NM_FLAGS_HAS(address->n_ifa_flags, IFA_F_SECONDARY)) { g_hash_table_insert(subnets, GUINT_TO_POINTER(net), p_address); @@ -3993,9 +3993,9 @@ nm_platform_ip_address_sync(NMPlatform *self, _CHECK_SELF(self, klass, FALSE); /* The order we want to enforce is only among addresses with the same - * scope, as the kernel keeps addresses sorted by scope. Therefore, - * apply the same sorting to known addresses, so that we don't try to - * unnecessary change the order of addresses with different scopes. */ + * scope, as the kernel keeps addresses sorted by scope. Therefore, + * apply the same sorting to known addresses, so that we don't try to + * unnecessary change the order of addresses with different scopes. */ if (!IS_IPv4) { if (known_addresses) g_ptr_array_sort_with_data(known_addresses, @@ -4011,7 +4011,7 @@ nm_platform_ip_address_sync(NMPlatform *self, known_addresses = NULL; /* @plat_addresses must be sorted in decreasing priority order (highest priority addresses first), contrary to - * @known_addresses which is in increasing priority order (lowest priority addresses first). */ + * @known_addresses which is in increasing priority order (lowest priority addresses first). */ plat_addresses = addresses_prune; if (nm_g_ptr_array_len(plat_addresses) > 0) { @@ -4049,7 +4049,7 @@ nm_platform_ip_address_sync(NMPlatform *self, ip4_addr_subnets_is_secondary(o, known_subnets, known_addresses, NULL); if (secondary == NM_FLAGS_HAS(plat_address->n_ifa_flags, IFA_F_SECONDARY)) { /* if we have an existing known-address, with matching secondary role, - * do not delete the platform-address. */ + * do not delete the platform-address. */ continue; } } @@ -4067,11 +4067,11 @@ nm_platform_ip_address_sync(NMPlatform *self, &addr_list) && addr_list) { /* If we just deleted a primary addresses and there were - * secondary ones the kernel can do two things, depending on - * version and sysctl setting: delete also secondary addresses - * or promote a secondary to primary. Ensure that secondary - * addresses are deleted, so that we can start with a clean - * slate and add addresses in the right order. */ + * secondary ones the kernel can do two things, depending on + * version and sysctl setting: delete also secondary addresses + * or promote a secondary to primary. Ensure that secondary + * addresses are deleted, so that we can start with a clean + * slate and add addresses in the right order. */ for (j = 1; j < addr_list->len; j++) { const NMPObject **o; @@ -4106,18 +4106,18 @@ nm_platform_ip_address_sync(NMPlatform *self, known_addresses_len = known_addresses ? known_addresses->len : 0; /* First, compare every address whether it is still a "known address", that is, whether - * to keep it or to delete it. - * - * If we don't find a matching valid address in @known_addresses, we will delete - * plat_addr. - * - * Certain addresses, like temporary addresses, are ignored by this function - * if not run with full_sync. These addresses are usually not managed by NetworkManager - * directly, or at least, they are not managed via nm_platform_ip6_address_sync(). - * Only in full_sync mode, we really want to get rid of them (usually, when we take - * the interface down). - * - * Note that we mark handled addresses by setting it to %NULL in @plat_addresses array. */ + * to keep it or to delete it. + * + * If we don't find a matching valid address in @known_addresses, we will delete + * plat_addr. + * + * Certain addresses, like temporary addresses, are ignored by this function + * if not run with full_sync. These addresses are usually not managed by NetworkManager + * directly, or at least, they are not managed via nm_platform_ip6_address_sync(). + * Only in full_sync mode, we really want to get rid of them (usually, when we take + * the interface down). + * + * Note that we mark handled addresses by setting it to %NULL in @plat_addresses array. */ for (i_plat = 0; i_plat < plat_addresses->len; i_plat++) { const NMPObject * plat_obj = plat_addresses->pdata[i_plat]; const NMPObject * know_obj; @@ -4128,13 +4128,13 @@ nm_platform_ip_address_sync(NMPlatform *self, if (know_obj && plat_addr->plen == NMP_OBJECT_CAST_IP6_ADDRESS(know_obj)->plen) { /* technically, plen is not part of the ID for IPv6 addresses and thus - * @plat_addr is essentially the same address as @know_addr (regrading - * its identity, not its other attributes). - * However, we cannot modify an existing addresses' plen without - * removing and readding it. Thus, only keep plat_addr, if the plen - * matches. - * - * keep this one, and continue */ + * @plat_addr is essentially the same address as @know_addr (regrading + * its identity, not its other attributes). + * However, we cannot modify an existing addresses' plen without + * removing and readding it. Thus, only keep plat_addr, if the plen + * matches. + * + * keep this one, and continue */ continue; } } @@ -4144,15 +4144,15 @@ nm_platform_ip_address_sync(NMPlatform *self, } /* Next, we must preserve the priority of the routes. That is, source address - * selection will choose addresses in the order as they are reported by kernel. - * Note that the order in @plat_addresses of the remaining matches is highest - * priority first. - * We need to compare this to the order of addresses with same scope in - * @known_addresses (which has lowest priority first). - * - * If we find a first discrepancy, we need to delete all remaining addresses - * with same scope from that point on, because below we must re-add all the - * addresses in the right order to get their priority right. */ + * selection will choose addresses in the order as they are reported by kernel. + * Note that the order in @plat_addresses of the remaining matches is highest + * priority first. + * We need to compare this to the order of addresses with same scope in + * @known_addresses (which has lowest priority first). + * + * If we find a first discrepancy, we need to delete all remaining addresses + * with same scope from that point on, because below we must re-add all the + * addresses in the right order to get their priority right. */ cur_scope = IP6_ADDR_SCOPE_LOOPBACK; delete_remaining_addrs = FALSE; i_plat = plat_addresses->len; @@ -4194,7 +4194,7 @@ nm_platform_ip_address_sync(NMPlatform *self, } /* plat_address has no match. Now delete_remaining_addrs is TRUE and we will - * delete all the remaining addresses with cur_scope. */ + * delete all the remaining addresses with cur_scope. */ break; } } @@ -4216,8 +4216,8 @@ next_plat:; : 0; /* Add missing addresses. New addresses are added by kernel with top - * priority. - */ + * priority. + */ for (i_know = 0; i_know < known_addresses->len; i_know++) { const NMPlatformIPXAddress *known_address; const NMPObject * o; @@ -4297,9 +4297,9 @@ _err_inval_due_to_ipv6_tentative_pref_src(NMPlatform *self, const NMPObject *obj nm_assert(NMP_OBJECT_IS_VALID(obj)); /* trying to add an IPv6 route with pref-src fails, if the address is - * still tentative (rh#1452684). We need to hack around that. - * - * Detect it, by guessing whether that's the case. */ + * still tentative (rh#1452684). We need to hack around that. + * + * Detect it, by guessing whether that's the case. */ if (NMP_OBJECT_GET_TYPE(obj) != NMP_OBJECT_TYPE_IP6_ROUTE) return FALSE; @@ -4470,8 +4470,8 @@ nm_platform_ip_route_sync(NMPlatform *self, if ((i_type == 0 && !VTABLE_IS_DEVICE_ROUTE(vt, conf_o)) || (i_type == 1 && VTABLE_IS_DEVICE_ROUTE(vt, conf_o))) { /* we add routes in two runs over @i_type. - * - * First device routes, then gateway routes. */ + * + * First device routes, then gateway routes. */ continue; } @@ -4490,7 +4490,7 @@ nm_platform_ip_route_sync(NMPlatform *self, if (!IS_IPv4 && NMP_OBJECT_CAST_IP6_ROUTE(conf_o)->metric == 0) { /* User space cannot add routes with metric 0. However, kernel can, and we might track such - * routes in @route as they are present external. Skip them silently. */ + * routes in @route as they are present external. Skip them silently. */ continue; } @@ -4507,7 +4507,7 @@ nm_platform_ip_route_sync(NMPlatform *self, continue; /* we need to replace the existing route with a (slightly) different - * one. Delete it first. */ + * one. Delete it first. */ if (!nm_platform_object_delete(self, plat_o)) { /* ignore error. */ } @@ -4521,8 +4521,8 @@ sync_route_add: if (r < 0) { if (r == -EEXIST) { /* Don't fail for EEXIST. It's not clear that the existing route - * is identical to the one that we were about to add. However, - * above we should have deleted conflicting (non-identical) routes. */ + * is identical to the one that we were about to add. However, + * above we should have deleted conflicting (non-identical) routes. */ if (_LOGD_ENABLED()) { plat_entry = nm_platform_lookup_entry(self, NMP_CACHE_ID_TYPE_OBJECT_TYPE, conf_o); @@ -4713,15 +4713,15 @@ static guint8 _ip_route_scope_inv_get_normalized(const NMPlatformIP4Route *route) { /* in kernel, you cannot set scope to RT_SCOPE_NOWHERE (255). - * That means, in NM, we treat RT_SCOPE_NOWHERE as unset, and detect - * it based on the presence of the gateway. In other words, when adding - * a route with scope RT_SCOPE_NOWHERE (in NetworkManager) to kernel, - * the resulting scope will be either "link" or "universe" (depending - * on the gateway). - * - * Note that internally, we track @scope_inv is the inverse of scope, - * so that the default equals zero (~(RT_SCOPE_NOWHERE)). - **/ + * That means, in NM, we treat RT_SCOPE_NOWHERE as unset, and detect + * it based on the presence of the gateway. In other words, when adding + * a route with scope RT_SCOPE_NOWHERE (in NetworkManager) to kernel, + * the resulting scope will be either "link" or "universe" (depending + * on the gateway). + * + * Note that internally, we track @scope_inv is the inverse of scope, + * so that the default equals zero (~(RT_SCOPE_NOWHERE)). + **/ if (route->scope_inv == 0) { if (route->type_coerced == nm_platform_route_type_coerce(RTN_LOCAL)) return nm_platform_route_scope_inv(RT_SCOPE_HOST); @@ -5019,9 +5019,9 @@ _ip4_dev_route_blacklist_notify_route(NMPlatform *self, const NMPObject *obj) } /* We cannot delete it right away because we are in the process of receiving netlink messages. - * It may be possible to do so, but complicated and error prone. - * - * Instead, we mark the entry and schedule an idle action (with high priority). */ + * It may be possible to do so, but complicated and error prone. + * + * Instead, we mark the entry and schedule an idle action (with high priority). */ *p_timeout_ms = (*p_timeout_ms) | ((gint64) 1); _ip4_dev_route_blacklist_check_schedule(self); } @@ -5065,8 +5065,8 @@ _ip4_dev_route_blacklist_schedule(NMPlatform *self) } else { if (!priv->ip4_dev_route_blacklist_gc_timeout_id) { /* this timeout is only to garbage collect the expired entries from priv->ip4_dev_route_blacklist_hash. - * It can run infrequently, and it doesn't hurt if expired entries linger around a bit - * longer then necessary. */ + * It can run infrequently, and it doesn't hurt if expired entries linger around a bit + * longer then necessary. */ priv->ip4_dev_route_blacklist_gc_timeout_id = g_timeout_add_seconds(IP4_DEV_ROUTE_BLACKLIST_GC_TIMEOUT_S, _ip4_dev_route_blacklist_gc_timeout_handle, @@ -5126,11 +5126,11 @@ nm_platform_ip4_dev_route_blacklist_set(NMPlatform *self, while (g_hash_table_iter_next(&iter, (gpointer *) &p_obj, (gpointer *) &p_timeout_ms)) { if (NMP_OBJECT_CAST_IP4_ROUTE(p_obj)->ifindex == ifindex) { /* we could g_hash_table_iter_remove(&iter) the current entry. - * Instead, just expire it and let _ip4_dev_route_blacklist_gc_timeout_handle() - * handle it. - * - * The assumption is, that ip4_dev_route_blacklist contains the very same entry - * again, with a new timeout. So, we can un-expire it below. */ + * Instead, just expire it and let _ip4_dev_route_blacklist_gc_timeout_handle() + * handle it. + * + * The assumption is, that ip4_dev_route_blacklist contains the very same entry + * again, with a new timeout. So, we can un-expire it below. */ *p_timeout_ms = 0; } } @@ -5206,7 +5206,7 @@ nm_platform_qdisc_add(NMPlatform *self, NMPNlmFlags flags, const NMPlatformQdisc _CHECK_SELF(self, klass, -NME_BUG); /* Note: @qdisc must not be copied or kept alive because the lifetime of qdisc.kind - * is undefined. */ + * is undefined. */ _LOG3D("adding or updating a qdisc: %s", nm_platform_qdisc_to_string(qdisc, NULL, 0)); return klass->qdisc_add(self, flags, qdisc); @@ -5309,7 +5309,7 @@ nm_platform_tfilter_add(NMPlatform *self, NMPNlmFlags flags, const NMPlatformTfi _CHECK_SELF(self, klass, -NME_BUG); /* Note: @tfilter must not be copied or kept alive because the lifetime of tfilter.kind - * and tfilter.action.kind is undefined. */ + * and tfilter.action.kind is undefined. */ _LOG3D("adding or updating a tfilter: %s", nm_platform_tfilter_to_string(tfilter, NULL, 0)); return klass->tfilter_add(self, flags, tfilter); @@ -6803,7 +6803,7 @@ nm_platform_routing_rule_to_string(const NMPlatformRoutingRule *routing_rule, ch if (routing_rule->ip_proto != 0) { /* we don't call getprotobynumber(), just print the numeric value. - * This differs from what ip-rule prints. */ + * This differs from what ip-rule prints. */ nm_utils_strbuf_append(&buf, &len, " ipproto %u", routing_rule->ip_proto); } @@ -6835,10 +6835,10 @@ nm_platform_routing_rule_to_string(const NMPlatformRoutingRule *routing_rule, ch if (routing_rule->flow) { /* FRA_FLOW is only for IPv4, but we want to print the value for all address-families, - * to see when it is set. In practice, this should not be set except for IPv4. - * - * We don't follow the style how ip-rule prints flow/realms. It's confusing. Just - * print the value hex. */ + * to see when it is set. In practice, this should not be set except for IPv4. + * + * We don't follow the style how ip-rule prints flow/realms. It's confusing. Just + * print the value hex. */ nm_utils_strbuf_append(&buf, &len, " realms 0x%08x", routing_rule->flow); } @@ -6846,7 +6846,7 @@ nm_platform_routing_rule_to_string(const NMPlatformRoutingRule *routing_rule, ch G_STATIC_ASSERT_EXPR(RTN_NAT == 10); /* NAT is deprecated for many years. We don't support RTA_GATEWAY/FRA_UNUSED2 - * for the gateway, and so do recent kernels ignore that parameter. */ + * for the gateway, and so do recent kernels ignore that parameter. */ nm_utils_strbuf_append_str(&buf, &len, " masquerade"); } else if (routing_rule->action == FR_ACT_GOTO) { if (routing_rule->goto_target != 0) @@ -7715,7 +7715,7 @@ nm_platform_ip4_address_pretty_sort_cmp(const NMPlatformIP4Address *a1, nm_assert(a2); /* Sort by address type. For example link local will - * be sorted *after* a global address. */ + * be sorted *after* a global address. */ NM_CMP_DIRECT(_address_pretty_sort_get_prio_4(a2->address), _address_pretty_sort_get_prio_4(a1->address)); @@ -7725,10 +7725,10 @@ nm_platform_ip4_address_pretty_sort_cmp(const NMPlatformIP4Address *a1, NM_CMP_DIRECT((a2->label[0] == '\0'), (a1->label[0] == '\0')); /* Finally, sort addresses lexically. We compare only the - * network part so that the order of addresses in the same - * subnet (and thus also the primary/secondary role) is - * preserved. - */ + * network part so that the order of addresses in the same + * subnet (and thus also the primary/secondary role) is + * preserved. + */ n1 = a1->address & _nm_utils_ip4_prefix_to_netmask(a1->plen); n2 = a2->address & _nm_utils_ip4_prefix_to_netmask(a2->plen); NM_CMP_DIRECT_MEMCMP(&n1, &n2, sizeof(guint32)); @@ -7770,7 +7770,7 @@ nm_platform_ip6_address_pretty_sort_cmp(const NMPlatformIP6Address *a1, NM_FLAGS_HAS(a2->n_ifa_flags, IFA_F_TENTATIVE)); /* Sort by address type. For example link local will - * be sorted *after* site local or global. */ + * be sorted *after* site local or global. */ NM_CMP_DIRECT(_address_pretty_sort_get_prio_6(&a2->address), _address_pretty_sort_get_prio_6(&a1->address)); @@ -8249,7 +8249,7 @@ nm_platform_routing_rule_hash_update(const NMPlatformRoutingRule *obj, if (G_UNLIKELY(!NM_IN_SET(obj->addr_family, AF_INET, AF_INET6))) { /* the address family is not one of the supported ones. That means, the - * instance will only compare equal to itself (pointer-equality). */ + * instance will only compare equal to itself (pointer-equality). */ nm_hash_update_val(h, (gconstpointer) obj); return; } @@ -8338,7 +8338,7 @@ nm_platform_routing_rule_cmp(const NMPlatformRoutingRule *a, if (G_UNLIKELY(!valid)) { /* the address family is not one of the supported ones. That means, the - * instance will only compare equal to itself. */ + * instance will only compare equal to itself. */ NM_CMP_DIRECT((uintptr_t) a, (uintptr_t) b); nm_assert_not_reached(); return 0; diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index 441c4828e8..c01008018a 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -73,7 +73,7 @@ typedef enum { NMP_NLM_FLAG_F_ECHO = 0x08, /* NLM_F_ECHO, Echo this request */ /* use our own platform enum for the nlmsg-flags. Otherwise, we'd have - * to include <linux/netlink.h> */ + * to include <linux/netlink.h> */ NMP_NLM_FLAG_F_REPLACE = 0x100, /* NLM_F_REPLACE, Override existing */ NMP_NLM_FLAG_F_EXCL = 0x200, /* NLM_F_EXCL, Do not touch, if it exists */ NMP_NLM_FLAG_F_CREATE = 0x400, /* NLM_F_CREATE, Create, if it does not exist */ @@ -82,15 +82,15 @@ typedef enum { NMP_NLM_FLAG_FMASK = 0xFFFF, /* a mask for all NMP_NLM_FLAG_F_* flags */ /* instructs NM to suppress logging an error message for any failures - * received from kernel. - * - * It will still log with debug-level, and it will still log - * other failures aside the kernel response. */ + * received from kernel. + * + * It will still log with debug-level, and it will still log + * other failures aside the kernel response. */ NMP_NLM_FLAG_SUPPRESS_NETLINK_FAILURE = 0x10000, /* the following aliases correspond to iproute2's `ip route CMD` for - * RTM_NEWROUTE, with CMD being one of add, change, replace, prepend, - * append and test. */ + * RTM_NEWROUTE, with CMD being one of add, change, replace, prepend, + * append and test. */ NMP_NLM_FLAG_ADD = NMP_NLM_FLAG_F_CREATE | NMP_NLM_FLAG_F_EXCL, NMP_NLM_FLAG_CHANGE = NMP_NLM_FLAG_F_REPLACE, NMP_NLM_FLAG_REPLACE = NMP_NLM_FLAG_F_CREATE | NMP_NLM_FLAG_F_REPLACE, @@ -101,40 +101,40 @@ typedef enum { typedef enum { /* compare fields which kernel considers as similar routes. - * It is a looser comparisong then NM_PLATFORM_IP_ROUTE_CMP_TYPE_ID - * and means that `ip route add` would fail to add two routes - * that have the same NM_PLATFORM_IP_ROUTE_CMP_TYPE_WEAK_ID. - * On the other hand, `ip route append` would allow that, as - * long as NM_PLATFORM_IP_ROUTE_CMP_TYPE_ID differs. */ + * It is a looser comparisong then NM_PLATFORM_IP_ROUTE_CMP_TYPE_ID + * and means that `ip route add` would fail to add two routes + * that have the same NM_PLATFORM_IP_ROUTE_CMP_TYPE_WEAK_ID. + * On the other hand, `ip route append` would allow that, as + * long as NM_PLATFORM_IP_ROUTE_CMP_TYPE_ID differs. */ NM_PLATFORM_IP_ROUTE_CMP_TYPE_WEAK_ID, /* compare two routes as kernel would allow to add them with - * `ip route append`. In other words, kernel does not allow you to - * add two routes (at the same time) which compare equal according - * to NM_PLATFORM_IP_ROUTE_CMP_TYPE_ID. - * - * For the ID we can only recognize route fields that we actually implement. - * However, kernel supports more routing options, some of them also part of - * the ID. NetworkManager is oblivious to these options and will wrongly think - * that two routes are identical, while they are not. That can lead to an - * inconsistent platform cache. Not much what we can do about that, except - * implementing all options that kernel supports *sigh*. See rh#1337860. - */ + * `ip route append`. In other words, kernel does not allow you to + * add two routes (at the same time) which compare equal according + * to NM_PLATFORM_IP_ROUTE_CMP_TYPE_ID. + * + * For the ID we can only recognize route fields that we actually implement. + * However, kernel supports more routing options, some of them also part of + * the ID. NetworkManager is oblivious to these options and will wrongly think + * that two routes are identical, while they are not. That can lead to an + * inconsistent platform cache. Not much what we can do about that, except + * implementing all options that kernel supports *sigh*. See rh#1337860. + */ NM_PLATFORM_IP_ROUTE_CMP_TYPE_ID, /* compare all fields as they make sense for kernel. For example, - * a route destination 192.168.1.5/24 is not accepted by kernel and - * we treat it identical to 192.168.1.0/24. Semantically these - * routes are identical, but NM_PLATFORM_IP_ROUTE_CMP_TYPE_FULL will - * report them as different. - * - * The result shall be identical to call first nm_platform_ip_route_normalize() - * on both routes and then doing a full comparison. */ + * a route destination 192.168.1.5/24 is not accepted by kernel and + * we treat it identical to 192.168.1.0/24. Semantically these + * routes are identical, but NM_PLATFORM_IP_ROUTE_CMP_TYPE_FULL will + * report them as different. + * + * The result shall be identical to call first nm_platform_ip_route_normalize() + * on both routes and then doing a full comparison. */ NM_PLATFORM_IP_ROUTE_CMP_TYPE_SEMANTICALLY, /* compare all fields. This should have the same effect as memcmp(), - * except allowing for undefined data in holes between field alignment. - */ + * except allowing for undefined data in holes between field alignment. + */ NM_PLATFORM_IP_ROUTE_CMP_TYPE_FULL, } NMPlatformIPRouteCmpType; @@ -158,16 +158,16 @@ GBytes * nmp_link_address_get_as_bytes(const NMPLinkAddress *addr); typedef enum { /* match-flags are strictly inclusive. That means, - * by default nothing is matched, but if you enable a particular - * flag, a candidate that matches passes the check. - * - * In other words: adding more flags can only extend the result - * set of matching objects. - * - * Also, the flags form partitions. Like, an address can be either of - * ADDRTYPE_NORMAL or ADDRTYPE_LINKLOCAL, but never both. Same for - * the ADDRSTATE match types. - */ + * by default nothing is matched, but if you enable a particular + * flag, a candidate that matches passes the check. + * + * In other words: adding more flags can only extend the result + * set of matching objects. + * + * Also, the flags form partitions. Like, an address can be either of + * ADDRTYPE_NORMAL or ADDRTYPE_LINKLOCAL, but never both. Same for + * the ADDRSTATE match types. + */ NM_PLATFORM_MATCH_WITH_NONE = 0, NM_PLATFORM_MATCH_WITH_ADDRTYPE_NORMAL = (1LL << 0), @@ -187,7 +187,7 @@ typedef enum { struct _NMPlatformObject { /* the object type has no fields of its own, it is only used to having - * a special pointer type that can be used to indicate "any" type. */ + * a special pointer type that can be used to indicate "any" type. */ char _dummy_don_t_use_me; }; @@ -214,8 +214,8 @@ struct _NMPlatformLink { int master; /* rtnl_link_get_link(), IFLA_LINK. - * If IFLA_LINK_NETNSID indicates that the parent is in another namespace, - * this field be set to (negative) NM_PLATFORM_LINK_OTHER_NETNS. */ + * If IFLA_LINK_NETNSID indicates that the parent is in another namespace, + * this field be set to (negative) NM_PLATFORM_LINK_OTHER_NETNS. */ int parent; /* IFF_* flags. Note that the flags in 'struct ifinfomsg' are declared as 'unsigned'. */ @@ -236,8 +236,8 @@ struct _NMPlatformLink { NMUtilsIPv6IfaceId inet6_token; /* The bitwise inverse of rtnl_link_inet6_get_addr_gen_mode(). It is inverse - * to have a default of 0 -- meaning: unspecified. That way, a struct - * initialized with memset(0) has and unset value.*/ + * to have a default of 0 -- meaning: unspecified. That way, a struct + * initialized with memset(0) has and unset value.*/ guint8 inet6_addr_gen_mode_inv; /* Statistics */ @@ -247,7 +247,7 @@ struct _NMPlatformLink { guint64 tx_bytes; /* @connected is mostly identical to (@n_ifi_flags & IFF_UP). Except for bridge/bond masters, - * where we coerce the link as disconnect if it has no slaves. */ + * where we coerce the link as disconnect if it has no slaves. */ bool connected : 1; bool initialized : 1; @@ -287,35 +287,35 @@ typedef enum { NMIPConfigSource addr_source; \ \ /* Timestamp in seconds in the reference system of nm_utils_get_monotonic_timestamp_*(). - * - * The rules are: - * 1 @lifetime==0: @timestamp and @preferred is irrelevant (but mostly set to 0 too). Such addresses - * are permanent. This rule is so that unset addresses (calloc) are permanent by default. - * 2 @lifetime==@preferred==NM_PLATFORM_LIFETIME_PERMANENT: @timestamp is irrelevant (but mostly - * set to 0). Such addresses are permanent. - * 3 Non permanent addresses should (almost) always have @timestamp > 0. 0 is not a valid timestamp - * and never returned by nm_utils_get_monotonic_timestamp_sec(). In this case @valid/@preferred - * is anchored at @timestamp. - * 4 Non permanent addresses with @timestamp == 0 are implicitly anchored at *now*, thus the time - * moves as time goes by. This is usually not useful, except e.g. nm_platform_ip[46]_address_add(). - * - * Non permanent addresses from DHCP/RA might have the @timestamp set to the moment of when the - * lease was received. Addresses from kernel might have the @timestamp based on the last modification - * time of the addresses. But don't rely on this behaviour, the @timestamp is only defined for anchoring - * @lifetime and @preferred. - */ \ + * + * The rules are: + * 1 @lifetime==0: @timestamp and @preferred is irrelevant (but mostly set to 0 too). Such addresses + * are permanent. This rule is so that unset addresses (calloc) are permanent by default. + * 2 @lifetime==@preferred==NM_PLATFORM_LIFETIME_PERMANENT: @timestamp is irrelevant (but mostly + * set to 0). Such addresses are permanent. + * 3 Non permanent addresses should (almost) always have @timestamp > 0. 0 is not a valid timestamp + * and never returned by nm_utils_get_monotonic_timestamp_sec(). In this case @valid/@preferred + * is anchored at @timestamp. + * 4 Non permanent addresses with @timestamp == 0 are implicitly anchored at *now*, thus the time + * moves as time goes by. This is usually not useful, except e.g. nm_platform_ip[46]_address_add(). + * + * Non permanent addresses from DHCP/RA might have the @timestamp set to the moment of when the + * lease was received. Addresses from kernel might have the @timestamp based on the last modification + * time of the addresses. But don't rely on this behaviour, the @timestamp is only defined for anchoring + * @lifetime and @preferred. + */ \ guint32 timestamp; \ guint32 lifetime; /* seconds since timestamp */ \ guint32 preferred; /* seconds since timestamp */ \ \ /* ifa_flags in 'struct ifaddrmsg' from <linux/if_addr.h>, extended to 32 bit by - * IFA_FLAGS attribute. */ \ + * IFA_FLAGS attribute. */ \ guint32 n_ifa_flags; \ \ guint8 plen; \ \ /* FIXME(l3cfg): the external marker won't be necessary anymore, because we only - * merge addresses we care about, and ignore (don't remove) external addresses. */ \ + * merge addresses we care about, and ignore (don't remove) external addresses. */ \ bool external : 1; \ \ bool use_ip4_broadcast_address : 1; \ @@ -345,20 +345,20 @@ struct _NMPlatformIP4Address { in_addr_t address; /* The IFA_ADDRESS PTP peer address. This field is rather important, because - * it constitutes the identifier for the IPv4 address (e.g. you can add two - * addresses that only differ by their peer's network-part. - * - * Beware that for most cases, NetworkManager doesn't want to set an explicit - * peer-address. However, that corresponds to setting the peer address to @address - * itself. Leaving peer-address unset/zero, means explicitly setting the peer - * address to 0.0.0.0, which you probably don't want. - * */ + * it constitutes the identifier for the IPv4 address (e.g. you can add two + * addresses that only differ by their peer's network-part. + * + * Beware that for most cases, NetworkManager doesn't want to set an explicit + * peer-address. However, that corresponds to setting the peer address to @address + * itself. Leaving peer-address unset/zero, means explicitly setting the peer + * address to 0.0.0.0, which you probably don't want. + * */ in_addr_t peer_address; /* PTP peer address */ /* IFA_BROADCAST. - * - * This parameter is ignored unless use_ip4_broadcast_address is TRUE. - * See nm_platform_ip4_broadcast_address_from_addr(). */ + * + * This parameter is ignored unless use_ip4_broadcast_address is TRUE. + * See nm_platform_ip4_broadcast_address_from_addr(). */ in_addr_t broadcast_address; char label[NMP_IFNAMSIZ]; @@ -407,32 +407,32 @@ typedef union { __NMPlatformObjWithIfindex_COMMON; \ \ /* The NMIPConfigSource. For routes that we receive from cache this corresponds - * to the rtm_protocol field (and is one of the NM_IP_CONFIG_SOURCE_RTPROT_* values). - * When adding a route, the source will be coerced to the protocol using - * nmp_utils_ip_config_source_coerce_to_rtprot(). - * - * rtm_protocol is part of the primary key of an IPv4 route (meaning, you can add - * two IPv4 routes that only differ in their rtm_protocol. For IPv6, that is not - * the case. - * - * When deleting an IPv4/IPv6 route, the rtm_protocol field must match (even - * if it is not part of the primary key for IPv6) -- unless rtm_protocol is set - * to zero, in which case the first matching route (with proto ignored) is deleted. */ \ + * to the rtm_protocol field (and is one of the NM_IP_CONFIG_SOURCE_RTPROT_* values). + * When adding a route, the source will be coerced to the protocol using + * nmp_utils_ip_config_source_coerce_to_rtprot(). + * + * rtm_protocol is part of the primary key of an IPv4 route (meaning, you can add + * two IPv4 routes that only differ in their rtm_protocol. For IPv6, that is not + * the case. + * + * When deleting an IPv4/IPv6 route, the rtm_protocol field must match (even + * if it is not part of the primary key for IPv6) -- unless rtm_protocol is set + * to zero, in which case the first matching route (with proto ignored) is deleted. */ \ NMIPConfigSource rt_source; \ \ guint8 plen; \ \ /* RTA_METRICS: - * - * For IPv4 routes, these properties are part of their - * ID (meaning: you can add otherwise identical IPv4 routes that - * only differ by the metric property). - * On the other hand, for IPv6 you cannot add two IPv6 routes that only differ - * by an RTA_METRICS property. - * - * When deleting a route, kernel seems to ignore the RTA_METRICS properties. - * That is a problem/bug for IPv4 because you cannot explicitly select which - * route to delete. Kernel just picks the first. See rh#1475642. */ \ + * + * For IPv4 routes, these properties are part of their + * ID (meaning: you can add otherwise identical IPv4 routes that + * only differ by the metric property). + * On the other hand, for IPv6 you cannot add two IPv6 routes that only differ + * by an RTA_METRICS property. + * + * When deleting a route, kernel seems to ignore the RTA_METRICS properties. + * That is a problem/bug for IPv4 because you cannot explicitly select which + * route to delete. Kernel just picks the first. See rh#1475642. */ \ \ /* RTA_METRICS.RTAX_LOCK (iproute2: "lock" arguments) */ \ bool lock_window : 1; \ @@ -442,15 +442,15 @@ typedef union { bool lock_mtu : 1; \ \ /* rtnh_flags - * - * Routes with rtm_flags RTM_F_CLONED are hidden by platform and - * do not exist from the point-of-view of platform users. - * Such a route is not alive, according to nmp_object_is_alive(). - * - * NOTE: currently we ignore all flags except RTM_F_CLONED - * and RTNH_F_ONLINK. - * We also may not properly consider the flags as part of the ID - * in route-cmp. */ \ + * + * Routes with rtm_flags RTM_F_CLONED are hidden by platform and + * do not exist from the point-of-view of platform users. + * Such a route is not alive, according to nmp_object_is_alive(). + * + * NOTE: currently we ignore all flags except RTM_F_CLONED + * and RTNH_F_ONLINK. + * We also may not properly consider the flags as part of the ID + * in route-cmp. */ \ unsigned r_rtm_flags; \ \ /* RTA_METRICS.RTAX_ADVMSS (iproute2: advmss) */ \ @@ -475,17 +475,17 @@ typedef union { guint32 metric; \ \ /* rtm_table, RTA_TABLE. - * - * This is not the original table ID. Instead, 254 (RT_TABLE_MAIN) and - * zero (RT_TABLE_UNSPEC) are swapped, so that the default is the main - * table. Use nm_platform_route_table_coerce()/nm_platform_route_table_uncoerce(). */ \ + * + * This is not the original table ID. Instead, 254 (RT_TABLE_MAIN) and + * zero (RT_TABLE_UNSPEC) are swapped, so that the default is the main + * table. Use nm_platform_route_table_coerce()/nm_platform_route_table_uncoerce(). */ \ guint32 table_coerced; \ \ /* rtm_type. - * - * This is not the original type, if type_coerced is 0 then - * it means RTN_UNSPEC otherwise the type value is preserved. - * */ \ + * + * This is not the original type, if type_coerced is 0 then + * it means RTN_UNSPEC otherwise the type value is preserved. + * */ \ guint8 type_coerced; \ \ /*end*/ @@ -515,29 +515,29 @@ struct _NMPlatformIP4Route { in_addr_t gateway; /* RTA_PREFSRC (called "src" by iproute2). - * - * pref_src is part of the ID of an IPv4 route. When deleting a route, - * pref_src must match, unless set to 0.0.0.0 to match any. */ + * + * pref_src is part of the ID of an IPv4 route. When deleting a route, + * pref_src must match, unless set to 0.0.0.0 to match any. */ in_addr_t pref_src; /* rtm_tos (iproute2: tos) - * - * For IPv4, tos is part of the weak-id (like metric). - * - * For IPv6, tos is ignored by kernel. */ + * + * For IPv4, tos is part of the weak-id (like metric). + * + * For IPv6, tos is ignored by kernel. */ guint8 tos; /* The bitwise inverse of the route scope rtm_scope. It is inverted so that the - * default value (RT_SCOPE_NOWHERE) is zero. Use nm_platform_route_scope_inv() - * to convert back and forth between the inverse representation and the - * real value. - * - * rtm_scope is part of the primary key for IPv4 routes. When deleting a route, - * the scope must match, unless it is left at RT_SCOPE_NOWHERE, in which case the first - * matching route is deleted. - * - * For IPv6 routes, the scope is ignored and kernel always assumes global scope. - * Hence, this field is only in NMPlatformIP4Route. */ + * default value (RT_SCOPE_NOWHERE) is zero. Use nm_platform_route_scope_inv() + * to convert back and forth between the inverse representation and the + * real value. + * + * rtm_scope is part of the primary key for IPv4 routes. When deleting a route, + * the scope must match, unless it is left at RT_SCOPE_NOWHERE, in which case the first + * matching route is deleted. + * + * For IPv6 routes, the scope is ignored and kernel always assumes global scope. + * Hence, this field is only in NMPlatformIP4Route. */ guint8 scope_inv; }; @@ -549,28 +549,28 @@ struct _NMPlatformIP6Route { struct in6_addr gateway; /* RTA_PREFSRC (called "src" by iproute2). - * - * pref_src is not part of the ID for an IPv6 route. You cannot add two - * routes that only differ by pref_src. - * - * When deleting a route, pref_src is ignored by kernel. */ + * + * pref_src is not part of the ID for an IPv6 route. You cannot add two + * routes that only differ by pref_src. + * + * When deleting a route, pref_src is ignored by kernel. */ struct in6_addr pref_src; /* RTA_SRC and rtm_src_len (called "from" by iproute2). - * - * Kernel clears the host part of src/src_plen. - * - * src/src_plen is part of the ID of a route just like network/plen. That is, - * Not only `ip route append`, but also `ip route add` allows to add routes that only - * differ in their src/src_plen. - */ + * + * Kernel clears the host part of src/src_plen. + * + * src/src_plen is part of the ID of a route just like network/plen. That is, + * Not only `ip route append`, but also `ip route add` allows to add routes that only + * differ in their src/src_plen. + */ struct in6_addr src; guint8 src_plen; /* RTA_PREF router preference. - * - * The type is guint8 to keep the struct size small. But the values are compatible with - * the NMIcmpv6RouterPref enum. */ + * + * The type is guint8 to keep the struct size small. But the values are compatible with + * the NMIcmpv6RouterPref enum. */ guint8 rt_pref; }; @@ -674,7 +674,7 @@ typedef struct { __NMPlatformObjWithIfindex_COMMON; /* beware, kind is embedded in an NMPObject, hence you must - * take care of the lifetime of the string. */ + * take care of the lifetime of the string. */ const char *kind; int addr_family; @@ -702,7 +702,7 @@ typedef struct { typedef struct { /* beware, kind is embedded in an NMPObject, hence you must - * take care of the lifetime of the string. */ + * take care of the lifetime of the string. */ const char *kind; union { @@ -718,7 +718,7 @@ typedef struct { __NMPlatformObjWithIfindex_COMMON; /* beware, kind is embedded in an NMPObject, hence you must - * take care of the lifetime of the string. */ + * take care of the lifetime of the string. */ const char *kind; int addr_family; @@ -988,7 +988,7 @@ typedef enum { NM_PLATFORM_KERNEL_SUPPORT_TYPE_IFLA_BR_VLAN_STATS_ENABLED, /* this also includes FRA_SPORT_RANGE and FRA_DPORT_RANGE which - * were added at the same time. */ + * were added at the same time. */ NM_PLATFORM_KERNEL_SUPPORT_TYPE_FRA_IP_PROTO, _NM_PLATFORM_KERNEL_SUPPORT_NUM, @@ -1270,7 +1270,7 @@ nm_platform_ip4_broadcast_address_from_addr(const NMPlatformIP4Address *addr) return addr->broadcast_address; /* the set broadcast-address gets ignored, and we determine a default brd base - * on the peer IFA_ADDRESS. */ + * on the peer IFA_ADDRESS. */ if (addr->peer_address != 0u && addr->plen < 31 /* RFC3021 */) return nm_platform_ip4_broadcast_address_create(addr->peer_address, addr->plen); return 0u; @@ -1290,11 +1290,11 @@ static inline guint32 nm_platform_route_table_coerce(guint32 table) { /* For kernel, the default table is RT_TABLE_MAIN (254). - * We want that in NMPlatformIPRoute.table_coerced a numeric - * zero is the default. Hence, @table_coerced swaps the - * value 0 and 254. Use nm_platform_route_table_coerce() - * and nm_platform_route_table_uncoerce() to convert between - * the two domains. */ + * We want that in NMPlatformIPRoute.table_coerced a numeric + * zero is the default. Hence, @table_coerced swaps the + * value 0 and 254. Use nm_platform_route_table_coerce() + * and nm_platform_route_table_uncoerce() to convert between + * the two domains. */ switch (table) { case 0 /* RT_TABLE_UNSPEC */: return 254; @@ -1334,13 +1334,13 @@ static inline gboolean nm_platform_route_table_is_main(guint32 table) { /* same as - * nm_platform_route_table_uncoerce (table, TRUE) == RT_TABLE_MAIN - * and - * nm_platform_route_table_uncoerce (nm_platform_route_table_coerce (table), TRUE) == RT_TABLE_MAIN - * - * That is, the function operates the same on @table and its coerced - * form. - */ + * nm_platform_route_table_uncoerce (table, TRUE) == RT_TABLE_MAIN + * and + * nm_platform_route_table_uncoerce (nm_platform_route_table_coerce (table), TRUE) == RT_TABLE_MAIN + * + * That is, the function operates the same on @table and its coerced + * form. + */ return table == 0 || table == 254; } diff --git a/src/platform/nmp-netns.c b/src/platform/nmp-netns.c index 977211fd10..134be51502 100644 --- a/src/platform/nmp-netns.c +++ b/src/platform/nmp-netns.c @@ -157,7 +157,7 @@ _netns_stack_get_impl(void) _netns_stack = s; /* at the bottom of the stack we must try to create a netns instance - * that we never pop. It's the base to which we need to return. */ + * that we never pop. It's the base to which we need to return. */ netns = _netns_new(&error); if (!netns) { _LOGE(NULL, "failed to create initial netns: %s", error->message); @@ -168,8 +168,8 @@ _netns_stack_get_impl(void) _stack_push(s, netns, _CLONE_NS_ALL); /* finally, register a destructor function to cleanup the array. If we fail - * to do so, we will leak NMPNetns instances (and their file descriptor) when the - * thread exits. */ + * to do so, we will leak NMPNetns instances (and their file descriptor) when the + * thread exits. */ if (pthread_key_create(&key, (void (*)(void *)) g_array_unref) != 0) _LOGE(NULL, "failure to initialize thread-local storage"); else if (pthread_setspecific(key, s) != 0) @@ -197,7 +197,7 @@ _stack_current_netns(GArray *netns_stack, int ns_types) nm_assert(netns_stack && netns_stack->len > 0); /* we search the stack top-down to find the netns that has - * all @ns_types set. */ + * all @ns_types set. */ for (j = netns_stack->len; ns_types && j >= 1;) { NetnsInfo *info; @@ -221,7 +221,7 @@ _stack_current_ns_types(GArray *netns_stack, NMPNetns *netns, int ns_types) nm_assert(netns_stack && netns_stack->len > 0); /* we search the stack top-down to check which of @ns_types - * are already set to @netns. */ + * are already set to @netns. */ for (j = netns_stack->len; ns_types && j >= 1;) { NetnsInfo *info; @@ -508,7 +508,7 @@ nmp_netns_new(void) if (!_stack_peek(netns_stack)) { /* there are no netns instances. We cannot create a new one - * (because after unshare we couldn't return to the original one). */ + * (because after unshare we couldn't return to the original one). */ errno = ENOTSUP; return NULL; } diff --git a/src/platform/nmp-object.c b/src/platform/nmp-object.c index b47bf86087..77e6808ea3 100644 --- a/src/platform/nmp-object.c +++ b/src/platform/nmp-object.c @@ -54,25 +54,25 @@ typedef struct { struct _NMPCache { /* the cache contains only one hash table for all object types, and similarly - * it contains only one NMMultiIndex. - * This works, because different object types don't ever compare equal and - * because their index ids also don't overlap. - * - * For routes and addresses, the cache contains an address if (and only if) the - * object was reported via netlink. - * For links, the cache contain a link if it was reported by either netlink - * or udev. That means, a link object can be alive, even if it was already - * removed via netlink. - * - * This effectively merges the udev-device cache into the NMPCache. - */ + * it contains only one NMMultiIndex. + * This works, because different object types don't ever compare equal and + * because their index ids also don't overlap. + * + * For routes and addresses, the cache contains an address if (and only if) the + * object was reported via netlink. + * For links, the cache contain a link if it was reported by either netlink + * or udev. That means, a link object can be alive, even if it was already + * removed via netlink. + * + * This effectively merges the udev-device cache into the NMPCache. + */ NMDedupMultiIndex *multi_idx; /* an idx_type entry for each NMP_CACHE_ID_TYPE. Note that NONE (zero) - * is skipped, so the index is shifted by one: idx_type[cache_id_type - 1]. - * - * Don't bother, use _idx_type_get() instead! */ + * is skipped, so the index is shifted by one: idx_type[cache_id_type - 1]. + * + * Don't bother, use _idx_type_get() instead! */ DedupMultiIdxType idx_types[NMP_CACHE_ID_TYPE_MAX]; gboolean use_udev; @@ -226,9 +226,9 @@ nm_sock_addr_union_to_string(const NMSockAddrUnion *sa, char *buf, gsize len) return buf; /* maybe we should use getnameinfo(), but here implement it ourself. - * - * We want to see the actual bytes for debugging (as we understand them), - * and now what getnameinfo() makes of it. Also, it's simpler this way. */ + * + * We want to see the actual bytes for debugging (as we understand them), + * and now what getnameinfo() makes of it. Also, it's simpler this way. */ switch (sa->sa.sa_family) { case AF_INET: @@ -300,7 +300,7 @@ _idx_obj_part(const DedupMultiIdxType *idx_type, NMPObjectType obj_type; /* the hash/equals functions are strongly related. So, keep them - * side-by-side and do it all in _idx_obj_part(). */ + * side-by-side and do it all in _idx_obj_part(). */ nm_assert(idx_type); nm_assert(idx_type->parent.klass == &_dedup_multi_idx_type_class); @@ -321,8 +321,8 @@ _idx_obj_part(const DedupMultiIdxType *idx_type, case NMP_CACHE_ID_TYPE_LINK_BY_IFNAME: if (NMP_OBJECT_GET_TYPE(obj_a) != NMP_OBJECT_TYPE_LINK) { /* first check, whether obj_a is suitable for this idx_type. - * If not, return 0 (which is correct for partitionable(), hash() and equal() - * functions. */ + * If not, return 0 (which is correct for partitionable(), hash() and equal() + * functions. */ if (h) nm_hash_update_val(h, obj_a); return 0; @@ -652,7 +652,7 @@ _nmp_object_fixup_link_udev_fields(NMPObject **obj_new, NMPObject *obj_orig, gbo obj = *obj_new ?: obj_orig; /* The link contains internal fields that are combined by - * properties from netlink and udev. Update those properties */ + * properties from netlink and udev. Update those properties */ /* When a link is not in netlink, its udev fields don't matter. */ if (obj->_link.netlink.is_in_netlink) { @@ -661,12 +661,12 @@ _nmp_object_fixup_link_udev_fields(NMPObject **obj_new, NMPObject *obj_orig, gbo initialized = TRUE; else if (!use_udev) { /* If we don't use udev, we immediately mark the link as initialized. - * - * For that, we consult @use_udev argument, that is cached via - * nmp_cache_use_udev_get(). It is on purpose not to test - * for a writable /sys on every call. A minor reason for that is - * performance, but the real reason is reproducibility. - * */ + * + * For that, we consult @use_udev argument, that is cached via + * nmp_cache_use_udev_get(). It is on purpose not to test + * for a writable /sys on every call. A minor reason for that is + * performance, but the real reason is reproducibility. + * */ initialized = TRUE; } } @@ -1217,9 +1217,9 @@ _vt_cmd_obj_cmp_link(const NMPObject *obj1, const NMPObject *obj2) return 1; /* Only compare based on pointer values. That is ugly because it's not a - * stable sort order. - * - * Have this check as very last. */ + * stable sort order. + * + * Have this check as very last. */ return (obj1->_link.udev.device < obj2->_link.udev.device) ? -1 : 1; } @@ -1451,7 +1451,7 @@ nmp_object_id_cmp(const NMPObject *obj1, const NMPObject *obj2) if (!klass->cmd_plobj_id_cmp) { /* the klass doesn't implement ID cmp(). That means, different objects - * never compare equal, but the cmp() according to their pointer value. */ + * never compare equal, but the cmp() according to their pointer value. */ NM_CMP_DIRECT_PTR(obj1, obj2); return 0; } @@ -1525,7 +1525,7 @@ nmp_object_id_hash_update(const NMPObject *obj, NMHashState *h) if (!klass->cmd_plobj_id_hash_update) { /* The klass doesn't implement ID compare. It means, to use pointer - * equality. */ + * equality. */ nm_hash_update_val(h, obj); return; } @@ -1679,20 +1679,20 @@ static gboolean _vt_cmd_obj_is_alive_ipx_route(const NMPObject *obj) { /* We want to ignore routes that are RTM_F_CLONED but we still - * let nmp_object_from_nl() create such route objects, instead of - * returning NULL right away. - * - * The idea is, that if we have the same route (according to its id) - * in the cache with !RTM_F_CLONED, an update that changes the route - * to be RTM_F_CLONED must remove the instance. - * - * If nmp_object_from_nl() would just return NULL, we couldn't look - * into the cache to see if it contains a route that now disappears - * (because it changed to be cloned). - * - * Instead we create a dead object, and nmp_cache_update_netlink() - * will remove the old version of the update. - **/ + * let nmp_object_from_nl() create such route objects, instead of + * returning NULL right away. + * + * The idea is, that if we have the same route (according to its id) + * in the cache with !RTM_F_CLONED, an update that changes the route + * to be RTM_F_CLONED must remove the instance. + * + * If nmp_object_from_nl() would just return NULL, we couldn't look + * into the cache to see if it contains a route that now disappears + * (because it changed to be cloned). + * + * Instead we create a dead object, and nmp_cache_update_netlink() + * will remove the old version of the update. + **/ return NMP_OBJECT_CAST_IP_ROUTE(obj)->ifindex > 0 && !NM_FLAGS_HAS(obj->ip_route.r_rtm_flags, RTM_F_CLONED); } @@ -1873,7 +1873,7 @@ nmp_cache_link_connected_needs_toggle(const NMPCache * cache, return FALSE; /* if native IFF_LOWER_UP is down, link.connected must also be down - * regardless of the slaves. */ + * regardless of the slaves. */ if (!NM_FLAGS_HAS(master->link.n_ifi_flags, IFF_LOWER_UP)) return !!master->link.connected; @@ -2305,13 +2305,13 @@ static NMDedupMultiIdxMode _obj_get_add_mode(const NMPObject *obj) { /* new objects are usually appended to the list. Except for - * addresses, which are prepended during `ip address add`. - * - * Actually, for routes it is more complicated, because depending on - * `ip route append`, `ip route replace`, `ip route prepend`, the object - * will be added at the tail, at the front, or even replace an element - * in the list. However, that is handled separately by nmp_cache_update_netlink_route() - * and of no concern here. */ + * addresses, which are prepended during `ip address add`. + * + * Actually, for routes it is more complicated, because depending on + * `ip route append`, `ip route replace`, `ip route prepend`, the object + * will be added at the tail, at the front, or even replace an element + * in the list. However, that is handled separately by nmp_cache_update_netlink_route() + * and of no concern here. */ if (NM_IN_SET(NMP_OBJECT_GET_TYPE(obj), NMP_OBJECT_TYPE_IP4_ADDRESS, NMP_OBJECT_TYPE_IP6_ADDRESS)) @@ -2385,7 +2385,7 @@ _idxcache_update_other_cache_ids(NMPCache * cache, if (obj_old && nm_dedup_multi_idx_type_id_equal(idx_type, obj_old, obj_new) && nm_dedup_multi_idx_type_partition_equal(idx_type, obj_old, obj_new)) { /* optimize. We just looked up the @obj_old entry and @obj_new compares equal - * according to idx_obj_id_equal(). entry_new is the same as entry_old. */ + * according to idx_obj_id_equal(). entry_new is the same as entry_old. */ entry_new = entry_old; } else { entry_new = nm_dedup_multi_index_lookup_obj(cache->multi_idx, idx_type, obj_new); @@ -2440,9 +2440,9 @@ _idxcache_update(NMPCache * cache, nm_auto_nmpobj const NMPObject *obj_old = NULL; /* we update an object in the cache. - * - * Note that @entry_old MUST be what is currently tracked in multi_idx, and it must - * have the same ID as @obj_new. */ + * + * Note that @entry_old MUST be what is currently tracked in multi_idx, and it must + * have the same ID as @obj_new. */ nm_assert(cache); nm_assert(entry_old || obj_new); @@ -2469,11 +2469,11 @@ _idxcache_update(NMPCache * cache, obj_old = nmp_object_ref(entry_old->obj); /* first update the main index NMP_CACHE_ID_TYPE_OBJECT_TYPE. - * We already know the pre-existing @entry old, so all that - * nm_dedup_multi_index_add_full() effectively does, is update the - * obj reference. - * - * We also get the new boxed object, which we need below. */ + * We already know the pre-existing @entry old, so all that + * nm_dedup_multi_index_add_full() effectively does, is update the + * obj reference. + * + * We also get the new boxed object, which we need below. */ if (obj_new) { nm_auto_nmpobj NMPObject *obj_old2 = NULL; @@ -2494,7 +2494,7 @@ _idxcache_update(NMPCache * cache, nm_dedup_multi_index_remove_entry(cache->multi_idx, entry_old); /* now update all other indexes. We know the previously boxed entry, and the - * newly boxed one. */ + * newly boxed one. */ klass = NMP_OBJECT_GET_CLASS(entry_new ? entry_new->obj : obj_old); for (i_idx_type = klass->supported_cache_ids; *i_idx_type; i_idx_type++) { NMPCacheIdType id_type = *i_idx_type; @@ -2534,7 +2534,7 @@ nmp_cache_remove(NMPCache * cache, if (equals_by_ptr && obj_old != obj_needle) { /* We found an identical object, but we only delete it if it's the same pointer as - * @obj_needle. */ + * @obj_needle. */ return NMP_CACHE_OPS_UNCHANGED; } if (only_dirty && !entry_old->dirty) { @@ -2568,9 +2568,9 @@ nmp_cache_remove_netlink(NMPCache * cache, if (NMP_OBJECT_GET_TYPE(obj_needle) == NMP_OBJECT_TYPE_LINK) { /* For nmp_cache_remove_netlink() we have an incomplete @obj_needle instance to be - * removed from netlink. Link objects are alive without being in netlink when they - * have a udev-device. All we want to do in this case is clear the netlink.is_in_netlink - * flag. */ + * removed from netlink. Link objects are alive without being in netlink when they + * have a udev-device. All we want to do in this case is clear the netlink.is_in_netlink + * flag. */ NM_SET_OUT(out_obj_old, nmp_object_ref(obj_old)); @@ -2647,8 +2647,8 @@ nmp_cache_update_netlink(NMPCache * cache, nm_assert(NMP_OBJECT_IS_VALID(obj_hand_over)); nm_assert(!NMP_OBJECT_IS_STACKINIT(obj_hand_over)); /* A link object from netlink must have the udev related fields unset. - * We could implement to handle that, but there is no need to support such - * a use-case */ + * We could implement to handle that, but there is no need to support such + * a use-case */ nm_assert(NMP_OBJECT_GET_TYPE(obj_hand_over) != NMP_OBJECT_TYPE_LINK || (!obj_hand_over->_link.udev.device && !obj_hand_over->link.driver)); nm_assert(nm_dedup_multi_index_obj_find(cache->multi_idx, obj_hand_over) != obj_hand_over); @@ -2685,14 +2685,14 @@ nmp_cache_update_netlink(NMPCache * cache, } if (obj_old->_link.udev.device) { /* @obj_hand_over is not in netlink. - * - * This is similar to nmp_cache_remove_netlink(), but there we preserve the - * preexisting netlink properties. The use case of that is when kernel_get_object() - * cannot load an object (based on the id of a needle). - * - * Here we keep the data provided from @obj_hand_over. The usecase is when receiving - * a valid @obj_hand_over instance from netlink with RTM_DELROUTE. - */ + * + * This is similar to nmp_cache_remove_netlink(), but there we preserve the + * preexisting netlink properties. The use case of that is when kernel_get_object() + * cannot load an object (based on the id of a needle). + * + * Here we keep the data provided from @obj_hand_over. The usecase is when receiving + * a valid @obj_hand_over instance from netlink with RTM_DELROUTE. + */ is_alive = TRUE; } else is_alive = FALSE; @@ -2765,8 +2765,8 @@ nmp_cache_update_netlink_route(NMPCache * cache, nm_assert(NMP_OBJECT_IS_VALID(obj_hand_over)); nm_assert(!NMP_OBJECT_IS_STACKINIT(obj_hand_over)); /* A link object from netlink must have the udev related fields unset. - * We could implement to handle that, but there is no need to support such - * a use-case */ + * We could implement to handle that, but there is no need to support such + * a use-case */ nm_assert(NM_IN_SET(NMP_OBJECT_GET_TYPE(obj_hand_over), NMP_OBJECT_TYPE_IP4_ROUTE, NMP_OBJECT_TYPE_IP6_ROUTE)); @@ -2809,12 +2809,12 @@ update_done: NM_SET_OUT(out_obj_new, nmp_object_ref(nm_dedup_multi_entry_get_obj(entry_new))); /* a RTM_GETROUTE event may signal that another object was replaced. - * Find out whether that is the case and return it as @obj_replaced. - * - * Also, fixup the order of @entry_new within NMP_CACHE_ID_TYPE_ROUTES_BY_WEAK_ID - * index. For most parts, we don't care about the order of objects (including routes). - * But NMP_CACHE_ID_TYPE_ROUTES_BY_WEAK_ID we must keep in the correct order, to - * properly find @obj_replaced. */ + * Find out whether that is the case and return it as @obj_replaced. + * + * Also, fixup the order of @entry_new within NMP_CACHE_ID_TYPE_ROUTES_BY_WEAK_ID + * index. For most parts, we don't care about the order of objects (including routes). + * But NMP_CACHE_ID_TYPE_ROUTES_BY_WEAK_ID we must keep in the correct order, to + * properly find @obj_replaced. */ resync_required = FALSE; entry_replace = NULL; if (is_dump) @@ -2824,15 +2824,15 @@ update_done: if (NM_FLAGS_HAS(nlmsgflags, NLM_F_REPLACE) && nmp_cache_lookup_all(cache, NMP_CACHE_ID_TYPE_ROUTES_BY_WEAK_ID, obj_hand_over)) { /* hm. @obj_hand_over was not added, meaning it was not alive. - * However, we track some other objects with the same weak-id. - * It's unclear what that means. To be sure, resync. */ + * However, we track some other objects with the same weak-id. + * It's unclear what that means. To be sure, resync. */ resync_required = TRUE; } goto out; } /* FIXME: for routes, we only maintain the order correctly for the BY_WEAK_ID - * index. For all other indexes their order becomes messed up. */ + * index. For all other indexes their order becomes messed up. */ entry_cur = _lookup_entry_with_idx_type(cache, NMP_CACHE_ID_TYPE_ROUTES_BY_WEAK_ID, entry_new->obj); if (!entry_cur) { diff --git a/src/platform/nmp-object.h b/src/platform/nmp-object.h index 660c0ad367..e6c664fb7c 100644 --- a/src/platform/nmp-object.h +++ b/src/platform/nmp-object.h @@ -120,44 +120,44 @@ typedef enum { /*< skip >*/ NMP_CACHE_ID_TYPE_NONE, /* all the objects of a certain type. - * - * This index is special. It is the only one that contains *all* object. - * Other indexes may consider some object as non "partitionable", hence - * they don't track all objects. - * - * Hence, this index type is used when looking at all objects (still - * partitioned by type). - * - * Also, note that links may be considered invisible. This index type - * expose all links, even invisible ones. For addresses/routes, this - * distinction doesn't exist, as all addresses/routes that are alive - * are visible as well. */ + * + * This index is special. It is the only one that contains *all* object. + * Other indexes may consider some object as non "partitionable", hence + * they don't track all objects. + * + * Hence, this index type is used when looking at all objects (still + * partitioned by type). + * + * Also, note that links may be considered invisible. This index type + * expose all links, even invisible ones. For addresses/routes, this + * distinction doesn't exist, as all addresses/routes that are alive + * are visible as well. */ NMP_CACHE_ID_TYPE_OBJECT_TYPE, /* index for the link objects by ifname. */ NMP_CACHE_ID_TYPE_LINK_BY_IFNAME, /* indices for the visible default-routes, ignoring ifindex. - * This index only contains two partitions: all visible default-routes, - * separate for IPv4 and IPv6. */ + * This index only contains two partitions: all visible default-routes, + * separate for IPv4 and IPv6. */ NMP_CACHE_ID_TYPE_DEFAULT_ROUTES, /* all the objects that have an ifindex (by object-type) for an ifindex. */ NMP_CACHE_ID_TYPE_OBJECT_BY_IFINDEX, /* Consider all the destination fields of a route, that is, the ID without the ifindex - * and gateway (meaning: network/plen,metric). - * The reason for this is that `ip route change` can replace an existing route - * and modify its ifindex/gateway. Effectively, that means it deletes an existing - * route and adds a different one (as the ID of the route changes). However, it only - * sends one RTM_NEWADDR notification without notifying about the deletion. We detect - * that by having this index to contain overlapping routes which require special - * cache-resync. */ + * and gateway (meaning: network/plen,metric). + * The reason for this is that `ip route change` can replace an existing route + * and modify its ifindex/gateway. Effectively, that means it deletes an existing + * route and adds a different one (as the ID of the route changes). However, it only + * sends one RTM_NEWADDR notification without notifying about the deletion. We detect + * that by having this index to contain overlapping routes which require special + * cache-resync. */ NMP_CACHE_ID_TYPE_ROUTES_BY_WEAK_ID, /* a filter for objects that track an explicit address family. - * - * Note that currently on NMPObjectRoutingRule is indexed by this filter. */ + * + * Note that currently on NMPObjectRoutingRule is indexed by this filter. */ NMP_CACHE_ID_TYPE_OBJECT_BY_ADDR_FAMILY, __NMP_CACHE_ID_TYPE_MAX, @@ -215,21 +215,21 @@ typedef struct { struct { /* note that "struct udev_device" references the library context - * "struct udev", but doesn't own it. - * - * Hence, the udev.device shall not be used after the library - * context is destroyed. - * - * In case of NMPObjectLink instances that you obtained from the - * platform cache, that means that you shall no keep references - * to those instances that outlife the NMPlatform instance. - * - * In practice, the requirement is less strict and you'll be even - * fine if the platform instance (and the "struct udev" instance) - * are already destroyed while you still hold onto a reference to - * the NMPObjectLink instance. Just don't make use of udev functions - * that cause access to the udev library context. - */ + * "struct udev", but doesn't own it. + * + * Hence, the udev.device shall not be used after the library + * context is destroyed. + * + * In case of NMPObjectLink instances that you obtained from the + * platform cache, that means that you shall no keep references + * to those instances that outlife the NMPlatform instance. + * + * In practice, the requirement is less strict and you'll be even + * fine if the platform instance (and the "struct udev" instance) + * are already destroyed while you still hold onto a reference to + * the NMPObjectLink instance. Just don't make use of udev functions + * that cause access to the udev library context. + */ struct udev_device *device; } udev; @@ -237,8 +237,8 @@ typedef struct { GObject *ext_data; /* FIXME: not every NMPObjectLink should pay the price for tracking - * the wireguard family id. This should be tracked via ext_data, which - * would be exactly the right place. */ + * the wireguard family id. This should be tracked via ext_data, which + * would be exactly the right place. */ int wireguard_family_id; } NMPObjectLink; @@ -447,7 +447,7 @@ NMP_OBJECT_IS_VALID(const NMPObject *obj) nm_assert(!obj || (obj && obj->parent._ref_count > 0 && NMP_CLASS_IS_VALID(obj->_class))); /* There isn't really much to check. Either @obj is NULL, or we must - * assume that it points to valid memory. */ + * assume that it points to valid memory. */ return obj != NULL; } @@ -589,9 +589,9 @@ nmp_object_ref(const NMPObject *obj) } /* ref and unref accept const pointers. NMPObject is supposed to be shared - * and kept immutable. Disallowing to take/return a reference to a const - * NMPObject is cumbersome, because callers are precisely expected to - * keep a ref on the otherwise immutable object. */ + * and kept immutable. Disallowing to take/return a reference to a const + * NMPObject is cumbersome, because callers are precisely expected to + * keep a ref on the otherwise immutable object. */ g_return_val_if_fail(NMP_OBJECT_IS_VALID(obj), NULL); g_return_val_if_fail(obj->parent._ref_count != NM_OBJ_REF_COUNT_STACKINIT, NULL); @@ -863,7 +863,7 @@ nmp_cache_reresolve_main_entry(NMPCache * cache, } /* we only track the dirty flag for the OBJECT-TYPE index. That means, - * for other lookup types we need to check the dirty flag of the main-entry. */ + * for other lookup types we need to check the dirty flag of the main-entry. */ main_entry = nmp_cache_lookup_entry(cache, entry->obj); nm_assert(main_entry); @@ -1045,12 +1045,12 @@ nmp_object_ip_route_is_best_defaut_route(const NMPObject *obj) const NMPlatformIPRoute *r = NMP_OBJECT_CAST_IP_ROUTE(obj); /* return whether @obj is considered a default-route. - * - * NMIP4Config/NMIP6Config tracks the (best) default-route explicitly, because - * at various places we act differently depending on whether there is a default-route - * configured. - * - * Note that this only considers the main routing table. */ + * + * NMIP4Config/NMIP6Config tracks the (best) default-route explicitly, because + * at various places we act differently depending on whether there is a default-route + * configured. + * + * Note that this only considers the main routing table. */ return r && NM_PLATFORM_IP_ROUTE_IS_DEFAULT(r) && nm_platform_route_table_is_main(r->table_coerced) && r->type_coerced == nm_platform_route_type_coerce(1 /* RTN_UNICAST */); diff --git a/src/platform/nmp-rules-manager.c b/src/platform/nmp-rules-manager.c index 84f1a35d34..3bb14d380d 100644 --- a/src/platform/nmp-rules-manager.c +++ b/src/platform/nmp-rules-manager.c @@ -66,18 +66,18 @@ typedef struct { CList user_tag_lst; /* track_priority_val zero is special: those are weakly tracked rules. - * That means: NetworkManager will restore them only if it removed them earlier. - * But it will not remove or add them otherwise. - * - * Otherwise, the track_priority_val goes together with track_priority_present. - * In case of one rule being tracked multiple times (with different priorities), - * the one with higher priority wins. See _rules_obj_get_best_data(). - * Then, the winning present state either enforces that the rule is present - * or absent. - * - * If a rules is not tracked at all, it is ignored by NetworkManager. Assuming - * that it was added externally by the user. But unlike weakly tracked rules, - * NM will *not* restore such rules if NetworkManager themself removed them. */ + * That means: NetworkManager will restore them only if it removed them earlier. + * But it will not remove or add them otherwise. + * + * Otherwise, the track_priority_val goes together with track_priority_present. + * In case of one rule being tracked multiple times (with different priorities), + * the one with higher priority wins. See _rules_obj_get_best_data(). + * Then, the winning present state either enforces that the rule is present + * or absent. + * + * If a rules is not tracked at all, it is ignored by NetworkManager. Assuming + * that it was added externally by the user. But unlike weakly tracked rules, + * NM will *not* restore such rules if NetworkManager themself removed them. */ guint32 track_priority_val; bool track_priority_present : 1; @@ -90,14 +90,14 @@ typedef enum { CONFIG_STATE_REMOVED_BY_US = 2, /* ConfigState encodes whether the rule was touched by us at all (CONFIG_STATE_NONE). - * - * Maybe we would only need to track whether we touched the rule at all. But we - * track it more in detail what we did: did we add it (CONFIG_STATE_ADDED_BY_US) - * or did we remove it (CONFIG_STATE_REMOVED_BY_US)? - * Finally, we need CONFIG_STATE_OWNED_BY_US, which means that we didn't actively - * add/remove it, but whenever we are about to undo the add/remove, we need to do it. - * In that sense, CONFIG_STATE_OWNED_BY_US is really just a flag that we unconditionally - * force the state next time when necessary. */ + * + * Maybe we would only need to track whether we touched the rule at all. But we + * track it more in detail what we did: did we add it (CONFIG_STATE_ADDED_BY_US) + * or did we remove it (CONFIG_STATE_REMOVED_BY_US)? + * Finally, we need CONFIG_STATE_OWNED_BY_US, which means that we didn't actively + * add/remove it, but whenever we are about to undo the add/remove, we need to do it. + * In that sense, CONFIG_STATE_OWNED_BY_US is really just a flag that we unconditionally + * force the state next time when necessary. */ CONFIG_STATE_OWNED_BY_US = 3, } ConfigState; @@ -106,15 +106,15 @@ typedef struct { CList obj_lst_head; /* indicates whether we configured/removed the rule (during sync()). We need that, so - * if the rule gets untracked, that we know to remove/restore it. - * - * This makes NMPRulesManager stateful (beyond the configuration that indicates - * which rules are tracked). - * After a restart, NetworkManager would no longer remember which rules were added - * by us. - * - * That is partially fixed by NetworkManager taking over the rules that it - * actively configures (see %NMP_RULES_MANAGER_EXTERN_WEAKLY_TRACKED_USER_TAG). */ + * if the rule gets untracked, that we know to remove/restore it. + * + * This makes NMPRulesManager stateful (beyond the configuration that indicates + * which rules are tracked). + * After a restart, NetworkManager would no longer remember which rules were added + * by us. + * + * That is partially fixed by NetworkManager taking over the rules that it + * actively configures (see %NMP_RULES_MANAGER_EXTERN_WEAKLY_TRACKED_USER_TAG). */ ConfigState config_state; } RulesObjData; @@ -203,7 +203,7 @@ _rules_obj_get_best_data(RulesObjData *obj_data) if (rd_best->track_priority_val == rules_data->track_priority_val) { if (rd_best->track_priority_present || !rules_data->track_priority_present) { /* if the priorities are identical, then "present" wins over - * "!present" (absent). */ + * "!present" (absent). */ continue; } } @@ -449,14 +449,14 @@ _rules_data_untrack(NMPRulesManager *self, if (make_owned_by_us) { if (obj_data->config_state == CONFIG_STATE_NONE) { /* we need to mark this entry that it requires a touch on the next - * sync. */ + * sync. */ obj_data->config_state = CONFIG_STATE_OWNED_BY_US; } } else if (remove_user_tag_data && c_list_length_is(&rules_data->user_tag_lst, 1)) g_hash_table_remove(self->by_user_tag, &rules_data->user_tag); /* if obj_data is marked to be "added_by_us" or "removed_by_us", we need to keep this entry - * around for the next sync -- so that we can undo what we did earlier. */ + * around for the next sync -- so that we can undo what we did earlier. */ if (obj_data->config_state == CONFIG_STATE_NONE && c_list_length_is(&rules_data->obj_lst, 1)) g_hash_table_remove(self->by_obj, &rules_data->obj); @@ -563,7 +563,7 @@ nmp_rules_manager_sync(NMPRulesManager *self, gboolean keep_deleted_rules) if (!obj_data) { /* this rule is not tracked. It was externally added, hence we - * ignore it. */ + * ignore it. */ continue; } diff --git a/src/platform/tests/test-address.c b/src/platform/tests/test-address.c index bd0964217d..311d61013d 100644 --- a/src/platform/tests/test-address.c +++ b/src/platform/tests/test-address.c @@ -233,8 +233,8 @@ test_ip4_address_general_2(void) g_assert(ifindex > 0); /* Looks like addresses are not announced by kernel when the interface - * is down. Link-local IPv6 address is automatically added. - */ + * is down. Link-local IPv6 address is automatically added. + */ g_assert(nm_platform_link_set_up(NM_PLATFORM_GET, DEVICE_IFINDEX, NULL)); /* Add/delete notification */ diff --git a/src/platform/tests/test-common.c b/src/platform/tests/test-common.c index 5363eaa252..97c4c4541b 100644 --- a/src/platform/tests/test-common.c +++ b/src/platform/tests/test-common.c @@ -790,14 +790,14 @@ nmtstp_wait_for_signal(NMPlatform *platform, gint64 timeout_msec) &data); /* if timeout_msec is negative, it means the wait-time already expired. - * Maybe, we should do nothing and return right away, without even - * processing events from platform. However, that inconsistency (of not - * processing events from mainloop) is inconvenient. - * - * It's better that on the return of nmtstp_wait_for_signal(), we always - * have no events pending. So, a negative timeout is treated the same as - * a zero timeout: we check whether there are any events pending in platform, - * and quite the mainloop immediately afterwards. But we always check. */ + * Maybe, we should do nothing and return right away, without even + * processing events from platform. However, that inconsistency (of not + * processing events from mainloop) is inconvenient. + * + * It's better that on the return of nmtstp_wait_for_signal(), we always + * have no events pending. So, a negative timeout is treated the same as + * a zero timeout: we check whether there are any events pending in platform, + * and quite the mainloop immediately afterwards. But we always check. */ data.id = g_timeout_add(CLAMP(timeout_msec, 0, G_MAXUINT32), _wait_for_signal_timeout, &data); @@ -880,7 +880,7 @@ nmtstp_wait_for_link_until(NMPlatform *platform, waited_once = TRUE; /* regardless of whether timeout is already reached, we poll the netlink - * socket a bit. */ + * socket a bit. */ nmtstp_wait_for_signal(platform, until_ms - now); } } @@ -1951,8 +1951,8 @@ nmtstp_link_tun_add(NMPlatform * platform, if (!lnk->persist) { /* ip tuntap does not support non-persistent devices. - * - * Add this device only via NMPlatform. */ + * + * Add this device only via NMPlatform. */ if (external_command == -1) external_command = FALSE; } @@ -1981,7 +1981,7 @@ nmtstp_link_tun_add(NMPlatform * platform, lnk->multi_queue ? " multi_queue" : "", name); /* Older versions of iproute2 don't support adding devices. - * On failure, fallback to using platform code. */ + * On failure, fallback to using platform code. */ if (err == 0) pllink = nmtstp_assert_wait_for_link(platform, name, NM_LINK_TYPE_TUN, 100); else @@ -2088,7 +2088,7 @@ nmtstp_link_vxlan_add(NMPlatform * platform, lnk->src_port_max, lnk->ageing); /* Older versions of iproute2 don't support adding vxlan devices. - * On failure, fallback to using platform code. */ + * On failure, fallback to using platform code. */ if (err == 0) pllink = nmtstp_assert_wait_for_link(platform, name, NM_LINK_TYPE_VXLAN, 100); else @@ -2491,7 +2491,7 @@ unshare_user(void) return FALSE; /* Since Linux 3.19 we have to disable setgroups() in order to map users. - * Just proceed if the file is not there. */ + * Just proceed if the file is not there. */ f = fopen("/proc/self/setgroups", "we"); if (f) { fprintf(f, "deny"); diff --git a/src/platform/tests/test-link.c b/src/platform/tests/test-link.c index 7713f44802..f93250bff1 100644 --- a/src/platform/tests/test-link.c +++ b/src/platform/tests/test-link.c @@ -174,14 +174,14 @@ test_link_changed_signal_cb(NMPlatform * platform, const NMPlatformSignalChangeType change_type = change_type_i; /* test invocation of platform signals with multiple listeners - * connected to the signal. Platform signals have enum-typed - * arguments and there seem to be an issue with invoking such - * signals on s390x and ppc64 archs. - * https://bugzilla.redhat.com/show_bug.cgi?id=1260577 - * - * As the test shows, the failure is not reproducible for - * platform signals. - */ + * connected to the signal. Platform signals have enum-typed + * arguments and there seem to be an issue with invoking such + * signals on s390x and ppc64 archs. + * https://bugzilla.redhat.com/show_bug.cgi?id=1260577 + * + * As the test shows, the failure is not reproducible for + * platform signals. + */ g_assert(NM_IS_PLATFORM(platform)); g_assert(platform == NM_PLATFORM_GET); @@ -226,9 +226,9 @@ test_slave(int master, int type, SignalData *master_changed) accept_signal(link_added); /* Set the slave up to see whether master's IFF_LOWER_UP is set correctly. - * - * See https://bugzilla.redhat.com/show_bug.cgi?id=910348 - */ + * + * See https://bugzilla.redhat.com/show_bug.cgi?id=910348 + */ g_assert(!nm_platform_link_is_up(NM_PLATFORM_GET, ifindex)); g_assert(nm_platform_link_set_down(NM_PLATFORM_GET, ifindex)); g_assert(!nm_platform_link_is_up(NM_PLATFORM_GET, ifindex)); @@ -274,10 +274,10 @@ test_slave(int master, int type, SignalData *master_changed) g_assert(test_link_changed_signal_arg2); /* Master with a disconnected slave is disconnected - * - * For some reason, bonding and teaming slaves are automatically set up. We - * need to set them back down for this test. - */ + * + * For some reason, bonding and teaming slaves are automatically set up. We + * need to set them back down for this test. + */ switch (nm_platform_link_get_type(NM_PLATFORM_GET, master)) { case NM_LINK_TYPE_BOND: case NM_LINK_TYPE_TEAM: @@ -293,8 +293,8 @@ test_slave(int master, int type, SignalData *master_changed) if (nmtstp_is_root_test() && nm_platform_link_is_connected(NM_PLATFORM_GET, master)) { if (nm_platform_link_get_type(NM_PLATFORM_GET, master) == NM_LINK_TYPE_TEAM) { /* Older team versions (e.g. Fedora 17) have a bug that team master stays - * IFF_LOWER_UP even if its slave is down. Double check it with iproute2 and if - * `ip link` also claims master to be up, accept it. */ + * IFF_LOWER_UP even if its slave is down. Double check it with iproute2 and if + * `ip link` also claims master to be up, accept it. */ char *stdout_str = NULL; nmtst_spawn_sync(NULL, @@ -322,9 +322,9 @@ test_slave(int master, int type, SignalData *master_changed) accept_signals(master_changed, 0, 3); /* Enslave again - * - * Gracefully succeed if already enslaved. - */ + * + * Gracefully succeed if already enslaved. + */ ensure_no_signal(link_changed); g_assert(nm_platform_link_enslave(NM_PLATFORM_GET, master, ifindex)); accept_signals(link_changed, 0, 2); @@ -357,7 +357,7 @@ test_slave(int master, int type, SignalData *master_changed) accept_signals(link_removed, 0, 1); } else { /* Due to https://bugzilla.redhat.com/show_bug.cgi?id=1285719 , kernel might send a - * wrong RTM_DELLINK message so that we instead see an removed+added signal. */ + * wrong RTM_DELLINK message so that we instead see an removed+added signal. */ accept_signal(link_added); ensure_no_signal(link_changed); accept_signal(link_removed); @@ -524,7 +524,7 @@ static int _system(const char *cmd) { /* some gcc version really want to warn on -Werror=unused-result. Add a bogus wrapper - * function. */ + * function. */ return system(cmd); } @@ -1475,11 +1475,11 @@ test_software_detect(gconstpointer user_data) lnk_macvlan.tap = FALSE; /* Since in old kernel versions sysfs files for macvtaps are not - * namespaced, the creation can fail if a macvtap in another namespace - * has the same index. Try to detect this situation and skip already - * used indexes. - * The fix (17af2bce) is included kernel 4.7, dated 24 July, 2016. - */ + * namespaced, the creation can fail if a macvtap in another namespace + * has the same index. Try to detect this situation and skip already + * used indexes. + * The fix (17af2bce) is included kernel 4.7, dated 24 July, 2016. + */ for (i = ifindex_parent + 1; i < ifindex_parent + 100; i++) { snprintf(buf, sizeof(buf), "/sys/class/macvtap/tap%d", i); if (!g_file_test(buf, G_FILE_TEST_IS_SYMLINK)) @@ -1605,7 +1605,7 @@ test_software_detect(gconstpointer user_data) .multi_queue = nmtst_get_rand_bool(), /* if we add the device via iproute2 (external), we can only - * create persistent devices. */ + * create persistent devices. */ .persist = (ext == 1) ? TRUE : nmtst_get_rand_bool(), }; break; @@ -1654,8 +1654,8 @@ test_software_detect(gconstpointer user_data) if (test_data->link_type == NM_LINK_TYPE_VXLAN && set_up) { /* On RHEL-7, we need to add a tiny sleep here, otherwise, - * upping the vxlan device fails with EADDRINUSE. - * https://bugzilla.redhat.com/show_bug.cgi?id=1277131 */ + * upping the vxlan device fails with EADDRINUSE. + * https://bugzilla.redhat.com/show_bug.cgi?id=1277131 */ g_usleep(1); } nmtstp_link_set_updown(NULL, -1, ifindex, set_up); @@ -1667,7 +1667,7 @@ test_software_detect(gconstpointer user_data) if (!lnk && test_data->link_type == NM_LINK_TYPE_TUN) { /* this is ok. Kernel apparently does not support tun properties via netlink. We - * fetch them from sysfs below. */ + * fetch them from sysfs below. */ } else g_assert(lnk); @@ -1833,8 +1833,8 @@ test_software_detect(gconstpointer user_data) == nm_platform_link_get_lnk_tun(NM_PLATFORM_GET, ifindex, NULL)); /* kernel might not expose tun options via netlink. Either way, try - * to read them (either from platform cache, or fallback to sysfs). - * See also: rh#1547213. */ + * to read them (either from platform cache, or fallback to sysfs). + * See also: rh#1547213. */ if (!nm_platform_link_tun_get_properties(NM_PLATFORM_GET, ifindex, &lnk_tun2)) g_assert_not_reached(); @@ -1844,9 +1844,9 @@ test_software_detect(gconstpointer user_data) if (i_step == 0) { /* Before we upped the device for the first time the kernel didn't notify - * us of the owner set after the link creation: - * https://bugzilla.redhat.com/show_bug.cgi?id=1566062 - */ + * us of the owner set after the link creation: + * https://bugzilla.redhat.com/show_bug.cgi?id=1566062 + */ break; } @@ -1895,7 +1895,7 @@ test_software_detect(gconstpointer user_data) g_assert_cmpint(plnk->dst_port, ==, 4789); if (plnk->src_port_min != 0 || plnk->src_port_max != 0) { /* on some kernels, omitting the port range results in setting - * following default port range. */ + * following default port range. */ g_assert_cmpint(plnk->src_port_min, ==, 32768); g_assert_cmpint(plnk->src_port_max, ==, 61000); } @@ -2426,8 +2426,8 @@ test_create_many_links_do(guint n_devices) nm_sprintf_buf(name, "t-%05u", i); if (EX == 2) { /* This mode is different from letting nmtstp_link_dummy_add() - * because in this case we don't process any platform events - * while adding all the links. */ + * because in this case we don't process any platform events + * while adding all the links. */ nmtstp_run_command_check("ip link add %s type dummy", name); } else nmtstp_link_dummy_add(NULL, EX, name); @@ -2516,20 +2516,20 @@ test_nl_bugs_veth(void) g_assert(pllink_veth0); if (pllink_veth0->parent == 0) { /* Kernels prior to 4.1 dated 21 June, 2015 don't support exposing the veth peer - * as IFA_LINK. skip the remainder of the test. */ + * as IFA_LINK. skip the remainder of the test. */ goto out; } g_assert_cmpint(pllink_veth0->parent, ==, ifindex_veth1); /* The following tests whether we have a workaround for kernel bug - * https://bugzilla.redhat.com/show_bug.cgi?id=1285827 in place. */ + * https://bugzilla.redhat.com/show_bug.cgi?id=1285827 in place. */ pllink_veth1 = nm_platform_link_get(NM_PLATFORM_GET, ifindex_veth1); g_assert(pllink_veth1); g_assert_cmpint(pllink_veth1->parent, ==, ifindex_veth0); /* move one veth peer to another namespace and check that the - * parent/IFLA_LINK of the remaining peer properly updates - * (https://bugzilla.redhat.com/show_bug.cgi?id=1262908). */ + * parent/IFLA_LINK of the remaining peer properly updates + * (https://bugzilla.redhat.com/show_bug.cgi?id=1262908). */ ns_handle = nmtstp_namespace_create(CLONE_NEWNET, &error); g_assert_no_error(error); g_assert(ns_handle); @@ -2673,7 +2673,7 @@ static void _test_netns_setup(gpointer fixture, gconstpointer test_data) { /* the singleton platform instance has netns support disabled. - * Destroy the instance before the test and re-create it afterwards. */ + * Destroy the instance before the test and re-create it afterwards. */ g_object_unref(NM_PLATFORM_GET); } @@ -2864,7 +2864,7 @@ test_netns_general(gpointer fixture, gconstpointer test_data) _sysctl_assert_eq(platform_2, "/proc/sys/net/ipv6/conf/dummy2a/disable_ipv6", NULL); /* Kernels prior to 3.19 dated 8 February, 2015 don't support ethtool -i for dummy devices. - * Work around that and skip asserts that are known to fail. */ + * Work around that and skip asserts that are known to fail. */ ethtool_support = nmtstp_run_command("ethtool -i dummy1_ > /dev/null") == 0; if (ethtool_support) { g_assert(nmp_utils_ethtool_get_driver_info( @@ -3340,7 +3340,7 @@ test_sysctl_netns_switch(void) nmtstp_netns_select_random(platforms, G_N_ELEMENTS(platforms), &netns_pop_3); /* even if we switch to other namespaces, we can still lookup the path correctly, - * either using dirfd or via the platform instance (which switches namespace as needed). */ + * either using dirfd or via the platform instance (which switches namespace as needed). */ { gs_free char *c = NULL; @@ -3417,7 +3417,7 @@ test_sysctl_netns_switch(void) } /* accessing the path directly, only succeeds iff the current namespace happens to be the namespace - * in which we created the link. */ + * in which we created the link. */ { gs_free char *c = NULL; @@ -3570,9 +3570,9 @@ _test_netns_mt_thread(gpointer data) g_assert(netns_bottom); /* I don't know why, but we need to create a new netns here at least once. - * Otherwise, setns(, CLONE_NEWNS) below fails with EINVAL (???). - * - * Something is not right here, but what? */ + * Otherwise, setns(, CLONE_NEWNS) below fails with EINVAL (???). + * + * Something is not right here, but what? */ netns2 = nmp_netns_new(); nmp_netns_pop(netns2); g_clear_object(&netns2); diff --git a/src/platform/tests/test-nmp-object.c b/src/platform/tests/test-nmp-object.c index 85042f7d16..0bdddb21da 100644 --- a/src/platform/tests/test-nmp-object.c +++ b/src/platform/tests/test-nmp-object.c @@ -577,8 +577,8 @@ main(int argc, char **argv) enumerator = nm_udev_client_enumerate_new(udev_client); /* Demand that the device is initialized (udev rules ran, - * device has a stable name now) in case udev is running - * (not in a container). */ + * device has a stable name now) in case udev is running + * (not in a container). */ if (access("/sys", W_OK) == 0) udev_enumerate_add_match_is_initialized(enumerator); diff --git a/src/platform/tests/test-platform-general.c b/src/platform/tests/test-platform-general.c index b10981d28b..ff02d8834e 100644 --- a/src/platform/tests/test-platform-general.c +++ b/src/platform/tests/test-platform-general.c @@ -556,13 +556,13 @@ test_platform_ip_address_pretty_sort_cmp(gconstpointer test_data) gsize i, j; /* - * First we create a list of addresses filled with (stable) random bytes. - * We tweak some fields explicitly (stable randomly), so that we cover all - * relevant cases. - * - * Then we sort the list of addresses, and compare that the result is - * as our EXPECTED_BUFFER. - */ + * First we create a list of addresses filled with (stable) random bytes. + * We tweak some fields explicitly (stable randomly), so that we cover all + * relevant cases. + * + * Then we sort the list of addresses, and compare that the result is + * as our EXPECTED_BUFFER. + */ addresses = g_malloc(ELM_SIZE * N_ADDRESSES); rand_map = g_malloc(sizeof(rand_map[0]) * N_ADDRESSES); @@ -640,7 +640,7 @@ test_platform_ip_address_pretty_sort_cmp(gconstpointer test_data) if (CONSUME_BITS(r, 5) != 0) { /* randomly make addr-source the same (so that several addresses compare - * equal). */ + * equal). */ a->a4.addr_source = CONSUME_BITS(r, 2); } diff --git a/src/platform/tests/test-route.c b/src/platform/tests/test-route.c index c559539862..2891b5b976 100644 --- a/src/platform/tests/test-route.c +++ b/src/platform/tests/test-route.c @@ -25,7 +25,7 @@ _wait_for_ipv4_addr_device_route(NMPlatform *platform, guint8 plen) { /* Wait that the addresses gets a device-route. After adding a address, - * the device route is not added immediately. It takes a moment... */ + * the device route is not added immediately. It takes a moment... */ addr = nm_utils_ip4_address_clear_host_address(addr, plen); NMTST_WAIT_ASSERT(400, { @@ -60,9 +60,9 @@ _wait_for_ipv6_addr_non_tentative(NMPlatform * platform, guint i; /* Wait that the addresses become non-tentative. Dummy interfaces are NOARP - * and thus don't do DAD, but the kernel sets the address as tentative for a - * small amount of time, which prevents the immediate addition of the route - * with RTA_PREFSRC */ + * and thus don't do DAD, but the kernel sets the address as tentative for a + * small amount of time, which prevents the immediate addition of the route + * with RTA_PREFSRC */ NMTST_WAIT_ASSERT(timeout_msec, { gboolean should_wait = FALSE; @@ -1248,7 +1248,7 @@ static guint32 _rr_rand_choose_u32(guint32 p) { /* mostly, we just return zero. We want that each rule only has few - * fields set -- having most fields at zero. */ + * fields set -- having most fields at zero. */ if ((p % 10000u) < 7500u) return 0; @@ -1317,9 +1317,9 @@ _rule_create_random(NMPlatform *platform) p = nmtst_get_rand_uint32(); if ((p % 1000u) < 100) { /* if we set src_len/dst_len to zero, the src/dst is actually ignored. - * - * For fuzzying, still set the address. It shall have no further effect. - * */ + * + * For fuzzying, still set the address. It shall have no further effect. + * */ *p_len = (~p) % (addr_size * 8 + 1); p = nmtst_get_rand_uint32(); if ((p % 3u) == 0) { @@ -1456,10 +1456,10 @@ _rule_fuzzy_equal(const NMPObject *obj, const NMPObject *obj_comp, int op_type) switch (op_type) { case RTM_NEWRULE: /* when adding rules with RTM_NEWRULE, kernel checks whether an existing - * rule already exists and may fail with EEXIST. This check has issues - * and reject legitimate rules (rh#1686075). - * - * Work around that. */ + * rule already exists and may fail with EEXIST. This check has issues + * and reject legitimate rules (rh#1686075). + * + * Work around that. */ if (rr->src_len == 0) rr_co.src_len = 0; if (rr->dst_len == 0) @@ -1477,7 +1477,7 @@ _rule_fuzzy_equal(const NMPObject *obj, const NMPObject *obj_comp, int op_type) break; case RTM_DELRULE: /* when deleting a rule with RTM_DELRULE, kernel tries to find the - * candidate to delete. It might delete the wrong rule (rh#1685816). */ + * candidate to delete. It might delete the wrong rule (rh#1685816). */ if (rr->action == FR_ACT_UNSPEC) rr_co.action = FR_ACT_UNSPEC; if (rr->iifname[0] == '\0') @@ -1646,8 +1646,8 @@ again: objs_sync = g_ptr_array_new_with_free_func((GDestroyNotify) nmp_object_unref); /* ensure that priorities are unique. Otherwise, it confuses the test, because - * kernel may wrongly be unable to add/delete routes based on a wrong match - * (rh#1685816, rh#1685816). */ + * kernel may wrongly be unable to add/delete routes based on a wrong match + * (rh#1685816, rh#1685816). */ for (i = 0; i < objs->len; i++) { const NMPObject *obj = objs->pdata[i]; guint32 prio = NMP_OBJECT_CAST_ROUTING_RULE(obj)->priority; @@ -1667,7 +1667,7 @@ again: NULL); if (nmtst_get_rand_bool()) { /* this has no effect, because a negative priority (of same absolute value) - * has lower priority than the positive priority above. */ + * has lower priority than the positive priority above. */ nmp_rules_manager_track(rules_manager, NMP_OBJECT_CAST_ROUTING_RULE(objs_sync->pdata[i]), -1, @@ -1748,7 +1748,7 @@ again: } if (r == 0) { /* OK, the rule is shadowed by another rule, and kernel does not allow - * us to add this one (rh#1686075). Drop this from the test. */ + * us to add this one (rh#1686075). Drop this from the test. */ g_ptr_array_remove_index(objs, i); had_an_issue_exist = TRUE; continue; @@ -1820,11 +1820,11 @@ again: guint k; /* When deleting a rule, kernel does a fuzzy match, ignoring for example: - * - action, if it is FR_ACT_UNSPEC - * - iifname,oifname if it is unspecified - * rh#1685816 - * - * That means, we may have deleted the wrong rule. Which one? */ + * - action, if it is FR_ACT_UNSPEC + * - iifname,oifname if it is unspecified + * rh#1685816 + * + * That means, we may have deleted the wrong rule. Which one? */ k = i; for (j = i + 1; j < objs->len; j++) { if (!_platform_has_routing_rule(platform, objs->pdata[j])) { @@ -1877,7 +1877,7 @@ again: objs_initial->len); /* the tests passed as good as we could (as good as we implemented workarounds for them). - * Still, with this kernel, not all features were fully tested. Mark the test as skipped. */ + * Still, with this kernel, not all features were fully tested. Mark the test as skipped. */ if (had_an_issue_exist) g_test_skip("adding a rule failed with EEXIST although it should not (rh#1686075)"); else if (!_rule_check_kernel_support(platform, -1)) diff --git a/src/platform/wifi/nm-wifi-utils-nl80211.c b/src/platform/wifi/nm-wifi-utils-nl80211.c index d2c409057b..468b4d1706 100644 --- a/src/platform/wifi/nm-wifi-utils-nl80211.c +++ b/src/platform/wifi/nm-wifi-utils-nl80211.c @@ -129,16 +129,16 @@ nl80211_send_and_recv(NMWifiUtilsNl80211 *self, return err; /* Loop until one of our NL callbacks says we're done; on success - * done will be 1, on error it will be < 0. - */ + * done will be 1, on error it will be < 0. + */ while (!done) { err = nl_recvmsgs(self->nl_sock, &cb); if (err < 0 && err != -EAGAIN) { /* Kernel scan list can change while we are dumping it, as new scan - * results from H/W can arrive. BSS info is assured to be consistent - * and we don't need consistent view of whole scan list. Hence do - * not warn on DUMP_INTR error for get scan command. - */ + * results from H/W can arrive. BSS info is assured to be consistent + * and we don't need consistent view of whole scan list. Hence do + * not warn on DUMP_INTR error for get scan command. + */ if (err == -NME_NL_DUMP_INTR && genlmsg_hdr(nlmsg_hdr(msg))->cmd == NL80211_CMD_GET_SCAN) break; @@ -652,8 +652,8 @@ wifi_nl80211_indicate_addressing_running(NMWifiUtils *data, gboolean running) : 99 /* NL80211_CMD_CRIT_PROTOCOL_STOP */, 0); /* Despite the DHCP name, we're using this for any type of IP addressing, - * DHCPv4, DHCPv6, and IPv6 SLAAC. - */ + * DHCPv4, DHCPv6, and IPv6 SLAAC. + */ NLA_PUT_U16(msg, 179 /* NL80211_ATTR_CRIT_PROT_ID */, 1 /* NL80211_CRIT_PROTO_DHCP */); if (running) { /* Give DHCP 5 seconds to complete */ @@ -756,11 +756,11 @@ nl80211_wiphy_info_handler(struct nl_msg *msg, void *arg) case NL80211_CMD_CONNECT: case NL80211_CMD_AUTHENTICATE: /* Only devices that support CONNECT or AUTH actually support - * 802.11, unlike say ipw2x00 (up to at least kernel 3.4) which - * has minimal info support, but no actual command support. - * This check mirrors what wpa_supplicant does to determine - * whether or not to use the nl80211 driver. - */ + * 802.11, unlike say ipw2x00 (up to at least kernel 3.4) which + * has minimal info support, but no actual command support. + * This check mirrors what wpa_supplicant does to determine + * whether or not to use the nl80211 driver. + */ info->supported = TRUE; break; default: diff --git a/src/platform/wifi/nm-wifi-utils-private.h b/src/platform/wifi/nm-wifi-utils-private.h index bc5b265557..891ad41fa8 100644 --- a/src/platform/wifi/nm-wifi-utils-private.h +++ b/src/platform/wifi/nm-wifi-utils-private.h @@ -37,8 +37,8 @@ typedef struct { gboolean (*get_bssid)(NMWifiUtils *data, guint8 *out_bssid); /* Return a signal strength percentage 0 - 100% for the current BSSID; - * return -1 on errors or if not associated. - */ + * return -1 on errors or if not associated. + */ int (*get_qual)(NMWifiUtils *data); /* OLPC Mesh-only functions */ diff --git a/src/platform/wifi/nm-wifi-utils-wext.c b/src/platform/wifi/nm-wifi-utils-wext.c index cf30e52228..98a03b4d78 100644 --- a/src/platform/wifi/nm-wifi-utils-wext.c +++ b/src/platform/wifi/nm-wifi-utils-wext.c @@ -76,8 +76,8 @@ iw_freq_to_uint32(const struct iw_freq *freq) { if (freq->e == 0) { /* Some drivers report channel not frequency. Convert to a - * frequency; but this assumes that the device is in b/g mode. - */ + * frequency; but this assumes that the device is in b/g mode. + */ if ((freq->m >= 1) && (freq->m <= 13)) return 2407 + (5 * freq->m); else if (freq->m == 14) @@ -341,24 +341,24 @@ wext_qual_to_percent(const struct iw_quality *qual, const struct iw_quality *max max_qual->updated); /* Try using the card's idea of the signal quality first as long as it tells us what the max quality is. - * Drivers that fill in quality values MUST treat them as percentages, ie the "Link Quality" MUST be - * bounded by 0 and max_qual->qual, and MUST change in a linear fashion. Within those bounds, drivers - * are free to use whatever they want to calculate "Link Quality". - */ + * Drivers that fill in quality values MUST treat them as percentages, ie the "Link Quality" MUST be + * bounded by 0 and max_qual->qual, and MUST change in a linear fashion. Within those bounds, drivers + * are free to use whatever they want to calculate "Link Quality". + */ if ((max_qual->qual != 0) && !(max_qual->updated & IW_QUAL_QUAL_INVALID) && !(qual->updated & IW_QUAL_QUAL_INVALID)) percent = (int) (100 * ((double) qual->qual / (double) max_qual->qual)); /* If the driver doesn't specify a complete and valid quality, we have two options: - * - * 1) dBm: driver must specify max_qual->level = 0, and have valid values for - * qual->level and (qual->noise OR max_qual->noise) - * 2) raw RSSI: driver must specify max_qual->level > 0, and have valid values for - * qual->level and max_qual->level - * - * This is the WEXT spec. If this interpretation is wrong, I'll fix it. Otherwise, - * If drivers don't conform to it, they are wrong and need to be fixed. - */ + * + * 1) dBm: driver must specify max_qual->level = 0, and have valid values for + * qual->level and (qual->noise OR max_qual->noise) + * 2) raw RSSI: driver must specify max_qual->level > 0, and have valid values for + * qual->level and max_qual->level + * + * This is the WEXT spec. If this interpretation is wrong, I'll fix it. Otherwise, + * If drivers don't conform to it, they are wrong and need to be fixed. + */ if ((max_qual->level == 0) && !(max_qual->updated & IW_QUAL_LEVEL_INVALID) /* Valid max_qual->level == 0 */ @@ -572,9 +572,9 @@ wext_get_range_ifname(NMWifiUtilsWext *wext, wrq.u.data.length = sizeof(struct iw_range); /* Need to give some drivers time to recover after suspend/resume - * (ex ipw3945 takes a few seconds to talk to its regulatory daemon; - * see rh bz#362421) - */ + * (ex ipw3945 takes a few seconds to talk to its regulatory daemon; + * see rh bz#362421) + */ while (i-- > 0) { if (ioctl(wext->fd, SIOCGIWRANGE, &wrq) == 0) { if (response_len) @@ -650,9 +650,9 @@ wext_get_caps(NMWifiUtilsWext *wext, const char *ifname, struct iw_range *range) } /* There's no way to detect Ad-Hoc/AP mode support with WEXT - * (other than actually trying to do it), so just assume that - * Ad-Hoc is supported and AP isn't. - */ + * (other than actually trying to do it), so just assume that + * Ad-Hoc is supported and AP isn't. + */ caps |= NM_WIFI_DEVICE_CAP_ADHOC; return caps; @@ -744,9 +744,9 @@ nm_wifi_utils_wext_new(int ifindex, gboolean check_scan) } /* Check for the ability to scan specific SSIDs. Until the scan_capa - * field gets added to wireless-tools, need to work around that by casting - * to the custom structure. - */ + * field gets added to wireless-tools, need to work around that by casting + * to the custom structure. + */ scan_capa_range = (struct iw_range_with_scan_capa *) ⦥ if (scan_capa_range->scan_capa & NM_IW_SCAN_CAPA_ESSID) { _LOGI(LOGD_PLATFORM | LOGD_WIFI, @@ -785,14 +785,14 @@ nm_wifi_utils_wext_is_wifi(const char *iface) gboolean is_wifi = FALSE; /* performing an ioctl on a non-existing name may cause the automatic - * loading of kernel modules, which should be avoided. - * - * Usually, we should thus make sure that an interface with this name - * exists. - * - * Note that wifi_wext_is_wifi() has only one caller which just verified - * that an interface with this name exists. - */ + * loading of kernel modules, which should be avoided. + * + * Usually, we should thus make sure that an interface with this name + * exists. + * + * Note that wifi_wext_is_wifi() has only one caller which just verified + * that an interface with this name exists. + */ fd = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); if (fd >= 0) { diff --git a/src/platform/wpan/nm-wpan-utils.c b/src/platform/wpan/nm-wpan-utils.c index 4e767cfde2..86c6df7b5f 100644 --- a/src/platform/wpan/nm-wpan-utils.c +++ b/src/platform/wpan/nm-wpan-utils.c @@ -118,8 +118,8 @@ nl802154_send_and_recv(NMWpanUtils * self, return err; /* Loop until one of our NL callbacks says we're done; on success - * done will be 1, on error it will be < 0. - */ + * done will be 1, on error it will be < 0. + */ while (!done) { err = nl_recvmsgs(self->nl_sock, &cb); if (err < 0 && err != -EAGAIN) { diff --git a/src/ppp/nm-ppp-manager-call.c b/src/ppp/nm-ppp-manager-call.c index 5d0cdba686..feff6830bf 100644 --- a/src/ppp/nm-ppp-manager-call.c +++ b/src/ppp/nm-ppp-manager-call.c @@ -68,7 +68,7 @@ nm_ppp_manager_create(const char *iface, GError **error) } /* after loading glib types from the plugin, we cannot unload the library anymore. - * Make it resident. */ + * Make it resident. */ g_module_make_resident(plugin); nm_assert(ops); diff --git a/src/ppp/nm-ppp-manager.c b/src/ppp/nm-ppp-manager.c index 472989a326..324f3b3e1c 100644 --- a/src/ppp/nm-ppp-manager.c +++ b/src/ppp/nm-ppp-manager.c @@ -328,11 +328,11 @@ ppp_secrets_cb(NMActRequest * req, } /* This is sort of a hack but... - * pppd plugin only ever needs username and password. Passing the full - * connection there would mean some bloat: the plugin would need to link - * against libnm just to parse this. So instead, let's just send what - * it needs. - */ + * pppd plugin only ever needs username and password. Passing the full + * connection there would mean some bloat: the plugin would need to link + * against libnm just to parse this. So instead, let's just send what + * it needs. + */ g_dbus_method_invocation_return_value(priv->pending_secrets_context, g_variant_new("(ss)", username ?: "", password ?: "")); @@ -384,9 +384,9 @@ impl_ppp_manager_need_secrets(NMDBusObject * obj, } /* Only ask for completely new secrets after retrying them once; some devices - * appear to ask a few times when they actually don't even care what you - * pass back. - */ + * appear to ask a few times when they actually don't even care what you + * pass back. + */ tries = GPOINTER_TO_UINT( g_object_get_qdata(G_OBJECT(applied_connection), ppp_manager_secret_tries_quark())); if (tries > 1) @@ -599,9 +599,9 @@ iid_value_to_ll6_addr(GVariant * dict, g_return_val_if_fail(iid != 0, FALSE); /* Construct an IPv6 LL address from the interface identifier. See - * http://tools.ietf.org/html/rfc4291#section-2.5.1 (IPv6) and - * http://tools.ietf.org/html/rfc5072#section-4.1 (IPv6 over PPP). - */ + * http://tools.ietf.org/html/rfc4291#section-2.5.1 (IPv6) and + * http://tools.ietf.org/html/rfc5072#section-4.1 (IPv6 over PPP). + */ memset(out_addr->s6_addr, 0, sizeof(out_addr->s6_addr)); out_addr->s6_addr16[0] = htons(0xfe80); memcpy(out_addr->s6_addr + 8, &iid, sizeof(iid)); @@ -857,9 +857,9 @@ create_pppd_cmd_line(NMPPPManager * self, nm_strv_ptrarray_add_int(cmd, baud_override); /* noauth by default, because we certainly don't have any information - * with which to verify anything the peer gives us if we ask it to - * authenticate itself, which is what 'auth' really means. - */ + * with which to verify anything the peer gives us if we ask it to + * authenticate itself, which is what 'auth' really means. + */ nm_strv_ptrarray_add_string_dup(cmd, "noauth"); if (nm_setting_ppp_get_refuse_eap(setting)) @@ -888,8 +888,8 @@ create_pppd_cmd_line(NMPPPManager * self, nm_strv_ptrarray_add_string_dup(cmd, "crtscts"); /* Always ask for DNS, we don't have to use them if the connection - * overrides the returned servers. - */ + * overrides the returned servers. + */ nm_strv_ptrarray_add_string_dup(cmd, "usepeerdns"); if (nm_setting_ppp_get_mru(setting)) { @@ -922,8 +922,8 @@ create_pppd_cmd_line(NMPPPManager * self, static int unit; /* The PPP interface is going to be renamed, so pass a - * different unit each time so that activations don't - * race with each others. */ + * different unit each time so that activations don't + * race with each others. */ nm_strv_ptrarray_add_string_dup(cmd, "unit"); nm_strv_ptrarray_add_int(cmd, unit); unit = unit < G_MAXINT ? unit + 1 : 0; @@ -1006,8 +1006,8 @@ _ppp_manager_start(NMPPPManager *self, s_ppp = nm_connection_get_setting_ppp(connection); if (!s_ppp) { /* If the PPP settings are all default we may not have a PPP setting yet, - * so just make a default one here. - */ + * so just make a default one here. + */ s_ppp = s_ppp_free = NM_SETTING_PPP(nm_setting_ppp_new()); } @@ -1100,7 +1100,7 @@ struct _NMPPPManagerStopHandle { gpointer user_data; /* this object delays shutdown, because we still need to wait until - * pppd process terminated. */ + * pppd process terminated. */ GObject *shutdown_waitobj; GCancellable *cancellable; @@ -1185,9 +1185,9 @@ _ppp_manager_stop(NMPPPManager * self, if (!priv->pid && !callback) { /* nothing to do further... - * - * In this case, we return a %NULL handle. The caller cannot cancel this - * event, but clearly he is not waiting for a callback anyway. */ + * + * In this case, we return a %NULL handle. The caller cannot cancel this + * event, but clearly he is not waiting for a callback anyway. */ return NULL; } @@ -1203,19 +1203,19 @@ _ppp_manager_stop(NMPPPManager * self, if (!priv->pid) { /* No PID. There is nothing to kill, however, invoke the callback in - * an idle handler. - * - * Note that we don't register nm_shutdown_wait_obj_register_object(). - * In order for shutdown to work properly, the caller must always - * explicitly cancel the action to go down. With the idle-handler, - * cancelling the handle completes the request. */ + * an idle handler. + * + * Note that we don't register nm_shutdown_wait_obj_register_object(). + * In order for shutdown to work properly, the caller must always + * explicitly cancel the action to go down. With the idle-handler, + * cancelling the handle completes the request. */ handle->idle_id = g_idle_add(_stop_idle_cb, handle); return handle; } /* we really want to kill the process and delay shutdown of NetworkManager - * until the process terminated. We do that, by registering an object - * that delays shutdown. */ + * until the process terminated. We do that, by registering an object + * that delays shutdown. */ handle->shutdown_waitobj = g_object_new(G_TYPE_OBJECT, NULL); nm_shutdown_wait_obj_register_object(handle->shutdown_waitobj, "ppp-manager-wait-kill-pppd"); nm_utils_kill_child_async(nm_steal_int(&priv->pid), @@ -1244,8 +1244,8 @@ _ppp_manager_stop_cancel(NMPPPManagerStopHandle *handle) } /* a real handle. Only invoke the callback (synchronously). This marks - * the handle as handled, but it keeps shutdown_waitobj around, until - * nm_utils_kill_child_async() returns. */ + * the handle as handled, but it keeps shutdown_waitobj around, until + * nm_utils_kill_child_async() returns. */ _stop_handle_complete(handle, TRUE); } @@ -1313,7 +1313,7 @@ dispose(GObject *object) NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE(self); /* we expect the user to first stop the manager. As fallback, - * still stop. */ + * still stop. */ g_warn_if_fail(!priv->pid); g_warn_if_fail(!nm_dbus_object_is_exported(NM_DBUS_OBJECT(self))); _ppp_manager_stop(self, NULL, NULL, NULL); diff --git a/src/ppp/nm-pppd-plugin.c b/src/ppp/nm-pppd-plugin.c index 37dc971bdb..bed68e6b66 100644 --- a/src/ppp/nm-pppd-plugin.c +++ b/src/ppp/nm-pppd-plugin.c @@ -128,8 +128,8 @@ nm_phasechange(int arg) ifindex = if_nametoindex(ifname); /* Make a sync call to ensure that when the call - * terminates the interface already has its final - * name. */ + * terminates the interface already has its final + * name. */ ret = g_dbus_connection_call_sync(gl.dbus_connection, NM_DBUS_SERVICE, gl.ipparam, @@ -181,8 +181,8 @@ nm_ip_up(void *data, int arg) g_variant_builder_init(&builder, G_VARIANT_TYPE_VARDICT); /* Keep sending the interface name to be backwards compatible - * with older versions of NM during a package upgrade, where - * NM is not restarted and the pppd plugin was not loaded. */ + * with older versions of NM during a package upgrade, where + * NM is not restarted and the pppd plugin was not loaded. */ g_variant_builder_add(&builder, "{sv}", NM_PPP_IP4_CONFIG_INTERFACE, @@ -194,9 +194,9 @@ nm_ip_up(void *data, int arg) g_variant_new_uint32(opts.ouraddr)); /* Prefer the peer options remote address first, _unless_ pppd made the - * address up, at which point prefer the local options remote address, - * and if that's not right, use the made-up address as a last resort. - */ + * address up, at which point prefer the local options remote address, + * and if that's not right, use the made-up address as a last resort. + */ if (peer_opts.hisaddr && (peer_opts.hisaddr != pppd_made_up_address)) { g_variant_builder_add(&builder, "{sv}", @@ -289,8 +289,8 @@ nm_ip6_up(void *data, int arg) g_variant_builder_init(&builder, G_VARIANT_TYPE_VARDICT); /* Keep sending the interface name to be backwards compatible - * with older versions of NM during a package upgrade, where - * NM is not restarted and the pppd plugin was not loaded. */ + * with older versions of NM during a package upgrade, where + * NM is not restarted and the pppd plugin was not loaded. */ g_variant_builder_add(&builder, "{sv}", NM_PPP_IP6_CONFIG_INTERFACE, @@ -382,8 +382,8 @@ nm_exit_notify(void *data, int arg) g_return_if_fail(G_IS_DBUS_CONNECTION(gl.dbus_connection)); /* We wait until this point to notify dead phase to make sure that - * the serial port has recovered already its original settings. - */ + * the serial port has recovered already its original settings. + */ nm_phasechange(PHASE_DEAD); g_message("nm-ppp-plugin: cleaning up"); diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c index df7c810a78..3814d64f42 100644 --- a/src/settings/nm-agent-manager.c +++ b/src/settings/nm-agent-manager.c @@ -202,8 +202,8 @@ struct _NMAgentManagerCallId { NMAuthChain *chain; /* Whether the agent currently being asked for secrets - * has the system.modify privilege. - */ + * has the system.modify privilege. + */ gboolean current_has_modify; union { @@ -411,8 +411,8 @@ _agent_create_auth_chain(NMAgentManager *self, NMSecretAgent *agent, GDBusMethod if (agent->auth_chain && !context && !agent->fully_registered) { /* we restart the authorization check (without a @context), but the currently - * pending auth-chain carries a context. We need to pass it on as we replace - * the auth-chain. */ + * pending auth-chain carries a context. We need to pass it on as we replace + * the auth-chain. */ context = nm_auth_chain_get_context(agent->auth_chain); nm_assert(context); } @@ -588,8 +588,8 @@ request_free(Request *req) g_source_remove(req->idle_id); /* cancel-secrets invokes the done-callback synchronously -- in which case - * the handler just return. - * Hence, we can proceed to free @req... */ + * the handler just return. + * Hence, we can proceed to free @req... */ nm_secret_agent_cancel_call(req->current, req->current_call_id); g_object_unref(req->subject); @@ -735,8 +735,8 @@ request_add_agent(Request *req, NMSecretAgent *agent) NMAuthSubject *subject = nm_secret_agent_get_subject(agent); /* Ensure the caller's username exists in the connection's permissions, - * or that the permissions is empty (ie, visible by everyone). - */ + * or that the permissions is empty (ie, visible by everyone). + */ if (!nm_auth_is_subject_in_acl(req->con.connection, subject, NULL)) { _LOGD(agent, "agent ignored for secrets request " LOG_REQ_FMT " (not in ACL)", @@ -978,9 +978,9 @@ set_secrets_not_required(NMConnection *connection, GVariant *dict) g_variant_iter_init(&setting_iter, setting_dict); while (g_variant_iter_next(&setting_iter, "{&sv}", &key_name, &val)) { /* For each secret, set the flag that it's not required; VPN - * secrets need slightly different treatment here since the - * "secrets" property is actually a dictionary of secrets. - */ + * secrets need slightly different treatment here since the + * "secrets" property is actually a dictionary of secrets. + */ if (strcmp(setting_name, NM_SETTING_VPN_SETTING_NAME) == 0 && strcmp(key_name, NM_SETTING_VPN_SECRETS) == 0 && g_variant_is_of_type(val, G_VARIANT_TYPE("a{ss}"))) { @@ -1022,9 +1022,9 @@ _con_get_request_start_proceed(Request *req, gboolean include_system_secrets) NULL); } else { /* Update secret flags in the temporary connection to indicate that - * the system secrets we're not sending to the agent aren't required, - * so the agent can properly validate UI controls and such. - */ + * the system secrets we're not sending to the agent aren't required, + * so the agent can properly validate UI controls and such. + */ if (req->con.get.existing_secrets) set_secrets_not_required(tmp, req->con.get.existing_secrets); } @@ -1061,9 +1061,9 @@ _con_get_request_start_validated(NMAuthChain * chain, req->con.chain = NULL; /* If the agent obtained the 'modify' permission, we send all system secrets - * to it. If it didn't, we still ask it for secrets, but we don't send - * any system secrets. - */ + * to it. If it didn't, we still ask it for secrets, but we don't send + * any system secrets. + */ perm = nm_auth_chain_get_data(chain, "perm"); g_assert(perm); if (nm_auth_chain_get_result(chain, perm) == NM_AUTH_CALL_RESULT_YES) @@ -1091,11 +1091,11 @@ _con_get_request_start(Request *req) agent_dbus_owner = nm_secret_agent_get_dbus_owner(req->current); /* If the request flags allow user interaction, and there are existing - * system secrets (or blank secrets that are supposed to be system-owned), - * check whether the agent has the 'modify' permission before sending those - * secrets to the agent. We shouldn't leak system-owned secrets to - * unprivileged users. - */ + * system secrets (or blank secrets that are supposed to be system-owned), + * check whether the agent has the 'modify' permission before sending those + * secrets to the agent. We shouldn't leak system-owned secrets to + * unprivileged users. + */ if ((req->con.get.flags != NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE) && (req->con.get.existing_secrets || _nm_connection_aggregate(req->con.connection, @@ -1113,9 +1113,9 @@ _con_get_request_start(Request *req) nm_assert(req->con.chain); /* If the caller is the only user in the connection's permissions, then - * we use the 'modify.own' permission instead of 'modify.system'. If the - * request affects more than just the caller, require 'modify.system'. - */ + * we use the 'modify.own' permission instead of 'modify.system'. If the + * request affects more than just the caller, require 'modify.system'. + */ s_con = nm_connection_get_setting_connection(req->con.connection); g_assert(s_con); if (nm_setting_connection_get_num_permissions(s_con) == 1) @@ -1155,10 +1155,10 @@ _con_get_try_complete_early(Request *req) return FALSE; /* The connection already had secrets; check if any more are required. - * If no more are required, we're done. If secrets are still needed, - * ask a secret agent for more. This allows admins to provide generic - * secrets but allow additional user-specific ones as well. - */ + * If no more are required, we're done. If secrets are still needed, + * ask a secret agent for more. This allows admins to provide generic + * secrets but allow additional user-specific ones as well. + */ tmp = nm_simple_connection_new_clone(req->con.connection); g_assert(tmp); @@ -1188,15 +1188,15 @@ _con_get_try_complete_early(Request *req) /* We don't, so ask some agents for additional secrets */ if (req->con.get.flags & NM_SECRET_AGENT_GET_SECRETS_FLAG_NO_ERRORS && !req->pending) { /* The request initiated from GetSecrets() via DBus, - * don't error out if any secrets are missing. */ + * don't error out if any secrets are missing. */ req_complete(req, req->con.get.existing_secrets, NULL, NULL, NULL); return TRUE; } /* Couldn't get secrets from system settings, so now we ask the - * agents for secrets. Let the Agent Manager handle which agents - * we'll ask and in which order. - */ + * agents for secrets. Let the Agent Manager handle which agents + * we'll ask and in which order. + */ return FALSE; } @@ -1248,10 +1248,10 @@ nm_agent_manager_get_secrets(NMAgentManager * self, setting_name); /* NOTE: a few things in the Request handling depend on existing_secrets - * being NULL if there aren't any system-owned secrets for this connection. - * This in turn depends on nm_connection_to_dbus() and nm_setting_to_hash() - * both returning NULL if they didn't hash anything. - */ + * being NULL if there aren't any system-owned secrets for this connection. + * This in turn depends on nm_connection_to_dbus() and nm_setting_to_hash() + * both returning NULL if they didn't hash anything. + */ req = request_new(self, REQUEST_TYPE_CON_GET, nm_connection_get_id(connection), subject); req->con.path = g_strdup(path); diff --git a/src/settings/nm-secret-agent.c b/src/settings/nm-secret-agent.c index 8852aa2201..d6f040f980 100644 --- a/src/settings/nm-secret-agent.c +++ b/src/settings/nm-secret-agent.c @@ -157,7 +157,7 @@ _call_id_new(NMSecretAgent * self, if (!priv->shutdown_wait_obj_registered) { /* self has async requests (that keep self alive). As long as - * we have pending requests, shutdown is blocked. */ + * we have pending requests, shutdown is blocked. */ priv->shutdown_wait_obj_registered = TRUE; nm_shutdown_wait_obj_register_object(G_OBJECT(self), "secret-agent"); } @@ -488,11 +488,11 @@ nm_secret_agent_cancel_call(NMSecretAgent *self, NMSecretAgentCallId *call_id) g_return_if_fail(!c_list_is_empty(&call_id->lst)); /* Theoretically, call-id already has a self pointer. But nm_secret_agent_cancel_call() has only - * one user: NMAgentManager. And that one has the self-pointer at hand, so the only purpose of - * the @self argument is to assert that we are cancelling the expected call. - * - * We could drop the @self argument, but that just remove an additional assert-check from - * our code, without making a simplification for the only caller of this function. */ + * one user: NMAgentManager. And that one has the self-pointer at hand, so the only purpose of + * the @self argument is to assert that we are cancelling the expected call. + * + * We could drop the @self argument, but that just remove an additional assert-check from + * our code, without making a simplification for the only caller of this function. */ g_return_if_fail(self == call_id->self); priv = NM_SECRET_AGENT_GET_PRIVATE(self); @@ -516,7 +516,7 @@ nm_secret_agent_cancel_call(NMSecretAgent *self, NMSecretAgentCallId *call_id) _call_cancel_cb, call_id); /* we keep call-id alive, but it will be unlinked from priv->requests. - * _call_cancel_cb() will finally free it later. */ + * _call_cancel_cb() will finally free it later. */ free_call_id = FALSE; } diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c index d55f58f96d..6e93f177ca 100644 --- a/src/settings/nm-settings-connection.c +++ b/src/settings/nm-settings-connection.c @@ -86,18 +86,18 @@ typedef struct _NMSettingsConnectionPrivate { NMDevice *default_wired_device; /* Caches secrets from on-disk connections; were they not cached any - * call to nm_connection_clear_secrets() wipes them out and we'd have - * to re-read them from disk which defeats the purpose of having the - * connection in-memory at all. - */ + * call to nm_connection_clear_secrets() wipes them out and we'd have + * to re-read them from disk which defeats the purpose of having the + * connection in-memory at all. + */ GVariant *system_secrets; /* Caches secrets from agents during the activation process; if new system - * secrets are returned from an agent, they get written out to disk, - * triggering a re-read of the connection, which reads only system - * secrets, and would wipe out any agent-owned or not-saved secrets the - * agent also returned. - */ + * secrets are returned from an agent, they get written out to disk, + * triggering a re-read of the connection, which reads only system + * secrets, and would wipe out any agent-owned or not-saved secrets the + * agent also returned. + */ GVariant *agent_secrets; GHashTable *seen_bssids; /* Up-to-date BSSIDs that's been seen for the connection */ @@ -288,13 +288,13 @@ _nm_settings_connection_set_connection(NMSettingsConnection * self, nmtst_connection_assert_unchanging(priv->connection); /* note that we only return @connection_old if the new connection actually differs from - * before. - * - * So, there are three cases: - * - * - return %NULL when setting the connection the first time. - * - return %NULL if setting a profile with the same content that we already have. - * - return the previous pointer if the connection changed. */ + * before. + * + * So, there are three cases: + * + * - return %NULL when setting the connection the first time. + * - return %NULL if setting a profile with the same content that we already have. + * - return the previous pointer if the connection changed. */ NM_SET_OUT(out_connection_old, g_steal_pointer(&connection_old)); } @@ -408,12 +408,12 @@ nm_settings_connection_check_permission(NMSettingsConnection *self, const char * for (i = 0; i < num; i++) { /* For each user get their secret agent and check if that agent has the - * required permission. - * - * FIXME: what if the user isn't running an agent? PolKit needs a bus - * name or a PID but if the user isn't running an agent they won't have - * either. - */ + * required permission. + * + * FIXME: what if the user isn't running an agent? PolKit needs a bus + * name or a PID but if the user isn't running an agent they won't have + * either. + */ if (nm_setting_connection_get_permission(s_con, i, NULL, &puser, NULL)) { if (nm_agent_manager_has_agent_with_permission(priv->agent_mgr, puser, permission)) return TRUE; @@ -438,7 +438,7 @@ update_system_secrets_cache(NMSettingsConnection *self, NMConnection *new) goto out; /* FIXME: improve NMConnection API so we can avoid the overhead of cloning the connection, - * in particular if there are no secrets to begin with. */ + * in particular if there are no secrets to begin with. */ connection_cloned = nm_simple_connection_new_clone(new); @@ -470,7 +470,7 @@ update_agent_secrets_cache(NMSettingsConnection *self, NMConnection *new) goto out; /* FIXME: improve NMConnection API so we can avoid the overhead of cloning the connection, - * in particular if there are no secrets to begin with. */ + * in particular if there are no secrets to begin with. */ connection_cloned = nm_simple_connection_new_clone(new); @@ -556,15 +556,15 @@ _secrets_update(NMConnection * connection, secrets_setting = g_variant_lookup_value(secrets, setting_name, NM_VARIANT_TYPE_SETTING); if (!secrets_setting) { /* The connection dictionary didn't contain any secrets for - * @setting_name; just return success. - */ + * @setting_name; just return success. + */ return TRUE; } secrets = secrets_setting; } /* if @out_new_connection is provided, we don't modify @connection but clone - * and return it. Otherwise, we update @connection inplace. */ + * and return it. Otherwise, we update @connection inplace. */ if (out_new_connection) { nm_assert(!*out_new_connection); connection = nm_simple_connection_new_clone(connection); @@ -733,18 +733,18 @@ get_cmp_flags(NMSettingsConnection * self, /* only needed for logging * } /* If the agent returned any system-owned secrets (initial connect and no - * secrets given when the connection was created, or something like that) - * make sure the agent's UID has the 'modify' permission before we use or - * save those system-owned secrets. If not, discard them and use the - * existing secrets, or fail the connection. - */ + * secrets given when the connection was created, or something like that) + * make sure the agent's UID has the 'modify' permission before we use or + * save those system-owned secrets. If not, discard them and use the + * existing secrets, or fail the connection. + */ *agent_had_system = _nm_connection_find_secret(connection, secrets, secret_is_system_owned, NULL); if (*agent_had_system) { if (flags == NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE) { /* No user interaction was allowed when requesting secrets; the - * agent is being bad. Remove system-owned secrets. - */ + * agent is being bad. Remove system-owned secrets. + */ if (is_self) { _LOGD("(%s:%p) interaction forbidden but agent %s returned system secrets", setting_name, @@ -755,8 +755,8 @@ get_cmp_flags(NMSettingsConnection * self, /* only needed for logging * cmp_flags->required |= NM_SETTING_SECRET_FLAG_AGENT_OWNED; } else if (agent_has_modify == FALSE) { /* Agent didn't successfully authenticate; clear system-owned secrets - * from the secrets the agent returned. - */ + * from the secrets the agent returned. + */ if (is_self) { _LOGD("(%s:%p) agent failed to authenticate but provided system secrets", setting_name, @@ -773,8 +773,8 @@ get_cmp_flags(NMSettingsConnection * self, /* only needed for logging * } /* If no user interaction was allowed, make sure that no "unsaved" secrets - * came back. Unsaved secrets by definition require user interaction. - */ + * came back. Unsaved secrets by definition require user interaction. + */ if (flags == NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE) { cmp_flags->forbidden |= (NM_SETTING_SECRET_FLAG_NOT_SAVED | NM_SETTING_SECRET_FLAG_NOT_REQUIRED); @@ -923,10 +923,10 @@ get_secrets_done_cb(NMAgentManager * manager, } /* Update the connection with the agent's secrets; by this point if any - * system-owned secrets exist in 'secrets' the agent that provided them - * will have been authenticated, so those secrets can replace the existing - * system secrets. - */ + * system-owned secrets exist in 'secrets' the agent that provided them + * will have been authenticated, so those secrets can replace the existing + * system secrets. + */ filtered_secrets = validate_secret_flags(new_connection, secrets, &cmp_flags); if (!_secrets_update(new_connection, setting_name, filtered_secrets, NULL, &local)) { @@ -937,10 +937,10 @@ get_secrets_done_cb(NMAgentManager * manager, } /* Only save secrets to backing storage if the agent returned any - * new system secrets. If it didn't, then the secrets are agent- - * owned and there's no point to writing out the connection when - * nothing has changed, since agent-owned secrets don't get saved here. - */ + * new system secrets. If it didn't, then the secrets are agent- + * owned and there's no point to writing out the connection when + * nothing has changed, since agent-owned secrets don't get saved here. + */ if (agent_had_system) { _LOGD("(%s:%p) saving new secrets to backing storage", setting_name, call_id); } else { @@ -1097,15 +1097,15 @@ nm_settings_connection_get_secrets(NMSettingsConnection * self, } /* we remember the current version-id of the secret-agents. The version-id is strictly increasing, - * as new agents register the number. We know hence, that this request was made against a certain - * set of secret-agents. - * If after making this request a new secret-agent registers, the version-id increases. - * Then we know that the this request probably did not yet include the latest secret-agent. */ + * as new agents register the number. We know hence, that this request was made against a certain + * set of secret-agents. + * If after making this request a new secret-agent registers, the version-id increases. + * Then we know that the this request probably did not yet include the latest secret-agent. */ priv->last_secret_agent_version_id = nm_agent_manager_get_agent_version_id(priv->agent_mgr); /* Use priv->system_secrets to work around the fact that nm_connection_clear_secrets() - * will clear secrets on this object's settings. - */ + * will clear secrets on this object's settings. + */ call_id_a = nm_agent_manager_get_secrets(priv->agent_mgr, nm_dbus_object_get_path(NM_DBUS_OBJECT(self)), nm_settings_connection_get_connection(self), @@ -1327,25 +1327,25 @@ get_settings_auth_cb(NMSettingsConnection * self, } /* Timestamp is not updated in connection's 'timestamp' property, - * because it would force updating the connection and in turn - * writing to /etc periodically, which we want to avoid. Rather real - * timestamps are kept track of in a private variable. So, substitute - * timestamp property with the real one here before returning the settings. - */ + * because it would force updating the connection and in turn + * writing to /etc periodically, which we want to avoid. Rather real + * timestamps are kept track of in a private variable. So, substitute + * timestamp property with the real one here before returning the settings. + */ options.timestamp.has = TRUE; nm_settings_connection_get_timestamp(self, &options.timestamp.val); /* Seen BSSIDs are not updated in 802-11-wireless 'seen-bssids' property - * from the same reason as timestamp. Thus we put it here to GetSettings() - * return settings too. - */ + * from the same reason as timestamp. Thus we put it here to GetSettings() + * return settings too. + */ seen_bssids = nm_settings_connection_get_seen_bssids(self); options.seen_bssids = seen_bssids; /* Secrets should *never* be returned by the GetSettings method, they - * get returned by the GetSecrets method which can be better - * protected against leakage of secrets to unprivileged callers. - */ + * get returned by the GetSecrets method which can be better + * protected against leakage of secrets to unprivileged callers. + */ settings = nm_connection_to_dbus_full(nm_settings_connection_get_connection(self), NM_CONNECTION_SERIALIZE_NO_SECRETS, &options); @@ -1449,9 +1449,9 @@ _autoconnect_retries_set(NMSettingsConnection *self, int retries, gboolean is_re priv->autoconnect_retries_blocked_until = 0; else { /* NOTE: the blocked time must be identical for all connections, otherwise - * the tracking of resetting the retry count in NMPolicy needs adjustment - * in _connection_autoconnect_retries_set() (as it would need to re-evaluate - * the next-timeout every time a connection gets blocked). */ + * the tracking of resetting the retry count in NMPolicy needs adjustment + * in _connection_autoconnect_retries_set() (as it would need to re-evaluate + * the next-timeout every time a connection gets blocked). */ priv->autoconnect_retries_blocked_until = nm_utils_get_monotonic_timestamp_sec() + AUTOCONNECT_RESET_RETRIES_TIMER; } @@ -1481,18 +1481,18 @@ update_auth_cb(NMSettingsConnection * self, NM_CONNECTION_AGGREGATE_ANY_SECRETS, NULL)) { /* If the new connection has no secrets, we do not want to remove all - * secrets, rather we keep all the existing ones. Do that by merging - * them in to the new connection. - */ + * secrets, rather we keep all the existing ones. Do that by merging + * them in to the new connection. + */ if (priv->agent_secrets) nm_connection_update_secrets(info->new_settings, NULL, priv->agent_secrets, NULL); if (priv->system_secrets) nm_connection_update_secrets(info->new_settings, NULL, priv->system_secrets, NULL); } else { /* Cache the new secrets from the agent, as stuff like inotify-triggered - * changes to connection's backing config files will blow them away if - * they're in the main connection. - */ + * changes to connection's backing config files will blow them away if + * they're in the main connection. + */ update_agent_secrets_cache(self, info->new_settings); /* New secrets, allow autoconnection again */ @@ -1560,9 +1560,9 @@ update_auth_cb(NMSettingsConnection * self, gs_unref_object NMConnection *for_agent = NULL; /* Dupe the connection so we can clear out non-agent-owned secrets, - * as agent-owned secrets are the only ones we send back be saved. - * Only send secrets to agents of the same UID that called update too. - */ + * as agent-owned secrets are the only ones we send back be saved. + * Only send secrets to agents of the same UID that called update too. + */ for_agent = nm_simple_connection_new_clone(nm_settings_connection_get_connection(self)); _nm_connection_clear_secrets_by_secret_flags(for_agent, NM_SETTING_SECRET_FLAG_AGENT_OWNED); nm_agent_manager_save_secrets(info->agent_mgr, @@ -1590,14 +1590,14 @@ get_update_modify_permission(NMConnection *old, NMConnection *new) new_num = nm_setting_connection_get_num_permissions(s_con); /* If the caller is the only user in either connection's permissions, then - * we use the 'modify.own' permission instead of 'modify.system'. - */ + * we use the 'modify.own' permission instead of 'modify.system'. + */ if (orig_num == 1 && new_num == 1) return NM_AUTH_PERMISSION_SETTINGS_MODIFY_OWN; /* If the update request affects more than just the caller (ie if the old - * settings were system-wide, or the new ones are), require 'modify.system'. - */ + * settings were system-wide, or the new ones are), require 'modify.system'. + */ return NM_AUTH_PERMISSION_SETTINGS_MODIFY_SYSTEM; } @@ -1643,9 +1643,9 @@ settings_connection_update(NMSettingsConnection * self, goto error; /* And that the new connection settings will be visible to the user - * that's sending the update request. You can't make a connection - * invisible to yourself. - */ + * that's sending the update request. You can't make a connection + * invisible to yourself. + */ if (!nm_auth_is_subject_in_acl_set_error(tmp ?: nm_settings_connection_get_connection(self), subject, NM_SETTINGS_ERROR, @@ -1822,9 +1822,9 @@ get_modify_permission_basic(NMSettingsConnection *self) NMSettingConnection *s_con; /* If the caller is the only user in the connection's permissions, then - * we use the 'modify.own' permission instead of 'modify.system'. If the - * request affects more than just the caller, require 'modify.system'. - */ + * we use the 'modify.own' permission instead of 'modify.system'. If the + * request affects more than just the caller, require 'modify.system'. + */ s_con = nm_connection_get_setting_connection(nm_settings_connection_get_connection(self)); if (nm_setting_connection_get_num_permissions(s_con) == 1) return NM_AUTH_PERMISSION_SETTINGS_MODIFY_OWN; @@ -1875,10 +1875,10 @@ dbus_get_agent_secrets_cb(NMSettingsConnection * self, g_dbus_method_invocation_return_gerror(context, error); else { /* Return secrets from agent and backing storage to the D-Bus caller; - * nm_settings_connection_get_secrets() will have updated itself with - * secrets from backing storage and those returned from the agent - * by the time we get here. - */ + * nm_settings_connection_get_secrets() will have updated itself with + * secrets from backing storage and those returned from the agent + * by the time we get here. + */ dict = nm_connection_to_dbus(nm_settings_connection_get_connection(self), NM_CONNECTION_SERIALIZE_ONLY_SECRETS); if (!dict) @@ -2133,7 +2133,7 @@ _cmp_last_resort(NMSettingsConnection *a, NMSettingsConnection *b) NM_CMP_DIRECT_STRCMP0(nm_settings_connection_get_uuid(a), nm_settings_connection_get_uuid(b)); /* hm, same UUID. Use their pointer value to give them a stable - * order. */ + * order. */ return (a > b) ? -1 : 1; } @@ -2309,10 +2309,10 @@ _nm_settings_connection_register_kf_dbs(NMSettingsConnection *self, nm_key_file_db_get_filename(priv->kf_db_seen_bssids)); /* If this connection didn't have an entry in the seen-bssids database, - * maybe this is the first time we've read it in, so populate the - * seen-bssids list from the deprecated seen-bssids property of the - * wifi setting. - */ + * maybe this is the first time we've read it in, so populate the + * seen-bssids list from the deprecated seen-bssids property of the + * wifi setting. + */ s_wifi = nm_connection_get_setting_wireless(nm_settings_connection_get_connection(self)); if (s_wifi) { @@ -2778,7 +2778,7 @@ nm_settings_connection_class_init(NMSettingsConnectionClass *klass) g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties); /* internal signal, with an argument (NMSettingsConnectionUpdateReason update_reason) as - * guint. */ + * guint. */ signals[UPDATED_INTERNAL] = g_signal_new(NM_SETTINGS_CONNECTION_UPDATED_INTERNAL, G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_FIRST, diff --git a/src/settings/nm-settings-connection.h b/src/settings/nm-settings-connection.h index b65a8c8ff6..c294870ff4 100644 --- a/src/settings/nm-settings-connection.h +++ b/src/settings/nm-settings-connection.h @@ -27,27 +27,27 @@ typedef enum { NM_SETTINGS_CONNECTION_UPDATE_REASON_NONE = 0, /* with persist-mode != NM_SETTINGS_CONNECTION_PERSIST_MODE_IN_MEMORY_ONLY, and - * update tries to update the profile on disk (which can always fail). - * In some cases we want to ignore such failure and proceed. For example, - * when we receive secrets from a secret-agent, we want to update the connection - * at all cost and ignore failures to write them to disk. */ + * update tries to update the profile on disk (which can always fail). + * In some cases we want to ignore such failure and proceed. For example, + * when we receive secrets from a secret-agent, we want to update the connection + * at all cost and ignore failures to write them to disk. */ NM_SETTINGS_CONNECTION_UPDATE_REASON_IGNORE_PERSIST_FAILURE = (1u << 0), /* When updating the profile, force renaming the file on disk. That matters - * only for keyfile plugin. Keyfile prefers a filename based on connection.id. - * When the connection.id changes we might want to rename the file on disk - * (that is, don't overwrite the existing file, but delete it and write it - * with the new name). - * This flag forces such rename. */ + * only for keyfile plugin. Keyfile prefers a filename based on connection.id. + * When the connection.id changes we might want to rename the file on disk + * (that is, don't overwrite the existing file, but delete it and write it + * with the new name). + * This flag forces such rename. */ NM_SETTINGS_CONNECTION_UPDATE_REASON_FORCE_RENAME = (1u << 1), /* Usually, changing a profile that is currently active does not immediately - * reapply the changes. The exception are connection.zone and connection.metered - * properties. When this flag is set, then these two properties are reapplied - * right away. - * - * See also %NM_SETTINGS_UPDATE2_FLAG_NO_REAPPLY flag, to prevent partial reapply - * during Update2(). */ + * reapply the changes. The exception are connection.zone and connection.metered + * properties. When this flag is set, then these two properties are reapplied + * right away. + * + * See also %NM_SETTINGS_UPDATE2_FLAG_NO_REAPPLY flag, to prevent partial reapply + * during Update2(). */ NM_SETTINGS_CONNECTION_UPDATE_REASON_REAPPLY_PARTIAL = (1u << 2), NM_SETTINGS_CONNECTION_UPDATE_REASON_CLEAR_SYSTEM_SECRETS = (1u << 3), @@ -57,8 +57,8 @@ typedef enum { NM_SETTINGS_CONNECTION_UPDATE_REASON_RESET_AGENT_SECRETS = (1u << 6), /* if a profile was greated as default-wired connection for a device, then - * when the user modifies it via D-Bus, the profile should become persisted - * to disk and it the purpose why the profile was created should be forgotten. */ + * when the user modifies it via D-Bus, the profile should become persisted + * to disk and it the purpose why the profile was created should be forgotten. */ NM_SETTINGS_CONNECTION_UPDATE_REASON_CLEAR_DEFAULT_WIRED = (1u << 7), NM_SETTINGS_CONNECTION_UPDATE_REASON_BLOCK_AUTOCONNECT = (1u << 8), @@ -68,49 +68,49 @@ typedef enum { typedef enum { /* if the profile is in-memory, update it in-memory and keep it. - * if the profile is on-disk, update it on-disk, and keep it. */ + * if the profile is on-disk, update it on-disk, and keep it. */ NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP, /* persist to disk. If the profile is currently in-memory, remove - * it from /run. Depending on the shadowed-storage, the pre-existing - * file is reused when moving the storage. - * - * Corresponds to %NM_SETTINGS_UPDATE2_FLAG_TO_DISK. */ + * it from /run. Depending on the shadowed-storage, the pre-existing + * file is reused when moving the storage. + * + * Corresponds to %NM_SETTINGS_UPDATE2_FLAG_TO_DISK. */ NM_SETTINGS_CONNECTION_PERSIST_MODE_TO_DISK, /* Update in-memory (i.e. persist to /run). If the profile is currently on disk, - * then a reference to the profile is remembered as "shadowed-storage". - * Later, when storing again to persistent storage, the shadowed-storage is - * updated. When deleting the profile, the shadowed-storage is also deleted - * from disk. - * - * Corresponds to %NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY. */ + * then a reference to the profile is remembered as "shadowed-storage". + * Later, when storing again to persistent storage, the shadowed-storage is + * updated. When deleting the profile, the shadowed-storage is also deleted + * from disk. + * + * Corresponds to %NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY. */ NM_SETTINGS_CONNECTION_PERSIST_MODE_IN_MEMORY, /* Update in-memory (i.e. persist to /run). This is almost like - * %NM_SETTINGS_CONNECTION_PERSIST_MODE_IN_MEMORY, except the in-memory profile - * remembers not to own the shadowed-storage ("shadowed-owned"). - * The difference is that when deleting the in-memory profile, the original - * profile is not deleted but instead the nmmeta tombstone remembers the - * shadowed-storage and re-used it when re-adding the profile. - * - * Corresponds to %NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY_DETACHED. */ + * %NM_SETTINGS_CONNECTION_PERSIST_MODE_IN_MEMORY, except the in-memory profile + * remembers not to own the shadowed-storage ("shadowed-owned"). + * The difference is that when deleting the in-memory profile, the original + * profile is not deleted but instead the nmmeta tombstone remembers the + * shadowed-storage and re-used it when re-adding the profile. + * + * Corresponds to %NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY_DETACHED. */ NM_SETTINGS_CONNECTION_PERSIST_MODE_IN_MEMORY_DETACHED, /* Update in-memory (i.e. persist to /run). If the profile is currently on disk, - * delete it from disk. - * - * If the profile is in-memory and has a shadowed-storage, the original profile - * will be deleted from disk. - * - * Corresponds to %NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY_ONLY. */ + * delete it from disk. + * + * If the profile is in-memory and has a shadowed-storage, the original profile + * will be deleted from disk. + * + * Corresponds to %NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY_ONLY. */ NM_SETTINGS_CONNECTION_PERSIST_MODE_IN_MEMORY_ONLY, /* This only updates the connection in-memory. Note that "in-memory" above - * means to write to keyfile in /run. This mode really means to not notify the - * settings plugin about the change. This should be only used for updating - * secrets. - */ + * means to write to keyfile in /run. This mode really means to not notify the + * settings plugin about the change. This should be only used for updating + * secrets. + */ NM_SETTINGS_CONNECTION_PERSIST_MODE_NO_PERSIST, } NMSettingsConnectionPersistMode; diff --git a/src/settings/nm-settings-plugin.c b/src/settings/nm-settings-plugin.c index 2692912602..e80caa7b09 100644 --- a/src/settings/nm-settings-plugin.c +++ b/src/settings/nm-settings-plugin.c @@ -45,7 +45,7 @@ nm_settings_plugin_cmp_by_priority(const NMSettingsPlugin *a, nm_assert(idx_b >= 0); /* plugins that appear first in @plugin_list have higher priority. - * That means: smaller index -> higher priority. Reverse sort. */ + * That means: smaller index -> higher priority. Reverse sort. */ NM_CMP_DIRECT(idx_b, idx_a); } diff --git a/src/settings/nm-settings-plugin.h b/src/settings/nm-settings-plugin.h index 1ac2ef743d..01f433a120 100644 --- a/src/settings/nm-settings-plugin.h +++ b/src/settings/nm-settings-plugin.h @@ -46,30 +46,30 @@ typedef struct { GObjectClass parent; /* - * Return a string list of specifications of devices which NetworkManager - * should not manage. Returned list will be freed by the system settings - * service, and each element must be allocated using g_malloc() or its - * variants (g_strdup, g_strdup_printf, etc). - * - * Each string in the list must be in one of the formats recognized by - * nm_device_spec_match_list(). - */ + * Return a string list of specifications of devices which NetworkManager + * should not manage. Returned list will be freed by the system settings + * service, and each element must be allocated using g_malloc() or its + * variants (g_strdup, g_strdup_printf, etc). + * + * Each string in the list must be in one of the formats recognized by + * nm_device_spec_match_list(). + */ GSList *(*get_unmanaged_specs)(NMSettingsPlugin *self); /* - * Return a string list of specifications of devices for which at least - * one non-NetworkManager-based configuration is defined. Returned list - * will be freed by the system settings service, and each element must be - * allocated using g_malloc() or its variants (g_strdup, g_strdup_printf, - * etc). - * - * Each string in the list must be in one of the formats recognized by - * nm_device_spec_match_list(). - */ + * Return a string list of specifications of devices for which at least + * one non-NetworkManager-based configuration is defined. Returned list + * will be freed by the system settings service, and each element must be + * allocated using g_malloc() or its variants (g_strdup, g_strdup_printf, + * etc). + * + * Each string in the list must be in one of the formats recognized by + * nm_device_spec_match_list(). + */ GSList *(*get_unrecognized_specs)(NMSettingsPlugin *self); /* Requests that the plugin load/reload a set of filenames. - */ + */ void (*load_connections)(NMSettingsPlugin * self, NMSettingsPluginConnectionLoadEntry * entries, gsize n_entries, @@ -77,8 +77,8 @@ typedef struct { gpointer user_data); /* Requests that the plugin reload all connection files from disk, - * and emit signals reflecting new, changed, and removed connections. - */ + * and emit signals reflecting new, changed, and removed connections. + */ void (*reload_connections)(NMSettingsPlugin * self, NMSettingsPluginConnectionLoadCallback callback, gpointer user_data); diff --git a/src/settings/nm-settings-storage.c b/src/settings/nm-settings-storage.c index e0304e0790..477c9933ff 100644 --- a/src/settings/nm-settings-storage.c +++ b/src/settings/nm-settings-storage.c @@ -20,9 +20,9 @@ nm_settings_storage_cmp(NMSettingsStorage *a, NMSettingsStorage *b, const GSList NMSettingsStorageClass *klass; /* Sort by priority. - * - * If a > b (by priority), we return a positive number (as one - * would expect by a cmp() function). */ + * + * If a > b (by priority), we return a positive number (as one + * would expect by a cmp() function). */ nm_assert(NM_IS_SETTINGS_STORAGE(a)); nm_assert(NM_IS_SETTINGS_STORAGE(b)); @@ -39,7 +39,7 @@ nm_settings_storage_cmp(NMSettingsStorage *a, NMSettingsStorage *b, const GSList klass = NM_SETTINGS_STORAGE_GET_CLASS(a); if (klass != NM_SETTINGS_STORAGE_GET_CLASS(b)) { /* one plugin must return storages of the same type. Otherwise, it's - * unclear how cmp_fcn() should compare them. */ + * unclear how cmp_fcn() should compare them. */ nm_assert_not_reached(); return 0; } diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c index 7c007df7f5..5c5fbf0790 100644 --- a/src/settings/nm-settings.c +++ b/src/settings/nm-settings.c @@ -156,9 +156,9 @@ static gboolean _storage_data_is_alive(StorageData *sd) { /* If the storage tracks a connection, it is considered alive. - * - * Meta-data storages are special: they never track a connection. - * We need to check them specially to know when to drop them. */ + * + * Meta-data storages are special: they never track a connection. + * We need to check them specially to know when to drop them. */ return sd->connection || nm_settings_storage_is_meta_data_alive(sd->storage); } @@ -250,28 +250,28 @@ _sett_conn_entry_storage_find_conflicting_storage(SettConnEntry * sett_conn_e if (storage_check_including && nm_settings_storage_is_keyfile_run(storage_check_including)) { /* the storage we check against is in-memory. It always has highest - * priority, so there can be no other conflicting storages. */ + * priority, so there can be no other conflicting storages. */ return NULL; } /* Finds the first (highest priority) storage that has a connection. - * Note that due to tombstones (that have a high priority), the connection - * may not actually be exposed. This is to find hidden/shadowed storages - * that provide a connection. */ + * Note that due to tombstones (that have a high priority), the connection + * may not actually be exposed. This is to find hidden/shadowed storages + * that provide a connection. */ c_list_for_each_entry (sd, &sett_conn_entry->sd_lst_head, sd_lst) { nm_assert(NM_IS_SETTINGS_STORAGE(sd->storage)); if (!sd->connection) { /* We only consider storages with connection. In particular, - * tombstones are not relevant, because we can delete them to - * resolve the conflict. */ + * tombstones are not relevant, because we can delete them to + * resolve the conflict. */ continue; } if (sd->storage == storage_check_including) { /* ok, the storage is the one we are about to check. All other - * storages are lower priority, so there is no storage that hides - * our storage_check_including. */ + * storages are lower priority, so there is no storage that hides + * our storage_check_including. */ return NULL; } @@ -280,12 +280,12 @@ _sett_conn_entry_storage_find_conflicting_storage(SettConnEntry * sett_conn_e plugins) <= 0) { /* the plugin of the existing storage is less important than @target_plugin. - * We have no conflicting/hiding storage. */ + * We have no conflicting/hiding storage. */ return NULL; } /* Found. If we would add the profile to @target_plugin, then it would be hidden - * by existing_storage. */ + * by existing_storage. */ return sd->storage; } @@ -493,7 +493,7 @@ _startup_complete_check_is_ready(NMSettings * self, if (nm_device_get_state(device) < NM_DEVICE_STATE_UNAVAILABLE || (!ignore_pending_actions && nm_device_has_pending_action(device))) { /* while a device is not yet available and still has a pending - * action itself, it's not a suitable candidate. */ + * action itself, it's not a suitable candidate. */ continue; } @@ -534,7 +534,7 @@ _startup_complete_check(NMSettings *self, gint64 now_msec) if (!priv->started) { /* before we are started there is no need to evaluate our list because - * we are anyway blocking startup-complete. */ + * we are anyway blocking startup-complete. */ return; } @@ -546,14 +546,14 @@ _startup_complete_check(NMSettings *self, gint64 now_msec) elapsed_msec = now_msec - priv->startup_complete_start_timestamp_msec; /* We search the entire list whether they all timed-out or found a compatible device. - * We do that by appending elements that are ready to the end of the list, so that - * we hopefully keep testing the elements that are ready already (and can shortcut - * the test in common cases). - * - * Note that all profiles that we wait for need to have their dependencies satisfied - * at the same time. For example, consider connection A is waiting for device A' which is ready. - * Connection B waits for device B', which isn't ready. Once B'/B becomes ready, A/A' must - * still be ready. Otherwise, we would wait for A/A' to become ready again. */ + * We do that by appending elements that are ready to the end of the list, so that + * we hopefully keep testing the elements that are ready already (and can shortcut + * the test in common cases). + * + * Note that all profiles that we wait for need to have their dependencies satisfied + * at the same time. For example, consider connection A is waiting for device A' which is ready. + * Connection B waits for device B', which isn't ready. Once B'/B becomes ready, A/A' must + * still be ready. Otherwise, we would wait for A/A' to become ready again. */ scd_not_ready = NULL; c_list_init(&ready_lst); c_list_for_each_entry_safe (scd, scd_safe, &priv->startup_complete_scd_lst_head, scd_lst) { @@ -568,7 +568,7 @@ _startup_complete_check(NMSettings *self, gint64 now_msec) next_with_ready: /* this element is ready. We move it to a temporary list, so that we - * can reorder the list (to next time evaluate the non-ready element first). */ + * can reorder the list (to next time evaluate the non-ready element first). */ nm_c_list_move_tail(&ready_lst, &scd->scd_lst); } c_list_splice(&priv->startup_complete_scd_lst_head, &ready_lst); @@ -830,49 +830,49 @@ _sett_conn_entry_sds_update_cmp_ascending(const StorageData *sd_a, bool is_keyfile_run_b; /* Sort storages by priority. More important storages are sorted - * higher (ascending sort). For example, if "sd_a" is more important than - * "sd_b" (sd_a>sd_b), a positive integer is returned. */ + * higher (ascending sort). For example, if "sd_a" is more important than + * "sd_b" (sd_a>sd_b), a positive integer is returned. */ meta_data_a = nm_settings_storage_is_meta_data(sd_a->storage); meta_data_b = nm_settings_storage_is_meta_data(sd_b->storage); /* runtime storages (both connections and meta-data) are always more - * important. */ + * important. */ is_keyfile_run_a = nm_settings_storage_is_keyfile_run(sd_a->storage); is_keyfile_run_b = nm_settings_storage_is_keyfile_run(sd_b->storage); if (is_keyfile_run_a != is_keyfile_run_b) { if (!meta_data_a && !meta_data_b) { /* Ok, both are non-meta-data providing actual profiles. But one is in /run and one is in - * another storage. In this case we first honor whether one of the storages is explicitly - * prioritized. The prioritize flag is an in-memory hack to overwrite relative priorities - * contrary to what exists on-disk. - * - * This is done because when we use explicit D-Bus API (like update-connection) - * to update a profile, then we really want to prioritize the candidate - * despite having multiple other profiles. - * - * The example is if you have the same UUID twice in /run (one of them shadowed). - * If you move it to disk, then one of the profiles gets deleted and re-created - * on disk, but that on-disk profile must win against the remainging profile in - * /run. At least until the next reload/restart. */ + * another storage. In this case we first honor whether one of the storages is explicitly + * prioritized. The prioritize flag is an in-memory hack to overwrite relative priorities + * contrary to what exists on-disk. + * + * This is done because when we use explicit D-Bus API (like update-connection) + * to update a profile, then we really want to prioritize the candidate + * despite having multiple other profiles. + * + * The example is if you have the same UUID twice in /run (one of them shadowed). + * If you move it to disk, then one of the profiles gets deleted and re-created + * on disk, but that on-disk profile must win against the remainging profile in + * /run. At least until the next reload/restart. */ NM_CMP_FIELD_UNSAFE(sd_a, sd_b, prioritize); } /* in-memory has higher priority. That is regardless of whether any of - * them is meta-data/tombstone or a profile. - * - * That works, because if any of them are tombstones/metadata, then we are in full - * control. There can by only one meta-data file, which is fully owned (and accordingly - * created/deleted) by NetworkManager. - * - * The only case where this might not be right is if we have profiles - * in /run that are shadowed. When we move such a profile to disk, then - * a conflict might arise. That is handled by "prioritize" above! */ + * them is meta-data/tombstone or a profile. + * + * That works, because if any of them are tombstones/metadata, then we are in full + * control. There can by only one meta-data file, which is fully owned (and accordingly + * created/deleted) by NetworkManager. + * + * The only case where this might not be right is if we have profiles + * in /run that are shadowed. When we move such a profile to disk, then + * a conflict might arise. That is handled by "prioritize" above! */ NM_CMP_DIRECT(is_keyfile_run_a, is_keyfile_run_b); } /* After we determined that both profiles are either in /run or not, - * tombstones are always more important than non-tombstones. */ + * tombstones are always more important than non-tombstones. */ NM_CMP_DIRECT(meta_data_a && meta_data_a->is_tombstone, meta_data_b && meta_data_b->is_tombstone); @@ -880,8 +880,8 @@ _sett_conn_entry_sds_update_cmp_ascending(const StorageData *sd_a, NM_CMP_FIELD_UNSAFE(sd_a, sd_b, prioritize); /* finally, compare the storages. This basically honors the timestamp - * of the profile and the relative order of the source plugin (via the - * @plugins list). */ + * of the profile and the relative order of the source plugin (via the + * @plugins list). */ return nm_settings_storage_cmp(sd_a->storage, sd_b->storage, plugins); } @@ -906,20 +906,20 @@ _sett_conn_entry_sds_update(NMSettings *self, SettConnEntry *sett_conn_entry) nm_assert_storage_data_lst(&sett_conn_entry->dirty_sd_lst_head); /* we merge the dirty list with the previous list. - * - * The idea is: - * - * - _connection_changed_track() appends events for the same UUID. Meaning: - * if the storage is new, it get appended (having lower priority). - * If it already exist and is an update for an event that we already - * track it, it keeps the list position in @dirty_sd_lst_head unchanged. - * - * - during merge, we want to preserve the previous order (with higher - * priority first in the list). - */ + * + * The idea is: + * + * - _connection_changed_track() appends events for the same UUID. Meaning: + * if the storage is new, it get appended (having lower priority). + * If it already exist and is an update for an event that we already + * track it, it keeps the list position in @dirty_sd_lst_head unchanged. + * + * - during merge, we want to preserve the previous order (with higher + * priority first in the list). + */ /* first go through all storages that we track and check whether they - * got an update...*/ + * got an update...*/ reprioritize = FALSE; c_list_for_each_entry (sd, &sett_conn_entry->dirty_sd_lst_head, sd_lst) { @@ -949,14 +949,14 @@ _sett_conn_entry_sds_update(NMSettings *self, SettConnEntry *sett_conn_entry) nm_assert_storage_data_lst(&sett_conn_entry->sd_lst_head); /* all remaining (so far unseen) dirty entries are appended to the merged list. - * (append means lower priority). */ + * (append means lower priority). */ c_list_splice(&sett_conn_entry->sd_lst_head, &sett_conn_entry->dirty_sd_lst_head); nm_assert_storage_data_lst(&sett_conn_entry->sd_lst_head); /* we drop the entries that are no longer "alive" (meaning, they no longer - * indicate a connection and are not a tombstone). */ + * indicate a connection and are not a tombstone). */ c_list_for_each_entry_safe (sd, sd_safe, &sett_conn_entry->sd_lst_head, sd_lst) { if (!_storage_data_is_alive(sd)) _storage_data_destroy(sd); @@ -1009,8 +1009,8 @@ _connection_changed_normalize_connection(NMSettingsStorage *storage, connection_cloned ? NULL : &connection_cloned, &error)) { /* this is most likely a bug in the plugin. It provided a connection that no longer verifies. - * Well, I guess it could also happen when we merge @secrets_to_merge above. In any case - * somewhere is a bug. */ + * Well, I guess it could also happen when we merge @secrets_to_merge above. In any case + * somewhere is a bug. */ _LOGT("storage[%s," NM_SETTINGS_STORAGE_PRINT_FMT "]: plugin provided an invalid connection: %s", uuid, @@ -1093,7 +1093,7 @@ _connection_changed_update(NMSettings * self, nm_assert(!NM_FLAGS_HAS(sett_flags, NM_SETTINGS_CONNECTION_INT_FLAGS_UNSAVED)); /* Profiles that don't reside in /run, are never nm-generated, - * volatile, and external. */ + * volatile, and external. */ sett_mask |= (NM_SETTINGS_CONNECTION_INT_FLAGS_NM_GENERATED | NM_SETTINGS_CONNECTION_INT_FLAGS_VOLATILE | NM_SETTINGS_CONNECTION_INT_FLAGS_EXTERNAL); @@ -1106,9 +1106,9 @@ _connection_changed_update(NMSettings * self, if (is_new) { /* FIXME(shutdown): The NMSettings instance can't be disposed - * while there is any exported connection. Ideally we should - * unexport all connections on NMSettings' disposal, but for now - * leak @self on termination when there are connections alive. */ + * while there is any exported connection. Ideally we should + * unexport all connections on NMSettings' disposal, but for now + * leak @self on termination when there are connections alive. */ path = nm_dbus_object_export(NM_DBUS_OBJECT(sett_conn)); } else path = nm_dbus_object_get_path(NM_DBUS_OBJECT(sett_conn)); @@ -1165,10 +1165,10 @@ _connection_changed_delete(NMSettings * self, NM_SETTINGS_STORAGE_PRINT_ARG(storage)); /* When the default wired sett_conn is removed (either deleted or saved to - * a new persistent sett_conn by a plugin), write the MAC address of the - * wired device to the config file and don't create a new default wired - * sett_conn for that device again. - */ + * a new persistent sett_conn by a plugin), write the MAC address of the + * wired device to the config file and don't create a new default wired + * sett_conn for that device again. + */ device = nm_settings_connection_default_wired_get_device(sett_conn); if (device) default_wired_clear_tag(self, device, sett_conn, allow_add_to_no_auto_default); @@ -1382,7 +1382,7 @@ _connection_changed_track(NMSettings * self, } /* see _sett_conn_entry_sds_update() for why we append the new events - * and leave existing ones at their position. */ + * and leave existing ones at their position. */ sd = _storage_data_find_in_lst(&sett_conn_entry->dirty_sd_lst_head, storage); if (sd) nm_g_object_ref_set(&sd->connection, connection); @@ -1482,13 +1482,13 @@ _add_connection_to_first_plugin(NMSettings * self, priv->plugins); if (conflicting_storage) { /* we have a connection provided by a plugin with higher priority than the one - * we would want to add the connection. We cannot do that, because doing so - * would result in adding a connection that gets hidden by the existing profile. - * Also, since we test the plugins in order of priority, all following plugins - * are unsuitable. - * - * Multiple connection plugins are so cumbersome, especially if they are unable - * to add the connection. I suggest to disable all plugins except keyfile. */ + * we would want to add the connection. We cannot do that, because doing so + * would result in adding a connection that gets hidden by the existing profile. + * Also, since we test the plugins in order of priority, all following plugins + * are unsuitable. + * + * Multiple connection plugins are so cumbersome, especially if they are unable + * to add the connection. I suggest to disable all plugins except keyfile. */ _LOGT("add-connection: failed to add %s/'%s': there is an existing " "storage " NM_SETTINGS_STORAGE_PRINT_FMT " with higher priority", nm_connection_get_uuid(new_connection), @@ -1766,10 +1766,10 @@ nm_settings_add_connection(NMSettings * self, NULL)); if (shadowed_storage) { /* We have a nmmeta tombstone that indicates that a storage is shadowed. - * - * This happens when deleting a in-memory profile that was decoupled from - * the persistent storage with NM_SETTINGS_CONNECTION_PERSIST_MODE_IN_MEMORY_DETACHED. - * We need to take over this storage again... */ + * + * This happens when deleting a in-memory profile that was decoupled from + * the persistent storage with NM_SETTINGS_CONNECTION_PERSIST_MODE_IN_MEMORY_DETACHED. + * We need to take over this storage again... */ break; } } @@ -1785,10 +1785,10 @@ nm_settings_add_connection(NMSettings * self, priv->plugins); if (conflicting_storage) { /* We cannot add the profile as @shadowed_storage, because there is another, existing storage - * that would hide it. Just add it as new storage. In general, this leads to duplication of profiles, - * but the circumstances where this happens are very exotic (you need at least one additional settings - * plugin, then going through the paths of making shadowed_storage in-memory-detached and delete it, - * and finally adding the conflicting storage outside of NM and restart/reload). */ + * that would hide it. Just add it as new storage. In general, this leads to duplication of profiles, + * but the circumstances where this happens are very exotic (you need at least one additional settings + * plugin, then going through the paths of making shadowed_storage in-memory-detached and delete it, + * and finally adding the conflicting storage outside of NM and restart/reload). */ _LOGT("ignore shadowed storage " NM_SETTINGS_STORAGE_PRINT_FMT " due to conflicting storage " NM_SETTINGS_STORAGE_PRINT_FMT, NM_SETTINGS_STORAGE_PRINT_ARG(shadowed_storage), @@ -1829,8 +1829,8 @@ again_add_connection: if (!success) { if (!NMS_IS_KEYFILE_STORAGE(update_storage)) { /* hm, the intended storage is not keyfile (it's ifcfg-rh). This settings - * plugin may not support the new connection. So step back and retry adding - * the profile anew. */ + * plugin may not support the new connection. So step back and retry adding + * the profile anew. */ _LOGT("failure to add profile as existing storage \"%s\": %s", nm_settings_storage_get_filename(update_storage), local->message); @@ -1894,8 +1894,8 @@ again_delete_tombstone: &new_tombstone_storage, NULL)) { /* Ups, something went wrong. We really need to get rid of the tombstone. At least - * forget about it in-memory. Upong next restart/reload, this might be reverted - * however :( .*/ + * forget about it in-memory. Upong next restart/reload, this might be reverted + * however :( .*/ if (!simulate) { simulate = TRUE; goto again_delete_tombstone; @@ -2012,9 +2012,9 @@ nm_settings_update_connection(NMSettings * self, NMDevice *device; /* The connection has been changed by the user, it should no longer be - * considered a default wired connection, and should no longer affect - * the no-auto-default configuration option. - */ + * considered a default wired connection, and should no longer affect + * the no-auto-default configuration option. + */ device = nm_settings_connection_default_wired_get_device(sett_conn); if (device) { nm_assert(cur_in_memory); @@ -2025,11 +2025,11 @@ nm_settings_update_connection(NMSettings * self, if (NM_IN_SET(persist_mode, NM_SETTINGS_CONNECTION_PERSIST_MODE_NO_PERSIST)) { /* making a default-wired-connection a regular connection implies persisting - * it to disk (unless specified differently). - * - * Actually, this line is probably unreached, because we should not use - * NM_SETTINGS_CONNECTION_PERSIST_MODE_NO_PERSIST to toggle the nm-generated - * flag. */ + * it to disk (unless specified differently). + * + * Actually, this line is probably unreached, because we should not use + * NM_SETTINGS_CONNECTION_PERSIST_MODE_NO_PERSIST to toggle the nm-generated + * flag. */ nm_assert_not_reached(); persist_mode = NM_SETTINGS_CONNECTION_PERSIST_MODE_TO_DISK; } @@ -2046,8 +2046,8 @@ nm_settings_update_connection(NMSettings * self, | NM_SETTINGS_CONNECTION_INT_FLAGS_VOLATILE | NM_SETTINGS_CONNECTION_INT_FLAGS_EXTERNAL)) { /* we update the nm-generated/volatile setting of a profile (which is inherently - * in-memory. The caller did not request to persist this to disk, however we need - * to store the flags in run. */ + * in-memory. The caller did not request to persist this to disk, however we need + * to store the flags in run. */ nm_assert(cur_in_memory); persist_mode = NM_SETTINGS_CONNECTION_PERSIST_MODE_IN_MEMORY; } @@ -2066,13 +2066,13 @@ nm_settings_update_connection(NMSettings * self, if (!new_in_memory) { /* Persistent connections cannot be volatile nor nm-generated. - * - * That is obviously true for volatile, as it is enforced by Update2() API. - * - * For nm-generated profiles also, because the nm-generated flag is only stored - * for in-memory profiles. If we would persist the profile to /etc it would loose - * the nm-generated flag after restart/reload, and that cannot be right. If a profile - * ends up on disk, the information who created it gets lost. */ + * + * That is obviously true for volatile, as it is enforced by Update2() API. + * + * For nm-generated profiles also, because the nm-generated flag is only stored + * for in-memory profiles. If we would persist the profile to /etc it would loose + * the nm-generated flag after restart/reload, and that cannot be right. If a profile + * ends up on disk, the information who created it gets lost. */ nm_assert(!NM_FLAGS_ANY(sett_flags, NM_SETTINGS_CONNECTION_INT_FLAGS_NM_GENERATED | NM_SETTINGS_CONNECTION_INT_FLAGS_VOLATILE @@ -2134,7 +2134,7 @@ nm_settings_update_connection(NMSettings * self, } } else if (nm_settings_storage_is_keyfile_lib(cur_storage)) { /* the profile is a keyfile in /usr/lib. It cannot be overwritten, we must migrate it - * from /usr/lib to /etc. */ + * from /usr/lib to /etc. */ } else update_storage = cur_storage; @@ -2253,7 +2253,7 @@ nm_settings_update_connection(NMSettings * self, NM_PRINT_FMT_QUOTED(filename, " (file \"", filename, "\")", ""), local->message); /* there is no aborting back form this. We must get rid of the connection and - * cannot do better than log a message. Proceed, but remember to write tombstones. */ + * cannot do better than log a message. Proceed, but remember to write tombstones. */ if (nm_settings_storage_is_keyfile_run(cur_storage)) tombstone_in_memory = TRUE; else @@ -2344,7 +2344,7 @@ nm_settings_delete_connection(NMSettings * self, local->message); g_clear_error(&local); /* there is no aborting back form this. We must get rid of the connection and - * cannot do better than log a message. Proceed, but remember to write tombstones. */ + * cannot do better than log a message. Proceed, but remember to write tombstones. */ if (nm_settings_storage_is_keyfile_run(cur_storage)) tombstone_in_memory = TRUE; else @@ -2363,7 +2363,7 @@ nm_settings_delete_connection(NMSettings * self, if (sd->storage == shadowed_storage_unowned) { /* this only happens if we leak a profile on disk after NM_SETTINGS_CONNECTION_PERSIST_MODE_IN_MEMORY_DETACHED. - * We need to write a tombstone and remember the shadowed-storage. */ + * We need to write a tombstone and remember the shadowed-storage. */ tombstone_in_memory = TRUE; new_shadowed_storage_filename = nm_settings_storage_get_filename(shadowed_storage_unowned); @@ -2402,9 +2402,9 @@ send_agent_owned_secrets(NMSettings *self, NMSettingsConnection *sett_conn, NMAu gs_unref_object NMConnection *for_agent = NULL; /* Dupe the connection so we can clear out non-agent-owned secrets, - * as agent-owned secrets are the only ones we send back to be saved. - * Only send secrets to agents of the same UID that called update too. - */ + * as agent-owned secrets are the only ones we send back to be saved. + * Only send secrets to agents of the same UID that called update too. + */ for_agent = nm_simple_connection_new_clone(nm_settings_connection_get_connection(sett_conn)); _nm_connection_clear_secrets_by_secret_flags(for_agent, NM_SETTING_SECRET_FLAG_AGENT_OWNED); nm_agent_manager_save_secrets(priv->agent_mgr, @@ -2453,9 +2453,9 @@ pk_add_cb(NMAuthChain *chain, GDBusMethodInvocation *context, gpointer user_data &error); /* The callback may remove the connection from the settings manager (e.g. - * because it's found to be incompatible with the device on AddAndActivate). - * But we need to keep it alive for a bit longer, precisely to check wehther - * it's still known to the setting manager. */ + * because it's found to be incompatible with the device on AddAndActivate). + * But we need to keep it alive for a bit longer, precisely to check wehther + * it's still known to the setting manager. */ nm_g_object_ref(added); } @@ -2511,9 +2511,9 @@ nm_settings_add_connection_dbus(NMSettings * self, goto done; /* If the caller is the only user in the connection's permissions, then - * we use the 'modify.own' permission instead of 'modify.system'. If the - * request affects more than just the caller, require 'modify.system'. - */ + * we use the 'modify.own' permission instead of 'modify.system'. If the + * request affects more than just the caller, require 'modify.system'. + */ s_con = nm_connection_get_setting_connection(connection); nm_assert(s_con); if (nm_setting_connection_get_num_permissions(s_con) == 1) @@ -2768,9 +2768,9 @@ impl_settings_load_connections(NMDBusObject * obj, g_variant_get(parameters, "(^a&s)", &filenames); /* The permission is already enforced by the D-Bus daemon, but we ensure - * that the caller is still alive so that clients are forced to wait and - * we'll be able to switch to polkit without breaking behavior. - */ + * that the caller is still alive so that clients are forced to wait and + * we'll be able to switch to polkit without breaking behavior. + */ if (!nm_dbus_manager_ensure_uid(nm_dbus_object_get_manager(obj), invocation, G_MAXULONG, @@ -2858,9 +2858,9 @@ impl_settings_reload_connections(NMDBusObject * obj, NMSettings *self = NM_SETTINGS(obj); /* The permission is already enforced by the D-Bus daemon, but we ensure - * that the caller is still alive so that clients are forced to wait and - * we'll be able to switch to polkit without breaking behavior. - */ + * that the caller is still alive so that clients are forced to wait and + * we'll be able to switch to polkit without breaking behavior. + */ if (!nm_dbus_manager_ensure_uid(nm_dbus_object_get_manager(obj), invocation, G_MAXULONG, @@ -2888,9 +2888,9 @@ _clear_connections_cached_list(NMSettingsPrivate *priv) #if NM_MORE_ASSERTS /* set the pointer to a bogus value. This makes it more apparent - * if somebody has a reference to the cached list and still uses - * it. That is a bug, this code just tries to make it blow up - * more eagerly. */ + * if somebody has a reference to the cached list and still uses + * it. That is a bug, this code just tries to make it blow up + * more eagerly. */ memset(priv->connections_cached_list, 0x43, sizeof(NMSettingsConnection *) * (priv->connections_len + 1)); @@ -3223,7 +3223,7 @@ add_plugin_load_file(NMSettings *self, const char *pname, GError **error) } /* after accessing the plugin we cannot unload it anymore, because the glib - * types cannot be properly unregistered. */ + * types cannot be properly unregistered. */ g_module_make_resident(module); plugin = (*factory_func)(); @@ -3278,7 +3278,7 @@ load_plugins(NMSettings *self, const char *const *plugins, GError **error) if (nm_utils_strv_find_first((char **) plugins, iter - plugins, pname) >= 0) { /* the plugin is already mentioned in the list previously. - * Don't load a duplicate. */ + * Don't load a duplicate. */ continue; } @@ -3466,15 +3466,15 @@ device_realized(NMDevice *device, GParamSpec *pspec, NMSettings *self) priv = NM_SETTINGS_GET_PRIVATE(self); /* If the device isn't managed or it already has a default wired connection, - * ignore it. - */ + * ignore it. + */ if (!NM_DEVICE_GET_CLASS(device)->new_default_connection || !nm_device_get_managed(device, FALSE) || g_object_get_qdata(G_OBJECT(device), _default_wired_connection_blocked_quark())) return; /* we only check once whether to create the auto-default connection. If we reach this point, - * we mark the creation of the default-wired-connection as blocked. */ + * we mark the creation of the default-wired-connection as blocked. */ g_object_set_qdata(G_OBJECT(device), _default_wired_connection_blocked_quark(), device); if (nm_config_get_no_auto_default_for_device(priv->config, device)) { @@ -3536,7 +3536,7 @@ nm_settings_device_added(NMSettings *self, NMDevice *device) device_realized(device, NULL, self); else { /* FIXME(shutdown): we need to disconnect this signal handler during - * shutdown. */ + * shutdown. */ g_signal_connect_after(device, "notify::" NM_DEVICE_REAL, G_CALLBACK(device_realized), @@ -3556,8 +3556,8 @@ nm_settings_device_removed(NMSettings *self, NMDevice *device, gboolean quitting default_wired_clear_tag(self, device, connection, FALSE); /* Don't delete the default wired connection on shutdown, so that it - * remains up and can be assumed if NM starts again. - */ + * remains up and can be assumed if NM starts again. + */ if (quitting == FALSE) nm_settings_connection_delete(connection, TRUE); } @@ -3585,13 +3585,13 @@ again: is_visible); if (generation != priv->connections_generation) { /* the cached list was invalidated. Start again. - * - * Note that nm_settings_connection_recheck_visibility() will do nothing - * if the visibility didn't change (including emitting no signals, - * and not invalidating the list). - * - * Hence, for this to be an endless loop, the settings would have - * to constantly change the visibility flag and also invalidate the list. */ + * + * Note that nm_settings_connection_recheck_visibility() will do nothing + * if the visibility didn't change (including emitting no signals, + * and not invalidating the list). + * + * Hence, for this to be an endless loop, the settings would have + * to constantly change the visibility flag and also invalidate the list. */ goto again; } } @@ -3776,9 +3776,9 @@ nm_settings_start(NMSettings *self, GError **error) _startup_complete_check(self, 0); /* FIXME(shutdown): we also need a nm_settings_stop() during shutdown. - * - * In particular, we need to remove all in-memory keyfiles from /run that are nm-generated. - * alternatively, the nm-generated flag must also be persisted and loaded to /run. */ + * + * In particular, we need to remove all in-memory keyfiles from /run that are nm-generated. + * alternatively, the nm-generated flag must also be persisted and loaded to /run. */ return TRUE; } diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c index 50a33cbc52..48a798ee49 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c @@ -293,12 +293,12 @@ _storages_consolidate(NMSIfcfgRHPlugin * self, guint i; /* when we reload all files, we must signal add/update/modify of profiles one-by-one. - * NMSettings then goes ahead and emits further signals and a lot of things happen. - * - * So, first, emit an update of the unmanaged/unrecognized specs that contains *all* - * the unmanaged/unrecognized devices from before and after. Since both unmanaged/unrecognized - * specs have the meaning of "not doing something", it makes sense that we temporarily - * disable that action for the sum of before and after. */ + * NMSettings then goes ahead and emits further signals and a lot of things happen. + * + * So, first, emit an update of the unmanaged/unrecognized specs that contains *all* + * the unmanaged/unrecognized devices from before and after. Since both unmanaged/unrecognized + * specs have the meaning of "not doing something", it makes sense that we temporarily + * disable that action for the sum of before and after. */ _unhandled_specs_merge_storages(self, storages_new); storages_modified = g_ptr_array_new_with_free_func(g_object_unref); @@ -366,7 +366,7 @@ _storages_consolidate(NMSIfcfgRHPlugin * self, if (!storage->dirty) { /* the entry is no longer dirty. In the meantime we already emitted - * another signal for it. */ + * another signal for it. */ continue; } storage->dirty = FALSE; @@ -375,8 +375,8 @@ _storages_consolidate(NMSIfcfgRHPlugin * self, &priv->storages, nms_ifcfg_rh_storage_get_filename(storage))) { /* hm? The profile was deleted in the meantime? That is only possible - * if the signal handler called again into the plugin. In any case, the event - * was already emitted. Skip. */ + * if the signal handler called again into the plugin. In any case, the event + * was already emitted. Skip. */ continue; } @@ -479,7 +479,7 @@ load_connections(NMSettingsPlugin * plugin, NMSIfcfgRHStorage *storage2; /* the file does not exist. We take that as indication to unload the file - * that was previously loaded... */ + * that was previously loaded... */ storage2 = nm_sett_util_storages_lookup_by_filename(&priv->storages, full_filename); if (storage2) g_hash_table_add(storages_replaced, g_object_ref(storage2)); @@ -519,15 +519,15 @@ load_connections(NMSettingsPlugin * plugin, } /* @storage has a UUID that was just loaded from disk, but we have an entry in cache. - * Reload that file too despite not being told to do so. The reason is to get - * the latest file timestamp so that we get the priorities right. */ + * Reload that file too despite not being told to do so. The reason is to get + * the latest file timestamp so that we get the priorities right. */ storage_new = _load_file(self, full_filename, &local); if (storage_new && !nm_streq0(loaded_uuid, nms_ifcfg_rh_storage_get_uuid_opt(storage_new))) { /* the file now references a different UUID. We are not told to reload - * that file, so this means the existing storage (with the previous - * filename and UUID tuple) is no longer valid. */ + * that file, so this means the existing storage (with the previous + * filename and UUID tuple) is no longer valid. */ g_clear_object(&storage_new); } @@ -567,12 +567,12 @@ load_connections_done(NMSettingsPlugin *plugin) NMSIfcfgRHPlugin *self = NMS_IFCFG_RH_PLUGIN(plugin); /* at the beginning of a load, we emit a change signal for unmanaged/unrecognized - * specs that contain the sum of before and after (_unhandled_specs_merge_storages()). - * - * The idea is that while we emit signals about changes to connection, we have - * the sum of all unmanaged/unrecognized devices from before and after. - * - * This if triggered at the end, to reset the specs. */ + * specs that contain the sum of before and after (_unhandled_specs_merge_storages()). + * + * The idea is that while we emit signals about changes to connection, we have + * the sum of all unmanaged/unrecognized devices from before and after. + * + * This if triggered at the end, to reset the specs. */ _unhandled_specs_reset(self); nm_assert_self(self, TRUE); @@ -923,11 +923,11 @@ impl_ifcfgrh_get_ifcfg_details(NMSIfcfgRHPlugin * self, } /* It is ugly that the ifcfg-rh plugin needs to call back into NMSettings this - * way. - * There are alternatives (like invoking a signal), but they are all significant - * extra code (and performance overhead). So the quick and dirty solution here - * is likely to be simpler than getting this right (also from point of readability!). - */ + * way. + * There are alternatives (like invoking a signal), but they are all significant + * extra code (and performance overhead). So the quick and dirty solution here + * is likely to be simpler than getting this right (also from point of readability!). + */ path = nm_settings_get_dbus_path_for_uuid(nm_settings_get(), uuid); if (!path) { @@ -1128,7 +1128,7 @@ _dbus_setup(NMSIfcfgRHPlugin *self) } /* We use a separate D-Bus connection so that org.freedesktop.NetworkManager and com.redhat.ifcfgrh1 - * are exported by different connections. */ + * are exported by different connections. */ address = g_dbus_address_get_for_bus_sync(G_BUS_TYPE_SYSTEM, NULL, &error); if (address == NULL) { _LOGW("dbus: failed getting address for system bus: %s", error->message); @@ -1156,11 +1156,11 @@ config_changed_cb(NMConfig * config, NMSIfcfgRHPluginPrivate *priv; /* If the dbus connection for some reason is borked the D-Bus service - * won't be offered. - * - * On SIGHUP and SIGUSR1 try to re-connect to D-Bus. So in the unlikely - * event that the D-Bus connection is broken, that allows for recovery - * without need for restarting NetworkManager. */ + * won't be offered. + * + * On SIGHUP and SIGUSR1 try to re-connect to D-Bus. So in the unlikely + * event that the D-Bus connection is broken, that allows for recovery + * without need for restarting NetworkManager. */ if (!NM_FLAGS_ANY(changes, NM_CONFIG_CHANGE_CAUSE_SIGHUP | NM_CONFIG_CHANGE_CAUSE_SIGUSR1)) return; @@ -1211,7 +1211,7 @@ dispose(GObject *object) g_signal_handlers_disconnect_by_func(priv->config, config_changed_cb, self); /* FIXME(shutdown) we need a stop method so that we can unregistering the D-Bus service - * when NMSettings is shutting down, and not when the instance gets destroyed. */ + * when NMSettings is shutting down, and not when the instance gets destroyed. */ _dbus_clear(self); nm_sett_util_storages_clear(&priv->storages); diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c index fa1fd22daf..1d94d95ded 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c @@ -311,8 +311,8 @@ check_if_bond_slave(shvarFile *ifcfg, NMSettingConnection *s_con) } /* We should be checking for SLAVE=yes as well, but NM used to not set that, - * so for backward-compatibility, we don't check. - */ + * so for backward-compatibility, we don't check. + */ } static void @@ -362,9 +362,9 @@ make_connection_name(shvarFile * ifcfg, prefix = "System"; /* For cosmetic reasons, if the suggested name is the same as - * the ifcfg files name, don't use it. Mainly for wifi so that - * the SSID is shown in the connection ID instead of just "wlan0". - */ + * the ifcfg files name, don't use it. Mainly for wifi so that + * the SSID is shown in the connection ID instead of just "wlan0". + */ if (suggested && strcmp(ifcfg_name, suggested)) full_name = g_strdup_printf("%s %s (%s)", prefix, suggested, ifcfg_name); else @@ -425,7 +425,7 @@ make_connection_setting(const char *file, GError *error = NULL; /* Only validate for NMU_IFACE_KERNEL, because ifcfg plugin anyway - * doesn't support OVS types. */ + * doesn't support OVS types. */ if (nm_utils_ifname_valid(v, NMU_IFACE_KERNEL, &error)) { g_object_set(s_con, NM_SETTING_CONNECTION_INTERFACE_NAME, v, NULL); } else { @@ -605,8 +605,8 @@ make_connection_setting(const char *file, d *= 1000.0; /* We round. Yes, this is not correct to round IEEE 754 floats in general, - * but sufficient for our case where we know that NetworkManager wrote the - * setting with up to 3 digits for the milliseconds. */ + * but sufficient for our case where we know that NetworkManager wrote the + * setting with up to 3 digits for the milliseconds. */ d += 0.5; if (d >= 0.0 && d <= (double) G_MAXINT32) vint64 = (gint64) d; @@ -790,10 +790,10 @@ static gboolean parse_route_line_is_comment(const char *line) { /* we obtained the line from a legacy route file. Here we skip - * empty lines and comments. - * - * initscripts compares: "$line" =~ '^[[:space:]]*(\#.*)?$' - */ + * empty lines and comments. + * + * initscripts compares: "$line" =~ '^[[:space:]]*(\#.*)?$' + */ while (nm_utils_is_separator(line[0])) line++; if (NM_IN_SET(line[0], '\0', '#')) @@ -817,7 +817,7 @@ typedef struct { bool disabled_with_options_route : 1; /* whether the element is to be ignored. Ignord is different from - * "disabled", because we still parse the option, but don't use it. */ + * "disabled", because we still parse the option, but don't use it. */ ParseLineAFFlag ignore : 3; bool int_base_16 : 1; @@ -829,7 +829,7 @@ typedef struct { typedef struct { /* whether the command line option was found, and @v is - * initialized. */ + * initialized. */ bool has : 1; union { @@ -1022,20 +1022,20 @@ parse_route_line(const char *line, nm_assert(!options_route || nm_ip_route_get_family(options_route) == addr_family); /* initscripts read the legacy route file line-by-line and - * use it as `ip route add $line`, thus doing split+glob. - * Splitting on IFS (which we consider '<space><tab><newline>') - * and globbing (which we obviously don't do). - * - * I think it's a mess, because it doesn't support escaping or - * quoting. In fact, it can only encode benign values. - * - * We also use the same form for the numbered OPTIONS - * variable. I think it's bad not to support any form of - * escaping. But do that for now. - * - * Maybe later we want to support some form of quotation here. - * Which of course, would be incompatible with initscripts. - */ + * use it as `ip route add $line`, thus doing split+glob. + * Splitting on IFS (which we consider '<space><tab><newline>') + * and globbing (which we obviously don't do). + * + * I think it's a mess, because it doesn't support escaping or + * quoting. In fact, it can only encode benign values. + * + * We also use the same form for the numbered OPTIONS + * variable. I think it's bad not to support any form of + * escaping. But do that for now. + * + * Maybe later we want to support some form of quotation here. + * Which of course, would be incompatible with initscripts. + */ words_free = nm_utils_strsplit_set(line, " \t\n"); words = words_free ?: NM_PTRARRAY_EMPTY(const char *); @@ -1060,7 +1060,7 @@ parse_route_line(const char *line, if (p_data->has) { /* iproute2 for most arguments allows specifying them multiple times. - * Let's not do that. */ + * Let's not do that. */ g_set_error(error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, @@ -1228,7 +1228,7 @@ parse_line_type_addr_with_prefix: if (p_info == &parse_infos[PARSE_LINE_ATTR_ROUTE_VIA] && nm_streq(s, "(null)")) { /* Due to a bug, would older versions of NM write "via (null)" - * (rh#1452648). Workaround that, and accept it.*/ + * (rh#1452648). Workaround that, and accept it.*/ memset(&p_data->v.addr.addr, 0, sizeof(p_data->v.addr.addr)); } else { if (unqualified_addr) { @@ -1374,9 +1374,9 @@ next:; break; case PARSE_LINE_TYPE_FLAG: /* NOTE: the flag (for "onlink") only allows to explicitly set "TRUE". - * There is no way to express an explicit "FALSE" setting - * of this attribute, hence, the file format cannot encode - * that configuration. */ + * There is no way to express an explicit "FALSE" setting + * of this attribute, hence, the file format cannot encode + * that configuration. */ nm_ip_route_set_attribute(route, p_info->key, g_variant_new_boolean(TRUE)); break; case PARSE_LINE_TYPE_STRING: @@ -1530,7 +1530,7 @@ read_route_file_parse(int addr_family, PARSE_WARNING("ignoring manual default route: '%s' (%s)", line, filename); else { /* we accept all unrecognized lines, because otherwise we would reject the - * entire connection. */ + * entire connection. */ PARSE_WARNING("ignoring invalid route at \"%s\" (%s:%lu): %s", line, filename, @@ -1782,10 +1782,10 @@ make_ip4_setting(shvarFile *ifcfg, s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new(); /* First check if DEFROUTE is set for this device; DEFROUTE has the - * opposite meaning from never-default. The default if DEFROUTE is not - * specified is DEFROUTE=yes which means that this connection can be used - * as a default route - */ + * opposite meaning from never-default. The default if DEFROUTE is not + * specified is DEFROUTE=yes which means that this connection can be used + * as a default route + */ i = svGetValueBoolean(ifcfg, "DEFROUTE", -1); if (i == -1) never_default = FALSE; @@ -1805,8 +1805,8 @@ make_ip4_setting(shvarFile *ifcfg, dns_options = svGetValue(network_ifcfg, "RES_OPTIONS", &dns_options_free); /* If there was a global gateway device specified, then only connections - * for that device can be the default connection. - */ + * for that device can be the default connection. + */ if (gatewaydev && v) never_default = !!strcmp(v, gatewaydev); @@ -1913,21 +1913,21 @@ make_ip4_setting(shvarFile *ifcfg, g_object_set(s_ip4, NM_SETTING_IP_CONFIG_DHCP_IAID, v, NULL); /* Read static IP addresses. - * Read them even for AUTO method - in this case the addresses are - * added to the automatic ones. Note that this is not currently supported by - * the legacy 'network' service (ifup-eth). - */ + * Read them even for AUTO method - in this case the addresses are + * added to the automatic ones. Note that this is not currently supported by + * the legacy 'network' service (ifup-eth). + */ for (i = -1;; i++) { NMIPAddress *addr = NULL; /* gateway will only be set if still unset. Hence, we don't leak gateway - * here by calling read_full_ip4_address() repeatedly */ + * here by calling read_full_ip4_address() repeatedly */ if (!read_full_ip4_address(ifcfg, i, NULL, &addr, &gateway, error)) return NULL; if (!addr) { /* The first mandatory variable is 2-indexed (IPADDR2) - * Variables IPADDR, IPADDR0 and IPADDR1 are optional */ + * Variables IPADDR, IPADDR0 and IPADDR1 are optional */ if (i > 1) break; continue; @@ -1963,15 +1963,15 @@ make_ip4_setting(shvarFile *ifcfg, PARSE_WARNING("GATEWAY will be ignored when DEFROUTE is disabled"); /* We used to skip saving a lot of unused properties for the ipv4 shared method. - * We want now to persist them but... unfortunately loading DNS or DOMAIN options - * would cause a fail in the ipv4 verify() function. As we don't want any regression - * in the unlikely event that someone has a working ifcfg file for an IPv4 shared ip - * connection with a crafted "DNS" entry... don't load it. So we will avoid failing - * the connection) */ + * We want now to persist them but... unfortunately loading DNS or DOMAIN options + * would cause a fail in the ipv4 verify() function. As we don't want any regression + * in the unlikely event that someone has a working ifcfg file for an IPv4 shared ip + * connection with a crafted "DNS" entry... don't load it. So we will avoid failing + * the connection) */ if (!nm_streq(method, NM_SETTING_IP4_CONFIG_METHOD_SHARED)) { /* DNS servers - * Pick up just IPv4 addresses (IPv6 addresses are taken by make_ip6_setting()) - */ + * Pick up just IPv4 addresses (IPv6 addresses are taken by make_ip6_setting()) + */ for (i = 1; i <= 10; i++) { char tag[256]; @@ -2245,16 +2245,16 @@ make_ip6_setting(shvarFile *ifcfg, shvarFile *network_ifcfg, gboolean routes_rea s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new(); /* First check if IPV6_DEFROUTE is set for this device; IPV6_DEFROUTE has the - * opposite meaning from never-default. The default if IPV6_DEFROUTE is not - * specified is IPV6_DEFROUTE=yes which means that this connection can be used - * as a default route - */ + * opposite meaning from never-default. The default if IPV6_DEFROUTE is not + * specified is IPV6_DEFROUTE=yes which means that this connection can be used + * as a default route + */ never_default = !svGetValueBoolean(ifcfg, "IPV6_DEFROUTE", TRUE); /* Then check if IPV6_DEFAULTGW or IPV6_DEFAULTDEV is specified; - * they are global and override IPV6_DEFROUTE - * When both are set, the device specified in IPV6_DEFAULTGW takes preference. - */ + * they are global and override IPV6_DEFROUTE + * When both are set, the device specified in IPV6_DEFAULTGW takes preference. + */ if (network_ifcfg) { const char * ipv6_defaultgw, *ipv6_defaultdev; gs_free char *ipv6_defaultgw_to_free = NULL; @@ -2276,8 +2276,8 @@ make_ip6_setting(shvarFile *ifcfg, shvarFile *network_ifcfg, gboolean routes_rea default_dev = ipv6_defaultdev; /* If there was a global default route device specified, then only connections - * for that device can be the default connection. - */ + * for that device can be the default connection. + */ if (default_dev && v) never_default = !!strcmp(v, default_dev); } @@ -2385,8 +2385,8 @@ make_ip6_setting(shvarFile *ifcfg, shvarFile *network_ifcfg, gboolean routes_rea nm_clear_g_free(&value); v = svGetValueStr(ifcfg, "DHCPV6_HOSTNAME", &value); /* Use DHCP_HOSTNAME as fallback if it is in FQDN format and ipv6.method is - * auto or dhcp: this is required to support old ifcfg files - */ + * auto or dhcp: this is required to support old ifcfg files + */ if (!v && (!strcmp(method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) || !strcmp(method, NM_SETTING_IP6_CONFIG_METHOD_DHCP))) { @@ -2413,10 +2413,10 @@ make_ip6_setting(shvarFile *ifcfg, shvarFile *network_ifcfg, gboolean routes_rea } /* Read static IP addresses. - * Read them even for AUTO and DHCP methods - in this case the addresses are - * added to the automatic ones. Note that this is not currently supported by - * the legacy 'network' service (ifup-eth). - */ + * Read them even for AUTO and DHCP methods - in this case the addresses are + * added to the automatic ones. Note that this is not currently supported by + * the legacy 'network' service (ifup-eth). + */ ipv6addr = svGetValueStr(ifcfg, "IPV6ADDR", &ipv6addr_to_free); ipv6addr_secondaries = svGetValueStr(ifcfg, "IPV6ADDR_SECONDARIES", &ipv6addr_secondaries_to_free); @@ -2485,8 +2485,8 @@ make_ip6_setting(shvarFile *ifcfg, shvarFile *network_ifcfg, gboolean routes_rea g_object_set(s_ip6, NM_SETTING_IP6_CONFIG_TOKEN, v, NULL); /* DNS servers - * Pick up just IPv6 addresses (IPv4 addresses are taken by make_ip4_setting()) - */ + * Pick up just IPv6 addresses (IPv4 addresses are taken by make_ip4_setting()) + */ for (i = 1; i <= 10; i++) { char tag[256]; @@ -3132,11 +3132,11 @@ add_one_wep_key(shvarFile * ifcfg, } /* Remove 's:' prefix. - * Don't convert to hex string. wpa_supplicant takes 'wep_key0' option over D-Bus as byte array - * and converts it to hex string itself. Even though we convert hex string keys into a bin string - * before passing to wpa_supplicant, this prevents two unnecessary conversions. And mainly, - * ASCII WEP key doesn't change to HEX WEP key in UI, which could confuse users. - */ + * Don't convert to hex string. wpa_supplicant takes 'wep_key0' option over D-Bus as byte array + * and converts it to hex string itself. Even though we convert hex string keys into a bin string + * before passing to wpa_supplicant, this prevents two unnecessary conversions. And mainly, + * ASCII WEP key doesn't change to HEX WEP key in UI, which could confuse users. + */ key = value + 2; } } @@ -3285,8 +3285,8 @@ make_wep_setting(shvarFile *ifcfg, const char *file, GError **error) } /* If no WEP keys were given, and the keys are not agent-owned, and no - * default WEP key index was given, then the connection is unencrypted. - */ + * default WEP key index was given, then the connection is unencrypted. + */ if (!nm_setting_wireless_security_get_wep_key(s_wsec, 0) && !nm_setting_wireless_security_get_wep_key(s_wsec, 1) && !nm_setting_wireless_security_get_wep_key(s_wsec, 2) @@ -3360,10 +3360,10 @@ parse_wpa_psk(shvarFile *ifcfg, const char *file, GBytes *ssid, GError **error) size_t plen; /* Passphrase must be between 10 and 66 characters in length because WPA - * hex keys are exactly 64 characters (no quoting), and WPA passphrases - * are between 8 and 63 characters (inclusive), plus optional quoting if - * the passphrase contains spaces. - */ + * hex keys are exactly 64 characters (no quoting), and WPA passphrases + * are between 8 and 63 characters (inclusive), plus optional quoting if + * the passphrase contains spaces. + */ /* Try to get keys from the "shadow" key file */ keys_ifcfg = utils_get_keys_ifcfg(file, FALSE); @@ -3518,11 +3518,11 @@ eap_tls_reader(const char * eap_method, : NM_SETTING_802_1X_CLIENT_CERT_PASSWORD); /* In the past when the private key and client certificate - * were the same PKCS #12 file we used to write only the - * private key variable. Still support that even if it means - * that we have to look into the file content, which makes - * the connection not self-contained. - */ + * were the same PKCS #12 file we used to write only the + * private key variable. Still support that even if it means + * that we have to look into the file content, which makes + * the connection not self-contained. + */ if (!client_cert && privkey && !svGetValue(ifcfg, client_cert_var, &value_to_free)) { if (phase2) format = nm_setting_802_1x_get_phase2_private_key_format(s_8021x); @@ -3859,9 +3859,9 @@ fill_8021x(shvarFile *ifcfg, const char *file, const char *key_mgmt, gboolean wi goto next; /* Some EAP methods don't provide keying material, thus they - * cannot be used with Wi-Fi unless they are an inner method - * used with TTLS or PEAP or whatever. - */ + * cannot be used with Wi-Fi unless they are an inner method + * used with TTLS or PEAP or whatever. + */ if (wifi && eap->wifi_phase2_only) { PARSE_WARNING("ignored invalid IEEE_8021X_EAP_METHOD '%s'; not allowed for wifi", lower); @@ -4256,7 +4256,7 @@ make_wireless_setting(shvarFile *ifcfg, GError **error) if (value_len > 2 && (value_len % 2) == 0 && g_str_has_prefix(value, "0x") && NM_STRCHAR_ALL(&value[2], ch, g_ascii_isxdigit(ch))) { /* interpret the value as hex-digits iff value starts - * with "0x" followed by pairs of hex digits */ + * with "0x" followed by pairs of hex digits */ bytes = nm_utils_hexstr2bin(&value[2]); } else bytes = g_bytes_new(value, value_len); @@ -4923,7 +4923,7 @@ parse_ethtool_options(shvarFile *ifcfg, NMConnection *connection) opts = nm_utils_strsplit_set(ethtool_opts, ";"); for (iter = opts; iter && iter[0]; iter++) { /* in case of repeated wol_passwords, parse_ethtool_option() - * will do the right thing and clear wol_password before resetting. */ + * will do the right thing and clear wol_password before resetting. */ parse_ethtool_option(iter[0], &wol_flags, &wol_password, @@ -6012,8 +6012,8 @@ make_vlan_setting(shvarFile *ifcfg, const char *file, GError **error) parent = g_strndup(iface_name, v - iface_name); if (g_str_has_prefix(parent, "vlan")) { /* Like initscripts, if no PHYSDEV and we get an obviously - * invalid parent interface from DEVICE, fail. - */ + * invalid parent interface from DEVICE, fail. + */ nm_clear_g_free(&parent); } } @@ -6028,8 +6028,8 @@ make_vlan_setting(shvarFile *ifcfg, const char *file, GError **error) int device_vlan_id; /* Grab VLAN ID from interface name; this takes precedence over the - * separate VLAN_ID property for backwards compat. - */ + * separate VLAN_ID property for backwards compat. + */ device_vlan_id = _nm_utils_ascii_str_to_int64(v, 10, 0, 4095, -1); if (device_vlan_id != -1) vlan_id = device_vlan_id; @@ -6158,9 +6158,9 @@ create_unhandled_connection(const char *filename, connection = nm_simple_connection_new(); /* Get NAME, UUID, etc. We need to set a connection type (generic) and add - * an empty type-specific setting as well, to make sure it passes - * nm_connection_verify() later. - */ + * an empty type-specific setting as well, to make sure it passes + * nm_connection_verify() later. + */ s_con = make_connection_setting(filename, ifcfg, NM_SETTING_GENERIC_SETTING_NAME, NULL, NULL); nm_connection_add_setting(connection, s_con); @@ -6200,8 +6200,8 @@ check_dns_search_domains(shvarFile *ifcfg, NMSetting *s_ip4, NMSetting *s_ip6) return; /* If there is no IPv4 config or it doesn't contain DNS searches, - * read DOMAIN and put the domains into IPv6. - */ + * read DOMAIN and put the domains into IPv6. + */ if (!s_ip4 || nm_setting_ip_config_get_num_dns_searches(NM_SETTING_IP_CONFIG(s_ip4)) == 0) { /* DNS searches */ gs_free char *value = NULL; @@ -6317,8 +6317,8 @@ connection_from_file_full(const char *filename, gs_free char *t = NULL; /* Team and TeamPort types are also accepted by the mere - * presence of TEAM_CONFIG/TEAM_MASTER. They don't require - * DEVICETYPE. */ + * presence of TEAM_CONFIG/TEAM_MASTER. They don't require + * DEVICETYPE. */ t = svGetValueStr_cp(main_ifcfg, "TEAM_CONFIG"); if (t) type = g_strdup(TYPE_TEAM); @@ -6373,11 +6373,11 @@ connection_from_file_full(const char *filename, gsize i; /* network-functions detects DEVICETYPE based on the ifcfg-* name and the existence - * of a ifup script: - * [ -z "$DEVICETYPE" ] && DEVICETYPE=$(echo ${DEVICE} | sed "s/[0-9]*$//") - * later... - * OTHERSCRIPT="/etc/sysconfig/network-scripts/ifup-${DEVICETYPE}" - * */ + * of a ifup script: + * [ -z "$DEVICETYPE" ] && DEVICETYPE=$(echo ${DEVICE} | sed "s/[0-9]*$//") + * later... + * OTHERSCRIPT="/etc/sysconfig/network-scripts/ifup-${DEVICETYPE}" + * */ #define IFUP_PATH_PREFIX "/etc/sysconfig/network-scripts/ifup-" i = strlen(device); p_path = g_malloc(NM_STRLEN(IFUP_PATH_PREFIX) + i + 1); @@ -6416,9 +6416,9 @@ connection_from_file_full(const char *filename, } } else { /* For the unit tests, there won't necessarily be any - * adapters of the connection's type in the system so the - * type can't be tested with ioctls. - */ + * adapters of the connection's type in the system so the + * type can't be tested with ioctls. + */ type = g_strdup(test_type); } @@ -6534,9 +6534,9 @@ connection_from_file_full(const char *filename, nm_connection_add_setting(connection, s_tc); /* For backwards compatibility, if IPv4 is disabled or the - * config fails for some reason, we read DOMAIN and put the - * values into IPv6 config instead of IPv4. - */ + * config fails for some reason, we read DOMAIN and put the + * values into IPv6 config instead of IPv4. + */ check_dns_search_domains(main_ifcfg, s_ip4, s_ip6); s_proxy = make_proxy_setting(main_ifcfg); diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-storage.h b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-storage.h index 89de695751..1684dea828 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-storage.h +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-storage.h @@ -31,7 +31,7 @@ typedef struct { char *unrecognized_spec; /* The timestamp (stat's mtime) of the file. Newer files have - * higher priority. */ + * higher priority. */ struct timespec stat_mtime; bool dirty : 1; diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.c index d30b4586e8..bb1ea38051 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.c @@ -150,11 +150,11 @@ utils_get_ifcfg_name(const char *file, gboolean only_ifcfg) G_STMT_END /* Do not detect alias files and return 'eth0:0' instead of 'eth0'. - * Unfortunately, we cannot be sure that our files don't contain colons, - * so we cannot reject files with colons. - * - * Instead, you must not call utils_get_ifcfg_name() with an alias file - * or files that are ignored. */ + * Unfortunately, we cannot be sure that our files don't contain colons, + * so we cannot reject files with colons. + * + * Instead, you must not call utils_get_ifcfg_name() with an alias file + * or files that are ignored. */ MATCH_TAG_AND_RETURN(name, IFCFG_TAG); if (!only_ifcfg) { MATCH_TAG_AND_RETURN(name, KEYS_TAG); @@ -300,7 +300,7 @@ utils_has_route_file_new_syntax_content(const char *contents, gsize len) if (eol) { /* restore the line ending. We don't want to mangle the content from - * POV of the caller. */ + * POV of the caller. */ eol[0] = '\n'; } @@ -382,8 +382,8 @@ utils_detect_ifcfg_path(const char *path, gboolean only_ifcfg) *ptr = '\0'; if (g_file_test(ifcfg, G_FILE_TEST_EXISTS)) { /* the file has a colon, so it is probably an alias. - * To be ~more~ certain that this is an alias file, - * check whether a corresponding base file exists. */ + * To be ~more~ certain that this is an alias file, + * check whether a corresponding base file exists. */ if (only_ifcfg) return NULL; return g_steal_pointer(&ifcfg); @@ -410,8 +410,8 @@ nms_ifcfg_rh_utils_user_key_encode(const char *key, GString *str_buffer) char ch = key[i]; /* we encode the key in only upper case letters, digits, and underscore. - * As we expect lower-case letters to be more common, we encode lower-case - * letters as upper case, and upper-case letters with a leading underscore. */ + * As we expect lower-case letters to be more common, we encode lower-case + * letters as upper case, and upper-case letters with a leading underscore. */ if (ch >= '0' && ch <= '9') { g_string_append_c(str_buffer, ch); @@ -491,7 +491,7 @@ nms_ifcfg_rh_utils_user_key_decode(const char *name, GString *str_buffer) if ((ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || (ch == '.') || (ch >= 'a' && ch <= 'z')) { /* such characters are not expected to be encoded via - * octal representation. The encoding is invalid. */ + * octal representation. The encoding is invalid. */ return FALSE; } g_string_append_c(str_buffer, ch); @@ -627,17 +627,17 @@ static NM_UTILS_STRING_TABLE_LOOKUP_DEFINE( { return NM_ETHTOOL_ID_UNKNOWN; }, /* Map the names from kernel/ethtool/ifcfg to NMEthtoolID. Note that ethtool utility has built-in - * features and NetworkManager's API follows the naming of these built-in features, whenever - * they exist. - * For example, NM's "ethtool.feature-ntuple" corresponds to ethtool utility's "ntuple" - * feature. However the underlying kernel feature is called "rx-ntuple-filter" (as reported - * for ETH_SS_FEATURES). - * - * With ethtool utility, whose command line we attempt to parse here, the user can also - * specify the name of the underlying kernel feature directly. So, check whether that is - * the case and if yes, map them to the corresponding NetworkManager's features. - * - * That is why there are duplicate IDs in this list. */ + * features and NetworkManager's API follows the naming of these built-in features, whenever + * they exist. + * For example, NM's "ethtool.feature-ntuple" corresponds to ethtool utility's "ntuple" + * feature. However the underlying kernel feature is called "rx-ntuple-filter" (as reported + * for ETH_SS_FEATURES). + * + * With ethtool utility, whose command line we attempt to parse here, the user can also + * specify the name of the underlying kernel feature directly. So, check whether that is + * the case and if yes, map them to the corresponding NetworkManager's features. + * + * That is why there are duplicate IDs in this list. */ {"esp-hw-offload", NM_ETHTOOL_ID_FEATURE_ESP_HW_OFFLOAD}, {"esp-tx-csum-hw-offload", NM_ETHTOOL_ID_FEATURE_ESP_TX_CSUM_HW_OFFLOAD}, {"fcoe-mtu", NM_ETHTOOL_ID_FEATURE_FCOE_MTU}, @@ -761,9 +761,9 @@ nms_ifcfg_rh_utils_is_numbered_tag_impl(const char *key, if (key[0] == '\0') { /* The key has no number suffix. We treat this also as a numbered - * tag, and it is for certain tags like "IPADDR", but not so much - * for others like "ROUTING_RULE_". The caller may want to handle - * this case specially. */ + * tag, and it is for certain tags like "IPADDR", but not so much + * for others like "ROUTING_RULE_". The caller may want to handle + * this case specially. */ NM_SET_OUT(out_idx, -1); return TRUE; } @@ -1065,9 +1065,9 @@ nms_ifcfg_rh_utils_is_well_known_key(const char *key) if (NM_FLAGS_ANY(ti->key_flags, NMS_IFCFG_KEY_TYPE_IS_PLAIN | NMS_IFCFG_KEY_TYPE_IS_NUMBERED)) { /* These tags are valid on full match. - * - * Note that numbered tags we also treat as valid if they have no - * suffix. That is correct for "IPADDR", but less so for "ROUTING_RULE_". */ + * + * Note that numbered tags we also treat as valid if they have no + * suffix. That is correct for "IPADDR", but less so for "ROUTING_RULE_". */ return ti; } nm_assert(NM_FLAGS_HAS(ti->key_flags, NMS_IFCFG_KEY_TYPE_IS_PREFIX)); @@ -1076,8 +1076,8 @@ nms_ifcfg_rh_utils_is_well_known_key(const char *key) } /* Not found. Maybe it's a numbered/prefixed key? With idx we got the index where - * we should insert the key. Since the numbered/prefixed keys share a prefix, we can - * find the possible prefix at the index before the insert position. */ + * we should insert the key. Since the numbered/prefixed keys share a prefix, we can + * find the possible prefix at the index before the insert position. */ idx = ~idx; if (idx == 0) return NULL; diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.h b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.h index c4c0e41e32..7384fef0e1 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.h +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-utils.h @@ -22,8 +22,8 @@ typedef enum { NMS_IFCFG_KEY_TYPE_IS_PREFIX = (1u << 3), /* by default, well knowns keys that are not explicitly set - * by the writer (the unvisited, dirty ones) are removed. - * With this flag, such keys are kept if they are present. */ + * by the writer (the unvisited, dirty ones) are removed. + * With this flag, such keys are kept if they are present. */ NMS_IFCFG_KEY_TYPE_KEEP_WHEN_DIRTY = (1u << 4), } NMSIfcfgKeyTypeFlags; @@ -118,7 +118,7 @@ _nms_ifcfg_rh_utils_numbered_tag(char *buf, gsize buf_len, const char *tag_name, _nm_unused char *const _buf = (buf); \ \ /* some static assert trying to ensure that the buffer is statically allocated. - * It disallows a buffer size of sizeof(gpointer) to catch that. */ \ + * It disallows a buffer size of sizeof(gpointer) to catch that. */ \ G_STATIC_ASSERT(G_N_ELEMENTS(buf) == sizeof(buf) && sizeof(buf) != sizeof(char *) \ && sizeof(buf) < G_MAXINT); \ _nms_ifcfg_rh_utils_numbered_tag(buf, sizeof(buf), "" tag_name "", (which)); \ diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c index cf4197c0ca..6d5ad3d5ff 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c @@ -240,8 +240,8 @@ write_object(NMSetting8021x * s_8021x, extension = "pem"; /* If the object path was specified, prefer that over any raw cert data that - * may have been sent. - */ + * may have been sent. + */ if (value) { svSetValueStr(ifcfg, objtype->ifcfg_rh_key, value); return TRUE; @@ -258,14 +258,14 @@ write_object(NMSetting8021x * s_8021x, } /* If certificate/private key wasn't sent, the connection may no longer be - * 802.1x and thus we clear out the paths and certs. - * - * Since no cert/private key is now being used, delete any standard file - * that was created for this connection, but leave other files alone. - * Thus, for example, - * /etc/sysconfig/network-scripts/ca-cert-Test_Write_Wifi_WPA_EAP-TLS.der - * will be deleted, but /etc/pki/tls/cert.pem will not. - */ + * 802.1x and thus we clear out the paths and certs. + * + * Since no cert/private key is now being used, delete any standard file + * that was created for this connection, but leave other files alone. + * Thus, for example, + * /etc/sysconfig/network-scripts/ca-cert-Test_Write_Wifi_WPA_EAP-TLS.der + * will be deleted, but /etc/pki/tls/cert.pem will not. + */ standard_file = utils_cert_path(svFileGetName(ifcfg), objtype->vtable->file_suffix, extension); g_hash_table_replace(blobs, standard_file, NULL); svSetValue(ifcfg, objtype->ifcfg_rh_key, force_write ? "" : NULL); @@ -292,9 +292,9 @@ write_blobs(GHashTable *blobs, GError **error) } /* Write the raw certificate data out to the standard file so that we - * can use paths from now on instead of pushing around the certificate - * data itself. - */ + * can use paths from now on instead of pushing around the certificate + * data itself. + */ if (!nm_utils_file_set_contents(filename, (const char *) g_bytes_get_data(blob, NULL), g_bytes_get_size(blob), @@ -348,11 +348,11 @@ write_8021x_certs(NMSetting8021x *s_8021x, return FALSE; /* Save the client certificate. - * If there is a private key, always write a property for the - * client certificate even if it is empty, so that the reader - * doesn't have to read the private key file to determine if it - * is a PKCS #12 one which serves also as client certificate. - */ + * If there is a private key, always write a property for the + * client certificate even if it is empty, so that the reader + * doesn't have to read the private key file to determine if it + * is a PKCS #12 one which serves also as client certificate. + */ if (!write_object( s_8021x, ifcfg, @@ -690,9 +690,9 @@ write_wireless_security_setting(NMConnection *connection, gboolean key_valid = TRUE; /* Passphrase needs a different ifcfg key since with WEP, there - * are some passphrases that are indistinguishable from WEP hex - * keys. - */ + * are some passphrases that are indistinguishable from WEP hex + * keys. + */ if (key_type == NM_WEP_KEY_TYPE_UNKNOWN) { if (nm_utils_wep_key_valid(key, NM_WEP_KEY_TYPE_KEY)) key_type = NM_WEP_KEY_TYPE_KEY; @@ -746,8 +746,8 @@ write_wireless_security_setting(NMConnection *connection, cipher = nm_setting_wireless_security_get_pairwise(s_wsec, i); /* Don't write out WEP40 or WEP104 if for some reason they are set; they - * are not valid pairwise ciphers. - */ + * are not valid pairwise ciphers. + */ if (strcmp(cipher, "wep40") && strcmp(cipher, "wep104")) { tmp = g_ascii_strup(cipher, -1); g_string_append(str, tmp); @@ -870,8 +870,8 @@ write_wireless_setting(NMConnection *connection, } /* If the SSID contains any non-printable characters, we need to use the - * hex notation of the SSID instead. - */ + * hex notation of the SSID instead. + */ if (ssid_len > 2 && ssid_data[0] == '0' && ssid_data[1] == 'x') { hex_ssid = TRUE; for (i = 2; i < ssid_len; i++) { @@ -941,9 +941,9 @@ write_wireless_setting(NMConnection *connection, svSetValueStr(ifcfg, "BSSID", bssid); /* Ensure DEFAULTKEY and SECURITYMODE are cleared unless there's security; - * otherwise there's no way to detect WEP vs. open when WEP keys aren't - * saved. - */ + * otherwise there's no way to detect WEP vs. open when WEP keys aren't + * saved. + */ if (nm_connection_get_setting_wireless_security(connection)) { if (!write_wireless_security_setting(connection, ifcfg, secrets, adhoc, no_8021x, error)) @@ -1127,7 +1127,7 @@ write_wired_setting(NMConnection *connection, shvarFile *ifcfg, GError **error) if (strchr(s390_key, '=')) { /* this key cannot be expressed. But after all, it's not valid anyway - * and the connection shouldn't even verify. */ + * and the connection shouldn't even verify. */ continue; } @@ -1190,10 +1190,10 @@ write_ethtool_setting(NMConnection *connection, shvarFile *ifcfg, GError **error duplex = nm_setting_wired_get_duplex(s_wired); /* autoneg off + speed 0 + duplex NULL, means we want NM - * to skip link configuration which is default. So write - * down link config only if we have auto-negotiate true or - * a valid value for one among speed and duplex. - */ + * to skip link configuration which is default. So write + * down link config only if we have auto-negotiate true or + * a valid value for one among speed and duplex. + */ if (auto_negotiate) { str = g_string_sized_new(64); g_string_printf(str, "autoneg on"); @@ -2089,8 +2089,8 @@ write_connection_setting(NMSettingConnection *s_con, shvarFile *ifcfg) const char *puser = NULL; /* Items separated by space for consistency with eg - * IPV6ADDR_SECONDARIES and DOMAIN. - */ + * IPV6ADDR_SECONDARIES and DOMAIN. + */ if (str->len) g_string_append_c(str, ' '); @@ -2117,7 +2117,7 @@ write_connection_setting(NMSettingConnection *s_con, shvarFile *ifcfg) master = nm_setting_connection_get_master(s_con); if (master) { /* The reader prefers the *_UUID variants, however we still try to resolve - * it into an interface name, so that legacy tooling is not confused. */ + * it into an interface name, so that legacy tooling is not confused. */ if (!nm_utils_get_testing()) { /* This is conditional for easier testing. */ master_iface = nm_manager_iface_for_uuid(NM_MANAGER_GET, master); @@ -2166,8 +2166,8 @@ write_connection_setting(NMSettingConnection *s_con, shvarFile *ifcfg) const char *uuid; /* Items separated by space for consistency with eg - * IPV6ADDR_SECONDARIES and DOMAIN. - */ + * IPV6ADDR_SECONDARIES and DOMAIN. + */ if (str->len) g_string_append_c(str, ' '); @@ -2271,7 +2271,7 @@ get_route_attributes_string(NMIPRoute *route, int family) g_string_append_printf(str, "%s lock 0", n); } else { /* we also have a corresponding attribute with the numeric value. The - * lock setting is handled above. */ + * lock setting is handled above. */ } } else if (nm_streq(names[i], NM_IP_ROUTE_ATTRIBUTE_SCOPE)) { g_string_append_printf(str, "%s %u", names[i], (unsigned) g_variant_get_byte(attr)); @@ -2688,7 +2688,7 @@ write_ip4_setting(NMConnection *connection, svSetValueStr(ifcfg, "BOOTPROTO", "dhcp"); else if (!strcmp(method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) { /* Preserve the archaic form of "static" if there actually - * is static configuration. */ + * is static configuration. */ if (g_strcmp0(svGetValue(ifcfg, "BOOTPROTO", &tmp), "static") || !num) svSetValueStr(ifcfg, "BOOTPROTO", "none"); g_free(tmp); @@ -2700,8 +2700,8 @@ write_ip4_setting(NMConnection *connection, has_netmask = !!svFindFirstNumberedKey(ifcfg, "NETMASK"); /* Write out IPADDR<n>, PREFIX<n>, GATEWAY<n> for current IP addresses - * without labels. Unset obsolete NETMASK<n>. - */ + * without labels. Unset obsolete NETMASK<n>. + */ for (i = n = 0; i < num; i++) { NMIPAddress *addr; guint prefix; @@ -2718,10 +2718,10 @@ write_ip4_setting(NMConnection *connection, if (n == 0) { /* Instead of index 0 use un-numbered variables. - * It's needed for compatibility with ifup that only recognizes 'GATEAWAY' - * See https://bugzilla.redhat.com/show_bug.cgi?id=771673 - * and https://bugzilla.redhat.com/show_bug.cgi?id=1105770 - */ + * It's needed for compatibility with ifup that only recognizes 'GATEAWAY' + * See https://bugzilla.redhat.com/show_bug.cgi?id=771673 + * and https://bugzilla.redhat.com/show_bug.cgi?id=1105770 + */ j = -1; } else j = n; @@ -2778,8 +2778,8 @@ write_ip4_setting(NMConnection *connection, svSetValueInt64_cond(ifcfg, "DHCP_HOSTNAME_FLAGS", flags != NM_DHCP_HOSTNAME_FLAG_NONE, flags); /* Missing DHCP_SEND_HOSTNAME means TRUE, and we prefer not write it explicitly - * in that case, because it is NM-specific variable - */ + * in that case, because it is NM-specific variable + */ svSetValueStr(ifcfg, "DHCP_SEND_HOSTNAME", nm_setting_ip_config_get_dhcp_send_hostname(s_ip4) ? NULL : "no"); @@ -2984,8 +2984,8 @@ write_ip6_setting(NMConnection *connection, svSetValueStr(ifcfg, "DHCPV6_HOSTNAME", hostname); /* Missing DHCPV6_SEND_HOSTNAME means TRUE, and we prefer not write it - * explicitly in that case, because it is NM-specific variable - */ + * explicitly in that case, because it is NM-specific variable + */ if (!nm_setting_ip_config_get_dhcp_send_hostname(s_ip6)) svSetValueStr(ifcfg, "DHCPV6_SEND_HOSTNAME", "no"); @@ -3431,8 +3431,8 @@ do_write_to_disk(NMConnection *connection, GError ** error) { /* From here on, we persist data to disk. Before, it was all in-memory - * only. But we loaded the ifcfg files from disk, and managled our - * new settings (in-memory). */ + * only. But we loaded the ifcfg files from disk, and managled our + * new settings (in-memory). */ if (!svWriteFileWithoutDirtyWellknown(ifcfg, 0644, error)) return FALSE; @@ -3544,13 +3544,13 @@ nms_ifcfg_rh_writer_write_connection(NMConnection * connection, return FALSE; /* Note that we just wrote the connection to disk, and re-read it from there. - * That is racy if somebody else modifies the connection. - * That race is why we must not tread a failure to re-read the profile - * as an error. - * - * FIXME: a much better solution might be, to re-read the connection only based - * on the in-memory representation of what we collected above. But the reader - * does not yet allow to inject the configuration. */ + * That is racy if somebody else modifies the connection. + * That race is why we must not tread a failure to re-read the profile + * as an error. + * + * FIXME: a much better solution might be, to re-read the connection only based + * on the in-memory representation of what we collected above. But the reader + * does not yet allow to inject the configuration. */ if (out_reread || out_reread_same) { gs_unref_object NMConnection *reread = NULL; gboolean reread_same = FALSE; diff --git a/src/settings/plugins/ifcfg-rh/shvar.c b/src/settings/plugins/ifcfg-rh/shvar.c index d31654eccf..2bab914f68 100644 --- a/src/settings/plugins/ifcfg-rh/shvar.c +++ b/src/settings/plugins/ifcfg-rh/shvar.c @@ -29,28 +29,28 @@ struct _shvarLine { CList lst; /* We index variables by their key in shvarFile.lst_idx. One shell variable might - * occur multiple times in a file (in which case the last occurrence wins). - * Hence, we need to keep a list of all the same keys. - * - * This is a pointer to the next shadowed line. */ + * occur multiple times in a file (in which case the last occurrence wins). + * Hence, we need to keep a list of all the same keys. + * + * This is a pointer to the next shadowed line. */ struct _shvarLine *prev_shadowed; /* There are three cases: - * - * 1) the line is not a valid variable assignment (that is, it doesn't - * start with a "FOO=" with possible whitespace prefix). - * In that case, @key and @key_with_prefix are %NULL, and the entire - * original line is in @line. Such entries are ignored for the most part. - * - * 2) if the line can be parsed with a "FOO=" assignment, then @line contains - * the part after '=', @key_with_prefix contains the key "FOO" with possible - * whitespace prefix, and @key points into @key_with_prefix skipping over the - * whitespace. - * - * 3) like 2, but if the value was deleted via svSetValue(), the entry is not removed, - * but only marked for deletion. That is done by clearing @line but preserving - * @key/@key_with_prefix. - * */ + * + * 1) the line is not a valid variable assignment (that is, it doesn't + * start with a "FOO=" with possible whitespace prefix). + * In that case, @key and @key_with_prefix are %NULL, and the entire + * original line is in @line. Such entries are ignored for the most part. + * + * 2) if the line can be parsed with a "FOO=" assignment, then @line contains + * the part after '=', @key_with_prefix contains the key "FOO" with possible + * whitespace prefix, and @key points into @key_with_prefix skipping over the + * whitespace. + * + * 3) like 2, but if the value was deleted via svSetValue(), the entry is not removed, + * but only marked for deletion. That is done by clearing @line but preserving + * @key/@key_with_prefix. + * */ char *line; char *key_with_prefix; @@ -236,9 +236,9 @@ svEscape(const char *s, char **to_free) requires_quotes = TRUE; else if (s[slen] < ' ') { /* if the string contains newline we can only express it using ANSI C quotation - * (as we don't support line continuation). - * Additionally, ANSI control characters look odd with regular quotation, so handle - * them too. */ + * (as we don't support line continuation). + * Additionally, ANSI control characters look odd with regular quotation, so handle + * them too. */ return (*to_free = _escape_ansic(s)); } } @@ -325,18 +325,18 @@ _gstr_init(GString **str, const char *value, gsize i) if (!(*str)) { /* if @str is not yet initialized, it allocates - * a new GString and copies @i characters from - * @value over. - * - * Unescaping usually does not extend the length of a string, - * so we might be tempted to allocate a fixed buffer of length - * (strlen(value)+CONST). - * However, due to $'\Ux' escapes, the maximum length is some - * (FACTOR*strlen(value) + CONST), which is non trivial to get - * right in all cases. Also, we would have to provision for the - * very unlikely extreme case. - * Instead, use a GString buffer which can grow as needed. But for an - * initial guess, strlen(value) is a good start */ + * a new GString and copies @i characters from + * @value over. + * + * Unescaping usually does not extend the length of a string, + * so we might be tempted to allocate a fixed buffer of length + * (strlen(value)+CONST). + * However, due to $'\Ux' escapes, the maximum length is some + * (FACTOR*strlen(value) + CONST), which is non trivial to get + * right in all cases. Also, we would have to provision for the + * very unlikely extreme case. + * Instead, use a GString buffer which can grow as needed. But for an + * initial guess, strlen(value) is a good start */ *str = g_string_new_len(NULL, strlen(value) + 3); if (i) g_string_append_len(*str, value, i); @@ -351,7 +351,7 @@ svUnescape(const char *value, char **to_free) int looks_like_old_svescaped = -1; /* we handle bash syntax here (note that ifup has #!/bin/bash. - * Thus, see https://www.gnu.org/software/bash/manual/html_node/Quoting.html#Quoting */ + * Thus, see https://www.gnu.org/software/bash/manual/html_node/Quoting.html#Quoting */ /* @value shall start with the first character after "FOO=" */ @@ -359,7 +359,7 @@ svUnescape(const char *value, char **to_free) nm_assert(to_free); /* we don't expect any newlines. They must be filtered out before-hand. - * We also don't support line continuation. */ + * We also don't support line continuation. */ nm_assert(!NM_STRCHAR_ANY(value, ch, ch == '\n')); i = 0; @@ -371,19 +371,19 @@ svUnescape(const char *value, char **to_free) gboolean has_semicolon = (value[i] == ';'); /* starting with space is only allowed, if the entire - * string consists of spaces (possibly terminated by a comment). - * This disallows for example - * LANG=C ls -1 - * LANG= ls -1 - * but allows - * LANG= #comment - * - * As a special case, we also allow one trailing semicolon, as long - * it is only followed by whitespace or a #-comment. - * FOO=; - * FOO=a; - * FOO=b ; #hallo - */ + * string consists of spaces (possibly terminated by a comment). + * This disallows for example + * LANG=C ls -1 + * LANG= ls -1 + * but allows + * LANG= #comment + * + * As a special case, we also allow one trailing semicolon, as long + * it is only followed by whitespace or a #-comment. + * FOO=; + * FOO=a; + * FOO=b ; #hallo + */ j = i + 1; while (g_ascii_isspace(value[j]) || (!has_semicolon && (has_semicolon = (value[j] == ';')))) @@ -452,17 +452,17 @@ svUnescape(const char *value, char **to_free) /* Drop the backslash. */ } else if (NM_IN_SET(value[i], '\'', '~')) { /* '\'' and '~' in double quotes are not handled special by shell. - * However, old versions of svEscape() would wrongly use double-quoting - * with backslash escaping for these characters (expecting svUnescape() - * to remove the backslash). - * - * In order to preserve previous behavior, we continue to read such - * strings different then shell does. */ + * However, old versions of svEscape() would wrongly use double-quoting + * with backslash escaping for these characters (expecting svUnescape() + * to remove the backslash). + * + * In order to preserve previous behavior, we continue to read such + * strings different then shell does. */ /* Actually, we can relax this. Old svEscape() escaped the entire value - * in a particular way with double quotes. - * If the value doesn't exactly look like something as created by svEscape(), - * don't do the compat hack and preserve the backslash. */ + * in a particular way with double quotes. + * If the value doesn't exactly look like something as created by svEscape(), + * don't do the compat hack and preserve the backslash. */ if (looks_like_old_svescaped < 0) looks_like_old_svescaped = _looks_like_old_svescaped(value); if (!looks_like_old_svescaped) @@ -598,7 +598,7 @@ loop_ansic_next:; if (NM_IN_SET(value[i], '|', '&', '(', ')', '<', '>')) { /* shell metacharacters are not supported without quoting. - * Note that ';' is already handled above. */ + * Note that ';' is already handled above. */ goto out_error; } @@ -687,8 +687,8 @@ void _nmtst_svFileSetName(shvarFile *s, const char *fileName) { /* changing the file name is not supported for regular - * operation. Only allowed to use in tests, otherwise, - * the filename is immutable. */ + * operation. Only allowed to use in tests, otherwise, + * the filename is immutable. */ g_free(s->fileName); s->fileName = g_strdup(fileName); } @@ -842,9 +842,9 @@ _line_link_parse(shvarFile *s, const char *value, gsize len) shvarLine *existing_val; /* Slow-path: we have duplicate keys. Fix the mess we created. - * Unfortunately, g_hash_table_insert() now had to allocate an extra - * array to track the keys/values differently. I wish there was an - * GHashTable API to add a key only if it does not exist yet. */ + * Unfortunately, g_hash_table_insert() now had to allocate an extra + * array to track the keys/values differently. I wish there was an + * GHashTable API to add a key only if it does not exist yet. */ if (!g_hash_table_lookup_extended(s->lst_idx, line, @@ -922,7 +922,7 @@ svOpenFileInternal(const char *name, gboolean create, GError **error) } /* closefd is set if we opened the file read-only, so go ahead and - * close it, because we can't write to it anyway */ + * close it, because we can't write to it anyway */ nm_assert(closefd || fd >= 0); return svFile_new(name, !closefd ? nm_steal_fd(&fd) : -1, content); } @@ -1018,7 +1018,7 @@ svGetKeys(shvarFile *s, SvKeyType match_key_type) line = c_list_entry(current, shvarLine, lst); if (line->key && line->line && _svKeyMatchesType(line->key, match_key_type)) { /* we don't clone the keys. The keys are only valid - * until @s gets modified. */ + * until @s gets modified. */ if (!keys) keys = g_hash_table_new_full(nm_str_hash, g_str_equal, NULL, NULL); g_hash_table_add(keys, (gpointer) line->key); @@ -1096,8 +1096,8 @@ _svGetValue(shvarFile *s, const char *key, char **to_free) v = svUnescape(line->line, to_free); if (!v) { /* a wrongly quoted value is treated like the empty string. - * See also svWriteFile(), which handles unparsable values - * that way. */ + * See also svWriteFile(), which handles unparsable values + * that way. */ nm_assert(!*to_free); return ""; } @@ -1248,7 +1248,7 @@ svGetValueInt64(shvarFile *s, const char *key, guint base, gint64 min, gint64 ma if (!value) { nm_assert(!to_free); /* indicate that the key does not exist (or has a syntax error - * and svUnescape() failed). */ + * and svUnescape() failed). */ errno = ENOKEY; return fallback; } @@ -1273,7 +1273,7 @@ svGetValueEnum(shvarFile *s, const char *key, GType gtype, int *out_value, GErro svalue = _svGetValue(s, key, &to_free); if (!svalue) { /* don't touch out_value. The caller is supposed - * to initialize it with the default value. */ + * to initialize it with the default value. */ return TRUE; } @@ -1367,7 +1367,7 @@ svSetValue(shvarFile *s, const char *key, const char *value) line = g_hash_table_lookup(s->lst_idx, &key); if (line && (l_shadowed = line->prev_shadowed)) { /* if we find multiple entries for the same key, we can - * delete the shadowed ones. */ + * delete the shadowed ones. */ line->prev_shadowed = NULL; changed = TRUE; do { @@ -1381,7 +1381,7 @@ svSetValue(shvarFile *s, const char *key, const char *value) if (!value) { if (line) { /* We only clear the value, but leave the line entry. This way, if we - * happen to re-add the value, we write it to the same line again. */ + * happen to re-add the value, we write it to the same line again. */ if (nm_clear_g_free(&line->line)) { changed = TRUE; } diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c index 1a924cbd57..7ed6dd11d1 100644 --- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c +++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c @@ -97,9 +97,9 @@ _assert_reread_same_FIXME(NMConnection *connection, NMConnection *reread) gs_unref_hashtable GHashTable *settings = NULL; /* FIXME: these assertion failures should not happen as we expect - * that re-reading a connection after write yields the same result. - * - * Needs investigation and fixing. */ + * that re-reading a connection after write yields the same result. + * + * Needs investigation and fixing. */ nmtst_assert_connection_verifies_without_normalization(reread); connection_normalized = nmtst_connection_duplicate_and_normalize(connection); @@ -170,7 +170,7 @@ _assert_expected_content(NMConnection *connection, const char *filename, const c } /* other '$' is not supported. If need be, support escaping of - * '$' via '$$'. */ + * '$' via '$$'. */ g_assert_not_reached(); } } @@ -623,9 +623,9 @@ test_read_basic(void) g_assert_cmpint(nm_setting_connection_get_autoconnect_retries(s_con), ==, -1); /* UUID can't be tested if the ifcfg does not contain the UUID key, because - * the UUID is generated on the full path of the ifcfg file, which can change - * depending on where the tests are run. - */ + * the UUID is generated on the full path of the ifcfg file, which can change + * depending on where the tests are run. + */ /* ===== WIRED SETTING ===== */ s_wired = nm_connection_get_setting_wired(connection); @@ -2145,8 +2145,8 @@ test_read_802_1x_ttls_eapgtc(void) NMSetting8021x *s_8021x; /* Test that EAP-* inner methods are correctly read into the - * NMSetting8021x::autheap property. - */ + * NMSetting8021x::autheap property. + */ connection = _connection_from_file(TEST_IFCFG_DIR "/ifcfg-test-wired-802-1x-ttls-eapgtc", NULL, @@ -2601,9 +2601,9 @@ test_read_wifi_open(void) g_assert_cmpstr(nm_setting_connection_get_id(s_con), ==, "System blahblah (test-wifi-open)"); /* UUID can't be tested if the ifcfg does not contain the UUID key, because - * the UUID is generated on the full path of the ifcfg file, which can change - * depending on where the tests are run. - */ + * the UUID is generated on the full path of the ifcfg file, which can change + * depending on where the tests are run. + */ g_assert_cmpint(nm_setting_connection_get_timestamp(s_con), ==, 0); g_assert(nm_setting_connection_get_autoconnect(s_con)); @@ -2812,9 +2812,9 @@ test_read_wifi_wep(void) g_assert_cmpstr(nm_setting_connection_get_id(s_con), ==, "System blahblah (test-wifi-wep)"); /* UUID can't be tested if the ifcfg does not contain the UUID key, because - * the UUID is generated on the full path of the ifcfg file, which can change - * depending on where the tests are run. - */ + * the UUID is generated on the full path of the ifcfg file, which can change + * depending on where the tests are run. + */ g_assert_cmpint(nm_setting_connection_get_timestamp(s_con), ==, 0); g_assert(nm_setting_connection_get_autoconnect(s_con)); @@ -2895,9 +2895,9 @@ test_read_wifi_wep_adhoc(void) "System blahblah (test-wifi-wep-adhoc)"); /* UUID can't be tested if the ifcfg does not contain the UUID key, because - * the UUID is generated on the full path of the ifcfg file, which can change - * depending on where the tests are run. - */ + * the UUID is generated on the full path of the ifcfg file, which can change + * depending on where the tests are run. + */ g_assert(!nm_setting_connection_get_autoconnect(s_con)); @@ -3181,9 +3181,9 @@ test_read_wifi_wpa_psk(void) g_assert_cmpstr(nm_setting_connection_get_id(s_con), ==, "System blahblah (test-wifi-wpa-psk)"); /* UUID can't be tested if the ifcfg does not contain the UUID key, because - * the UUID is generated on the full path of the ifcfg file, which can change - * depending on where the tests are run. - */ + * the UUID is generated on the full path of the ifcfg file, which can change + * depending on where the tests are run. + */ g_assert_cmpint(nm_setting_connection_get_timestamp(s_con), ==, 0); g_assert(nm_setting_connection_get_autoconnect(s_con)); @@ -3710,8 +3710,8 @@ test_read_wifi_dynamic_wep_leap(void) g_assert_cmpstr(nm_setting_wireless_security_get_key_mgmt(s_wsec), ==, "ieee8021x"); /* Auth alg should be NULL (open) for dynamic WEP with LEAP as the EAP method; - * only "old-school" LEAP uses 'leap' for the auth alg. - */ + * only "old-school" LEAP uses 'leap' for the auth alg. + */ g_assert_cmpstr(nm_setting_wireless_security_get_auth_alg(s_wsec), ==, NULL); /* Expect no old-school LEAP username/password, that'll be in the 802.1x setting */ @@ -4508,9 +4508,9 @@ test_read_wifi_wep_no_keys(void) "System foobar (test-wifi-wep-no-keys)"); /* UUID can't be tested if the ifcfg does not contain the UUID key, because - * the UUID is generated on the full path of the ifcfg file, which can change - * depending on where the tests are run. - */ + * the UUID is generated on the full path of the ifcfg file, which can change + * depending on where the tests are run. + */ /* ===== WIRELESS SETTING ===== */ @@ -4592,8 +4592,8 @@ test_read_wifi_wep_agent_keys(void) NULL); /* Ensure the connection is still marked for wifi security even though - * we don't have any WEP keys because they are agent owned. - */ + * we don't have any WEP keys because they are agent owned. + */ /* ===== WIRELESS SETTING ===== */ s_wifi = nm_connection_get_setting_wireless(connection); @@ -5513,9 +5513,9 @@ test_read_write_static_routes_legacy(void) g_assert(!nm_setting_ip_config_get_never_default(s_ip4)); /* Save the ifcfg; use a special different scratch dir to ensure that - * we can clean up after the written connection in both the original - * source tree and for 'make distcheck'. - */ + * we can clean up after the written connection in both the original + * source tree and for 'make distcheck'. + */ _writer_new_connec_exp(connection, TEST_SCRATCH_DIR_TMP, TEST_IFCFG_DIR "/ifcfg-test-static-routes-legacy.cexpected", @@ -5637,8 +5637,8 @@ test_write_wired_static_routes(void) &reread, &reread_same); /* ifcfg does not support setting onlink=0. It gets lost during write+re-read. - * Assert that it's missing, and patch it to check whether the rest of the - * connection equals. */ + * Assert that it's missing, and patch it to check whether the rest of the + * connection equals. */ g_assert(!reread_same); nmtst_assert_connection_verifies_without_normalization(reread); s_ip4 = nm_connection_get_setting_ip4_config(reread); @@ -5860,9 +5860,9 @@ test_write_wired_8021x_tls(gconstpointer test_data) nmtst_file_unlink_if_exists(keyfile); /* Ensure the reread connection's certificates and private key are paths; no - * matter what scheme was used in the original connection they will be read - * back in as paths. - */ + * matter what scheme was used in the original connection they will be read + * back in as paths. + */ s_8021x = nm_connection_get_setting_802_1x(reread); g_assert(s_8021x); g_assert_cmpint(nm_setting_802_1x_get_ca_cert_scheme(s_8021x), @@ -5888,16 +5888,16 @@ test_write_wired_8021x_tls(gconstpointer test_data) if (scheme == NM_SETTING_802_1X_CK_SCHEME_PATH) { /* Do a direct compare if using the path scheme since then the - * certificate and key properties should be the same. If using blob - * scheme the original connection cert/key properties will be blobs - * but the re-read connection is always path scheme, so we wouldn't - * expect it to compare successfully. - */ + * certificate and key properties should be the same. If using blob + * scheme the original connection cert/key properties will be blobs + * but the re-read connection is always path scheme, so we wouldn't + * expect it to compare successfully. + */ if (flags != NM_SETTING_SECRET_FLAG_NONE) { /* Clear original connection's private key password because flags - * say it's not system-owned, and therefore it should not show up - * in the re-read connection. - */ + * say it's not system-owned, and therefore it should not show up + * in the re-read connection. + */ s_8021x = nm_connection_get_setting_802_1x(connection); g_object_set(s_8021x, NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD, NULL, NULL); } @@ -6013,9 +6013,9 @@ test_write_wired_aliases(void) nmtst_file_unlink(TEST_SCRATCH_ALIAS_BASE ":3"); /* nm_connection_compare() is not guaranteed to succeed, because the - * aliases get read back in essentially random order. So just - * verify the aliases manually. - */ + * aliases get read back in essentially random order. So just + * verify the aliases manually. + */ s_ip4 = nm_connection_get_setting_ip4_config(connection); g_assert(nm_setting_ip_config_get_num_addresses(s_ip4) == num_addresses); @@ -6961,8 +6961,8 @@ test_write_wifi_leap_secret_flags(gconstpointer data) g_assert(g_file_test(keyfile, G_FILE_TEST_EXISTS) == FALSE); /* Remove the LEAP password from the original connection since it wont' be - * in the reread connection, as the password is not system owned. - */ + * in the reread connection, as the password is not system owned. + */ g_object_set(s_wsec, NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD, NULL, NULL); nmtst_assert_connection_equals(connection, TRUE, reread, FALSE); } @@ -7585,8 +7585,8 @@ test_write_wifi_wpa_then_open(void) const char * ssid_data = "blahblah"; /* Test that writing out a WPA config then changing that to an open - * config doesn't leave various WPA-related keys lying around in the ifcfg. - */ + * config doesn't leave various WPA-related keys lying around in the ifcfg. + */ connection = nm_simple_connection_new(); @@ -7700,8 +7700,8 @@ test_write_wifi_wpa_then_wep_with_perms(void) const char * ssid_data = "SomeSSID"; /* Test that writing out a WPA config then changing that to a WEP - * config works and doesn't cause infinite loop or other issues. - */ + * config works and doesn't cause infinite loop or other issues. + */ connection = nm_simple_connection_new(); g_assert(connection); @@ -7906,9 +7906,9 @@ test_write_wifi_dynamic_wep_leap(void) nmtst_assert_connection_equals(connection, TRUE, reread, FALSE); /* Check and make sure that an "old-school" LEAP (Network EAP) connection - * did not get written. Check first that the auth alg is not set to "LEAP" - * and next that the only IEEE 802.1x EAP method is "LEAP". - */ + * did not get written. Check first that the auth alg is not set to "LEAP" + * and next that the only IEEE 802.1x EAP method is "LEAP". + */ ifcfg = _svOpenFile(testfile); _svGetValue_check(ifcfg, "SECURITYMODE", NULL); _svGetValue_check(ifcfg, "IEEE_8021X_EAP_METHODS", "LEAP"); @@ -8210,10 +8210,10 @@ test_write_wifi_wep_agent_keys(void) reread = _connection_from_file(testfile, NULL, TYPE_WIRELESS, NULL); /* Remove the WEP key from the original, because it should not have been - * written out to disk as it was agent-owned. The new connection should - * not have any WEP keys set. - * Also the new connection should not have WEP key type set. - */ + * written out to disk as it was agent-owned. The new connection should + * not have any WEP keys set. + * Also the new connection should not have WEP key type set. + */ nm_setting_wireless_security_set_wep_key(s_wsec, 0, NULL); g_object_set(s_wsec, NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, NM_WEP_KEY_TYPE_UNKNOWN, NULL); @@ -9041,9 +9041,9 @@ test_write_ethernet_missing_ipv6(void) /* IP6 setting */ /* - * We intentionally don't add IPv6 setting here. ifcfg-rh plugin should regard - * missing IPv6 as IPv6 with NM_SETTING_IP6_CONFIG_METHOD_AUTO method. - */ + * We intentionally don't add IPv6 setting here. ifcfg-rh plugin should regard + * missing IPv6 as IPv6 with NM_SETTING_IP6_CONFIG_METHOD_AUTO method. + */ nmtst_assert_connection_verifies(connection); @@ -10379,9 +10379,9 @@ do_svUnescape_combine_ansi_append(GString * str_val, g_string_append(str_exp, data->exp); if (honor_needs_ascii_separator && data->needs_ascii_separator) { /* the string has an open escape sequence. We must ensure that when - * combining it with another sequence, that they don't merge into - * something different. for example "\xa" + "a" must not result in - * "\xaa". Instead, we add a space in between to get "\xa a". */ + * combining it with another sequence, that they don't merge into + * something different. for example "\xa" + "a" must not result in + * "\xaa". Instead, we add a space in between to get "\xa a". */ g_string_append(str_val, " "); g_string_append(str_exp, " "); } @@ -10500,7 +10500,7 @@ test_svUnescape(void) V1("\"aa\\\"\"b", "aa\"b"), /* the following is not shell behavior, but kept for backward compatibility - * with old svEscape(). */ + * with old svEscape(). */ V0("\"\\'\"", "'"), V0("\"\\~\"", "~"), V0("\"b\\~b\"", "b~b"), @@ -10508,7 +10508,7 @@ test_svUnescape(void) V0("\"\\~\\'\"", "~'"), /* the following is shell-behavior, because it doesn't look like written - * by old svEscape(). */ + * by old svEscape(). */ V1("\"\\~~\"", "\\~~"), V1("\"\\a\\'\"", "\\a\\'"), V1("x\"\\~\"", "x\\~"), @@ -10518,7 +10518,7 @@ test_svUnescape(void) }; const UnescapeTestData data_ansi[] = { /* strings inside $''. They cannot be compared directly, but must - * be wrapped by do_svUnescape_combine_ansi(). */ + * be wrapped by do_svUnescape_combine_ansi(). */ V1("", ""), V1("a", "a"), V1("b", "b"), @@ -10732,9 +10732,9 @@ test_read_vlan_trailing_spaces(void) char * contents = NULL; /* Ensure there is whitespace at the end of the VLAN interface name, - * to prevent the whitespace getting stripped off and committed mistakenly - * by something in the future. - */ + * to prevent the whitespace getting stripped off and committed mistakenly + * by something in the future. + */ success = g_file_get_contents(testfile, &contents, NULL, &error); g_assert_no_error(error); g_assert(success); diff --git a/src/settings/plugins/ifupdown/nms-ifupdown-interface-parser.c b/src/settings/plugins/ifupdown/nms-ifupdown-interface-parser.c index 071116596d..25090d1aee 100644 --- a/src/settings/plugins/ifupdown/nms-ifupdown-interface-parser.c +++ b/src/settings/plugins/ifupdown/nms-ifupdown-interface-parser.c @@ -74,7 +74,7 @@ add_data(if_parser *parser, const char *key, const char *data) memcpy((char *) ifd->data, data, l_data); /* Normalize keys. Convert '_' to '-', as ifupdown accepts both variants. - * When querying keys via ifparser_getkey(), use '-'. */ + * When querying keys via ifparser_getkey(), use '-'. */ idx = (char *) ifd->key; while ((idx = strchr(idx, '_'))) *(idx++) = '-'; @@ -184,8 +184,8 @@ _recursive_ifparser(if_parser *parser, const char *eni_file, int quiet) } /* There are six different stanzas: - * iface, mapping, auto, allow-*, source, and source-directory. - * Create a block for each of them except source and source-directory. */ + * iface, mapping, auto, allow-*, source, and source-directory. + * Create a block for each of them except source and source-directory. */ /* iface stanza takes at least 3 parameters */ if (nm_streq(token[0], "iface")) { @@ -200,7 +200,7 @@ _recursive_ifparser(if_parser *parser, const char *eni_file, int quiet) add_data(parser, token[2], join_values_with_spaces(value, token + 3)); } /* auto and allow-auto stanzas are equivalent, - * both can take multiple interfaces as parameters: add one block for each */ + * both can take multiple interfaces as parameters: add one block for each */ else if (NM_IN_STRSET(token[0], "auto", "allow-auto")) { int i; diff --git a/src/settings/plugins/ifupdown/nms-ifupdown-plugin.c b/src/settings/plugins/ifupdown/nms-ifupdown-plugin.c index f96aee3616..2379dd7381 100644 --- a/src/settings/plugins/ifupdown/nms-ifupdown-plugin.c +++ b/src/settings/plugins/ifupdown/nms-ifupdown-plugin.c @@ -31,8 +31,8 @@ typedef struct { typedef struct { /* Stores an entry for blocks/interfaces read from /e/n/i and (if exists) - * the StorageData associated with the block. - */ + * the StorageData associated with the block. + */ GHashTable *eni_ifaces; bool ifupdown_managed : 1; @@ -123,11 +123,11 @@ reload_connections(NMSettingsPlugin * plugin, initialize(self); else if (!priv->already_reloaded) { /* This is the first call to reload, but we are already initialized. - * - * This happens because during start NMSettings first queries unmanaged-specs, - * and then issues a reload call right away. - * - * On future reloads, we really want to load /e/n/i again. */ + * + * This happens because during start NMSettings first queries unmanaged-specs, + * and then issues a reload call right away. + * + * On future reloads, we really want to load /e/n/i again. */ priv->already_reloaded = TRUE; } else { eni_ifaces_old = priv->eni_ifaces; diff --git a/src/settings/plugins/keyfile/nms-keyfile-plugin.c b/src/settings/plugins/keyfile/nms-keyfile-plugin.c index 7e2be5dee1..8704923c3f 100644 --- a/src/settings/plugins/keyfile/nms-keyfile-plugin.c +++ b/src/settings/plugins/keyfile/nms-keyfile-plugin.c @@ -42,18 +42,18 @@ typedef struct { NMConfig *config; /* there can/could be multiple read-only directories. For example, one - * could set dirname_libs to - * - /usr/lib/NetworkManager/profiles/ - * - /etc/NetworkManager/system-connections - * and leave dirname_etc unset. In this case, there would be multiple - * read-only directories. - * - * Directories that come later have higher priority and shadow profiles - * from earlier directories. - * - * Currently, this is only an array with zero or one elements. It could be - * easily extended to support multiple read-only directories. - */ + * could set dirname_libs to + * - /usr/lib/NetworkManager/profiles/ + * - /etc/NetworkManager/system-connections + * and leave dirname_etc unset. In this case, there would be multiple + * read-only directories. + * + * Directories that come later have higher priority and shadow profiles + * from earlier directories. + * + * Currently, this is only an array with zero or one elements. It could be + * easily extended to support multiple read-only directories. + */ char *dirname_libs[2]; char *dirname_etc; char *dirname_run; @@ -130,7 +130,7 @@ static gboolean _ignore_filename(NMSKeyfileStorageType storage_type, const char *filename) { /* for backward-compatibility, we don't require an extension for - * files under "/etc/...". */ + * files under "/etc/...". */ return nm_keyfile_utils_ignore_filename(filename, (storage_type != NMS_KEYFILE_STORAGE_TYPE_ETC)); } @@ -139,9 +139,9 @@ static const char * _get_plugin_dir(NMSKeyfilePluginPrivate *priv) { /* the plugin dir is only needed to generate connection.uuid value via - * nm_keyfile_read_ensure_uuid(). This is either the configured /etc - * directory, of the compile-time default (in case the /etc directory - * is disabled). */ + * nm_keyfile_read_ensure_uuid(). This is either the configured /etc + * directory, of the compile-time default (in case the /etc directory + * is disabled). */ return priv->dirname_etc ?: NM_KEYFILE_PATH_NAME_ETC_DEFAULT; } @@ -543,15 +543,15 @@ _storages_consolidate(NMSKeyfilePlugin * self, if (!storage->is_dirty) { /* the entry is no longer is_dirty. In the meantime we already emitted - * another signal for it. */ + * another signal for it. */ continue; } storage->is_dirty = FALSE; if (c_list_is_empty(&storage->parent._storage_lst)) { /* hm? The profile was deleted in the meantime? That is only possible - * if the signal handler called again into the plugin. In any case, the event - * was already emitted. Skip. */ + * if the signal handler called again into the plugin. In any case, the event + * was already emitted. Skip. */ continue; } @@ -681,7 +681,7 @@ load_connections(NMSettingsPlugin * plugin, NMSKeyfileStorage *storage2; /* the file does not exist. We take that as indication to unload the file - * that was previously loaded... */ + * that was previously loaded... */ storage2 = nm_sett_util_storages_lookup_by_filename(&priv->storages, full_filename); if (storage2) g_hash_table_add(storages_replaced, g_object_ref(storage2)); @@ -719,14 +719,14 @@ load_connections(NMSettingsPlugin * plugin, } /* @storage has a UUID that was just loaded from disk, but we have an entry in cache. - * Reload that file too despite not being told to do so. The reason is to get - * the latest file timestamp so that we get the priorities right. */ + * Reload that file too despite not being told to do so. The reason is to get + * the latest file timestamp so that we get the priorities right. */ storage_new = _load_file_from_path(self, full_filename, storage->storage_type, &local); if (storage_new && !nm_streq(loaded_uuid, nms_keyfile_storage_get_uuid(storage_new))) { /* the file now references a different UUID. We are not told to reload - * that file, so this means the existing storage (with the previous - * filename and UUID tuple) is no longer valid. */ + * that file, so this means the existing storage (with the previous + * filename and UUID tuple) is no longer valid. */ g_clear_object(&storage_new); } @@ -777,7 +777,7 @@ nms_keyfile_plugin_add_connection(NMSKeyfilePlugin * self, uuid = nm_connection_get_uuid(connection); /* Note that even if the caller requests persistent storage, we may switch to in-memory, if - * no /etc directory is configured. */ + * no /etc directory is configured. */ storage_type = !in_memory && priv->dirname_etc ? NMS_KEYFILE_STORAGE_TYPE_ETC : NMS_KEYFILE_STORAGE_TYPE_RUN; @@ -1244,8 +1244,8 @@ nms_keyfile_plugin_init(NMSKeyfilePlugin *plugin) nms_keyfile_storage_destroy); /* dirname_libs are a set of read-only directories with lower priority than /etc or /run. - * There is nothing complicated about having multiple of such directories, so dirname_libs - * is a list (which currently only has at most one directory). */ + * There is nothing complicated about having multiple of such directories, so dirname_libs + * is a list (which currently only has at most one directory). */ priv->dirname_libs[0] = nm_sd_utils_path_simplify(g_strdup(NM_KEYFILE_PATH_NAME_LIB), FALSE); priv->dirname_libs[1] = NULL; priv->dirname_run = nm_sd_utils_path_simplify(g_strdup(NM_KEYFILE_PATH_NAME_RUN), FALSE); @@ -1255,8 +1255,8 @@ nms_keyfile_plugin_init(NMSKeyfilePlugin *plugin) NM_CONFIG_GET_VALUE_STRIP); if (priv->dirname_etc && priv->dirname_etc[0] == '\0') { /* special case: configure an empty keyfile path so that NM has no writable keyfile - * directory. In this case, NM will only honor dirname_libs and dirname_run, meaning - * it cannot persist profile to non-volatile memory. */ + * directory. In this case, NM will only honor dirname_libs and dirname_run, meaning + * it cannot persist profile to non-volatile memory. */ nm_clear_g_free(&priv->dirname_etc); } else if (!priv->dirname_etc || priv->dirname_etc[0] != '/') { /* either invalid path or unspecified. Use the default. */ diff --git a/src/settings/plugins/keyfile/nms-keyfile-reader.c b/src/settings/plugins/keyfile/nms-keyfile-reader.c index d423cdb27a..b0cedd4926 100644 --- a/src/settings/plugins/keyfile/nms-keyfile-reader.c +++ b/src/settings/plugins/keyfile/nms-keyfile-reader.c @@ -118,7 +118,7 @@ nms_keyfile_reader_from_keyfile(GKeyFile * key_file, nm_assert(filename[0] == '/'); /* @base_dir may be NULL, in which case @filename must be an absolute path, - * and the directory is taken as the @base_dir. */ + * and the directory is taken as the @base_dir. */ s = strrchr(filename, '/'); base_dir = nm_strndup_a(255, filename, s - filename, &base_dir_free); if (!profile_dir || nm_streq(base_dir, profile_dir)) diff --git a/src/settings/plugins/keyfile/nms-keyfile-storage.c b/src/settings/plugins/keyfile/nms-keyfile-storage.c index dfd40eec01..dcf120a955 100644 --- a/src/settings/plugins/keyfile/nms-keyfile-storage.c +++ b/src/settings/plugins/keyfile/nms-keyfile-storage.c @@ -69,7 +69,7 @@ cmp_fcn(const NMSKeyfileStorage *a, const NMSKeyfileStorage *b) nm_assert(a != b); /* sort by storage-type, which also has a numeric value according to their - * (inverse) priority. */ + * (inverse) priority. */ NM_CMP_FIELD_UNSAFE(b, a, storage_type); /* meta-data is more important. */ diff --git a/src/settings/plugins/keyfile/nms-keyfile-storage.h b/src/settings/plugins/keyfile/nms-keyfile-storage.h index 08702d7a5a..3686cb8be6 100644 --- a/src/settings/plugins/keyfile/nms-keyfile-storage.h +++ b/src/settings/plugins/keyfile/nms-keyfile-storage.h @@ -33,65 +33,65 @@ typedef struct { NMSettingsStorage parent; /* The connection. Note that there are tombstones (loaded-uuid files to /dev/null) - * that don't have a connection. - * - * Also, we don't actually remember the loaded connection after returning it - * to NMSettings. So, also for regular storages (non-tombstones) this field - * is often cleared. */ + * that don't have a connection. + * + * Also, we don't actually remember the loaded connection after returning it + * to NMSettings. So, also for regular storages (non-tombstones) this field + * is often cleared. */ union { struct { NMConnection *connection; /* when we move a profile from permanent storage to unsaved (/run), then - * we may leave the profile on disk (depending on options for Update2()). - * - * Later, when we save the profile again to disk, we want to re-use that filename. - * Likewise, we delete the (now in-memory) profile, we may want to also delete - * the original filename. - * - * This is the original filename, and we store it inside [.nmmeta] in the - * keyfile in /run. Note that we don't store this in the .nmmeta file, because - * the information is tied to the particular keyfile in /run, not to all UUIDs - * in general. */ + * we may leave the profile on disk (depending on options for Update2()). + * + * Later, when we save the profile again to disk, we want to re-use that filename. + * Likewise, we delete the (now in-memory) profile, we may want to also delete + * the original filename. + * + * This is the original filename, and we store it inside [.nmmeta] in the + * keyfile in /run. Note that we don't store this in the .nmmeta file, because + * the information is tied to the particular keyfile in /run, not to all UUIDs + * in general. */ char *shadowed_storage; /* the timestamp (stat's mtime) of the keyfile. For meta-data this - * is irrelevant. The purpose is that if the same storage type (directory) has - * multiple files with the same UUID, then the newer file gets preferred. */ + * is irrelevant. The purpose is that if the same storage type (directory) has + * multiple files with the same UUID, then the newer file gets preferred. */ struct timespec stat_mtime; /* these flags are only relevant for storages with %NMS_KEYFILE_STORAGE_TYPE_RUN - * (and non-metadata). This is to persist and reload these settings flags to - * /run. - * - * Note that these flags are not stored in as meta-data. The reason is that meta-data - * is per UUID. But these flags are only relevant for a particular keyfile on disk. - * That is, it must be tied to the actual keyfile, and not to the UUID. */ + * (and non-metadata). This is to persist and reload these settings flags to + * /run. + * + * Note that these flags are not stored in as meta-data. The reason is that meta-data + * is per UUID. But these flags are only relevant for a particular keyfile on disk. + * That is, it must be tied to the actual keyfile, and not to the UUID. */ bool is_nm_generated : 1; bool is_volatile : 1; bool is_external : 1; /* if shadowed_storage is set, then this flag indicates whether the file - * is owned. The difference comes into play when deleting the in-memory, - * shadowing profile: a owned profile will also be deleted. */ + * is owned. The difference comes into play when deleting the in-memory, + * shadowing profile: a owned profile will also be deleted. */ bool shadowed_owned : 1; } conn_data; /* the content from the .nmmeta file. Note that the nmmeta file has the UUID - * in the filename, that means there can be only two variants of this file: - * in /etc and in /run. As such, this is really meta-data about the entire profile - * (the UUID), and not about the individual keyfile. */ + * in the filename, that means there can be only two variants of this file: + * in /etc and in /run. As such, this is really meta-data about the entire profile + * (the UUID), and not about the individual keyfile. */ NMSettingsMetaData meta_data; } u; /* The storage type. This is directly related to the filename. Since - * the filename cannot change, this value is unchanging. */ + * the filename cannot change, this value is unchanging. */ const NMSKeyfileStorageType storage_type; /* whether union "u" has meta_data or conn_data. Since the type of the storage - * depends on the (immutable) filename, this is also const. */ + * depends on the (immutable) filename, this is also const. */ const bool is_meta_data; /* this flag is only used during reload to mark and prune old entries. */ @@ -188,13 +188,13 @@ nm_settings_storage_is_meta_data_alive(const NMSettingsStorage *storage) return NULL; /* Regular (all other) storages are alive as long as they report a NMConnection, and - * they will be dropped, once they have no more connection. - * - * Meta-data storages are special: they never report a NMConnection. - * So, a meta-data storage is alive as long as it is tracked by the - * settings plugin. - * - * This function is used to ckeck for that. */ + * they will be dropped, once they have no more connection. + * + * Meta-data storages are special: they never report a NMConnection. + * So, a meta-data storage is alive as long as it is tracked by the + * settings plugin. + * + * This function is used to ckeck for that. */ if (c_list_is_empty(&storage->_storage_lst)) return NULL; diff --git a/src/settings/plugins/keyfile/nms-keyfile-utils.c b/src/settings/plugins/keyfile/nms-keyfile-utils.c index a5aab64ce8..42d4615873 100644 --- a/src/settings/plugins/keyfile/nms-keyfile-utils.c +++ b/src/settings/plugins/keyfile/nms-keyfile-utils.c @@ -52,7 +52,7 @@ nms_keyfile_nmmeta_check_filename(const char *filename, guint *out_uuid_len) if (!NM_IN_SET(len, 36, 40)) { /* the remaining part of the filename has not the right length to - * contain a UUID (according to nm_utils_is_uuid()). */ + * contain a UUID (according to nm_utils_is_uuid()). */ return NULL; } @@ -81,7 +81,7 @@ nms_keyfile_nmmeta_filename(const char *dirname, const char *uuid, gboolean temp temporary ? "~" : "") >= sizeof(filename)) { /* valid uuids are limited in length (nm_utils_is_uuid). The buffer should always - * be large enough. */ + * be large enough. */ nm_assert_not_reached(); } @@ -151,7 +151,7 @@ nms_keyfile_nmmeta_read(const char * dirname, if (!loaded_path && !shadowed_storage) { /* if there is no useful information in the file, it is the same as if - * the file is not present. Signal failure. */ + * the file is not present. Signal failure. */ return FALSE; } @@ -240,7 +240,7 @@ nms_keyfile_nmmeta_write(const char *dirname, f = nm_utils_file_is_in_path(loaded_path, dirname); if (f) { /* @loaded_path points to a file directly in @dirname. - * Don't use absolute paths. */ + * Don't use absolute paths. */ loaded_path = f; } } @@ -275,8 +275,8 @@ nms_keyfile_nmmeta_write(const char *dirname, } } else { /* we only have the "loaded_path" to store. That is commonly used for the tombstones to - * link to /dev/null. A symlink is sufficient to store that amount of information. - * No need to bother with a keyfile. */ + * link to /dev/null. A symlink is sufficient to store that amount of information. + * No need to bother with a keyfile. */ if (symlink(loaded_path, full_filename_tmp) != 0) { errsv = -NM_ERRNO_NATIVE(errno); full_filename_tmp[strlen(full_filename_tmp) - 1] = '\0'; diff --git a/src/settings/plugins/keyfile/nms-keyfile-writer.c b/src/settings/plugins/keyfile/nms-keyfile-writer.c index dc52f1a06d..1e3b0b7673 100644 --- a/src/settings/plugins/keyfile/nms-keyfile-writer.c +++ b/src/settings/plugins/keyfile/nms-keyfile-writer.c @@ -50,15 +50,15 @@ cert_writer(NMConnection * connection, const char *p = path + strlen(info->keyfile_dir); /* If the path is rooted in the keyfile directory, just use a - * relative path instead of an absolute one. - */ + * relative path instead of an absolute one. + */ if (*p == '/') { while (*p == '/') p++; if (p[0]) { /* If @p looks like an integer list, the following detection will fail too and - * we will file:// qualify the path below. We thus avoid writing a path string - * that would be interpreted as legacy binary format by reader. */ + * we will file:// qualify the path below. We thus avoid writing a path string + * that would be interpreted as legacy binary format by reader. */ tmp = nm_keyfile_detect_unqualified_path_scheme(info->keyfile_dir, p, -1, @@ -73,7 +73,7 @@ cert_writer(NMConnection * connection, } if (!accepted_path) { /* What we are about to write, must also be understood by the reader. - * Otherwise, add a file:// prefix */ + * Otherwise, add a file:// prefix */ tmp = nm_keyfile_detect_unqualified_path_scheme(info->keyfile_dir, path, -1, FALSE, NULL); if (tmp) { @@ -115,8 +115,8 @@ cert_writer(NMConnection * connection, } /* Write the raw data out to the standard file so that we can use paths - * from now on instead of pushing around the certificate data. - */ + * from now on instead of pushing around the certificate data. + */ new_path = g_strdup_printf("%s/%s-%s.%s", info->keyfile_dir, nm_connection_get_uuid(connection), @@ -124,9 +124,9 @@ cert_writer(NMConnection * connection, ext); /* FIXME(keyfile-parse-in-memory): writer must not access/write to the file system before - * being sure that the entire profile can be written and all circumstances are good to - * proceed. That means, while writing we must only collect the blogs in-memory, and write - * them all in the end together (or not at all). */ + * being sure that the entire profile can be written and all circumstances are good to + * proceed. That means, while writing we must only collect the blogs in-memory, and write + * them all in the end together (or not at all). */ success = nm_utils_file_set_contents(new_path, (const char *) blob_data, blob_len, @@ -135,7 +135,7 @@ cert_writer(NMConnection * connection, &local); if (success) { /* Write the path value to the keyfile. - * We know, that basename(new_path) starts with a UUID, hence no conflict with "data:;base64," */ + * We know, that basename(new_path) starts with a UUID, hence no conflict with "data:;base64," */ nm_keyfile_plugin_kf_set_string(file, setting_name, vtable->setting_key, @@ -152,11 +152,11 @@ cert_writer(NMConnection * connection, g_free(new_path); } else { /* scheme_func() returns UNKNOWN in all other cases. The only valid case - * where a scheme is allowed to be UNKNOWN, is unsetting the value. In this - * case, we don't expect the writer to be called, because the default value - * will not be serialized. - * The only other reason for the scheme to be UNKNOWN is an invalid cert. - * But our connection verifies, so that cannot happen either. */ + * where a scheme is allowed to be UNKNOWN, is unsetting the value. In this + * case, we don't expect the writer to be called, because the default value + * will not be serialized. + * The only other reason for the scheme to be UNKNOWN is an invalid cert. + * But our connection verifies, so that cannot happen either. */ g_return_if_reached(); } } @@ -395,8 +395,8 @@ _internal_write_connection(NMConnection * connection, } /* In case of updating the connection and changing the file path, - * we need to remove the old one, not to end up with two connections. - */ + * we need to remove the old one, not to end up with two connections. + */ if (existing_path && !existing_path_read_only && !nm_streq(path, existing_path)) unlink(existing_path); diff --git a/src/settings/plugins/keyfile/tests/test-keyfile-settings.c b/src/settings/plugins/keyfile/tests/test-keyfile-settings.c index e225c7ff20..011f166565 100644 --- a/src/settings/plugins/keyfile/tests/test-keyfile-settings.c +++ b/src/settings/plugins/keyfile/tests/test-keyfile-settings.c @@ -1656,9 +1656,9 @@ test_write_wired_8021x_tls_connection_path(void) keyfile = keyfile_load_from_file(testfile); /* Depending on whether this test is being run from 'make check' or - * 'make distcheck' we might be using relative paths (check) or - * absolute ones (distcheck). - */ + * 'make distcheck' we might be using relative paths (check) or + * absolute ones (distcheck). + */ tmp2 = g_path_get_dirname(testfile); if (g_strcmp0(tmp2, TEST_KEYFILES_DIR) == 0) relative = TRUE; diff --git a/src/supplicant/nm-supplicant-config.c b/src/supplicant/nm-supplicant-config.c index 39c1130460..b17f0e7b83 100644 --- a/src/supplicant/nm-supplicant-config.c +++ b/src/supplicant/nm-supplicant-config.c @@ -533,8 +533,8 @@ nm_supplicant_config_add_setting_wireless(NMSupplicantConfig *self, } /* Except for Ad-Hoc, Hotspot and Mesh, request that the driver probe for the - * specific SSID we want to associate with. - */ + * specific SSID we want to associate with. + */ if (!(is_adhoc || is_ap || is_mesh)) { if (!nm_supplicant_config_add_option(self, "scan_ssid", "1", -1, NULL, error)) return FALSE; @@ -590,33 +590,33 @@ nm_supplicant_config_add_bgscan(NMSupplicantConfig *self, NMConnection *connecti g_assert(s_wifi); /* Don't scan when a shared connection (either AP or Ad-Hoc) is active; - * it will disrupt connected clients. - */ + * it will disrupt connected clients. + */ if (NM_IN_STRSET(nm_setting_wireless_get_mode(s_wifi), NM_SETTING_WIRELESS_MODE_AP, NM_SETTING_WIRELESS_MODE_ADHOC)) return TRUE; /* Don't scan when the connection is locked to a specific AP, since - * intra-ESS roaming (which requires periodic scanning) isn't being - * used due to the specific AP lock. (bgo #513820) - */ + * intra-ESS roaming (which requires periodic scanning) isn't being + * used due to the specific AP lock. (bgo #513820) + */ if (nm_setting_wireless_get_bssid(s_wifi)) return TRUE; /* Default to a very long bgscan interval when signal is OK on the assumption - * that either (a) there aren't multiple APs and we don't need roaming, or - * (b) since EAP/802.1x isn't used and thus there are fewer steps to fail - * during a roam, we can wait longer before scanning for roam candidates. - */ + * that either (a) there aren't multiple APs and we don't need roaming, or + * (b) since EAP/802.1x isn't used and thus there are fewer steps to fail + * during a roam, we can wait longer before scanning for roam candidates. + */ bgscan = "simple:30:-70:86400"; /* If using WPA Enterprise, Dynamic WEP or we have seen more than one AP use - * a shorter bgscan interval on the assumption that this is a multi-AP ESS - * in which we want more reliable roaming between APs. Thus trigger scans - * when the signal is still somewhat OK so we have an up-to-date roam - * candidate list when the signal gets bad. - */ + * a shorter bgscan interval on the assumption that this is a multi-AP ESS + * in which we want more reliable roaming between APs. Thus trigger scans + * when the signal is still somewhat OK so we have an up-to-date roam + * candidate list when the signal gets bad. + */ if (nm_setting_wireless_get_num_seen_bssids(s_wifi) > 1 || ((s_wsec = nm_connection_get_setting_wireless_security(connection)) && NM_IN_STRSET(nm_setting_wireless_security_get_key_mgmt(s_wsec), @@ -878,10 +878,10 @@ nm_supplicant_config_add_setting_wireless_security(NMSupplicantConfig * if (psk_len >= 8 && psk_len <= 63) { /* Use NM_SUPPL_OPT_TYPE_STRING here so that it gets pushed to the - * supplicant as a string, and therefore gets quoted, - * and therefore the supplicant will interpret it as a - * passphrase and not a hex key. - */ + * supplicant as a string, and therefore gets quoted, + * and therefore the supplicant will interpret it as a + * passphrase and not a hex key. + */ if (!nm_supplicant_config_add_option_with_type(self, "psk", psk, @@ -892,8 +892,8 @@ nm_supplicant_config_add_setting_wireless_security(NMSupplicantConfig * return FALSE; } else if (nm_streq(key_mgmt, "sae")) { /* If the SAE password doesn't comply with WPA-PSK limitation, - * we need to call it "sae_password" instead of "psk". - */ + * we need to call it "sae_password" instead of "psk". + */ if (!nm_supplicant_config_add_option_with_type(self, "sae_password", psk, @@ -1070,9 +1070,9 @@ nm_supplicant_config_add_setting_wireless_security(NMSupplicantConfig * if (nm_streq(key_mgmt, "wpa-eap")) { /* When using WPA-Enterprise, we want to use Proactive Key Caching (also - * called Opportunistic Key Caching) to avoid full EAP exchanges when - * roaming between access points in the same mobility group. - */ + * called Opportunistic Key Caching) to avoid full EAP exchanges when + * roaming between access points in the same mobility group. + */ if (!nm_supplicant_config_add_option(self, "proactive_key_caching", "1", @@ -1104,8 +1104,8 @@ add_pkcs11_uri_with_pin(NMSupplicantConfig * self, return TRUE; /* We ignore the attributes -- RFC 7512 suggests that some of them - * might be unsafe and we want to be on the safe side. Also, we're - * installing our attributes, so this makes things a bit easier for us. */ + * might be unsafe and we want to be on the safe side. Also, we're + * installing our attributes, so this makes things a bit easier for us. */ split = g_strsplit(uri, "&", 2); if (split[1]) nm_log_info(LOGD_SUPPLICANT, "URI attributes ignored"); @@ -1117,8 +1117,8 @@ add_pkcs11_uri_with_pin(NMSupplicantConfig * self, g_free(escaped); } else if (!(pin_flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED)) { /* Include an empty PIN to indicate the login is still needed. - * Probably a token that has a PIN path and the actual PIN will - * be entered using a protected path. */ + * Probably a token that has a PIN path and the actual PIN will + * be entered using a protected path. */ pin_qattr = g_strdup("pin-value="); } @@ -1191,7 +1191,7 @@ nm_supplicant_config_add_setting_8021x(NMSupplicantConfig *self, } /* Build the "eap" option string while we check for EAP methods needing - * special handling: PEAP + GTC, FAST, external */ + * special handling: PEAP + GTC, FAST, external */ eap_str = g_string_new(NULL); num_eap = nm_setting_802_1x_get_num_eap_methods(setting); for (i = 0; i < num_eap; i++) { @@ -1225,7 +1225,7 @@ nm_supplicant_config_add_setting_8021x(NMSupplicantConfig *self, return FALSE; /* Adjust the fragment size according to MTU, but do not set it higher than 1280-14 - * for better compatibility */ + * for better compatibility */ hdrs = 14; /* EAPOL + EAP-TLS */ frag = 1280 - hdrs; if (mtu > hdrs) @@ -1308,8 +1308,8 @@ nm_supplicant_config_add_setting_8021x(NMSupplicantConfig *self, return FALSE; } else { /* PAC file is not specified. - * If provisioning is allowed, use an blob format. - */ + * If provisioning is allowed, use an blob format. + */ if (fast_provisoning_allowed) { gs_free char *blob_name = NULL; @@ -1330,7 +1330,7 @@ nm_supplicant_config_add_setting_8021x(NMSupplicantConfig *self, } /* If user wants to use system CA certs, either populate ca_path (if the path - * is a directory) or ca_cert (the path is a file name) */ + * is a directory) or ca_cert (the path is a file name) */ if (nm_setting_802_1x_get_system_ca_certs(setting)) { if (g_file_test(SYSTEM_CA_PATH, G_FILE_TEST_IS_DIR)) ca_path_override = SYSTEM_CA_PATH; @@ -1517,9 +1517,9 @@ nm_supplicant_config_add_setting_8021x(NMSupplicantConfig *self, if (scheme == NM_SETTING_802_1X_CK_SCHEME_PATH || format == NM_SETTING_802_1X_CK_FORMAT_PKCS12) { /* Only add the private key password for PKCS#12 blobs and - * all path schemes, since in both of these cases the private key - * isn't decrypted at all. - */ + * all path schemes, since in both of these cases the private key + * isn't decrypted at all. + */ value = nm_setting_802_1x_get_private_key_password(setting); if (!add_string_val(self, value, "private_key_passwd", FALSE, "<hidden>", error)) return FALSE; @@ -1527,8 +1527,8 @@ nm_supplicant_config_add_setting_8021x(NMSupplicantConfig *self, if (format != NM_SETTING_802_1X_CK_FORMAT_PKCS12) { /* Only add the client cert if the private key is not PKCS#12, as - * wpa_supplicant configuration directs us to do. - */ + * wpa_supplicant configuration directs us to do. + */ switch (nm_setting_802_1x_get_client_cert_scheme(setting)) { case NM_SETTING_802_1X_CK_SCHEME_BLOB: bytes = nm_setting_802_1x_get_client_cert_blob(setting); @@ -1606,9 +1606,9 @@ nm_supplicant_config_add_setting_8021x(NMSupplicantConfig *self, if (scheme == NM_SETTING_802_1X_CK_SCHEME_PATH || format == NM_SETTING_802_1X_CK_FORMAT_PKCS12) { /* Only add the private key password for PKCS#12 blobs and - * all path schemes, since in both of these cases the private key - * isn't decrypted at all. - */ + * all path schemes, since in both of these cases the private key + * isn't decrypted at all. + */ value = nm_setting_802_1x_get_phase2_private_key_password(setting); if (!add_string_val(self, value, "private_key2_passwd", FALSE, "<hidden>", error)) return FALSE; @@ -1616,8 +1616,8 @@ nm_supplicant_config_add_setting_8021x(NMSupplicantConfig *self, if (format != NM_SETTING_802_1X_CK_FORMAT_PKCS12) { /* Only add the client cert if the private key is not PKCS#12, as - * wpa_supplicant configuration directs us to do. - */ + * wpa_supplicant configuration directs us to do. + */ switch (nm_setting_802_1x_get_phase2_client_cert_scheme(setting)) { case NM_SETTING_802_1X_CK_SCHEME_BLOB: bytes = nm_setting_802_1x_get_phase2_client_cert_blob(setting); diff --git a/src/supplicant/nm-supplicant-interface.c b/src/supplicant/nm-supplicant-interface.c index a6a19721fb..05826cb898 100644 --- a/src/supplicant/nm-supplicant-interface.c +++ b/src/supplicant/nm-supplicant-interface.c @@ -466,8 +466,8 @@ _notify_maybe_scanning(NMSupplicantInterface *self) if (!scanning && !c_list_is_empty(&priv->bss_initializing_lst_head)) { /* we would change state to indicate we no longer scan. However, - * we still have BSS instances to be initialized. Delay the - * state change further. */ + * we still have BSS instances to be initialized. Delay the + * state change further. */ return; } @@ -1177,8 +1177,8 @@ parse_capabilities(NMSupplicantInterface *self, GVariant *capabilities) if (g_variant_lookup(capabilities, "Modes", "^a&s", &array)) { /* Setting p2p_capable might toggle _prop_p2p_available_get(). However, - * we don't need to check for a property changed notification, because - * the caller did g_object_freeze_notify() and will perform the check. */ + * we don't need to check for a property changed notification, because + * the caller did g_object_freeze_notify() and will perform the check. */ priv->p2p_capable_property = g_strv_contains(array, "p2p"); g_free(array); } @@ -1201,10 +1201,10 @@ parse_capabilities(NMSupplicantInterface *self, GVariant *capabilities) const gint32 WPAS_MAX_SCAN_SSIDS = 16; /* Even if supplicant claims that 20 SSIDs are supported, the Scan request - * still only accepts WPAS_MAX_SCAN_SSIDS SSIDs. Otherwise, the D-Bus - * request will be rejected with "fi.w1.wpa_supplicant1.InvalidArgs" - * Body: ('Did not receive correct message arguments.', 'Too many ssids specified. Specify at most four') - * */ + * still only accepts WPAS_MAX_SCAN_SSIDS SSIDs. Otherwise, the D-Bus + * request will be rejected with "fi.w1.wpa_supplicant1.InvalidArgs" + * Body: ('Did not receive correct message arguments.', 'Too many ssids specified. Specify at most four') + * */ priv->max_scan_ssids = CLAMP(max_scan_ssids, 0, WPAS_MAX_SCAN_SSIDS); } @@ -1536,7 +1536,7 @@ _wps_handle_set_pc_cb(GVariant *res, GError *error, gpointer user_data) g_variant_builder_add(&start_args, "{sv}", "Pin", g_variant_new_string(wps_data->pin)); if (wps_data->bssid) { /* The BSSID is in fact not mandatory. If it is not set the supplicant would - * enroll with any BSS in range. */ + * enroll with any BSS in range. */ if (!nm_utils_hwaddr_aton(wps_data->bssid, bssid_buf, sizeof(bssid_buf))) nm_assert_not_reached(); g_variant_builder_add( @@ -1787,11 +1787,11 @@ _properties_changed_main(NMSupplicantInterface *self, GVariant *properties) if (nm_g_variant_lookup(properties, "DisconnectReason", "i", &v_i32)) { /* Disconnect reason is currently only given for deauthentication events, - * not disassociation; currently they are IEEE 802.11 "reason codes", - * defined by (IEEE 802.11-2007, 7.3.1.7, Table 7-22). Any locally caused - * deauthentication will be negative, while authentications caused by the - * AP will be positive. - */ + * not disassociation; currently they are IEEE 802.11 "reason codes", + * defined by (IEEE 802.11-2007, 7.3.1.7, Table 7-22). Any locally caused + * deauthentication will be negative, while authentications caused by the + * AP will be positive. + */ priv->disconnect_reason = v_i32; } @@ -1810,10 +1810,10 @@ _properties_changed_main(NMSupplicantInterface *self, GVariant *properties) priv->supp_state = state; if (priv->state > NM_SUPPLICANT_INTERFACE_STATE_STARTING) { /* Only transition to actual wpa_supplicant interface states (ie, - * anything > STARTING) after the NMSupplicantInterface has had a - * chance to initialize, which is signalled by entering the STARTING - * state. - */ + * anything > STARTING) after the NMSupplicantInterface has had a + * chance to initialize, which is signalled by entering the STARTING + * state. + */ do_set_state = TRUE; } } @@ -2126,10 +2126,10 @@ assoc_add_network_cb(GObject *source, GAsyncResult *result, gpointer user_data) const char *net_path; /* the assoc-request was already cancelled, but the AddNetwork request succeeded. - * Cleanup the created network. - * - * This cleanup action does not work when NetworkManager is about to exit - * and leaves the mainloop. During program shutdown, we may orphan networks. */ + * Cleanup the created network. + * + * This cleanup action does not work when NetworkManager is about to exit + * and leaves the mainloop. During program shutdown, we may orphan networks. */ g_variant_get(res, "(&o)", &net_path); g_dbus_connection_call(G_DBUS_CONNECTION(source), name_owner->str, @@ -2197,11 +2197,11 @@ add_network(NMSupplicantInterface *self) priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE(self); /* the association does not keep @self alive. We want to be able to remove - * the network again, even if @self is already gone. Hence, track the data - * separately. - * - * For that we also have a shutdown_wait_obj so that on exit we still wait - * to handle the response. */ + * the network again, even if @self is already gone. Hence, track the data + * separately. + * + * For that we also have a shutdown_wait_obj so that on exit we still wait + * to handle the response. */ add_network_data = g_slice_new(AddNetworkData); *add_network_data = (AddNetworkData){ .assoc_data = priv->assoc_data, @@ -2345,8 +2345,8 @@ nm_supplicant_interface_assoc(NMSupplicantInterface * self, if (_get_capability(priv, NM_SUPPL_CAP_TYPE_FAST) == NM_TERNARY_FALSE && nm_supplicant_config_fast_required(cfg)) { /* Make sure the supplicant supports EAP-FAST before trying to send - * it an EAP-FAST configuration. - */ + * it an EAP-FAST configuration. + */ assoc_data->fail_on_idle_id = g_idle_add(assoc_fail_on_idle_cb, self); return; } @@ -2375,10 +2375,10 @@ nm_supplicant_interface_assoc(NMSupplicantInterface * self, } else { assoc_data->calls_left++; /* It would be smarter to change the property only when necessary. - * However, wpa_supplicant doesn't send the PropertiesChanged - * signal for ApIsolate, and so to know the current value we would - * need first a Get call. It seems simpler to just set the value - * we want. */ + * However, wpa_supplicant doesn't send the PropertiesChanged + * signal for ApIsolate, and so to know the current value we would + * need first a Get call. It seems simpler to just set the value + * we want. */ nm_dbus_connection_call_set(priv->dbus_connection, priv->name_owner->str, priv->object_path->str, @@ -2429,8 +2429,8 @@ scan_request_cb(GObject *source, GAsyncResult *result, gpointer user_data) } /* we don't propagate the error/success. That is, because either answer is not - * reliable. What is important to us is whether the request completed, and - * the current nm_supplicant_interface_get_scanning() state. */ + * reliable. What is important to us is whether the request completed, and + * the current nm_supplicant_interface_get_scanning() state. */ if (cancelled) _LOGD("request-scan: request cancelled"); else { @@ -2497,8 +2497,8 @@ nm_supplicant_interface_request_scan(NMSupplicantInterface * se if (callback) { /* A callback was provided. This keeps @self alive. The caller - * must provide a cancellable as the caller must never leave an asynchronous - * operation pending indefinitely. */ + * must provide a cancellable as the caller must never leave an asynchronous + * operation pending indefinitely. */ nm_assert(G_IS_CANCELLABLE(cancellable)); g_object_ref(self); } else { @@ -2868,7 +2868,7 @@ _signal_handle(NMSupplicantInterface *self, } /* the state eventually reaches one of started, success or failure - * so ignore any other intermediate (unknown) state change. */ + * so ignore any other intermediate (unknown) state change. */ if (auth_state != NM_SUPPLICANT_AUTH_STATE_UNKNOWN && auth_state != priv->auth_state) { priv->auth_state = auth_state; _notify(self, PROP_AUTH_STATE); @@ -2943,9 +2943,9 @@ _signal_handle(NMSupplicantInterface *self, g_variant_get(parameters, "(@a{sv})", &args); /* TODO: Group finished is called on the management interface! - * This means the signal consumer will currently need to assume which - * interface is finishing or it needs to match the object paths. - */ + * This means the signal consumer will currently need to assume which + * interface is finishing or it needs to match the object paths. + */ if (!g_variant_lookup(args, "interface_object", "&o", &iface_path)) return; @@ -3201,10 +3201,10 @@ constructed(GObject *object) if (_get_capability(priv, NM_SUPPL_CAP_TYPE_AP) == NM_TERNARY_DEFAULT) { /* If the global supplicant capabilities property is not present, we can - * fall back to checking whether the ProbeRequest method is supported. If - * neither of these works we have no way of determining if AP mode is - * supported or not. hostap 1.0 and earlier don't support either of these. - */ + * fall back to checking whether the ProbeRequest method is supported. If + * neither of these works we have no way of determining if AP mode is + * supported or not. hostap 1.0 and earlier don't support either of these. + */ priv->starting_pending_count++; _dbus_connection_call(self, DBUS_INTERFACE_INTROSPECTABLE, @@ -3283,9 +3283,9 @@ dispose(GObject *object) if (priv->wps_data) { /* we shut down, but an asynchronous Cancel request is pending. - * We don't want to cancel it, so mark wps-data that @self is gone. - * This way, _wps_handle_cancel_cb() knows it must no longer touch - * @self */ + * We don't want to cancel it, so mark wps-data that @self is gone. + * This way, _wps_handle_cancel_cb() knows it must no longer touch + * @self */ priv->wps_data->self = NULL; priv->wps_data = NULL; } diff --git a/src/supplicant/nm-supplicant-manager.c b/src/supplicant/nm-supplicant-manager.c index 9f500f5f41..757c08f41f 100644 --- a/src/supplicant/nm-supplicant-manager.c +++ b/src/supplicant/nm-supplicant-manager.c @@ -295,8 +295,8 @@ _poke_name_owner_timeout_cb(gpointer user_data) if (priv->available == NM_TERNARY_DEFAULT) { /* the available flag usually only changes together with the name-owner. - * However, if we tries to poke the service but failed to start it (with - * timeout), was also set it as (hard) not available. */ + * However, if we tries to poke the service but failed to start it (with + * timeout), was also set it as (hard) not available. */ priv->available = NM_TERNARY_FALSE; nm_clear_g_source(&priv->available_reset_id); priv->available_reset_id = g_timeout_add_seconds(60, _available_reset_cb, self); @@ -311,7 +311,7 @@ _poke_name_owner_timeout_cb(gpointer user_data) if (available_changed) { /* We delay the emitting of the notification after aborting all - * create-iface handles. */ + * create-iface handles. */ g_signal_emit(self, signals[AVAILABLE_CHANGED], 0); } @@ -334,7 +334,7 @@ _poke_name_owner_cb(GObject *source, GAsyncResult *result, gpointer user_data) _LOGT("poke service \"%s\" succeeded", NM_WPAS_DBUS_SERVICE); /* in both cases, we react the same: we wait for the name owner to appear - * or hit the timeout. */ + * or hit the timeout. */ } static void @@ -387,8 +387,8 @@ _create_iface_complete(NMSupplMgrCreateIfaceHandle *handle, if (handle->shutdown_handle) { /* we have a pending CreateInterface request. We keep the handle - * instance alive. This is to remove the device again, once the - * request completes. */ + * instance alive. This is to remove the device again, once the + * request completes. */ return; } @@ -467,7 +467,7 @@ _create_iface_dbus_call_get_interface_cb(GObject *source, GAsyncResult *result, && _nm_dbus_error_has_name(error, NM_WPAS_ERROR_UNKNOWN_IFACE) && nm_platform_if_indextoname(NM_PLATFORM_GET, handle->ifindex, ifname)) { /* Before, supplicant told us the interface existed. Was there a race? - * Try again. */ + * Try again. */ _LOGT("create-iface[" NM_HASH_OBFUSCATE_PTR_FMT "]: D-Bus call failed to get interface. Try to create it again (ifname \"%s\")", NM_HASH_OBFUSCATE_PTR(handle), @@ -652,20 +652,20 @@ _create_iface_dbus_start(NMSupplicantManager *self, NMSupplMgrCreateIfaceHandle } /* Our handle keeps @self alive. That means, when NetworkManager shall shut - * down, it's the responsibility of the callers to cancel the handles, - * to initiate coordinated shutdown. - * - * However, we now issue a CreateInterface call. Even if the handle gets cancelled - * (because of shutdown, or because the caller is no longer interested in the - * result), we don't want to cancel this request. Instead, we want to get - * the interface path and remove it right away. - * - * That means, the D-Bus call cannot be cancelled (because we always care about - * the result). Only the @handle can be cancelled, but parts of the handle will - * stick around to complete the task. - * - * See also handle->shutdown_handle. - */ + * down, it's the responsibility of the callers to cancel the handles, + * to initiate coordinated shutdown. + * + * However, we now issue a CreateInterface call. Even if the handle gets cancelled + * (because of shutdown, or because the caller is no longer interested in the + * result), we don't want to cancel this request. Instead, we want to get + * the interface path and remove it right away. + * + * That means, the D-Bus call cannot be cancelled (because we always care about + * the result). Only the @handle can be cancelled, but parts of the handle will + * stick around to complete the task. + * + * See also handle->shutdown_handle. + */ handle->name_owner = nm_ref_string_ref(priv->name_owner); handle->cancellable = g_cancellable_new(); _LOGT("create-iface[" NM_HASH_OBFUSCATE_PTR_FMT "]: creating interface (ifname \"%s\")...", @@ -778,9 +778,9 @@ _create_iface_proceed_all(NMSupplicantManager *self, GError *error) CList alt_list; /* we move the handles we want to proceed to a alternative list. - * That is, because we invoke callbacks to the caller, who might - * create another request right away. We don't want to proceed - * that one. */ + * That is, because we invoke callbacks to the caller, who might + * create another request right away. We don't want to proceed + * that one. */ c_list_init(&alt_list); c_list_splice(&alt_list, &priv->create_iface_lst_head); @@ -796,7 +796,7 @@ _create_iface_proceed_all(NMSupplicantManager *self, GError *error) } /* start all the handles. This does not invoke callbacks, so the list of handles - * cannot be modified while we iterate it. */ + * cannot be modified while we iterate it. */ c_list_for_each_entry (handle, &priv->create_iface_lst_head, create_iface_lst) { _LOGT("create-iface[" NM_HASH_OBFUSCATE_PTR_FMT "]: create interface on %s...", NM_HASH_OBFUSCATE_PTR(handle), @@ -897,14 +897,14 @@ _dbus_get_capabilities_cb(GVariant *res, GError *error, gpointer user_data) g_clear_object(&priv->get_capabilities_cancellable); /* The supplicant only advertises global capabilities if the following - * commit has been applied: - * - * commit 1634ac0654eba8d458640a115efc0a6cde3bac4d - * Author: Dan Williams <dcbw@redhat.com> - * Date: Sat Sep 29 19:06:30 2012 +0300 - * - * dbus: Add global capabilities property - */ + * commit has been applied: + * + * commit 1634ac0654eba8d458640a115efc0a6cde3bac4d + * Author: Dan Williams <dcbw@redhat.com> + * Date: Sat Sep 29 19:06:30 2012 +0300 + * + * dbus: Add global capabilities property + */ _caps_set(priv, NM_SUPPL_CAP_TYPE_AP, NM_TERNARY_DEFAULT); _caps_set(priv, NM_SUPPL_CAP_TYPE_PMF, NM_TERNARY_DEFAULT); _caps_set(priv, NM_SUPPL_CAP_TYPE_FILS, NM_TERNARY_DEFAULT); @@ -1159,16 +1159,16 @@ name_owner_changed(NMSupplicantManager *self, const char *name_owner, gboolean f } /* if supplicant is running (has a name owner), we may use it. - * If this is the first time, and supplicant is not running, we - * may also use it (and assume that we probably could D-Bus activate - * it). - * - * Otherwise, somebody else stopped supplicant. It's no longer useable to - * us and we block auto starting it. The user has to start the service... - * - * Actually, below we reset the hard block after a short timeout. This - * causes the caller to notify that supplicant may now by around and - * retry to D-Bus activate it. */ + * If this is the first time, and supplicant is not running, we + * may also use it (and assume that we probably could D-Bus activate + * it). + * + * Otherwise, somebody else stopped supplicant. It's no longer useable to + * us and we block auto starting it. The user has to start the service... + * + * Actually, below we reset the hard block after a short timeout. This + * causes the caller to notify that supplicant may now by around and + * retry to D-Bus activate it. */ if (priv->name_owner) available = NM_TERNARY_TRUE; else if (first_time) @@ -1194,7 +1194,7 @@ name_owner_changed(NMSupplicantManager *self, const char *name_owner, gboolean f if (!priv->name_owner) { if (priv->poke_name_owner_timeout_id) { /* we are still poking for the service to start. Don't cancel - * the pending create requests just yet. */ + * the pending create requests just yet. */ } else { gs_free_error GError *local_error = NULL; @@ -1204,12 +1204,12 @@ name_owner_changed(NMSupplicantManager *self, const char *name_owner, gboolean f } } else { /* We got a name-owner, but we don't do anything. Instead let - * _dbus_get_capabilities_cb() complete and kick of the create-iface - * handles. - * - * Note that before the first name-owner change, all create-iface - * requests fail right away. So we don't have to handle them here - * (by starting to poke the service). */ + * _dbus_get_capabilities_cb() complete and kick of the create-iface + * handles. + * + * Note that before the first name-owner change, all create-iface + * requests fail right away. So we don't have to handle them here + * (by starting to poke the service). */ } if (available_changed) @@ -1244,7 +1244,7 @@ name_owner_changed_cb(GDBusConnection *connection, if (name_owner && priv->name_owner) { /* odd, we directly switch from one name owner to the next. Can't allow that. - * First clear the name owner before resetting. */ + * First clear the name owner before resetting. */ name_owner_changed(self, NULL, FALSE); } name_owner_changed(user_data, name_owner, FALSE); diff --git a/src/tests/config/test-config.c b/src/tests/config/test-config.c index b3cbffaa56..f63b286bb8 100644 --- a/src/tests/config/test-config.c +++ b/src/tests/config/test-config.c @@ -1218,9 +1218,9 @@ test_config_signal(void) nm_config_reload(config, expected, FALSE); /* test with subscribing two signals... - * - * This test exposes glib bug https://bugzilla.redhat.com/show_bug.cgi?id=1260577 - * for which we however have a workaround in 'nm-config.c' */ + * + * This test exposes glib bug https://bugzilla.redhat.com/show_bug.cgi?id=1260577 + * for which we however have a workaround in 'nm-config.c' */ g_signal_connect(G_OBJECT(config), NM_CONFIG_SIGNAL_CONFIG_CHANGED, G_CALLBACK(_test_signal_config_changed_cb2), @@ -1389,9 +1389,9 @@ main(int argc, char **argv) g_test_add_func("/config/state-file", test_config_state_file); /* This one has to come last, because it leaves its values in - * nm-config.c's global variables, and there's no way to reset - * those to NULL. - */ + * nm-config.c's global variables, and there's no way to reset + * those to NULL. + */ g_test_add_func("/config/override", test_config_override); return g_test_run(); diff --git a/src/tests/test-core-with-expect.c b/src/tests/test-core-with-expect.c index 390c38fff7..019e3207ee 100644 --- a/src/tests/test-core-with-expect.c +++ b/src/tests/test-core-with-expect.c @@ -332,7 +332,7 @@ do_test_nm_utils_kill_child(void) test_nm_utils_kill_child_sync_do("test-s-3-1", pid3s, SIGTERM, 3000, TRUE, &expected_exit_47); /* pid3s should not be a valid process, hence the call should fail. Note, that there - * is a race here. */ + * is a race here. */ NMTST_EXPECT_NM_ERROR( "kill child process 'test-s-3-2' (*): failed due to unexpected return value -1 by waitpid " "(No child processes, 10) after sending no signal (0)"); @@ -395,7 +395,7 @@ do_test_nm_utils_kill_child(void) test_nm_utils_kill_child_async_do("test-a-3-1", pid3a, SIGTERM, 3000, TRUE, &expected_exit_47); /* pid3a should not be a valid process, hence the call should fail. Note, that there - * is a race here. */ + * is a race here. */ NMTST_EXPECT_NM_ERROR( "kill child process 'test-a-3-2' (*): failed due to unexpected return value -1 by waitpid " "(No child processes, 10) after sending no signal (0)"); @@ -425,12 +425,12 @@ test_nm_utils_kill_child(void) pid_t child_pid; /* the tests spawns several processes, we want to clean them up - * by sending a SIGKILL to the process group. - * - * The current process might be a session leader, which prevents it from - * creating a new process group. Hence, first fork and let the child - * create a new process group, run the tests, and kill all pending - * processes. */ + * by sending a SIGKILL to the process group. + * + * The current process might be a session leader, which prevents it from + * creating a new process group. Hence, first fork and let the child + * create a new process group, run the tests, and kill all pending + * processes. */ child_pid = fork(); g_assert(child_pid >= 0); diff --git a/src/tests/test-core.c b/src/tests/test-core.c index b75bc80d74..6446ac54d5 100644 --- a/src/tests/test-core.c +++ b/src/tests/test-core.c @@ -226,8 +226,8 @@ test_nm_utils_log_connection_diff(void) NMConnection *connection2; /* if logging is disabled (the default), nm_utils_log_connection_diff() returns - * early without doing anything. Hence, in the normal testing, this test does nothing. - * It only gets interesting, when run verbosely with NMTST_DEBUG=debug ... */ + * early without doing anything. Hence, in the normal testing, this test does nothing. + * It only gets interesting, when run verbosely with NMTST_DEBUG=debug ... */ nm_log(LOGL_DEBUG, LOGD_CORE, NULL, NULL, "START TEST test_nm_utils_log_connection_diff..."); @@ -458,9 +458,9 @@ test_connection_match_ip6_method(void) connections = g_slist_append(connections, copy); /* Check that if the generated connection is IPv6 method=link-local, and the - * candidate is both method=auto and may-faily=true, that the candidate is - * matched. - */ + * candidate is both method=auto and may-faily=true, that the candidate is + * matched. + */ s_ip6 = nm_connection_get_setting_ip6_config(orig); g_assert(s_ip6); g_object_set(G_OBJECT(s_ip6), @@ -497,8 +497,8 @@ test_connection_match_ip6_method_ignore(void) connections = g_slist_append(connections, copy); /* Check that if the generated connection is IPv6 method=link-local, and the - * candidate is method=ignore, that the candidate is matched. - */ + * candidate is method=ignore, that the candidate is matched. + */ s_ip6 = nm_connection_get_setting_ip6_config(orig); g_assert(s_ip6); g_object_set(G_OBJECT(s_ip6), @@ -533,8 +533,8 @@ test_connection_match_ip6_method_ignore_auto(void) connections = g_slist_append(connections, copy); /* Check that if the generated connection is IPv6 method=auto, and the - * candidate is method=ignore, that the candidate is matched. - */ + * candidate is method=ignore, that the candidate is matched. + */ s_ip6 = nm_connection_get_setting_ip6_config(orig); g_assert(s_ip6); g_object_set(G_OBJECT(s_ip6), @@ -569,9 +569,9 @@ test_connection_match_ip4_method(void) connections = g_slist_append(connections, copy); /* Check that if the generated connection is IPv4 method=disabled, and the - * candidate is both method=auto and may-faily=true, and the device has no - * carrier that the candidate is matched. - */ + * candidate is both method=auto and may-faily=true, and the device has no + * carrier that the candidate is matched. + */ s_ip4 = nm_connection_get_setting_ip4_config(orig); g_assert(s_ip4); g_object_set(G_OBJECT(s_ip4), @@ -612,8 +612,8 @@ test_connection_match_interface_name(void) connections = g_slist_append(connections, copy); /* Check that if the generated connection has an interface name and the - * candidate's interface name is NULL, that the candidate is matched. - */ + * candidate's interface name is NULL, that the candidate is matched. + */ s_con = nm_connection_get_setting_connection(orig); g_assert(s_con); g_object_set(G_OBJECT(s_con), NM_SETTING_CONNECTION_INTERFACE_NAME, "em1", NULL); @@ -695,8 +695,8 @@ test_connection_match_wired2(void) connections = g_slist_append(connections, copy); /* Check that if the generated connection do not have wired setting - * and s390 properties in the existing connection's setting are default, - * the connections match. It can happen if assuming VLAN devices. */ + * and s390 properties in the existing connection's setting are default, + * the connections match. It can happen if assuming VLAN devices. */ nm_connection_remove_setting(orig, NM_TYPE_SETTING_WIRED); matched = _match_connection(connections, orig, TRUE, 0, 0); @@ -759,8 +759,8 @@ test_connection_no_match_ip4_addr(void) connections = g_slist_append(connections, copy); /* Check that if we have two differences, ipv6.method (exception we allow) and - * ipv4.addresses (which is fatal), we don't match the connections. - */ + * ipv4.addresses (which is fatal), we don't match the connections. + */ s_ip6 = nm_connection_get_setting_ip6_config(orig); g_assert(s_ip6); g_object_set(G_OBJECT(s_ip6), @@ -1253,7 +1253,7 @@ _do_test_match_spec_device(const char * spec_str, g_slist_free_full(specs_resplit, g_free); /* also check the matches in the random order. They must yield the same result because - * matches are inclusive -- except "except:" which always wins. */ + * matches are inclusive -- except "except:" which always wins. */ specs_randperm = nmtst_rand_perm_gslist(NULL, g_slist_copy(specs)); for (i = 0; matches && matches[i]; i++) { @@ -1799,9 +1799,9 @@ test_nm_utils_strbuf_append(void) g_snprintf(t_buf, t_len, "%s", str); if (t_len > 0 && strlen(str) >= buf_len && (nmtst_get_rand_uint32() % 2)) { /* the string was truncated by g_snprintf(). That means, at the last position in the - * buffer is now NUL. - * Replace the NUL by the actual character, and check that nm_utils_strbuf_seek_end() - * does the right thing: NUL terminate the buffer and seek past the end of the buffer. */ + * buffer is now NUL. + * Replace the NUL by the actual character, and check that nm_utils_strbuf_seek_end() + * does the right thing: NUL terminate the buffer and seek past the end of the buffer. */ g_assert_cmpmem(t_buf, t_len - 1, str, t_len - 1); g_assert(t_buf[t_len - 1] == '\0'); g_assert(str[t_len - 1] != '\0'); @@ -1814,15 +1814,15 @@ test_nm_utils_strbuf_append(void) nm_utils_strbuf_seek_end(&t_buf, &t_len); if (buf_len > 0 && strlen(str) + 1 > buf_len) { /* the buffer was truncated by g_snprintf() above. - * - * But nm_utils_strbuf_seek_end() does not recognize that and returns - * a remaining length of 1. - * - * Note that other nm_utils_strbuf_append*() functions recognize - * truncation, and properly set the remaining length to zero. - * As the assertions below check for the behavior of nm_utils_strbuf_append*(), - * we assert here that nm_utils_strbuf_seek_end() behaved as expected, and then - * adjust t_buf/t_len according to the "is-truncated" case. */ + * + * But nm_utils_strbuf_seek_end() does not recognize that and returns + * a remaining length of 1. + * + * Note that other nm_utils_strbuf_append*() functions recognize + * truncation, and properly set the remaining length to zero. + * As the assertions below check for the behavior of nm_utils_strbuf_append*(), + * we assert here that nm_utils_strbuf_seek_end() behaved as expected, and then + * adjust t_buf/t_len according to the "is-truncated" case. */ g_assert(t_len == 1); g_assert(t_buf == &buf[buf_len - 1]); g_assert(t_buf[0] == '\0'); @@ -1897,8 +1897,8 @@ static void test_duplicate_decl_specifier(void) { /* We're intentionally assigning values to static arrays v_const - * and v_result without using it afterwards just so that valgrind - * doesn't complain about the leak. */ + * and v_result without using it afterwards just so that valgrind + * doesn't complain about the leak. */ NM_PRAGMA_WARNING_DISABLE("-Wunused-but-set-variable") /* have some static variables, so that the result is certainly not optimized out. */ @@ -1907,7 +1907,7 @@ test_duplicate_decl_specifier(void) const int v2 = 3; /* Test that we don't get a compiler warning about duplicate const specifier. - * C99 allows that and it can easily happen in macros. */ + * C99 allows that and it can easily happen in macros. */ #define TEST_MAX(a, b) \ ({ \ @@ -2267,8 +2267,8 @@ test_machine_id_read(void) logstate = nmtst_logging_disable(FALSE); /* If you run this test as root, without a valid /etc/machine-id, - * the code will try to get the secret-key. That is a bit ugly, - * but no real problem. */ + * the code will try to get the secret-key. That is a bit ugly, + * but no real problem. */ machine_id = nm_utils_machine_id_bin(); nmtst_logging_reenable(logstate); @@ -2281,12 +2281,12 @@ test_machine_id_read(void) /* double check with systemd's implementation... */ if (!nm_sd_utils_id128_get_machine(&machine_id_sd)) { /* if systemd failed to read /etc/machine-id, the file likely - * is invalid. Our machine-id is fake, and we have nothing to - * compare against. */ + * is invalid. Our machine-id is fake, and we have nothing to + * compare against. */ /* NOTE: this test will fail, if you don't have /etc/machine-id, - * but a valid "LOCALSTATEDIR/lib/dbus/machine-id" file. - * Just don't do that. */ + * but a valid "LOCALSTATEDIR/lib/dbus/machine-id" file. + * Just don't do that. */ g_assert(nm_utils_machine_id_is_fake()); } else { g_assert(!nm_utils_machine_id_is_fake()); @@ -2378,8 +2378,8 @@ test_nm_utils_dhcp_client_id_systemd_node_specific(gconstpointer test_data) gint32 u32; /* the test already hard-codes the expected values iaid_ifname and duid_id - * above. Still, redo the steps to derive them from the ifname/machine-id - * and double check. */ + * above. Still, redo the steps to derive them from the ifname/machine-id + * and double check. */ u64 = c_siphash_hash(HASH_KEY, (const guint8 *) d->ifname, strlen(d->ifname)); g_assert_cmpint(u64, ==, d->ifname_hash_1); u32 = be32toh((u64 & 0xffffffffu) ^ (u64 >> 32)); @@ -2410,7 +2410,7 @@ test_nm_utils_dhcp_client_id_systemd_node_specific(gconstpointer test_data) #if __BYTE_ORDER == __BIG_ENDIAN if (legacy_unstable_byteorder) { /* on non-little endian, the legacy behavior is to have the bytes - * swapped. */ + * swapped. */ iaid = bswap_32(iaid); } #endif diff --git a/src/tests/test-systemd.c b/src/tests/test-systemd.c index 8949de637d..71d9ee1d1e 100644 --- a/src/tests/test-systemd.c +++ b/src/tests/test-systemd.c @@ -80,7 +80,7 @@ test_dhcp_create(void) if (/* never true */ client4 == (gpointer) &r) { /* we don't want to call this, but ensure that the linker - * includes all these symbols. */ + * includes all these symbols. */ sd_dhcp_client_start(client4); } diff --git a/src/vpn/nm-vpn-connection.c b/src/vpn/nm-vpn-connection.c index c9ff044e40..b552584a50 100644 --- a/src/vpn/nm-vpn-connection.c +++ b/src/vpn/nm-vpn-connection.c @@ -115,8 +115,8 @@ typedef struct { NMIP6Config * ip6_config; /* These config instances are passed on to NMDevice and modified by NMDevice. - * This pointer is only useful for nm_device_replace_vpn4_config() to clear the - * previous configuration. Consider these instances to be owned by NMDevice. */ + * This pointer is only useful for nm_device_replace_vpn4_config() to clear the + * previous configuration. Consider these instances to be owned by NMDevice. */ NMIP4Config *last_device_ip4_config; NMIP6Config *last_device_ip6_config; @@ -258,11 +258,11 @@ _state_to_nm_vpn_state(VpnState state) case STATE_DEACTIVATING: { /* Map DEACTIVATING to ACTIVATED to preserve external API behavior, - * since our API has no DEACTIVATING state of its own. Since this can - * take some time, and the VPN isn't actually disconnected until it - * hits the DISCONNECTED state, to clients it should still appear - * connected. - */ + * since our API has no DEACTIVATING state of its own. Since this can + * take some time, and the VPN isn't actually disconnected until it + * hits the DISCONNECTED state, to clients it should still appear + * connected. + */ return NM_VPN_CONNECTION_STATE_ACTIVATED; } case STATE_DISCONNECTED: @@ -305,8 +305,8 @@ _get_settings_connection(NMVpnConnection *self, gboolean allow_missing) NMSettingsConnection *con; /* Currently, we operate on the assumption, that the settings-connection - * never changes after it is set (though initially, it might be unset). - * Later we might want to change that, but then we need fixes here too. */ + * never changes after it is set (though initially, it might be unset). + * Later we might want to change that, but then we need fixes here too. */ con = _nm_active_connection_get_settings_connection(NM_ACTIVE_CONNECTION(self)); if (!con && !allow_missing) @@ -400,8 +400,8 @@ vpn_cleanup(NMVpnConnection *self, NMDevice *parent_dev) priv->bus_name = NULL; /* Clear out connection secrets to ensure that the settings service - * gets asked for them next time the connection is activated. - */ + * gets asked for them next time the connection is activated. + */ nm_active_connection_clear_secrets(NM_ACTIVE_CONNECTION(self)); } @@ -466,8 +466,8 @@ _set_vpn_state(NMVpnConnection * self, priv->vpn_state = vpn_state; /* The device gets destroyed by active connection when it enters - * the deactivated state, so we need to ref it for usage below. - */ + * the deactivated state, so we need to ref it for usage below. + */ if (parent_dev) g_object_ref(parent_dev); @@ -482,9 +482,9 @@ _set_vpn_state(NMVpnConnection * self, dispatcher_cleanup(self); /* The connection gets destroyed by the VPN manager when it enters the - * disconnected/failed state, but we need to keep it around for a bit - * to send out signals and handle the dispatcher. So ref it. - */ + * disconnected/failed state, but we need to keep it around for a bit + * to send out signals and handle the dispatcher. So ref it. + */ g_object_ref(self); old_external_state = _state_to_nm_vpn_state(old_vpn_state); @@ -508,9 +508,9 @@ _set_vpn_state(NMVpnConnection * self, switch (vpn_state) { case STATE_NEED_AUTH: /* Do nothing; not part of 'default' because we don't want to touch - * priv->secrets_req as NEED_AUTH is re-entered during interactive - * secrets. - */ + * priv->secrets_req as NEED_AUTH is re-entered during interactive + * secrets. + */ break; case STATE_PRE_UP: if (!nm_dispatcher_call_vpn(NM_DISPATCHER_ACTION_VPN_PRE_UP, @@ -678,8 +678,8 @@ device_state_changed(NMActiveConnection *active, } /* FIXME: map device DEACTIVATING state to VPN DEACTIVATING state and - * block device deactivation on VPN deactivation. - */ + * block device deactivation on VPN deactivation. + */ } static void @@ -705,7 +705,7 @@ add_ip4_vpn_gateway_route(NMIP4Config *config, nm_assert(ifindex == nm_device_get_ip_ifindex(parent_device)); /* Ask kernel how to reach @vpn_gw. We can only inject the route in - * @parent_device, so whatever we resolve, it can only be on @ifindex. */ + * @parent_device, so whatever we resolve, it can only be on @ifindex. */ if (nm_platform_ip_route_get(platform, AF_INET, &vpn_gw, @@ -718,10 +718,10 @@ add_ip4_vpn_gateway_route(NMIP4Config *config, const NMPObject *obj; /* `ip route get` always resolves the route, even if the destination is unreachable. - * In which case, it pretends the destination is directly reachable. - * - * So, only accept direct routes if @vpn_gw is a private network - * or if the parent device also has a direct default route */ + * In which case, it pretends the destination is directly reachable. + * + * So, only accept direct routes if @vpn_gw is a private network + * or if the parent device also has a direct default route */ if (nm_platform_route_table_is_main(r->table_coerced)) { if (r->gateway) { parent_gw = r->gateway; @@ -752,10 +752,10 @@ add_ip4_vpn_gateway_route(NMIP4Config *config, if (parent_gw) { /* Ensure there's a route to the parent device's gateway through the - * parent device, since if the VPN claims the default route and the VPN - * routes include a subnet that matches the parent device's subnet, - * the parent device's gateway would get routed through the VPN and fail. - */ + * parent device, since if the VPN claims the default route and the VPN + * routes include a subnet that matches the parent device's subnet, + * the parent device's gateway would get routed through the VPN and fail. + */ memset(&route, 0, sizeof(route)); route.network = parent_gw; route.plen = 32; @@ -788,7 +788,7 @@ add_ip6_vpn_gateway_route(NMIP6Config * config, nm_assert(ifindex == nm_device_get_ip_ifindex(parent_device)); /* Ask kernel how to reach @vpn_gw. We can only inject the route in - * @parent_device, so whatever we resolve, it can only be on @ifindex. */ + * @parent_device, so whatever we resolve, it can only be on @ifindex. */ if (nm_platform_ip_route_get(platform, AF_INET6, vpn_gw, @@ -801,10 +801,10 @@ add_ip6_vpn_gateway_route(NMIP6Config * config, const NMPObject *obj; /* `ip route get` always resolves the route, even if the destination is unreachable. - * In which case, it pretends the destination is directly reachable. - * - * So, only accept direct routes if @vpn_gw is a private network - * or if the parent device also has a direct default route */ + * In which case, it pretends the destination is directly reachable. + * + * So, only accept direct routes if @vpn_gw is a private network + * or if the parent device also has a direct default route */ if (nm_platform_route_table_is_main(r->table_coerced)) { if (!IN6_IS_ADDR_UNSPECIFIED(&r->gateway)) { parent_gw = &r->gateway; @@ -835,10 +835,10 @@ add_ip6_vpn_gateway_route(NMIP6Config * config, nm_ip6_config_add_route(config, &route, NULL); /* Ensure there's a route to the parent device's gateway through the - * parent device, since if the VPN claims the default route and the VPN - * routes include a subnet that matches the parent device's subnet, - * the parent device's gateway would get routed through the VPN and fail. - */ + * parent device, since if the VPN claims the default route and the VPN + * routes include a subnet that matches the parent device's subnet, + * the parent device's gateway would get routed through the VPN and fail. + */ if (parent_gw && !IN6_IS_ADDR_UNSPECIFIED(parent_gw)) { memset(&route, 0, sizeof(route)); route.network = *parent_gw; @@ -965,8 +965,8 @@ plugin_state_changed(NMVpnConnection *self, NMVpnServiceState new_service_state) if (new_service_state == NM_VPN_SERVICE_STATE_STOPPED) { /* Clear connection secrets to ensure secrets get requested each time the - * connection is activated. - */ + * connection is activated. + */ nm_active_connection_clear_secrets(NM_ACTIVE_CONNECTION(self)); if ((priv->vpn_state >= STATE_WAITING) && (priv->vpn_state <= STATE_ACTIVATED)) { @@ -978,8 +978,8 @@ plugin_state_changed(NMVpnConnection *self, NMVpnServiceState new_service_state) priv->failure_reason = NM_ACTIVE_CONNECTION_STATE_REASON_UNKNOWN; /* If the connection failed, the service cannot persist, but the - * connection can persist, ask listeners to re-activate the connection. - */ + * connection can persist, ask listeners to re-activate the connection. + */ if (old_state == STATE_ACTIVATED && priv->vpn_state == STATE_FAILED && _connection_only_can_persist(self)) g_signal_emit(self, signals[INTERNAL_RETRY_AFTER_FAILURE], 0); @@ -1105,9 +1105,9 @@ apply_parent_device_config(NMVpnConnection *self) ifindex = nm_device_get_ip_ifindex(parent_dev); if (ifindex > 0) { /* If the VPN didn't return a network interface, it is a route-based - * VPN (like kernel IPSec) and all IP addressing and routing should - * be done on the parent interface instead. - */ + * VPN (like kernel IPSec) and all IP addressing and routing should + * be done on the parent interface instead. + */ if (priv->ip4_config) { vpn4_parent_config = nm_ip4_config_new(nm_netns_get_multi_idx(priv->netns), ifindex); if (priv->ip_ifindex <= 0) @@ -1529,8 +1529,8 @@ nm_vpn_connection_ip4_config_get(NMVpnConnection *self, GVariant *dict) _LOGI("VPN connection: (IP4 Config Get) reply received from old-style plugin"); /* In the old API, the generic and IPv4 configuration items - * were mixed together. - */ + * were mixed together. + */ if (!process_generic_config(self, dict)) return; @@ -1640,10 +1640,10 @@ nm_vpn_connection_ip4_config_get(NMVpnConnection *self, GVariant *dict) if (priv->ip4_external_gw && route.network == priv->ip4_external_gw && route.plen == 32) { /* Ignore host routes to the VPN gateway since NM adds one itself - * below. Since NM knows more about the routing situation than - * the VPN server, we want to use the NM created route instead of - * whatever the server provides. - */ + * below. Since NM knows more about the routing situation than + * the VPN server, we want to use the NM created route instead of + * whatever the server provides. + */ break; } @@ -1839,10 +1839,10 @@ nm_vpn_connection_ip6_config_get(NMVpnConnection *self, GVariant *dict) if (priv->ip6_external_gw && IN6_ARE_ADDR_EQUAL(&route.network, priv->ip6_external_gw) && route.plen == 128) { /* Ignore host routes to the VPN gateway since NM adds one itself. - * Since NM knows more about the routing situation than the VPN - * server, we want to use the NM created route instead of whatever - * the server provides. - */ + * Since NM knows more about the routing situation than the VPN + * server, we want to use the NM created route instead of whatever + * the server provides. + */ goto next; } @@ -1919,7 +1919,7 @@ connect_success(NMVpnConnection *self) g_assert(s_vpn); /* Timeout waiting for IP config signal from VPN service - * It is a configured value or 60 seconds */ + * It is a configured value or 60 seconds */ timeout = nm_setting_vpn_get_timeout(s_vpn); if (timeout == 0) { timeout = nm_config_data_get_connection_default_int64(NM_CONFIG_GET_DATA, @@ -2008,8 +2008,8 @@ _hash_with_username(NMConnection *connection, const char *username) NMSettingVpn * s_vpn; /* Shortcut if we weren't given a username or if there already was one in - * the VPN setting; don't bother duplicating the connection and everything. - */ + * the VPN setting; don't bother duplicating the connection and everything. + */ s_vpn = nm_connection_get_setting_vpn(connection); g_assert(s_vpn); if (username == NULL || nm_setting_vpn_get_user_name(s_vpn)) @@ -2039,11 +2039,11 @@ really_activate(NMVpnConnection *self, const char *username) g_variant_ref_sink(priv->connect_hash); /* If at least one agent doesn't support VPN hints, then we can't use - * ConnectInteractive(), because that agent won't be able to pass hints - * from the VPN plugin's interactive secrets requests to the VPN authentication - * dialog and we won't get the secrets we need. In this case fall back to - * the old Connect() call. - */ + * ConnectInteractive(), because that agent won't be able to pass hints + * from the VPN plugin's interactive secrets requests to the VPN authentication + * dialog and we won't get the secrets we need. In this case fall back to + * the old Connect() call. + */ if (nm_agent_manager_all_agents_have_capability( nm_agent_manager_get(), nm_active_connection_get_subject(NM_ACTIVE_CONNECTION(self)), @@ -2186,10 +2186,10 @@ _name_owner_changed(GObject *object, GParamSpec *pspec, gpointer user_data) _set_vpn_state(self, STATE_NEED_AUTH, NM_ACTIVE_CONNECTION_STATE_REASON_NONE, FALSE); /* Kick off the secrets requests; first we get existing system secrets - * and ask the plugin if these are sufficient, next we get all existing - * secrets from system and from user agents and ask the plugin again, - * and last we ask the user for new secrets if required. - */ + * and ask the plugin if these are sufficient, next we get all existing + * secrets from system and from user agents and ask the plugin again, + * and last we ask the user for new secrets if required. + */ get_secrets(self, SECRETS_REQ_SYSTEM, NULL); } else if (!owner && priv->service_running) { /* service went away */ @@ -2223,17 +2223,17 @@ _get_log_level(void) NMLogLevel level; /* curiously enough, nm-logging also uses syslog. But it - * maps NMLogLevel differently to the syslog levels then we - * do here. - * - * The reason is, that LOG_NOTICE is already something worth - * highlighting in the journal, but we have 3 levels that are - * lower then LOG_NOTICE (LOGL_TRACE, LOGL_DEBUG, LOGL_INFO), - * On the other hand, syslog only defines LOG_DEBUG and LOG_INFO. - * Thus, we must map them differently. - * - * Inside the VPN plugin, you might want to treat LOG_NOTICE as - * as low severity, not worthy to be highlighted (like NM does). */ + * maps NMLogLevel differently to the syslog levels then we + * do here. + * + * The reason is, that LOG_NOTICE is already something worth + * highlighting in the journal, but we have 3 levels that are + * lower then LOG_NOTICE (LOGL_TRACE, LOGL_DEBUG, LOGL_INFO), + * On the other hand, syslog only defines LOG_DEBUG and LOG_INFO. + * Thus, we must map them differently. + * + * Inside the VPN plugin, you might want to treat LOG_NOTICE as + * as low severity, not worthy to be highlighted (like NM does). */ level = nm_logging_get_level(LOGD_VPN_PLUGIN); if (level != _LOGL_OFF) { @@ -2295,9 +2295,9 @@ nm_vpn_service_daemon_exec(NMVpnConnection *self, GError **error) envp[i++] = nm_sprintf_buf(env_log_level, "NM_VPN_LOG_LEVEL=%d", _get_log_level()); /* NM_VPN_LOG_SYSLOG: whether to log to stdout or syslog. If NetworkManager itself runs in - * foreground, we also want the plugin to log to stdout. - * If the plugin runs in background, the plugin should prefer logging to syslog. Otherwise - * logging messages will be lost (unless using journald, in which case it wouldn't matter). */ + * foreground, we also want the plugin to log to stdout. + * If the plugin runs in background, the plugin should prefer logging to syslog. Otherwise + * logging messages will be lost (unless using journald, in which case it wouldn't matter). */ envp[i++] = nm_sprintf_buf(env_log_syslog, "NM_VPN_LOG_SYSLOG=%c", nm_logging_syslog_enabled() ? '1' : '0'); @@ -2463,7 +2463,7 @@ _get_ip_iface_for_device(NMVpnConnection *self, const char **out_iface) nm_assert(NM_IS_VPN_CONNECTION(self)); /* the ifindex and the ifname in this case should come together. - * They either must be both set, or none. */ + * They either must be both set, or none. */ parent_dev = nm_active_connection_get_device(NM_ACTIVE_CONNECTION(self)); if (!parent_dev) @@ -2785,15 +2785,15 @@ device_changed(NMActiveConnection *active, NMDevice *new_device, NMDevice *old_d return; /* Route-based VPNs must update their routing and send a new IP config - * since all their routes need to be adjusted for new_device. - */ + * since all their routes need to be adjusted for new_device. + */ if (priv->ip_ifindex <= 0) return; /* Device changed underneath the VPN connection. Let the plugin figure - * out that connectivity is down and start its reconnect attempt if it - * needs to. - */ + * out that connectivity is down and start its reconnect attempt if it + * needs to. + */ if (old_device) remove_parent_device_config(NM_VPN_CONNECTION(active), old_device); diff --git a/src/vpn/nm-vpn-manager.c b/src/vpn/nm-vpn-manager.c index d518b08229..90632e3257 100644 --- a/src/vpn/nm-vpn-manager.c +++ b/src/vpn/nm-vpn-manager.c @@ -22,7 +22,7 @@ typedef struct { gulong monitor_id_lib; /* This is only used for services that don't support multiple - * connections, to guard access to them. */ + * connections, to guard access to them. */ GHashTable *active_services; } NMVpnManagerPrivate; @@ -128,8 +128,8 @@ try_add_plugin(NMVpnManager *self, NMVpnPluginInfo *plugin_info) return; /* Make sure we don't add dupes. - * We don't really allow reload of the same file. What we do allow is however to - * delete a file and re-add it. */ + * We don't really allow reload of the same file. What we do allow is however to + * delete a file and re-add it. */ if (nm_vpn_plugin_info_list_find_by_filename(priv->plugins, nm_vpn_plugin_info_get_filename(plugin_info))) return; @@ -168,9 +168,9 @@ vpn_dir_changed(GFileMonitor * monitor, plugin_info = nm_vpn_plugin_info_list_find_by_filename(priv->plugins, path); if (plugin_info) { /* we don't support reloading an existing plugin. You can only remove the file - * and re-add it. By reloading we want to support the use case of installing - * a VPN plugin after NM started. No need to burden ourself with a complete - * reload. */ + * and re-add it. By reloading we want to support the use case of installing + * a VPN plugin after NM started. No need to burden ourself with a complete + * reload. */ break; } @@ -230,9 +230,9 @@ nm_vpn_manager_init(NMVpnManager *self) } /* first read conf_dir_lib. The name files are not really user configuration, but - * plugin configuration. Hence we expect ~newer~ plugins to install their files - * in /usr/lib/NetworkManager. We want to prefer those files. - * In case of no-conflict, the order doesn't matter. */ + * plugin configuration. Hence we expect ~newer~ plugins to install their files + * in /usr/lib/NetworkManager. We want to prefer those files. + * In case of no-conflict, the order doesn't matter. */ infos = _nm_vpn_plugin_info_list_load_dir(conf_dir_lib, TRUE, 0, NULL, NULL); for (info = infos; info; info = info->next) try_add_plugin(self, info->data); |