From 982807ec4e28d434779396520359636c57ea8e2b Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 18 Jan 2022 15:49:47 +0100 Subject: [PATCH] Revert "nm-device: prefer manually configured addresses to automatic" This commit does not seem correct. The enum was moved with the declared intent to make manual IP configuration preferred. But the code comment in L3ConfigDataType states that higher numbers are more important. Also, all the other values are intentionally ordered so that more important method have higher numbers. For example, LL_4 < DHCP_4 < SHARED_4 < DEV_4 (in increasing priority). While it's often not clear whether to prefer one method over the other, or what the actual effect of (LL_4 < DHCP_4) is, the numbers were chosen intentionally. Only moving MANUALIP first, counters the relative order of the other values. If there is the problem, that the code comment is wrong (and lower numbers mean more important), then we would have to reverse all enum values. The real problem is that NML3Cfg's _l3_config_datas_get_sorted_cmp() has the wrong order/understanding. So the real fix is there and will be done next. That is, unless we would agree that _l3_config_datas_get_sorted_cmp() is in the right, and prefer lower numbers -- in which case all values had to be reversed. This reverts commit af1903fe3f41acb79acfba6463615dff87abde01. --- src/core/devices/nm-device.c | 4 ++-- src/core/nm-l3cfg.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c index bc23ef0198..2be894ac03 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -139,8 +139,6 @@ typedef enum { * their relative order matters: higher numbers in this enum means more * important (and during merge overwrites other settings). */ - L3_CONFIG_DATA_TYPE_MANUALIP, - L3_CONFIG_DATA_TYPE_LL_4, L3_CONFIG_DATA_TYPE_LL_6, @@ -183,6 +181,8 @@ typedef enum { _t; \ }) + L3_CONFIG_DATA_TYPE_MANUALIP, + _L3_CONFIG_DATA_TYPE_NUM, _L3_CONFIG_DATA_TYPE_NONE, _L3_CONFIG_DATA_TYPE_ACD_ONLY, diff --git a/src/core/nm-l3cfg.h b/src/core/nm-l3cfg.h index d994efde32..a7d89a2618 100644 --- a/src/core/nm-l3cfg.h +++ b/src/core/nm-l3cfg.h @@ -6,8 +6,8 @@ #include "libnm-platform/nmp-object.h" #include "nm-l3-config-data.h" -#define NM_L3CFG_CONFIG_PRIORITY_IPV4LL 1 -#define NM_L3CFG_CONFIG_PRIORITY_IPV6LL 1 +#define NM_L3CFG_CONFIG_PRIORITY_IPV4LL 0 +#define NM_L3CFG_CONFIG_PRIORITY_IPV6LL 0 #define NM_ACD_TIMEOUT_RFC5227_MSEC 9000u #define NM_TYPE_L3CFG (nm_l3cfg_get_type())