summary refs log tree commit diff
path: root/libnm-core
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2021-08-16 09:51:46 +0200
committerMichael Biebl <biebl@debian.org>2021-08-16 09:51:46 +0200
commitbfe522304da217296e2a61040f58e35ec5d6f3f2 (patch)
tree6c4296644fa59cbfe51d9e8aafebddace5ac6b6f /libnm-core
parent3a56bce6c0ea7ba0fe269520547740783b342e0d (diff)
New upstream version 1.30.6 upstream/1.30.6
Diffstat (limited to 'libnm-core')
-rw-r--r--libnm-core/nm-core-internal.h2
-rw-r--r--libnm-core/nm-libnm-core-intern/nm-libnm-core-utils.c1
-rw-r--r--libnm-core/nm-libnm-core-intern/nm-libnm-core-utils.h3
-rw-r--r--libnm-core/nm-setting-bond.c41
-rw-r--r--libnm-core/nm-setting-bond.h1
-rw-r--r--libnm-core/nm-setting-ip-config.c1
-rw-r--r--libnm-core/nm-setting-ip-config.h2
-rw-r--r--libnm-core/nm-setting-tc-config.c30
-rw-r--r--libnm-core/nm-setting-wireless-security.c5
-rw-r--r--libnm-core/nm-utils.c20
-rw-r--r--libnm-core/nm-version-macros.h2
-rw-r--r--libnm-core/tests/test-setting.c2
12 files changed, 88 insertions, 22 deletions
diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h
index d9374fe5..e386d5e9 100644
--- a/libnm-core/nm-core-internal.h
+++ b/libnm-core/nm-core-internal.h
@@ -586,6 +586,8 @@ NMBondOptionType _nm_setting_bond_get_option_type(NMSettingBond *setting, const
 
 const char *nm_setting_bond_get_option_or_default(NMSettingBond *self, const char *option);
 
+#define NM_BOND_AD_ACTOR_SYSTEM_DEFAULT "00:00:00:00:00:00"
+
 /*****************************************************************************/
 
 /* nm_connection_get_uuid() asserts against NULL, which is the right thing to
diff --git a/libnm-core/nm-libnm-core-intern/nm-libnm-core-utils.c b/libnm-core/nm-libnm-core-intern/nm-libnm-core-utils.c
index 1ab0fcf2..3b4c2da7 100644
--- a/libnm-core/nm-libnm-core-intern/nm-libnm-core-utils.c
+++ b/libnm-core/nm-libnm-core-intern/nm-libnm-core-utils.c
@@ -25,6 +25,7 @@ _nm_setting_bond_remove_options_miimon(NMSettingBond *s_bond)
     nm_setting_bond_remove_option(s_bond, NM_SETTING_BOND_OPTION_MIIMON);
     nm_setting_bond_remove_option(s_bond, NM_SETTING_BOND_OPTION_UPDELAY);
     nm_setting_bond_remove_option(s_bond, NM_SETTING_BOND_OPTION_DOWNDELAY);
+    nm_setting_bond_remove_option(s_bond, NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY);
 }
 
 void
diff --git a/libnm-core/nm-libnm-core-intern/nm-libnm-core-utils.h b/libnm-core/nm-libnm-core-intern/nm-libnm-core-utils.h
index 946c7a2c..ea887f3f 100644
--- a/libnm-core/nm-libnm-core-intern/nm-libnm-core-utils.h
+++ b/libnm-core/nm-libnm-core-intern/nm-libnm-core-utils.h
@@ -36,6 +36,9 @@ NM_AUTO_DEFINE_FCN0(NMTCQdisc *, _nm_auto_unref_tc_qdisc, nm_tc_qdisc_unref);
 #define nm_auto_unref_tc_tfilter nm_auto(_nm_auto_unref_tc_tfilter)
 NM_AUTO_DEFINE_FCN0(NMTCTfilter *, _nm_auto_unref_tc_tfilter, nm_tc_tfilter_unref);
 
+#define nm_auto_unref_tc_action nm_auto(_nm_auto_unref_tc_action)
+NM_AUTO_DEFINE_FCN0(NMTCAction *, _nm_auto_unref_tc_action, nm_tc_action_unref);
+
 #define nm_auto_unref_bridge_vlan nm_auto(_nm_auto_unref_bridge_vlan)
 NM_AUTO_DEFINE_FCN0(NMBridgeVlan *, _nm_auto_unref_bridge_vlan, nm_bridge_vlan_unref);
 
diff --git a/libnm-core/nm-setting-bond.c b/libnm-core/nm-setting-bond.c
index 2d64ef02..60470200 100644
--- a/libnm-core/nm-setting-bond.c
+++ b/libnm-core/nm-setting-bond.c
@@ -74,6 +74,7 @@ static const char *const valid_options_lst[] = {
     NM_SETTING_BOND_OPTION_PACKETS_PER_SLAVE,
     NM_SETTING_BOND_OPTION_TLB_DYNAMIC_LB,
     NM_SETTING_BOND_OPTION_LP_INTERVAL,
+    NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY,
     NULL,
 };
 
@@ -191,6 +192,7 @@ static NM_UTILS_STRING_TABLE_LOOKUP_STRUCT_DEFINE(
     {NM_SETTING_BOND_OPTION_NUM_GRAT_ARP, {"1", NM_BOND_OPTION_TYPE_INT, 0, 255}},
     {NM_SETTING_BOND_OPTION_NUM_UNSOL_NA, {"1", NM_BOND_OPTION_TYPE_INT, 0, 255}},
     {NM_SETTING_BOND_OPTION_PACKETS_PER_SLAVE, {"1", NM_BOND_OPTION_TYPE_INT, 0, 65535}},
+    {NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY, {"0", NM_BOND_OPTION_TYPE_INT, 0, G_MAXINT}},
     {NM_SETTING_BOND_OPTION_PRIMARY, {"", NM_BOND_OPTION_TYPE_IFNAME}},
     {NM_SETTING_BOND_OPTION_PRIMARY_RESELECT,
      {"always", NM_BOND_OPTION_TYPE_BOTH, 0, 2, _option_default_strv_primary_reselect}},
@@ -225,7 +227,7 @@ static NM_UTILS_STRING_TABLE_LOOKUP_DEFINE(
     {NM_SETTING_BOND_OPTION_PACKETS_PER_SLAVE, ~(BIT(NM_BOND_MODE_ROUNDROBIN))},
     {NM_SETTING_BOND_OPTION_PRIMARY,
      ~(BIT(NM_BOND_MODE_ACTIVEBACKUP) | BIT(NM_BOND_MODE_TLB) | BIT(NM_BOND_MODE_ALB))},
-    {NM_SETTING_BOND_OPTION_TLB_DYNAMIC_LB, ~(BIT(NM_BOND_MODE_TLB))}, );
+    {NM_SETTING_BOND_OPTION_TLB_DYNAMIC_LB, ~(BIT(NM_BOND_MODE_TLB) | BIT(NM_BOND_MODE_ALB))}, );
 
 gboolean
 _nm_setting_bond_option_supported(const char *option, NMBondMode mode)
@@ -337,7 +339,7 @@ _bond_get_option_normalized(NMSettingBond *self, const char *option, gboolean ge
     if (nm_streq(option, NM_SETTING_BOND_OPTION_AD_ACTOR_SYSTEM)) {
         /* The default value depends on the current mode */
         if (mode == NM_BOND_MODE_8023AD)
-            return "00:00:00:00:00:00";
+            return NM_BOND_AD_ACTOR_SYSTEM_DEFAULT;
         return "";
     }
 
@@ -766,6 +768,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
     int                      arp_interval;
     int                      num_grat_arp;
     int                      num_unsol_na;
+    int                      peer_notif_delay;
     const char *             mode_str;
     const char *             arp_ip_target = NULL;
     const char *             lacp_rate;
@@ -794,6 +797,8 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
     arp_interval = _atoi(_bond_get_option_or_default(self, NM_SETTING_BOND_OPTION_ARP_INTERVAL));
     num_grat_arp = _atoi(_bond_get_option_or_default(self, NM_SETTING_BOND_OPTION_NUM_GRAT_ARP));
     num_unsol_na = _atoi(_bond_get_option_or_default(self, NM_SETTING_BOND_OPTION_NUM_UNSOL_NA));
+    peer_notif_delay =
+        _atoi(_bond_get_option_or_default(self, NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY));
 
     /* Option restrictions:
      *
@@ -802,6 +807,8 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
      * arp_validate does not work with [ BOND_MODE_8023AD, BOND_MODE_TLB, BOND_MODE_ALB ]
      * downdelay needs miimon
      * updelay needs miimon
+     * peer_notif_delay needs miimon enabled
+     * peer_notif_delay must be a miimon multiple
      * primary needs [ active-backup, tlb, alb ]
      */
 
@@ -910,6 +917,36 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
         }
     }
 
+    if (peer_notif_delay) {
+        if (miimon == 0) {
+            g_set_error(error,
+                        NM_CONNECTION_ERROR,
+                        NM_CONNECTION_ERROR_INVALID_PROPERTY,
+                        _("'%s' option requires '%s' option to be enabled"),
+                        NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY,
+                        NM_SETTING_BOND_OPTION_MIIMON);
+            g_prefix_error(error, "%s.%s: ", NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_OPTIONS);
+            return FALSE;
+        }
+
+        /* The code disables miimon when arp is set, so they never occur together.
+         * But this occurs after this verification, so this check can occur in
+         * an invalid state, when both arp and miimon are enabled. To assure not
+         * dealing with an invalid state, this arp_interval == 0 condition,
+         * that is implicit, was made explicit.
+         */
+        if ((peer_notif_delay % miimon) && (arp_interval == 0)) {
+            g_set_error(error,
+                        NM_CONNECTION_ERROR,
+                        NM_CONNECTION_ERROR_INVALID_PROPERTY,
+                        _("'%s' option needs to be a value multiple of '%s' value"),
+                        NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY,
+                        NM_SETTING_BOND_OPTION_MIIMON);
+            g_prefix_error(error, "%s.%s: ", NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_OPTIONS);
+            return FALSE;
+        }
+    }
+
     /* arp_ip_target can only be used with arp_interval, and must
      * contain a comma-separated list of IPv4 addresses.
      */
diff --git a/libnm-core/nm-setting-bond.h b/libnm-core/nm-setting-bond.h
index 25ae8c36..abaebb9e 100644
--- a/libnm-core/nm-setting-bond.h
+++ b/libnm-core/nm-setting-bond.h
@@ -56,6 +56,7 @@ G_BEGIN_DECLS
 #define NM_SETTING_BOND_OPTION_PACKETS_PER_SLAVE "packets_per_slave"
 #define NM_SETTING_BOND_OPTION_TLB_DYNAMIC_LB    "tlb_dynamic_lb"
 #define NM_SETTING_BOND_OPTION_LP_INTERVAL       "lp_interval"
+#define NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY  "peer_notif_delay"
 
 /**
  * NMSettingBond:
diff --git a/libnm-core/nm-setting-ip-config.c b/libnm-core/nm-setting-ip-config.c
index 45ecbd88..1addf8c6 100644
--- a/libnm-core/nm-setting-ip-config.c
+++ b/libnm-core/nm-setting-ip-config.c
@@ -5738,6 +5738,7 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
         priv->dhcp_timeout = g_value_get_int(value);
         break;
     case PROP_DHCP_IAID:
+        g_free(priv->dhcp_iaid);
         priv->dhcp_iaid = g_value_dup_string(value);
         break;
     case PROP_DHCP_HOSTNAME_FLAGS:
diff --git a/libnm-core/nm-setting-ip-config.h b/libnm-core/nm-setting-ip-config.h
index 1cb16717..cb8a3f24 100644
--- a/libnm-core/nm-setting-ip-config.h
+++ b/libnm-core/nm-setting-ip-config.h
@@ -291,7 +291,7 @@ char *nm_ip_routing_rule_to_string(const NMIPRoutingRule *      self,
 #define NM_SETTING_IP_CONFIG(obj) \
     (G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_SETTING_IP_CONFIG, NMSettingIPConfig))
 #define NM_SETTING_IP_CONFIG_CLASS(klass) \
-    (G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_SETTING_IPCONFIG, NMSettingIPConfigClass))
+    (G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_SETTING_IP_CONFIG, NMSettingIPConfigClass))
 #define NM_IS_SETTING_IP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_SETTING_IP_CONFIG))
 #define NM_IS_SETTING_IP_CONFIG_CLASS(klass) \
     (G_TYPE_CHECK_CLASS_TYPE((klass), NM_TYPE_SETTING_IP_CONFIG))
diff --git a/libnm-core/nm-setting-tc-config.c b/libnm-core/nm-setting-tc-config.c
index 33df6d34..31e829c1 100644
--- a/libnm-core/nm-setting-tc-config.c
+++ b/libnm-core/nm-setting-tc-config.c
@@ -1810,11 +1810,23 @@ nm_setting_tc_config_class_init(NMSettingTCConfigClass *klass)
      * NMSettingTCConfig:qdiscs: (type GPtrArray(NMTCQdisc))
      *
      * Array of TC queueing disciplines.
+     *
+     * When the #NMSettingTCConfig setting is present, qdiscs from this
+     * property are applied upon activation. If the property is empty,
+     * all qdiscs are removed and the device will only
+     * have the default qdisc assigned by kernel according to the
+     * "net.core.default_qdisc" sysctl.
+     *
+     * If the #NMSettingTCConfig setting is not present, NetworkManager
+     * doesn't touch the qdiscs present on the interface.
      **/
     /* ---ifcfg-rh---
      * property: qdiscs
-     * variable: QDISC1(+), QDISC2(+), ...
-     * description: Queueing disciplines
+     * variable: QDISC1(+), QDISC2(+), ..., TC_COMMIT(+)
+     * description: Queueing disciplines to set on the interface. When no
+     *  QDISC1, QDISC2, ..., FILTER1, FILTER2, ... keys are present,
+     *  NetworkManager doesn't touch qdiscs and filters present on the
+     *  interface, unless TC_COMMIT is set to 'yes'.
      * example: QDISC1=ingress, QDISC2="root handle 1234: fq_codel"
      * ---end---
      */
@@ -1834,11 +1846,21 @@ nm_setting_tc_config_class_init(NMSettingTCConfigClass *klass)
      * NMSettingTCConfig:tfilters: (type GPtrArray(NMTCTfilter))
      *
      * Array of TC traffic filters.
+     *
+     * When the #NMSettingTCConfig setting is present, filters from this
+     * property are applied upon activation. If the property is empty,
+     * NetworkManager removes all the filters.
+     *
+     * If the #NMSettingTCConfig setting is not present, NetworkManager
+     * doesn't touch the filters present on the interface.
      **/
     /* ---ifcfg-rh---
      * property: qdiscs
-     * variable: FILTER1(+), FILTER2(+), ...
-     * description: Traffic filters
+     * variable: FILTER1(+), FILTER2(+), ..., TC_COMMIT(+)
+     * description: Traffic filters to set on the interface. When no
+     *  QDISC1, QDISC2, ..., FILTER1, FILTER2, ... keys are present,
+     *  NetworkManager doesn't touch qdiscs and filters present on the
+     *  interface, unless TC_COMMIT is set to 'yes'.
      * example: FILTER1="parent ffff: matchall action simple sdata Input", ...
      * ---end---
      */
diff --git a/libnm-core/nm-setting-wireless-security.c b/libnm-core/nm-setting-wireless-security.c
index 162f9220..f3fabc6e 100644
--- a/libnm-core/nm-setting-wireless-security.c
+++ b/libnm-core/nm-setting-wireless-security.c
@@ -866,8 +866,9 @@ need_secrets(NMSetting *setting)
         goto no_secrets;
     }
 
-    g_assert_not_reached();
-    return secrets;
+    /* If we get here, we're an older libnm talking to a newer NetworkManager
+     * service (perhaps from a container or during an upgrade). Assume that
+     * unknown/future key management modes don't need any extra secrets. */
 
 no_secrets:
     if (secrets)
diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c
index 6ceef1e4..eebd73cf 100644
--- a/libnm-core/nm-utils.c
+++ b/libnm-core/nm-utils.c
@@ -2823,14 +2823,14 @@ static const NMVariantAttributeSpec *const tc_tfilter_attribute_spec[] = {
 NMTCTfilter *
 nm_utils_tc_tfilter_from_str(const char *str, GError **error)
 {
-    guint32            handle         = TC_H_UNSPEC;
-    guint32            parent         = TC_H_UNSPEC;
-    gs_free char *     kind           = NULL;
-    gs_free char *     rest           = NULL;
-    NMTCAction *       action         = NULL;
-    const char *       extra_opts     = NULL;
-    NMTCTfilter *      tfilter        = NULL;
-    gs_unref_hashtable GHashTable *ht = NULL;
+    guint32                 handle                 = TC_H_UNSPEC;
+    guint32                 parent                 = TC_H_UNSPEC;
+    gs_free char *          kind                   = NULL;
+    gs_free char *          rest                   = NULL;
+    nm_auto_unref_tc_action NMTCAction *action     = NULL;
+    const char *                        extra_opts = NULL;
+    NMTCTfilter *                       tfilter    = NULL;
+    gs_unref_hashtable GHashTable *ht              = NULL;
     GVariant *                     variant;
 
     nm_assert(str);
@@ -2870,10 +2870,8 @@ nm_utils_tc_tfilter_from_str(const char *str, GError **error)
         return NULL;
 
     nm_tc_tfilter_set_handle(tfilter, handle);
-    if (action) {
+    if (action)
         nm_tc_tfilter_set_action(tfilter, action);
-        nm_tc_action_unref(action);
-    }
 
     return tfilter;
 }
diff --git a/libnm-core/nm-version-macros.h b/libnm-core/nm-version-macros.h
index a7b074de..4a936791 100644
--- a/libnm-core/nm-version-macros.h
+++ b/libnm-core/nm-version-macros.h
@@ -30,7 +30,7 @@
  * Evaluates to the micro version number of NetworkManager which this source
  * compiled against.
  */
-#define NM_MICRO_VERSION (0)
+#define NM_MICRO_VERSION (6)
 
 /**
  * NM_CHECK_VERSION:
diff --git a/libnm-core/tests/test-setting.c b/libnm-core/tests/test-setting.c
index 01cdb41c..56ba3154 100644
--- a/libnm-core/tests/test-setting.c
+++ b/libnm-core/tests/test-setting.c
@@ -687,7 +687,7 @@ test_bond_normalize(void)
                                 ((const char *[]){"mode", "active-backup", "miimon", "1", NULL}));
     test_bond_normalize_options(
         ((const char *[]){"mode", "balance-alb", "tlb_dynamic_lb", "1", NULL}),
-        ((const char *[]){"mode", "balance-alb", NULL}));
+        ((const char *[]){"mode", "balance-alb", "tlb_dynamic_lb", "1", NULL}));
     test_bond_normalize_options(
         ((const char *[]){"mode", "balance-tlb", "tlb_dynamic_lb", "1", NULL}),
         ((const char *[]){"mode", "balance-tlb", "tlb_dynamic_lb", "1", NULL}));