public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH ifupdown2 1/2] d/patches: translate bond-slaves altnames directly on attribute read
@ 2025-07-31 14:39 Christoph Heiss
  2025-07-31 14:39 ` [pve-devel] [PATCH ifupdown2 2/2] d/patches: translate altnames before accessing sysctls in address module Christoph Heiss
  2025-08-01  7:22 ` [pve-devel] applied: [PATCH ifupdown2 1/2] d/patches: translate bond-slaves altnames directly on attribute read Thomas Lamprecht
  0 siblings, 2 replies; 3+ messages in thread
From: Christoph Heiss @ 2025-07-31 14:39 UTC (permalink / raw)
  To: pve-devel

Avoids overriding parse_port_list(), making it a bit more clear where
altnames are translated.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
 ...-add-transparent-support-interface-a.patch | 62 +++++++++----------
 1 file changed, 29 insertions(+), 33 deletions(-)

diff --git a/debian/patches/pve/0011-nlmanager-addons-add-transparent-support-interface-a.patch b/debian/patches/pve/0011-nlmanager-addons-add-transparent-support-interface-a.patch
index 5c8fe18..e99dc3a 100644
--- a/debian/patches/pve/0011-nlmanager-addons-add-transparent-support-interface-a.patch
+++ b/debian/patches/pve/0011-nlmanager-addons-add-transparent-support-interface-a.patch
@@ -1,4 +1,4 @@
-From 594825e710bd9b33b19ba2b0f20f76076b638cc0 Mon Sep 17 00:00:00 2001
+From acab81c40482f2c3cdff25c599fe690fc466b0be Mon Sep 17 00:00:00 2001
 From: Christoph Heiss <c.heiss@proxmox.com>
 Date: Fri, 11 Jul 2025 17:45:47 +0200
 Subject: [PATCH] nlmanager, addons: add transparent support interface altnames
@@ -18,7 +18,7 @@ name(s) and add the appropriate translation there too.
 
 Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
 ---
- ifupdown2/addons/bond.py             |   3 +-
+ ifupdown2/addons/bond.py             |   9 ++-
  ifupdown2/addons/bridge.py           |  14 ----
  ifupdown2/addons/openvswitch.py      |   1 +
  ifupdown2/addons/openvswitch_port.py |  31 +++++---
@@ -28,10 +28,10 @@ Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
  ifupdown2/lib/nlcache.py             | 102 +++++++++++++++++++++++++++
  ifupdown2/nlmanager/nlmanager.py     |  15 ++++
  ifupdown2/nlmanager/nlpacket.py      |  63 +++++++++++++++++
- 10 files changed, 240 insertions(+), 36 deletions(-)
+ 10 files changed, 246 insertions(+), 36 deletions(-)
 
 diff --git a/ifupdown2/addons/bond.py b/ifupdown2/addons/bond.py
-index 2af5cf6..ef6d37a 100644
+index 2af5cf6..d5a7f3d 100644
 --- a/ifupdown2/addons/bond.py
 +++ b/ifupdown2/addons/bond.py
 @@ -277,6 +277,7 @@ class bond(Addon, moduleBase):
@@ -42,28 +42,24 @@ index 2af5cf6..ef6d37a 100644
          self._bond_attr_ifquery_check_translate_func[Link.IFLA_BOND_PRIMARY] = self.cache.get_ifindex
          self._bond_attr_set_list = self._bond_attr_set_list + (('bond-primary', Link.IFLA_BOND_PRIMARY, self.cache.get_ifindex),)
  
-@@ -292,7 +293,7 @@ class bond(Addon, moduleBase):
+@@ -291,8 +292,14 @@ class bond(Addon, moduleBase):
+         self.speed_pattern = re.compile(r"Speed: (\d+)")
  
      def get_bond_slaves(self, ifaceobj):
++        slaves = []
++
          # bond-ports aliases should be translated to bond-slaves
 -        return ifaceobj.get_attr_value_first('bond-slaves')
-+        return self.cache.link_translate_altname(ifaceobj.get_attr_value_first('bond-slaves'))
++        raw_ports = ifaceobj.get_attr_value_first('bond-slaves')
++        if raw_ports:
++            slaves = raw_ports.split()
++
++        return ' '.join(self.cache.link_translate_altnames(slaves))
  
      def _is_bond(self, ifaceobj):
          # at first link_kind is not set but once ifupdownmain
-@@ -301,6 +302,10 @@
-                or ifaceobj.get_attr_value_first("bond-mode") \
-                or self.get_bond_slaves(ifaceobj)
- 
-+    def parse_port_list(self, ifacename, port_expr, ifacenames=None):
-+        port_list = super().parse_port_list(ifacename, port_expr, ifacenames)
-+        return self.cache.link_translate_altnames(port_list)
-+
-     def get_dependent_ifacenames(self, ifaceobj, ifacenames_all=None, old_ifaceobjs=False):
-         """ Returns list of interfaces dependent on ifaceobj """
- 
 diff --git a/ifupdown2/addons/bridge.py b/ifupdown2/addons/bridge.py
-index 87bcda9..1da8de7 100644
+index e0e7375..0215309 100644
 --- a/ifupdown2/addons/bridge.py
 +++ b/ifupdown2/addons/bridge.py
 @@ -1134,20 +1134,6 @@ class bridge(Bridge, moduleBase):
@@ -223,7 +219,7 @@ index 4380dd8..a53b2f9 100644
  
              #
 diff --git a/ifupdown2/ifupdown/ifupdownmain.py b/ifupdown2/ifupdown/ifupdownmain.py
-index 1b034d1..97a83f7 100644
+index 92e3393..904062d 100644
 --- a/ifupdown2/ifupdown/ifupdownmain.py
 +++ b/ifupdown2/ifupdown/ifupdownmain.py
 @@ -228,7 +228,7 @@ class ifupdownMain:
@@ -343,7 +339,7 @@ index 47e42c7..77056b2 100644
      try:
          ip_blacklist = [ipnetwork.IPNetwork(ip).ip for ip in policymanager.policymanager_api.get_module_globals(
 diff --git a/ifupdown2/lib/nlcache.py b/ifupdown2/lib/nlcache.py
-index 8d67cba..e5a42ef 100644
+index bbd2a8b..891524e 100644
 --- a/ifupdown2/lib/nlcache.py
 +++ b/ifupdown2/lib/nlcache.py
 @@ -804,6 +804,44 @@ class _NetlinkCache:
@@ -391,7 +387,7 @@ index 8d67cba..e5a42ef 100644
      ################
      # MASTER & SLAVE
      ################
-@@ -1265,6 +1303,13 @@ class _NetlinkCache:
+@@ -1219,6 +1257,13 @@ class _NetlinkCache:
          # dictionaries if the master has changed or was un-enslaved.
          old_ifla_master = None
  
@@ -405,7 +401,7 @@ index 8d67cba..e5a42ef 100644
          with self._cache_lock:
  
              # do we have a wait event registered for RTM_NEWLINK this ifname
-@@ -1288,6 +1333,14 @@ class _NetlinkCache:
+@@ -1242,6 +1287,14 @@ class _NetlinkCache:
  
              self._link_cache[ifname] = link
  
@@ -420,7 +416,7 @@ index 8d67cba..e5a42ef 100644
              ######################################################
              # update helper dictionaries and handle link renamed #
              ######################################################
-@@ -1299,6 +1352,9 @@ class _NetlinkCache:
+@@ -1253,6 +1306,9 @@ class _NetlinkCache:
                  # in get_ifname/get_ifindex/get_master to do the work.
  
                  self._ifindex_by_ifname[ifname] = ifindex
@@ -430,7 +426,7 @@ index 8d67cba..e5a42ef 100644
  
                  rename_detected                 = False
                  old_ifname_entry_for_ifindex    = self._ifname_by_ifindex.get(ifindex)
-@@ -1309,6 +1365,7 @@ class _NetlinkCache:
+@@ -1263,6 +1319,7 @@ class _NetlinkCache:
                      # renamed. We need to update the cache accordingly.
                      rename_detected = True
  
@@ -438,7 +434,7 @@ index 8d67cba..e5a42ef 100644
                  self._ifname_by_ifindex[ifindex] = ifname
  
                  if rename_detected:
-@@ -1547,9 +1604,17 @@ class _NetlinkCache:
+@@ -1501,9 +1558,17 @@ class _NetlinkCache:
                      self._ignore_rtm_newlinkq.remove(ifname)
              except ValueError:
                  pass
@@ -456,7 +452,7 @@ index 8d67cba..e5a42ef 100644
  
          link_ifla_master = None
          # when an enslaved device is removed we receive the RTM_DELLINK
-@@ -1578,6 +1643,17 @@ class _NetlinkCache:
+@@ -1532,6 +1597,17 @@ class _NetlinkCache:
                  # KeyError means that the link doesn't exists in the cache
                  log.debug('del _link_cache: KeyError ifname: %s' % ifname)
  
@@ -474,7 +470,7 @@ index 8d67cba..e5a42ef 100644
              try:
                  # like in __unslave_nolock() we need to make sure that all deleted link
                  # have their bridge-vlans and _slaves_master entries cleared.
-@@ -1606,6 +1682,12 @@ class _NetlinkCache:
+@@ -1560,6 +1636,12 @@ class _NetlinkCache:
              except KeyError:
                  log.debug('del _ifindex_by_ifname: KeyError ifname: %s' % ifname)
  
@@ -487,7 +483,7 @@ index 8d67cba..e5a42ef 100644
              try:
                  del self._addr_cache[ifname]
              except KeyError:
-@@ -1627,6 +1709,12 @@ class _NetlinkCache:
+@@ -1581,6 +1663,12 @@ class _NetlinkCache:
                      log.debug('_masters_and_slaves[if%s].remove(%s): KeyError' % (link_ifla_master, ifname))
  
      def _address_get_ifname_and_ifindex(self, addr):
@@ -500,7 +496,7 @@ index 8d67cba..e5a42ef 100644
          ifindex = addr.ifindex
          label = addr.get_attribute_value(Address.IFA_LABEL)
  
-@@ -3200,6 +3288,20 @@ class NetlinkListenerWithCache(nllistener.NetlinkManagerWithListener, BaseObject
+@@ -3139,6 +3227,20 @@ class NetlinkListenerWithCache(nllistener.NetlinkManagerWithListener, BaseObject
          self.log_info_ifname_dry_run(ifname, "netlink: ip link set dev %s: bridge port attributes" % ifname)
          self.logger.debug("attributes: %s" % ifla_info_slave_data)
  
@@ -548,10 +544,10 @@ index 5e0cd8e..d57ddcf 100644
          debug = RTM_GETLINK in self.debug
          msg = Link(RTM_GETLINK, debug, use_color=self.use_color)
 diff --git a/ifupdown2/nlmanager/nlpacket.py b/ifupdown2/nlmanager/nlpacket.py
-index 4d6a4c4..95d59dc 100644
+index ed463c2..efc4c4e 100644
 --- a/ifupdown2/nlmanager/nlpacket.py
 +++ b/ifupdown2/nlmanager/nlpacket.py
-@@ -3486,6 +3486,49 @@ class AttributeIFLA_PROTINFO(Attribute):
+@@ -3464,6 +3464,49 @@ class AttributeIFLA_PROTINFO(Attribute):
          return value_pretty
  
  
@@ -601,7 +597,7 @@ index 4d6a4c4..95d59dc 100644
  
  class NetlinkPacket(object):
      """
-@@ -4185,6 +4228,16 @@ class Link(NetlinkPacket, NetlinkPacket_IFLA_LINKINFO_Attributes):
+@@ -4163,6 +4206,16 @@ class Link(NetlinkPacket, NetlinkPacket_IFLA_LINKINFO_Attributes):
      IFLA_NEW_IFINDEX        = 49
      IFLA_MIN_MTU            = 50
      IFLA_MAX_MTU            = 51
@@ -618,7 +614,7 @@ index 4d6a4c4..95d59dc 100644
  
      attribute_to_class = {
          IFLA_UNSPEC          : ('IFLA_UNSPEC', AttributeGeneric),
-@@ -4239,6 +4292,16 @@ class Link(NetlinkPacket, NetlinkPacket_IFLA_LINKINFO_Attributes):
+@@ -4217,6 +4270,16 @@ class Link(NetlinkPacket, NetlinkPacket_IFLA_LINKINFO_Attributes):
          IFLA_NEW_IFINDEX        : ('IFLA_NEW_IFINDEX', AttributeFourByteValue),
          IFLA_MIN_MTU            : ('IFLA_MIN_MTU', AttributeFourByteValue),
          IFLA_MAX_MTU            : ('IFLA_MAX_MTU', AttributeFourByteValue),
-- 
2.49.0



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] [PATCH ifupdown2 2/2] d/patches: translate altnames before accessing sysctls in address module
  2025-07-31 14:39 [pve-devel] [PATCH ifupdown2 1/2] d/patches: translate bond-slaves altnames directly on attribute read Christoph Heiss
@ 2025-07-31 14:39 ` Christoph Heiss
  2025-08-01  7:22 ` [pve-devel] applied: [PATCH ifupdown2 1/2] d/patches: translate bond-slaves altnames directly on attribute read Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Heiss @ 2025-07-31 14:39 UTC (permalink / raw)
  To: pve-devel

Requires changes to both our altname support patch, as well as the IPv6
SLAAC support patch. The latter is applied after the altname support and
introduces more sysctl operations.

The changes are pretty straight-forward, basically replacing
`ifaceobj.name` access with the translated ifname.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---

Notes:
    Stumbled upon this while doing some more testing and suddenly getting
    `setting_default_value is not defined` errors - which traced back to the
    SLAAC support, and prompted me to dig deeper.

 ...-add-transparent-support-interface-a.patch | 107 +++++++++++++++++-
 ...6-slaac-support-inet6-auto-accept_ra.patch |  53 +++++----
 2 files changed, 134 insertions(+), 26 deletions(-)

diff --git a/debian/patches/pve/0011-nlmanager-addons-add-transparent-support-interface-a.patch b/debian/patches/pve/0011-nlmanager-addons-add-transparent-support-interface-a.patch
index e99dc3a..fe2b197 100644
--- a/debian/patches/pve/0011-nlmanager-addons-add-transparent-support-interface-a.patch
+++ b/debian/patches/pve/0011-nlmanager-addons-add-transparent-support-interface-a.patch
@@ -1,4 +1,4 @@
-From acab81c40482f2c3cdff25c599fe690fc466b0be Mon Sep 17 00:00:00 2001
+From ca818a46bc5519adde981df317ac635e064eae45 Mon Sep 17 00:00:00 2001
 From: Christoph Heiss <c.heiss@proxmox.com>
 Date: Fri, 11 Jul 2025 17:45:47 +0200
 Subject: [PATCH] nlmanager, addons: add transparent support interface altnames
@@ -18,6 +18,7 @@ name(s) and add the appropriate translation there too.
 
 Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
 ---
+ ifupdown2/addons/address.py          |  27 +++----
  ifupdown2/addons/bond.py             |   9 ++-
  ifupdown2/addons/bridge.py           |  14 ----
  ifupdown2/addons/openvswitch.py      |   1 +
@@ -28,8 +29,110 @@ Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
  ifupdown2/lib/nlcache.py             | 102 +++++++++++++++++++++++++++
  ifupdown2/nlmanager/nlmanager.py     |  15 ++++
  ifupdown2/nlmanager/nlpacket.py      |  63 +++++++++++++++++
- 10 files changed, 246 insertions(+), 36 deletions(-)
+ 11 files changed, 260 insertions(+), 49 deletions(-)
 
+diff --git a/ifupdown2/addons/address.py b/ifupdown2/addons/address.py
+index 20f8866..c19b138 100644
+--- a/ifupdown2/addons/address.py
++++ b/ifupdown2/addons/address.py
+@@ -912,6 +912,7 @@ class address(AddonWithIpBlackList, moduleBase):
+         self.write_file("/proc/sys/net/%s/conf/%s/forwarding" % (family, ifname), "%s\n" % value)
+ 
+     def _sysctl_config(self, ifaceobj):
++        ifacename = self.cache.link_translate_altname(ifaceobj.name)
+         setting_default_value = False
+         mpls_enable = ifaceobj.get_attr_value_first('mpls-enable');
+         if not mpls_enable:
+@@ -923,17 +924,17 @@ class address(AddonWithIpBlackList, moduleBase):
+         if ifupdownflags.flags.PERFMODE:
+             running_mpls_enable = '0'
+         else:
+-            running_mpls_enable = str(self.cache.get_netconf_mpls_input(ifaceobj.name))
++            running_mpls_enable = str(self.cache.get_netconf_mpls_input(ifacename))
+ 
+         if mpls_enable != running_mpls_enable:
+             try:
+                 self.sysctl_set('net.mpls.conf.%s.input'
+-                                %('/'.join(ifaceobj.name.split("."))),
++                                %('/'.join(ifacename.split("."))),
+                                 mpls_enable)
+             except Exception as e:
+                 if not setting_default_value:
+                     ifaceobj.status = ifaceStatus.ERROR
+-                    self.logger.error('%s: %s' %(ifaceobj.name, str(e)))
++                    self.logger.error('%s: %s' %(ifacename, str(e)))
+ 
+         if (ifaceobj.link_kind & ifaceLinkKind.BRIDGE):
+             self._set_bridge_forwarding(ifaceobj)
+@@ -948,21 +949,21 @@ class address(AddonWithIpBlackList, moduleBase):
+         if ifupdownflags.flags.PERFMODE:
+             if ipforward:
+                 self.sysctl_set('net.ipv4.conf.%s.forwarding'
+-                                 %('/'.join(ifaceobj.name.split("."))),
++                                 %('/'.join(ifacename.split("."))),
+                                 utils.boolean_support_binary(ipforward))
+             if ip6forward:
+                 self.sysctl_set('net.ipv6.conf.%s.forwarding'
+-                                %('/'.join(ifaceobj.name.split("."))),
++                                %('/'.join(ifacename.split("."))),
+                                 utils.boolean_support_binary(ip6forward))
+             return
+         bridge_port = ifaceobj.link_privflags & ifaceLinkPrivFlags.BRIDGE_PORT
+         if bridge_port:
+             if ipforward:
+                 self.log_error('%s: \'ip-forward\' is not supported for '
+-                               'bridge port' %ifaceobj.name)
++                               'bridge port' %ifacename)
+             if ip6forward:
+                 self.log_error('%s: \'ip6-forward\' is not supported for '
+-                               'bridge port' %ifaceobj.name)
++                               'bridge port' %ifacename)
+             return
+         setting_default_value = False
+         if not ipforward:
+@@ -970,16 +971,16 @@ class address(AddonWithIpBlackList, moduleBase):
+             ipforward = self.ipforward
+         if ipforward:
+             ipforward = int(utils.get_boolean_from_string(ipforward))
+-            running_ipforward = self.cache.get_netconf_forwarding(socket.AF_INET, ifaceobj.name)
++            running_ipforward = self.cache.get_netconf_forwarding(socket.AF_INET, ifacename)
+             if ipforward != running_ipforward:
+                 try:
+                     self.sysctl_set('net.ipv4.conf.%s.forwarding'
+-                                    %('/'.join(ifaceobj.name.split("."))),
++                                    %('/'.join(ifacename.split("."))),
+                                     ipforward)
+                 except Exception as e:
+                     if not setting_default_value:
+                         ifaceobj.status = ifaceStatus.ERROR
+-                        self.logger.error('%s: %s' %(ifaceobj.name, str(e)))
++                        self.logger.error('%s: %s' %(ifacename, str(e)))
+ 
+         setting_default_value = False
+ 
+@@ -989,11 +990,11 @@ class address(AddonWithIpBlackList, moduleBase):
+ 
+         if ip6forward:
+             ip6forward = int(utils.get_boolean_from_string(ip6forward))
+-            running_ip6forward = self.cache.get_netconf_forwarding(socket.AF_INET6, ifaceobj.name)
++            running_ip6forward = self.cache.get_netconf_forwarding(socket.AF_INET6, ifacename)
+             if ip6forward != running_ip6forward:
+                 try:
+                     self.sysctl_set('net.ipv6.conf.%s.forwarding'
+-                                    %('/'.join(ifaceobj.name.split("."))),
++                                    %('/'.join(ifacename.split("."))),
+                                     ip6forward)
+                 except Exception as e:
+                     # There is chance of ipv6 being removed because of,
+@@ -1002,7 +1003,7 @@ class address(AddonWithIpBlackList, moduleBase):
+                     # ip6-forward
+                     if not setting_default_value:
+                        ifaceobj.status = ifaceStatus.ERROR
+-                       self.logger.error('%s: %s' %(ifaceobj.name, str(e)))
++                       self.logger.error('%s: %s' %(ifacename, str(e)))
+ 
+     def process_mtu(self, ifaceobj, ifaceobj_getfunc):
+ 
 diff --git a/ifupdown2/addons/bond.py b/ifupdown2/addons/bond.py
 index 2af5cf6..d5a7f3d 100644
 --- a/ifupdown2/addons/bond.py
diff --git a/debian/patches/upstream/0001-add-ipv6-slaac-support-inet6-auto-accept_ra.patch b/debian/patches/upstream/0001-add-ipv6-slaac-support-inet6-auto-accept_ra.patch
index 8a03cd8..4d5dbff 100644
--- a/debian/patches/upstream/0001-add-ipv6-slaac-support-inet6-auto-accept_ra.patch
+++ b/debian/patches/upstream/0001-add-ipv6-slaac-support-inet6-auto-accept_ra.patch
@@ -1,4 +1,4 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From 38dadc7048726671b8e1bf6c63a3313720afeaf9 Mon Sep 17 00:00:00 2001
 From: Alexandre Derumier <aderumier@odiso.com>
 Date: Tue, 9 May 2023 17:48:14 +0200
 Subject: [PATCH] add ipv6 slaac support (inet6 auto && accept_ra)
@@ -12,9 +12,10 @@ upstream pull request:
 https://github.com/CumulusNetworks/ifupdown2/pull/259
 Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
 Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
+Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
 ---
  etc/network/ifupdown2/addons.conf       |   2 +
- ifupdown2/addons/address.py             | 107 +++++++++++++--
+ ifupdown2/addons/address.py             | 108 +++++++++++++--
  ifupdown2/addons/auto.py                | 168 ++++++++++++++++++++++++
  ifupdown2/addons/dhcp.py                |  18 +--
  ifupdown2/ifupdown/iface.py             |   4 +
@@ -22,7 +23,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  ifupdown2/lib/nlcache.py                |  63 ++++++++-
  ifupdown2/man/interfaces.5.rst          |   9 ++
  ifupdown2/nlmanager/nlpacket.py         |  24 +++-
- 9 files changed, 371 insertions(+), 26 deletions(-)
+ 9 files changed, 372 insertions(+), 26 deletions(-)
  create mode 100644 ifupdown2/addons/auto.py
 
 diff --git a/etc/network/ifupdown2/addons.conf b/etc/network/ifupdown2/addons.conf
@@ -46,10 +47,10 @@ index a8f2317..5a3964d 100644
  down,address
  down,usercmds
 diff --git a/ifupdown2/addons/address.py b/ifupdown2/addons/address.py
-index 20f8866..a2918e9 100644
+index c19b138..3ab8309 100644
 --- a/ifupdown2/addons/address.py
 +++ b/ifupdown2/addons/address.py
-@@ -194,6 +194,18 @@ class address(AddonWithIpBlackList, moduleBase):
+@@ -193,6 +193,18 @@ class address(AddonWithIpBlackList, moduleBase):
                  "validvals": ['on', 'off', 'yes', 'no', '0', '1'],
                  "default": "no",
                  "aliases": ["disable-ip6"]
@@ -133,12 +134,14 @@ index 20f8866..a2918e9 100644
              if netconf_ipv4_forwarding:
                  self.sysctl_write_forwarding_value_to_proc(ifname, "ipv4", 0)
              if netconf_ipv6_forwarding:
-@@ -911,6 +945,43 @@ class address(AddonWithIpBlackList, moduleBase):
+@@ -911,6 +945,44 @@ class address(AddonWithIpBlackList, moduleBase):
      def sysctl_write_forwarding_value_to_proc(self, ifname, family, value):
          self.write_file("/proc/sys/net/%s/conf/%s/forwarding" % (family, ifname), "%s\n" % value)
  
 +    def _sysctl_slaac(self, ifaceobj):
++        ifacename = self.cache.link_translate_altname(ifaceobj.name)
 +        addr_method = ifaceobj.addr_method
++
 +        if addr_method not in ["auto"]:
 +
 +            try:
@@ -151,9 +154,9 @@ index 20f8866..a2918e9 100644
 +
 +                if running_accept_ra != accept_ra:
 +                    self.sysctl_set('net.ipv6.conf.%s.accept_ra'
-+                                    %('/'.join(ifaceobj.name.split("."))),
++                                    %('/'.join(ifacename.split("."))),
 +                                    accept_ra)
-+                    self.cache.update_link_inet6_accept_ra(ifaceobj.name, accept_ra)
++                    self.cache.update_link_inet6_accept_ra(ifacename, accept_ra)
 +
 +                running_autoconf = self.cache.get_link_inet6_autoconf(ifaceobj)
 +                if running_autoconf == '':
@@ -164,29 +167,28 @@ index 20f8866..a2918e9 100644
 +
 +                if running_autoconf != autoconf:
 +                    self.sysctl_set('net.ipv6.conf.%s.autoconf'
-+                                    %('/'.join(ifaceobj.name.split("."))),
++                                    %('/'.join(ifacename.split("."))),
 +                                    autoconf)
-+                    self.cache.update_link_inet6_autoconf(ifaceobj.name, autoconf)
++                    self.cache.update_link_inet6_autoconf(ifacename, autoconf)
 +
 +            except Exception as e:
-+                if not setting_default_value:
-+                    ifaceobj.status = ifaceStatus.ERROR
-+                    self.logger.error('%s: %s' %(ifaceobj.name, str(e)))
++                ifaceobj.status = ifaceStatus.ERROR
++                self.logger.error('%s: %s' %(ifacename, str(e)))
 +
 +
      def _sysctl_config(self, ifaceobj):
+         ifacename = self.cache.link_translate_altname(ifaceobj.name)
          setting_default_value = False
-         mpls_enable = ifaceobj.get_attr_value_first('mpls-enable');
-@@ -1004,6 +1075,8 @@ class address(AddonWithIpBlackList, moduleBase):
+@@ -1005,6 +1077,8 @@ class address(AddonWithIpBlackList, moduleBase):
                         ifaceobj.status = ifaceStatus.ERROR
-                        self.logger.error('%s: %s' %(ifaceobj.name, str(e)))
+                        self.logger.error('%s: %s' %(ifacename, str(e)))
  
 +        self._sysctl_slaac(ifaceobj)
 +
      def process_mtu(self, ifaceobj, ifaceobj_getfunc):
  
          if ifaceobj.link_privflags & ifaceLinkPrivFlags.OPENVSWITCH:
-@@ -1041,7 +1114,7 @@ class address(AddonWithIpBlackList, moduleBase):
+@@ -1042,7 +1116,7 @@ class address(AddonWithIpBlackList, moduleBase):
              # no need to go further during perfmode (boot)
              return
  
@@ -195,7 +197,7 @@ index 20f8866..a2918e9 100644
              return
  
          if not user_configured_ipv6_addrgen:
-@@ -1268,7 +1341,7 @@ class address(AddonWithIpBlackList, moduleBase):
+@@ -1269,7 +1343,7 @@ class address(AddonWithIpBlackList, moduleBase):
              if not self.cache.link_exists(ifaceobj.name):
                  return
              addr_method = ifaceobj.addr_method
@@ -204,7 +206,7 @@ index 20f8866..a2918e9 100644
                  if ifaceobj.get_attr_value_first('address-purge')=='no':
                      addrlist = ifaceobj.get_attr_value('address')
                      for addr in addrlist or []:
-@@ -1381,6 +1454,22 @@ class address(AddonWithIpBlackList, moduleBase):
+@@ -1382,6 +1456,22 @@ class address(AddonWithIpBlackList, moduleBase):
              ifaceobjcurr.update_config_with_status('mpls-enable',
                                                     running_mpls_enable,
                                              mpls_enable != running_mpls_enable)
@@ -227,7 +229,7 @@ index 20f8866..a2918e9 100644
          return
  
      def query_check_ipv6_addrgen(self, ifaceobj, ifaceobjcurr):
-@@ -1451,7 +1540,7 @@ class address(AddonWithIpBlackList, moduleBase):
+@@ -1452,7 +1542,7 @@ class address(AddonWithIpBlackList, moduleBase):
  
      def _query_check_address(self, ifaceobj, ifaceobjcurr, ifaceobj_getfunc):
          """ ifquery-check: attribute: "address" """
@@ -475,7 +477,7 @@ index 55f93fa..bfdc349 100644
  
      def __init__(self, interfacesfile='/etc/network/interfaces',
 diff --git a/ifupdown2/lib/nlcache.py b/ifupdown2/lib/nlcache.py
-index bbd2a8b..8d67cba 100644
+index 891524e..e5a42ef 100644
 --- a/ifupdown2/lib/nlcache.py
 +++ b/ifupdown2/lib/nlcache.py
 @@ -152,7 +152,7 @@ class _NetlinkCache:
@@ -487,7 +489,7 @@ index bbd2a8b..8d67cba 100644
      )
  
      def __init__(self):
-@@ -1179,6 +1179,52 @@ class _NetlinkCache:
+@@ -1217,6 +1217,52 @@ class _NetlinkCache:
          except TypeError as e:
              return self.__handle_type_error(inspect.currentframe().f_code.co_name, ifname, str(e), return_value=0)
  
@@ -540,7 +542,7 @@ index bbd2a8b..8d67cba 100644
      #####################################################
      #####################################################
      #####################################################
-@@ -1745,6 +1791,21 @@ class _NetlinkCache:
+@@ -1833,6 +1879,21 @@ class _NetlinkCache:
          except (KeyError, AttributeError):
              return addresses
  
@@ -590,7 +592,7 @@ index 262d726..ca461ea 100644
          source /etc/network/interfaces.d/*
  
 diff --git a/ifupdown2/nlmanager/nlpacket.py b/ifupdown2/nlmanager/nlpacket.py
-index ed463c2..4d6a4c4 100644
+index efc4c4e..95d59dc 100644
 --- a/ifupdown2/nlmanager/nlpacket.py
 +++ b/ifupdown2/nlmanager/nlpacket.py
 @@ -1818,6 +1818,15 @@ class AttributeIFLA_AF_SPEC(Attribute):
@@ -632,3 +634,6 @@ index ed463c2..4d6a4c4 100644
                              inet6_attr[inet6_attr_type] = self.decode_one_byte_attribute(sub_attr_data)
  
                              # nlmanager doesn't support multiple kernel version
+-- 
+2.49.0
+
-- 
2.49.0



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] applied: [PATCH ifupdown2 1/2] d/patches: translate bond-slaves altnames directly on attribute read
  2025-07-31 14:39 [pve-devel] [PATCH ifupdown2 1/2] d/patches: translate bond-slaves altnames directly on attribute read Christoph Heiss
  2025-07-31 14:39 ` [pve-devel] [PATCH ifupdown2 2/2] d/patches: translate altnames before accessing sysctls in address module Christoph Heiss
@ 2025-08-01  7:22 ` Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2025-08-01  7:22 UTC (permalink / raw)
  To: pve-devel, Christoph Heiss

On Thu, 31 Jul 2025 16:39:00 +0200, Christoph Heiss wrote:
> Avoids overriding parse_port_list(), making it a bit more clear where
> altnames are translated.
> 
> 

Applied, thanks!

[1/2] d/patches: translate bond-slaves altnames directly on attribute read
      commit: 426bedc9380da6d7e3591cce5651bc15d0c46132
[2/2] d/patches: translate altnames before accessing sysctls in address module
      commit: 87b15163078f16d438c84ec10958245715c2330d


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-08-01  7:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-31 14:39 [pve-devel] [PATCH ifupdown2 1/2] d/patches: translate bond-slaves altnames directly on attribute read Christoph Heiss
2025-07-31 14:39 ` [pve-devel] [PATCH ifupdown2 2/2] d/patches: translate altnames before accessing sysctls in address module Christoph Heiss
2025-08-01  7:22 ` [pve-devel] applied: [PATCH ifupdown2 1/2] d/patches: translate bond-slaves altnames directly on attribute read Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal