diff --git a/configs/aarch64_defconfig b/configs/aarch64_defconfig index 6b6310ae..b38a294a 100644 --- a/configs/aarch64_defconfig +++ b/configs/aarch64_defconfig @@ -27,7 +27,7 @@ BR2_ROOTFS_POST_BUILD_SCRIPT="${BR2_EXTERNAL_INFIX_PATH}/board/common/post-build BR2_ROOTFS_POST_IMAGE_SCRIPT="${BR2_EXTERNAL_INFIX_PATH}/board/common/post-image.sh" BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_VERSION=y -BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.11" +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.13" BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="${BR2_EXTERNAL_INFIX_PATH}/board/aarch64/linux_defconfig" BR2_LINUX_KERNEL_INSTALL_TARGET=y diff --git a/configs/aarch64_minimal_defconfig b/configs/aarch64_minimal_defconfig index 53021277..02298106 100644 --- a/configs/aarch64_minimal_defconfig +++ b/configs/aarch64_minimal_defconfig @@ -27,7 +27,7 @@ BR2_ROOTFS_POST_BUILD_SCRIPT="${BR2_EXTERNAL_INFIX_PATH}/board/common/post-build BR2_ROOTFS_POST_IMAGE_SCRIPT="${BR2_EXTERNAL_INFIX_PATH}/board/common/post-image.sh" BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_VERSION=y -BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.11" +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.13" BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="${BR2_EXTERNAL_INFIX_PATH}/board/aarch64/linux_defconfig" BR2_LINUX_KERNEL_INSTALL_TARGET=y diff --git a/configs/x86_64_defconfig b/configs/x86_64_defconfig index a13e831c..1edf5363 100644 --- a/configs/x86_64_defconfig +++ b/configs/x86_64_defconfig @@ -26,7 +26,7 @@ BR2_ROOTFS_POST_BUILD_SCRIPT="board/qemu/x86_64/post-build.sh ${BR2_EXTERNAL_INF BR2_ROOTFS_POST_IMAGE_SCRIPT="${BR2_EXTERNAL_INFIX_PATH}/board/common/post-image.sh" BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_VERSION=y -BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.11" +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.13" BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="${BR2_EXTERNAL_INFIX_PATH}/board/x86_64/linux_defconfig" BR2_LINUX_KERNEL_INSTALL_TARGET=y diff --git a/configs/x86_64_minimal_defconfig b/configs/x86_64_minimal_defconfig index 13bac873..575c3f92 100644 --- a/configs/x86_64_minimal_defconfig +++ b/configs/x86_64_minimal_defconfig @@ -26,7 +26,7 @@ BR2_ROOTFS_POST_BUILD_SCRIPT="board/qemu/x86_64/post-build.sh ${BR2_EXTERNAL_INF BR2_ROOTFS_POST_IMAGE_SCRIPT="${BR2_EXTERNAL_INFIX_PATH}/board/common/post-image.sh" BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_VERSION=y -BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.11" +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.13" BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="${BR2_EXTERNAL_INFIX_PATH}/board/x86_64/linux_defconfig" BR2_LINUX_KERNEL_INSTALL_TARGET=y diff --git a/doc/ChangeLog.md b/doc/ChangeLog.md index 30d0799f..e277910a 100644 --- a/doc/ChangeLog.md +++ b/doc/ChangeLog.md @@ -8,6 +8,7 @@ All notable changes to the project are documented in this file. ------------------------- ### Changes + - Upgrade Linux kernel to 6.12.13 (LTS) - YANG type for SSH private/public keys has changed, from ietf-crypto-types to infix-crypto-types diff --git a/patches/linux/6.12.11/0001-FIX-net-dsa-mv88e6xxx-Fix-timeout-on-waiting-for-PPU.patch b/patches/linux/6.12.13/0001-FIX-net-dsa-mv88e6xxx-Fix-timeout-on-waiting-for-PPU.patch similarity index 92% rename from patches/linux/6.12.11/0001-FIX-net-dsa-mv88e6xxx-Fix-timeout-on-waiting-for-PPU.patch rename to patches/linux/6.12.13/0001-FIX-net-dsa-mv88e6xxx-Fix-timeout-on-waiting-for-PPU.patch index 8eb242f2..42d717af 100644 --- a/patches/linux/6.12.11/0001-FIX-net-dsa-mv88e6xxx-Fix-timeout-on-waiting-for-PPU.patch +++ b/patches/linux/6.12.13/0001-FIX-net-dsa-mv88e6xxx-Fix-timeout-on-waiting-for-PPU.patch @@ -1,4 +1,4 @@ -From 998f0e99f2bd7ab54e1d25acac4227335c8caaec Mon Sep 17 00:00:00 2001 +From 773a0e32210336d682148e2e4c87add5e69105ec Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Tue, 12 Mar 2024 10:27:24 +0100 Subject: [PATCH 01/25] [FIX] net: dsa: mv88e6xxx: Fix timeout on waiting for @@ -6,7 +6,7 @@ Subject: [PATCH 01/25] [FIX] net: dsa: mv88e6xxx: Fix timeout on waiting for MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires In a multi-chip setup, delays of up to 750ms are observed before the device (6393X) signals completion of PPU initialization (Global 1, diff --git a/patches/linux/6.12.11/0002-net-dsa-mv88e6xxx-Improve-indirect-register-access-p.patch b/patches/linux/6.12.13/0002-net-dsa-mv88e6xxx-Improve-indirect-register-access-p.patch similarity index 98% rename from patches/linux/6.12.11/0002-net-dsa-mv88e6xxx-Improve-indirect-register-access-p.patch rename to patches/linux/6.12.13/0002-net-dsa-mv88e6xxx-Improve-indirect-register-access-p.patch index 6fe5f5d3..8b7fb35a 100644 --- a/patches/linux/6.12.11/0002-net-dsa-mv88e6xxx-Improve-indirect-register-access-p.patch +++ b/patches/linux/6.12.13/0002-net-dsa-mv88e6xxx-Improve-indirect-register-access-p.patch @@ -1,4 +1,4 @@ -From 3002b9e08272f3d740c2b582cf9b01fa1fde46b8 Mon Sep 17 00:00:00 2001 +From 765cc95de163acf8022b093ce227184e04b49d7b Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Wed, 27 Mar 2024 15:52:43 +0100 Subject: [PATCH 02/25] net: dsa: mv88e6xxx: Improve indirect register access @@ -6,7 +6,7 @@ Subject: [PATCH 02/25] net: dsa: mv88e6xxx: Improve indirect register access MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires When operating in multi-chip mode, the 6393 family maps a subset of commonly used global registers to the outermost address space (in diff --git a/patches/linux/6.12.11/0003-net-dsa-mv88e6xxx-Honor-ports-being-managed-via-in-b.patch b/patches/linux/6.12.13/0003-net-dsa-mv88e6xxx-Honor-ports-being-managed-via-in-b.patch similarity index 93% rename from patches/linux/6.12.11/0003-net-dsa-mv88e6xxx-Honor-ports-being-managed-via-in-b.patch rename to patches/linux/6.12.13/0003-net-dsa-mv88e6xxx-Honor-ports-being-managed-via-in-b.patch index 7a70043e..192dd061 100644 --- a/patches/linux/6.12.11/0003-net-dsa-mv88e6xxx-Honor-ports-being-managed-via-in-b.patch +++ b/patches/linux/6.12.13/0003-net-dsa-mv88e6xxx-Honor-ports-being-managed-via-in-b.patch @@ -1,4 +1,4 @@ -From 6bad36ecd3bb8f9b97c51f8ee2409f250344c1fc Mon Sep 17 00:00:00 2001 +From eb1ba5920254e04daff5c9a09e90b8882bf34490 Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Mon, 22 Apr 2024 23:18:01 +0200 Subject: [PATCH 03/25] net: dsa: mv88e6xxx: Honor ports being managed via @@ -6,7 +6,7 @@ Subject: [PATCH 03/25] net: dsa: mv88e6xxx: Honor ports being managed via MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires Keep all link parameters in their unforced states when the port is declared as being managed via in-band-status, and let the MAC diff --git a/patches/linux/6.12.11/0004-net-dsa-mv88e6xxx-Limit-rsvd2cpu-policy-to-user-port.patch b/patches/linux/6.12.13/0004-net-dsa-mv88e6xxx-Limit-rsvd2cpu-policy-to-user-port.patch similarity index 97% rename from patches/linux/6.12.11/0004-net-dsa-mv88e6xxx-Limit-rsvd2cpu-policy-to-user-port.patch rename to patches/linux/6.12.13/0004-net-dsa-mv88e6xxx-Limit-rsvd2cpu-policy-to-user-port.patch index de76772e..7ba0de08 100644 --- a/patches/linux/6.12.11/0004-net-dsa-mv88e6xxx-Limit-rsvd2cpu-policy-to-user-port.patch +++ b/patches/linux/6.12.13/0004-net-dsa-mv88e6xxx-Limit-rsvd2cpu-policy-to-user-port.patch @@ -1,4 +1,4 @@ -From 980366a1f8709fdfe643edb666c86a916c681a6c Mon Sep 17 00:00:00 2001 +From 8b3590e253746d5704650889c106cf5454e26cd3 Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Wed, 24 Apr 2024 22:41:04 +0200 Subject: [PATCH 04/25] net: dsa: mv88e6xxx: Limit rsvd2cpu policy to user @@ -6,7 +6,7 @@ Subject: [PATCH 04/25] net: dsa: mv88e6xxx: Limit rsvd2cpu policy to user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires For packets with a DA in the IEEE reserved L2 group range, originating from a CPU, forward it as normal, rather than classifying it as diff --git a/patches/linux/6.12.11/0005-net-dsa-mv88e6xxx-Add-LED-infrastructure.patch b/patches/linux/6.12.13/0005-net-dsa-mv88e6xxx-Add-LED-infrastructure.patch similarity index 98% rename from patches/linux/6.12.11/0005-net-dsa-mv88e6xxx-Add-LED-infrastructure.patch rename to patches/linux/6.12.13/0005-net-dsa-mv88e6xxx-Add-LED-infrastructure.patch index 006a6149..5fe6f6d2 100644 --- a/patches/linux/6.12.11/0005-net-dsa-mv88e6xxx-Add-LED-infrastructure.patch +++ b/patches/linux/6.12.13/0005-net-dsa-mv88e6xxx-Add-LED-infrastructure.patch @@ -1,11 +1,11 @@ -From cfc55d98057160753158b7c5357c94ac24d918fe Mon Sep 17 00:00:00 2001 +From 3c13e341f9e18cdd819584086bed0d207a3f042a Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Thu, 16 Nov 2023 19:44:32 +0100 Subject: [PATCH 05/25] net: dsa: mv88e6xxx: Add LED infrastructure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires Parse DT for LEDs and register them for devices that support it, though no actual implementations exist yet. diff --git a/patches/linux/6.12.11/0006-net-dsa-mv88e6xxx-Add-LED-support-for-6393X.patch b/patches/linux/6.12.13/0006-net-dsa-mv88e6xxx-Add-LED-support-for-6393X.patch similarity index 99% rename from patches/linux/6.12.11/0006-net-dsa-mv88e6xxx-Add-LED-support-for-6393X.patch rename to patches/linux/6.12.13/0006-net-dsa-mv88e6xxx-Add-LED-support-for-6393X.patch index 4028f3d3..495d6cb3 100644 --- a/patches/linux/6.12.11/0006-net-dsa-mv88e6xxx-Add-LED-support-for-6393X.patch +++ b/patches/linux/6.12.13/0006-net-dsa-mv88e6xxx-Add-LED-support-for-6393X.patch @@ -1,11 +1,11 @@ -From 180f2b90c73bc9fdfb27335327571daf8507f9c8 Mon Sep 17 00:00:00 2001 +From eb8d96aab3ee81c40252f8c5e1628b3709e23cab Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Thu, 16 Nov 2023 21:59:35 +0100 Subject: [PATCH 06/25] net: dsa: mv88e6xxx: Add LED support for 6393X MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires Trigger support: - "none" diff --git a/patches/linux/6.12.11/0007-net-dsa-tag_dsa-Use-tag-priority-as-initial-skb-prio.patch b/patches/linux/6.12.13/0007-net-dsa-tag_dsa-Use-tag-priority-as-initial-skb-prio.patch similarity index 94% rename from patches/linux/6.12.11/0007-net-dsa-tag_dsa-Use-tag-priority-as-initial-skb-prio.patch rename to patches/linux/6.12.13/0007-net-dsa-tag_dsa-Use-tag-priority-as-initial-skb-prio.patch index a36f2f0f..92163eed 100644 --- a/patches/linux/6.12.11/0007-net-dsa-tag_dsa-Use-tag-priority-as-initial-skb-prio.patch +++ b/patches/linux/6.12.13/0007-net-dsa-tag_dsa-Use-tag-priority-as-initial-skb-prio.patch @@ -1,4 +1,4 @@ -From 2e42839d4edb250b298f7683975382e9ec97c9a9 Mon Sep 17 00:00:00 2001 +From 06a7be8d8ca0241b89504595b0838ecf25b6c768 Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Tue, 28 May 2024 10:38:42 +0200 Subject: [PATCH 07/25] net: dsa: tag_dsa: Use tag priority as initial @@ -6,7 +6,7 @@ Subject: [PATCH 07/25] net: dsa: tag_dsa: Use tag priority as initial MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires Use the 3-bit priority field from the DSA tag as the initial packet priority on ingress to the CPU. diff --git a/patches/linux/6.12.11/0008-net-dsa-Support-MDB-memberships-whose-L2-addresses-o.patch b/patches/linux/6.12.13/0008-net-dsa-Support-MDB-memberships-whose-L2-addresses-o.patch similarity index 96% rename from patches/linux/6.12.11/0008-net-dsa-Support-MDB-memberships-whose-L2-addresses-o.patch rename to patches/linux/6.12.13/0008-net-dsa-Support-MDB-memberships-whose-L2-addresses-o.patch index 1246cf6c..d3d351b4 100644 --- a/patches/linux/6.12.11/0008-net-dsa-Support-MDB-memberships-whose-L2-addresses-o.patch +++ b/patches/linux/6.12.13/0008-net-dsa-Support-MDB-memberships-whose-L2-addresses-o.patch @@ -1,4 +1,4 @@ -From 681fc63548bae02cd286042a3470011617ff78fd Mon Sep 17 00:00:00 2001 +From 0312ac7f2a3d956ff9aec3f84b3b64302e59d36c Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Tue, 16 Jan 2024 16:00:55 +0100 Subject: [PATCH 08/25] net: dsa: Support MDB memberships whose L2 addresses @@ -6,7 +6,7 @@ Subject: [PATCH 08/25] net: dsa: Support MDB memberships whose L2 addresses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires Multiple IP multicast groups (32 for v4, 2^80 for v6) map to the same L2 address. This means that switchdev drivers may receive multiple MDB diff --git a/patches/linux/6.12.11/0009-net-dsa-Support-EtherType-based-priority-overrides.patch b/patches/linux/6.12.13/0009-net-dsa-Support-EtherType-based-priority-overrides.patch similarity index 97% rename from patches/linux/6.12.11/0009-net-dsa-Support-EtherType-based-priority-overrides.patch rename to patches/linux/6.12.13/0009-net-dsa-Support-EtherType-based-priority-overrides.patch index a13886dd..5caa1aca 100644 --- a/patches/linux/6.12.11/0009-net-dsa-Support-EtherType-based-priority-overrides.patch +++ b/patches/linux/6.12.13/0009-net-dsa-Support-EtherType-based-priority-overrides.patch @@ -1,11 +1,11 @@ -From d1c7aeac75ffe6e1350d8a08ee9ba99209636df5 Mon Sep 17 00:00:00 2001 +From 45716feb5762311a384f38d8b6449fc652a73764 Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Thu, 21 Mar 2024 19:12:15 +0100 Subject: [PATCH 09/25] net: dsa: Support EtherType based priority overrides MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires Signed-off-by: Mattias Walström --- diff --git a/patches/linux/6.12.11/0010-net-dsa-mv88e6xxx-Support-EtherType-based-priority-o.patch b/patches/linux/6.12.13/0010-net-dsa-mv88e6xxx-Support-EtherType-based-priority-o.patch similarity index 99% rename from patches/linux/6.12.11/0010-net-dsa-mv88e6xxx-Support-EtherType-based-priority-o.patch rename to patches/linux/6.12.13/0010-net-dsa-mv88e6xxx-Support-EtherType-based-priority-o.patch index df0e3a18..b1886a18 100644 --- a/patches/linux/6.12.11/0010-net-dsa-mv88e6xxx-Support-EtherType-based-priority-o.patch +++ b/patches/linux/6.12.13/0010-net-dsa-mv88e6xxx-Support-EtherType-based-priority-o.patch @@ -1,4 +1,4 @@ -From 79d68d69f6cd6cf57ef5ed4bcba45134ff8ba174 Mon Sep 17 00:00:00 2001 +From d2802357f81b4995c92fdd6f2ab8ea923b69cef1 Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Fri, 22 Mar 2024 16:15:43 +0100 Subject: [PATCH 10/25] net: dsa: mv88e6xxx: Support EtherType based priority @@ -6,7 +6,7 @@ Subject: [PATCH 10/25] net: dsa: mv88e6xxx: Support EtherType based priority MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires Signed-off-by: Mattias Walström --- diff --git a/patches/linux/6.12.11/0011-net-dsa-mv88e6xxx-Add-mqprio-qdisc-support.patch b/patches/linux/6.12.13/0011-net-dsa-mv88e6xxx-Add-mqprio-qdisc-support.patch similarity index 98% rename from patches/linux/6.12.11/0011-net-dsa-mv88e6xxx-Add-mqprio-qdisc-support.patch rename to patches/linux/6.12.13/0011-net-dsa-mv88e6xxx-Add-mqprio-qdisc-support.patch index aef5371f..58887f29 100644 --- a/patches/linux/6.12.11/0011-net-dsa-mv88e6xxx-Add-mqprio-qdisc-support.patch +++ b/patches/linux/6.12.13/0011-net-dsa-mv88e6xxx-Add-mqprio-qdisc-support.patch @@ -1,11 +1,11 @@ -From 57eabbff1169a5641c59fc698d7b122d17733d49 Mon Sep 17 00:00:00 2001 +From 985f9b471326f65d2c29978b511181200c1b32dd Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Tue, 28 May 2024 11:04:22 +0200 Subject: [PATCH 11/25] net: dsa: mv88e6xxx: Add mqprio qdisc support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires Add support for attaching mqprio qdisc's to mv88e6xxx ports and use the packet's traffic class as the outgoing priority when no PCP bits diff --git a/patches/linux/6.12.11/0012-net-dsa-mv88e6xxx-Use-VLAN-prio-over-IP-when-both-ar.patch b/patches/linux/6.12.13/0012-net-dsa-mv88e6xxx-Use-VLAN-prio-over-IP-when-both-ar.patch similarity index 96% rename from patches/linux/6.12.11/0012-net-dsa-mv88e6xxx-Use-VLAN-prio-over-IP-when-both-ar.patch rename to patches/linux/6.12.13/0012-net-dsa-mv88e6xxx-Use-VLAN-prio-over-IP-when-both-ar.patch index 57617332..0e097437 100644 --- a/patches/linux/6.12.11/0012-net-dsa-mv88e6xxx-Use-VLAN-prio-over-IP-when-both-ar.patch +++ b/patches/linux/6.12.13/0012-net-dsa-mv88e6xxx-Use-VLAN-prio-over-IP-when-both-ar.patch @@ -1,4 +1,4 @@ -From 752cce791dfe31525e3974d6f6419e4be0535343 Mon Sep 17 00:00:00 2001 +From da95446b056b1efc27353d2549298580978a079f Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Wed, 29 May 2024 13:20:41 +0200 Subject: [PATCH 12/25] net: dsa: mv88e6xxx: Use VLAN prio over IP when both @@ -6,7 +6,7 @@ Subject: [PATCH 12/25] net: dsa: mv88e6xxx: Use VLAN prio over IP when both MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires Switch the priority sourcing precdence to prefer VLAN PCP over IP DSCP, when both are available. diff --git a/patches/linux/6.12.11/0013-FIX-net-dsa-mv88e6xxx-Trap-locally-terminated-VLANs.patch b/patches/linux/6.12.13/0013-FIX-net-dsa-mv88e6xxx-Trap-locally-terminated-VLANs.patch similarity index 98% rename from patches/linux/6.12.11/0013-FIX-net-dsa-mv88e6xxx-Trap-locally-terminated-VLANs.patch rename to patches/linux/6.12.13/0013-FIX-net-dsa-mv88e6xxx-Trap-locally-terminated-VLANs.patch index 134dbe04..c211f3d6 100644 --- a/patches/linux/6.12.11/0013-FIX-net-dsa-mv88e6xxx-Trap-locally-terminated-VLANs.patch +++ b/patches/linux/6.12.13/0013-FIX-net-dsa-mv88e6xxx-Trap-locally-terminated-VLANs.patch @@ -1,4 +1,4 @@ -From b3b9b97cbe4eebd6cd3d68744e11a1bde5b98a47 Mon Sep 17 00:00:00 2001 +From e4a71c66724ba89a37dee71db5ae9e555676547e Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Tue, 26 Nov 2024 19:45:59 +0100 Subject: [PATCH 13/25] [FIX] net: dsa: mv88e6xxx: Trap locally terminated @@ -6,7 +6,7 @@ Subject: [PATCH 13/25] [FIX] net: dsa: mv88e6xxx: Trap locally terminated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires Before this change, in a setup like the following, packets assigned to VLAN 10 were forwarded between the switch ports, even though the diff --git a/patches/linux/6.12.11/0014-net-phy-marvell10g-Support-firmware-loading-on-88X33.patch b/patches/linux/6.12.13/0014-net-phy-marvell10g-Support-firmware-loading-on-88X33.patch similarity index 98% rename from patches/linux/6.12.11/0014-net-phy-marvell10g-Support-firmware-loading-on-88X33.patch rename to patches/linux/6.12.13/0014-net-phy-marvell10g-Support-firmware-loading-on-88X33.patch index 3b39471b..3b75bef9 100644 --- a/patches/linux/6.12.11/0014-net-phy-marvell10g-Support-firmware-loading-on-88X33.patch +++ b/patches/linux/6.12.13/0014-net-phy-marvell10g-Support-firmware-loading-on-88X33.patch @@ -1,4 +1,4 @@ -From 1e19f28f4f44973f349ad8bbb2fe0f4624e3c0f3 Mon Sep 17 00:00:00 2001 +From 9ade37c2fa9f5a6faebeaa8894d9703624eae5ef Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Tue, 19 Sep 2023 18:38:10 +0200 Subject: [PATCH 14/25] net: phy: marvell10g: Support firmware loading on @@ -6,7 +6,7 @@ Subject: [PATCH 14/25] net: phy: marvell10g: Support firmware loading on MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires When probing, if a device is waiting for firmware to be loaded into its RAM, ask userspace for the binary and load it over XMDIO. diff --git a/patches/linux/6.12.11/0015-net-phy-marvell10g-Fix-power-up-when-strapped-to-sta.patch b/patches/linux/6.12.13/0015-net-phy-marvell10g-Fix-power-up-when-strapped-to-sta.patch similarity index 94% rename from patches/linux/6.12.11/0015-net-phy-marvell10g-Fix-power-up-when-strapped-to-sta.patch rename to patches/linux/6.12.13/0015-net-phy-marvell10g-Fix-power-up-when-strapped-to-sta.patch index d037fda9..d1675448 100644 --- a/patches/linux/6.12.11/0015-net-phy-marvell10g-Fix-power-up-when-strapped-to-sta.patch +++ b/patches/linux/6.12.13/0015-net-phy-marvell10g-Fix-power-up-when-strapped-to-sta.patch @@ -1,4 +1,4 @@ -From 95ff23729224c6c08801c2dba8830b18c177431b Mon Sep 17 00:00:00 2001 +From 9571b0e79717fbcef4540b9a20a4fb2fe4c57f26 Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Tue, 21 Nov 2023 20:15:24 +0100 Subject: [PATCH 15/25] net: phy: marvell10g: Fix power-up when strapped to @@ -6,7 +6,7 @@ Subject: [PATCH 15/25] net: phy: marvell10g: Fix power-up when strapped to MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires On devices which are hardware strapped to start powered down (PDSTATE == 1), make sure that we clear the power-down bit on all units diff --git a/patches/linux/6.12.11/0016-net-phy-marvell10g-Add-LED-support-for-88X3310.patch b/patches/linux/6.12.13/0016-net-phy-marvell10g-Add-LED-support-for-88X3310.patch similarity index 99% rename from patches/linux/6.12.11/0016-net-phy-marvell10g-Add-LED-support-for-88X3310.patch rename to patches/linux/6.12.13/0016-net-phy-marvell10g-Add-LED-support-for-88X3310.patch index db7845cc..168e2e3e 100644 --- a/patches/linux/6.12.11/0016-net-phy-marvell10g-Add-LED-support-for-88X3310.patch +++ b/patches/linux/6.12.13/0016-net-phy-marvell10g-Add-LED-support-for-88X3310.patch @@ -1,11 +1,11 @@ -From ecdfc7324dd50d79c81af453699467023d72e2bf Mon Sep 17 00:00:00 2001 +From 05a6f49a221e797fdbd21501902bd969b9c64640 Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Wed, 15 Nov 2023 20:58:42 +0100 Subject: [PATCH 16/25] net: phy: marvell10g: Add LED support for 88X3310 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires Pickup the LEDs from the state in which the hardware reset or bootloader left them, but also support further configuration via diff --git a/patches/linux/6.12.11/0017-net-phy-marvell10g-Support-LEDs-tied-to-a-single-med.patch b/patches/linux/6.12.13/0017-net-phy-marvell10g-Support-LEDs-tied-to-a-single-med.patch similarity index 96% rename from patches/linux/6.12.11/0017-net-phy-marvell10g-Support-LEDs-tied-to-a-single-med.patch rename to patches/linux/6.12.13/0017-net-phy-marvell10g-Support-LEDs-tied-to-a-single-med.patch index 1094be28..66e1daba 100644 --- a/patches/linux/6.12.11/0017-net-phy-marvell10g-Support-LEDs-tied-to-a-single-med.patch +++ b/patches/linux/6.12.13/0017-net-phy-marvell10g-Support-LEDs-tied-to-a-single-med.patch @@ -1,4 +1,4 @@ -From df3d8aede0c04a0ae93e0dc02ba6b471e3791500 Mon Sep 17 00:00:00 2001 +From 202a7fccb4d46e38ed6f82788a44cf7320377549 Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Tue, 12 Dec 2023 09:51:05 +0100 Subject: [PATCH 17/25] net: phy: marvell10g: Support LEDs tied to a single @@ -6,7 +6,7 @@ Subject: [PATCH 17/25] net: phy: marvell10g: Support LEDs tied to a single MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires In a combo-port setup, i.e. where both the copper and fiber interface are available to the user, the LEDs may be physically located either diff --git a/patches/linux/6.12.11/0018-net-phy-Do-not-resume-PHY-when-attaching.patch b/patches/linux/6.12.13/0018-net-phy-Do-not-resume-PHY-when-attaching.patch similarity index 92% rename from patches/linux/6.12.11/0018-net-phy-Do-not-resume-PHY-when-attaching.patch rename to patches/linux/6.12.13/0018-net-phy-Do-not-resume-PHY-when-attaching.patch index 28cab3ce..00ba679d 100644 --- a/patches/linux/6.12.11/0018-net-phy-Do-not-resume-PHY-when-attaching.patch +++ b/patches/linux/6.12.13/0018-net-phy-Do-not-resume-PHY-when-attaching.patch @@ -1,11 +1,11 @@ -From f76443118313f681a62cf34a6f8b38f743832dff Mon Sep 17 00:00:00 2001 +From 31f2aa0e957643cc51be65750c4f65be8c507a18 Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Wed, 27 Mar 2024 10:10:19 +0100 Subject: [PATCH 18/25] net: phy: Do not resume PHY when attaching MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires The PHY should not start negotiating with its link-partner until explicitly instructed to do so. diff --git a/patches/linux/6.12.11/0019-net-bridge-avoid-classifying-unknown-multicast-as-mr.patch b/patches/linux/6.12.13/0019-net-bridge-avoid-classifying-unknown-multicast-as-mr.patch similarity index 98% rename from patches/linux/6.12.11/0019-net-bridge-avoid-classifying-unknown-multicast-as-mr.patch rename to patches/linux/6.12.13/0019-net-bridge-avoid-classifying-unknown-multicast-as-mr.patch index 5ccde049..459115b1 100644 --- a/patches/linux/6.12.11/0019-net-bridge-avoid-classifying-unknown-multicast-as-mr.patch +++ b/patches/linux/6.12.13/0019-net-bridge-avoid-classifying-unknown-multicast-as-mr.patch @@ -1,4 +1,4 @@ -From cd73e20a5c51dc26ab6a768a813ab805ad8b0689 Mon Sep 17 00:00:00 2001 +From 83c259d997fa40f0b9b9a3250746531df9c730c3 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Mon, 4 Mar 2024 16:47:28 +0100 Subject: [PATCH 19/25] net: bridge: avoid classifying unknown multicast as @@ -6,7 +6,7 @@ Subject: [PATCH 19/25] net: bridge: avoid classifying unknown multicast as MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires Unknown multicast, MAC/IPv4/IPv6, should always be flooded according to the per-port mcast_flood setting, as well as to detected and configured diff --git a/patches/linux/6.12.11/0020-net-bridge-Ignore-router-ports-when-forwarding-L2-mu.patch b/patches/linux/6.12.13/0020-net-bridge-Ignore-router-ports-when-forwarding-L2-mu.patch similarity index 93% rename from patches/linux/6.12.11/0020-net-bridge-Ignore-router-ports-when-forwarding-L2-mu.patch rename to patches/linux/6.12.13/0020-net-bridge-Ignore-router-ports-when-forwarding-L2-mu.patch index 9b643994..f80267f4 100644 --- a/patches/linux/6.12.11/0020-net-bridge-Ignore-router-ports-when-forwarding-L2-mu.patch +++ b/patches/linux/6.12.13/0020-net-bridge-Ignore-router-ports-when-forwarding-L2-mu.patch @@ -1,4 +1,4 @@ -From ed61171f9f5d42000b7315d8af12691bb02dac35 Mon Sep 17 00:00:00 2001 +From f2d2f489eb2073e79d3908a4f9abe797ce5c5a17 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Tue, 5 Mar 2024 06:44:41 +0100 Subject: [PATCH 20/25] net: bridge: Ignore router ports when forwarding L2 @@ -6,7 +6,7 @@ Subject: [PATCH 20/25] net: bridge: Ignore router ports when forwarding L2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires Multicast router ports are either statically configured or learned from control protocol traffic (IGMP/MLD/PIM). These protocols regulate IP diff --git a/patches/linux/6.12.11/0021-net-bridge-drop-delay-for-applying-strict-multicast-.patch b/patches/linux/6.12.13/0021-net-bridge-drop-delay-for-applying-strict-multicast-.patch similarity index 98% rename from patches/linux/6.12.11/0021-net-bridge-drop-delay-for-applying-strict-multicast-.patch rename to patches/linux/6.12.13/0021-net-bridge-drop-delay-for-applying-strict-multicast-.patch index 3623f792..301ea7bd 100644 --- a/patches/linux/6.12.11/0021-net-bridge-drop-delay-for-applying-strict-multicast-.patch +++ b/patches/linux/6.12.13/0021-net-bridge-drop-delay-for-applying-strict-multicast-.patch @@ -1,4 +1,4 @@ -From 73702e1c0331ef8644f326f2dc155a73749cb1c5 Mon Sep 17 00:00:00 2001 +From 4a88856e21984b9292361ad77d7dfc13fad239a5 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Thu, 4 Apr 2024 16:36:30 +0200 Subject: [PATCH 21/25] net: bridge: drop delay for applying strict multicast @@ -6,7 +6,7 @@ Subject: [PATCH 21/25] net: bridge: drop delay for applying strict multicast MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires This *local* patch drops the initial delay before applying strict multicast filtering, introduced in [1] and recently updated in [2]. diff --git a/patches/linux/6.12.11/0022-net-bridge-Differentiate-MDB-additions-from-modifica.patch b/patches/linux/6.12.13/0022-net-bridge-Differentiate-MDB-additions-from-modifica.patch similarity index 97% rename from patches/linux/6.12.11/0022-net-bridge-Differentiate-MDB-additions-from-modifica.patch rename to patches/linux/6.12.13/0022-net-bridge-Differentiate-MDB-additions-from-modifica.patch index 45e33410..b73c14e5 100644 --- a/patches/linux/6.12.11/0022-net-bridge-Differentiate-MDB-additions-from-modifica.patch +++ b/patches/linux/6.12.13/0022-net-bridge-Differentiate-MDB-additions-from-modifica.patch @@ -1,4 +1,4 @@ -From a48795ef7dbcfd7f1921753ad943144b933020b0 Mon Sep 17 00:00:00 2001 +From 12fe155cedae381d143a0b61b5375d1edb7c46e6 Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Thu, 16 May 2024 14:51:54 +0200 Subject: [PATCH 22/25] net: bridge: Differentiate MDB additions from @@ -6,7 +6,7 @@ Subject: [PATCH 22/25] net: bridge: Differentiate MDB additions from MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires Before this change, the reception of an IGMPv3 report (and analogously for MLDv2) that adds a new group, would trigger two MDB RTM_NEWMDB diff --git a/patches/linux/6.12.11/0023-nvmem-layouts-onie-tlv-Let-device-probe-even-when-TL.patch b/patches/linux/6.12.13/0023-nvmem-layouts-onie-tlv-Let-device-probe-even-when-TL.patch similarity index 95% rename from patches/linux/6.12.11/0023-nvmem-layouts-onie-tlv-Let-device-probe-even-when-TL.patch rename to patches/linux/6.12.13/0023-nvmem-layouts-onie-tlv-Let-device-probe-even-when-TL.patch index 609aaea8..af5bf18c 100644 --- a/patches/linux/6.12.11/0023-nvmem-layouts-onie-tlv-Let-device-probe-even-when-TL.patch +++ b/patches/linux/6.12.13/0023-nvmem-layouts-onie-tlv-Let-device-probe-even-when-TL.patch @@ -1,4 +1,4 @@ -From f0bbef0a94ed2e00475036b25dac8746e061c114 Mon Sep 17 00:00:00 2001 +From d8d81ca2a348095d87110d3d6a65134f1b7ce212 Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Fri, 24 Nov 2023 23:29:55 +0100 Subject: [PATCH 23/25] nvmem: layouts: onie-tlv: Let device probe even when @@ -6,7 +6,7 @@ Subject: [PATCH 23/25] nvmem: layouts: onie-tlv: Let device probe even when MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires Before this change, probing an NVMEM device, expected to contain a valid TLV, would fail if it had not been provisioned yet. But an diff --git a/patches/linux/6.12.11/0024-usb-core-adjust-log-level-for-unauthorized-devices.patch b/patches/linux/6.12.13/0024-usb-core-adjust-log-level-for-unauthorized-devices.patch similarity index 95% rename from patches/linux/6.12.11/0024-usb-core-adjust-log-level-for-unauthorized-devices.patch rename to patches/linux/6.12.13/0024-usb-core-adjust-log-level-for-unauthorized-devices.patch index 88dae57b..09c648af 100644 --- a/patches/linux/6.12.11/0024-usb-core-adjust-log-level-for-unauthorized-devices.patch +++ b/patches/linux/6.12.13/0024-usb-core-adjust-log-level-for-unauthorized-devices.patch @@ -1,11 +1,11 @@ -From 7135f0ab4f04b5cea7a0b67df0fe91f925ef19df Mon Sep 17 00:00:00 2001 +From 49592053a901870104c3ea6f6d4a4c18711c955d Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Mon, 29 Apr 2024 15:14:51 +0200 Subject: [PATCH 24/25] usb: core: adjust log level for unauthorized devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires The fact that a USB device currently is not authorized is not an error, so let's adjust the log level so these messages slip below radar for the diff --git a/patches/linux/6.12.11/0025-net-dsa-mv88e6xxx-collapse-disabled-state-into-block.patch b/patches/linux/6.12.13/0025-net-dsa-mv88e6xxx-collapse-disabled-state-into-block.patch similarity index 94% rename from patches/linux/6.12.11/0025-net-dsa-mv88e6xxx-collapse-disabled-state-into-block.patch rename to patches/linux/6.12.13/0025-net-dsa-mv88e6xxx-collapse-disabled-state-into-block.patch index 3714a0c1..0012f634 100644 --- a/patches/linux/6.12.11/0025-net-dsa-mv88e6xxx-collapse-disabled-state-into-block.patch +++ b/patches/linux/6.12.13/0025-net-dsa-mv88e6xxx-collapse-disabled-state-into-block.patch @@ -1,4 +1,4 @@ -From 733067c41391c3b9f10d0bf62b1097dce9996df1 Mon Sep 17 00:00:00 2001 +From a86053426ab5a0e9155e0b4c7c20495964fa4b59 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Thu, 16 Jan 2025 12:35:12 +0100 Subject: [PATCH 25/25] net: dsa: mv88e6xxx: collapse disabled state into @@ -6,7 +6,7 @@ Subject: [PATCH 25/25] net: dsa: mv88e6xxx: collapse disabled state into MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Organization: Addiva Elektronik +Organization: Wires This patch changes the behavior of switchcore ports wrt. the port state. Instead of disabling the port, the driver now treats the disabled state diff --git a/src/confd/src/cni.c b/src/confd/src/cni.c index eaee5a40..701b1a4c 100644 --- a/src/confd/src/cni.c +++ b/src/confd/src/cni.c @@ -6,6 +6,7 @@ #include "core.h" #include "cni.h" +#include "ietf-interfaces.h" #define CNI_NAME "/etc/cni/net.d/%s.conflist" @@ -86,13 +87,13 @@ FILE *cni_popen(const char *fmt, const char *ifname) return popenf("re", "nsenter -t %d -n %s", pid, cmd); } -static bool iface_is_cni(const char *ifname, struct lyd_node *node, const char **type) +static bool iface_is_cni(const char *ifname, struct lyd_node *node, enum iftype *type) { struct lyd_node *net = lydx_get_child(node, "container-network"); if (net) { if (type) - *type = lydx_get_cattr(net, "type"); + *type = iftype_from_iface(net); return true; } @@ -365,9 +366,7 @@ static int iface_gen_cni(const char *ifname, struct lyd_node *cif) * "container-network": {}, so someone does their job. */ if (!type) { - const char *iftype = lydx_get_cattr(cif, "type"); - - if (iftype && !strcmp(iftype, "infix-if-type:bridge")) + if (iftype_from_iface(cif) == IFT_BRIDGE) type = "infix-interfaces:bridge"; else type = "infix-interfaces:host"; @@ -386,7 +385,7 @@ static int iface_gen_cni(const char *ifname, struct lyd_node *cif) int cni_netdag_gen_iface(struct dagger *net, const char *ifname, struct lyd_node *dif, struct lyd_node *cif) { - const char *cni_type = NULL; + enum iftype cni_type; FILE *fp; if (iface_is_cni(ifname, cif, &cni_type)) { @@ -403,7 +402,7 @@ int cni_netdag_gen_iface(struct dagger *net, const char *ifname, err = iface_gen_cni(ifname, cif); if (err) return err; - if (cni_type && !strcmp(cni_type, "bridge")) + if (cni_type == IFT_BRIDGE) return 1; /* CNI bridges are managed by podman */ } else if (iface_is_cni(ifname, dif, &cni_type)) { /* No longer a container-network, clean up. */ @@ -414,7 +413,7 @@ int cni_netdag_gen_iface(struct dagger *net, const char *ifname, fprintf(fp, "container -a -f delete network %s >/dev/null\n", ifname); fclose(fp); - if (cni_type && !strcmp(cni_type, "bridge")) + if (cni_type == IFT_BRIDGE) return 1; /* CNI bridges are managed by podman */ } diff --git a/src/confd/src/dagger.c b/src/confd/src/dagger.c index c9fed136..9dfd3e28 100644 --- a/src/confd/src/dagger.c +++ b/src/confd/src/dagger.c @@ -155,26 +155,6 @@ int dagger_evolve_or_abandon(struct dagger *d) return err; } -void dagger_skip_iface(struct dagger *d, const char *ifname) -{ - touchf("%s/%d/skip/%s", d->path, d->next, ifname); -} - -void dagger_skip_current_iface(struct dagger *d, const char *ifname) -{ - touchf("%s/%d/skip/%s", d->path, d->current, ifname); -} - -int dagger_should_skip(struct dagger *d, const char *ifname) -{ - return fexistf("%s/%d/skip/%s", d->path, d->next, ifname); -} - -int dagger_should_skip_current(struct dagger *d, const char *ifname) -{ - return fexistf("%s/%d/skip/%s", d->path, d->current, ifname); -} - int dagger_is_bootstrap(struct dagger *d) { return d->next == 0; diff --git a/src/confd/src/dagger.h b/src/confd/src/dagger.h index 4720657b..d98469b1 100644 --- a/src/confd/src/dagger.h +++ b/src/confd/src/dagger.h @@ -27,10 +27,6 @@ int dagger_abandon(struct dagger *d); int dagger_evolve(struct dagger *d); int dagger_evolve_or_abandon(struct dagger *d); -void dagger_skip_iface(struct dagger *d, const char *ifname); -void dagger_skip_current_iface(struct dagger *d, const char *ifname); -int dagger_should_skip(struct dagger *d, const char *ifname); -int dagger_should_skip_current(struct dagger *d, const char *ifname); int dagger_is_bootstrap(struct dagger *d); int dagger_claim(struct dagger *d, const char *path); diff --git a/src/confd/src/ieee802-ethernet-interface.c b/src/confd/src/ieee802-ethernet-interface.c index 699ee051..70285e91 100644 --- a/src/confd/src/ieee802-ethernet-interface.c +++ b/src/confd/src/ieee802-ethernet-interface.c @@ -104,7 +104,6 @@ out: int netdag_gen_ethtool(struct dagger *net, struct lyd_node *cif, struct lyd_node *dif) { struct lyd_node *eth = lydx_get_child(dif, "ethernet"); - const char *type = lydx_get_cattr(cif, "type"); int err; /* @@ -121,7 +120,7 @@ int netdag_gen_ethtool(struct dagger *net, struct lyd_node *cif, struct lyd_node * * Hence this "redundant" check. */ - if (strcmp(type, "infix-if-type:ethernet")) + if (iftype_from_iface(cif) != IFT_ETH) return 0; if (!eth) diff --git a/src/confd/src/ietf-interfaces.c b/src/confd/src/ietf-interfaces.c index 5e02d1ad..8f4f8d73 100644 --- a/src/confd/src/ietf-interfaces.c +++ b/src/confd/src/ietf-interfaces.c @@ -169,7 +169,7 @@ static int netdag_gen_link_mtu(FILE *ip, struct lyd_node *dif) return 0; } -static void calc_mac(const char *base_mac, const char *mac_offset, char *buf, size_t len) +static void calc_mac(const char *base_mac, const char *mac_offset, char *buf) { uint8_t base[6], offset[6], result[6]; int carry = 0, i; @@ -187,113 +187,74 @@ static void calc_mac(const char *base_mac, const char *mac_offset, char *buf, si carry = (sum > 0xFF) ? 1 : 0; } - snprintf(buf, len, "%02x:%02x:%02x:%02x:%02x:%02x", - result[0], result[1], result[2], result[3], result[4], result[5]); + sprintf(buf, "%02x:%02x:%02x:%02x:%02x:%02x", + result[0], result[1], result[2], result[3], result[4], result[5]); } -/* - * Get child value from a diff parent, only returns value if not - * deleted. In which case the deleted flag may be set. - */ -static const char *get_val(struct lyd_node *parent, char *name, int *deleted) +const char *get_chassis_addr(void) { - const char *value = NULL; - struct lyd_node *node; + struct json_t *addr; - node = lydx_get_child(parent, name); - if (node) { - if (lydx_get_op(node) == LYDX_OP_DELETE) { - if (deleted) - *deleted = 1; - return NULL; - } - - value = lyd_get_value(node); + addr = json_object_get(confd.root, "mac-address"); + if (!addr) { + WARN("No chassis MAC found."); + return NULL; } - return value; + return json_string_value(addr); } -/* - * Locate custom-phys-address, adjust for any offset, and return pointer - * to a static string. (Which will be overwritten on subsequent calls.) - * - * The 'deleted' flag will be set if any of the nodes in the subtree are - * deleted. Used when restoring permaddr and similar. - */ -char *get_phys_addr(struct lyd_node *parent, int *deleted) +static int get_phys_addr(struct lyd_node *cif, char *mac) { - struct lyd_node *node, *cpa; - static char mac[18]; - struct json_t *j; - const char *ptr; + struct lyd_node *cpa, *chassis; + const char *base, *offs; - cpa = lydx_get_descendant(lyd_child(parent), "custom-phys-address", NULL); - if (!cpa || lydx_get_op(cpa) == LYDX_OP_DELETE) { - if (cpa && deleted) - *deleted = 1; - return NULL; + cpa = lydx_get_child(cif, "custom-phys-address"); + if (!cpa) + return -ENODATA; + + base = lydx_get_cattr(cpa, "static"); + if (base) { + strcpy(mac, base); + return 0; } - ptr = get_val(cpa, "static", deleted); - if (ptr) { - strlcpy(mac, ptr, sizeof(mac)); - return mac; + chassis = lydx_get_child(cpa, "chassis"); + if (chassis) { + base = get_chassis_addr() ? : "00:00:00:00:00:00"; + offs = lydx_get_cattr(chassis, "offset") ? : "00:00:00:00:00:00"; + calc_mac(base, offs, mac); + return 0; } - node = lydx_get_child(cpa, "chassis"); - if (!node || lydx_get_op(node) == LYDX_OP_DELETE) { - if (node && deleted) - *deleted = 1; - return NULL; - } + return -ENODATA; +} - j = json_object_get(confd.root, "mac-address"); - if (!j) { - WARN("cannot set chassis based MAC, not found."); - return NULL; - } +int link_gen_address(struct lyd_node *cif, FILE *ip) +{ + char mac[18]; + int err; - ptr = json_string_value(j); - strlcpy(mac, ptr, sizeof(mac)); + err = get_phys_addr(cif, mac); + if (err) + return err; - ptr = get_val(node, "offset", deleted); - if (ptr) - calc_mac(mac, ptr, mac, sizeof(mac)); - - return mac; + fprintf(ip, " address %s", mac); + return 0; } static int netdag_gen_link_addr(FILE *ip, struct lyd_node *cif, struct lyd_node *dif) { const char *ifname = lydx_get_cattr(dif, "name"); - const char *mac; - int deleted = 0; - char buf[32]; + char mac[18]; + int err; - mac = get_phys_addr(dif, &deleted); - if (!mac && deleted) { - FILE *fp; - - /* - * Only physical interfaces support this, virtual ones - * we remove, see netdag_must_del() for details. - */ - fp = cni_popen("ip -d -j link show dev %s |jq -rM .[].permaddr", ifname); - if (fp) { - if (fgets(buf, sizeof(buf), fp)) - mac = chomp(buf); - pclose(fp); - - if (mac && !strcmp(mac, "null")) - return 0; - } - } - - if (!mac || !strlen(mac)) { - DEBUG("No change in %s phys-address, skipping ...", ifname); + if (!lydx_get_child(dif, "custom-phys-address")) return 0; - } + + err = get_phys_addr(cif, mac); + if (err) + return (err == -ENODATA) ? 0 : err; fprintf(ip, "link set %s address %s\n", ifname, mac); return 0; @@ -369,13 +330,13 @@ skip_mtu: return err; } -static int netdag_gen_dummy(struct dagger *net, struct lyd_node *dif, - struct lyd_node *cif, FILE *ip) +static int dummy_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip) { const char *ifname = lydx_get_cattr(cif, "name"); - fprintf(ip, "link add dev %s type dummy\n", ifname); - + fprintf(ip, "link add dev %s", ifname); + link_gen_address(cif, ip); + fputs(" type dummy\n", ip); return 0; } @@ -383,140 +344,172 @@ static int netdag_gen_afspec_add(sr_session_ctx_t *session, struct dagger *net, struct lyd_node *cif, FILE *ip) { const char *ifname = lydx_get_cattr(cif, "name"); - const char *iftype = lydx_get_cattr(cif, "type"); - int err = 0; DEBUG_IFACE(dif, ""); - if (!strcmp(iftype, "infix-if-type:bridge")) { - err = bridge_gen(dif, cif, ip, 1); - } else if (!strcmp(iftype, "infix-if-type:dummy")) { - err = netdag_gen_dummy(net, NULL, cif, ip); - } else if (!strcmp(iftype, "infix-if-type:veth")) { - err = netdag_gen_veth(net, NULL, cif, ip); - } else if (!strcmp(iftype, "infix-if-type:vlan")) { - err = netdag_gen_vlan(net, NULL, cif, ip); - } else if (!strcmp(iftype, "infix-if-type:ethernet")) { - sr_session_set_error_message(net->session, "Cannot create fixed Ethernet interface %s," - " wrong type or name.", ifname); - return -ENOENT; - } else if (!strcmp(iftype, "infix-if-type:gre") || !strcmp(iftype, "infix-if-type:gretap")) { - err = gre_gen(net, NULL, cif, ip); - } else if (!strcmp(iftype, "infix-if-type:vxlan")) { - err = vxlan_gen(net, NULL, cif, ip); - } else { - sr_session_set_error_message(net->session, "%s: unsupported interface type \"%s\"", ifname, iftype); + switch (iftype_from_iface(cif)) { + case IFT_BRIDGE: + return bridge_gen(dif, cif, ip, 1); + case IFT_DUMMY: + return dummy_gen(NULL, cif, ip); + case IFT_GRE: + case IFT_GRETAP: + return gre_gen(NULL, cif, ip); + case IFT_VETH: + return veth_gen(NULL, cif, ip); + case IFT_VLAN: + return vlan_gen(NULL, cif, ip); + case IFT_VXLAN: + return vxlan_gen(NULL, cif, ip); + + case IFT_ETH: + case IFT_ETHISH: + case IFT_LO: + case IFT_UNKNOWN: + sr_session_set_error_message(net->session, "%s: unsupported interface type \"%s\"", + ifname, lydx_get_cattr(cif, "type")); return -ENOSYS; } - if (err) - return err; - - return 0; + __builtin_unreachable(); + return -EINVAL; } static int netdag_gen_afspec_set(sr_session_ctx_t *session, struct dagger *net, struct lyd_node *dif, struct lyd_node *cif, FILE *ip) { - const char *ifname = lydx_get_cattr(cif, "name"); - const char *iftype = lydx_get_cattr(cif, "type"); - DEBUG_IFACE(dif, ""); - if (!strcmp(iftype, "infix-if-type:bridge")) + switch (iftype_from_iface(cif)) { + case IFT_BRIDGE: return bridge_gen(dif, cif, ip, 0); - if (!strcmp(iftype, "infix-if-type:vlan")) - return netdag_gen_vlan(net, dif, cif, ip); - if (!strcmp(iftype, "infix-if-type:veth")) - return 0; - if (!strcmp(iftype, "infix-if-type:gretap")) - return 0; - if (!strcmp(iftype, "infix-if-type:vxlan")) - return 0; - ERROR("%s: unsupported interface type \"%s\"", ifname, iftype); - return -ENOSYS; -} + case IFT_VLAN: + return vlan_gen(dif, cif, ip); -static bool is_phys_addr_deleted(struct lyd_node *dif) -{ - int deleted = 0; + case IFT_DUMMY: + case IFT_GRE: + case IFT_GRETAP: + case IFT_VETH: + case IFT_VXLAN: + return 0; - if (!get_phys_addr(dif, &deleted) && deleted) - return true; + case IFT_ETH: + case IFT_ETHISH: + case IFT_LO: + case IFT_UNKNOWN: + return ERR_IFACE(cif, -ENOSYS, "unsupported interface type \"%s\"", + lydx_get_cattr(cif, "type")); + } - return false; + __builtin_unreachable(); + return -EINVAL; } static bool netdag_must_del(struct lyd_node *dif, struct lyd_node *cif) { - const char *iftype = lydx_get_cattr(cif, "type"); - - if (strcmp(iftype, "infix-if-type:ethernet") && - strcmp(iftype, "infix-if-type:etherlike")) { - if (is_phys_addr_deleted(dif)) - return true; - } - - if (!strcmp(iftype, "infix-if-type:vlan")) { - if (lydx_get_descendant(lyd_child(dif), "vlan", NULL)) - return true; - } else if (!strcmp(iftype, "infix-if-type:veth")) { - if (lydx_get_descendant(lyd_child(dif), "veth", NULL)) - return true; - } else if (!strcmp(iftype, "infix-if-type:gre") || !strcmp(iftype, "infix-if-type:gretap")) { - if (lydx_get_descendant(lyd_child(dif), "gre", NULL)) - return true; - } else if (!strcmp(iftype, "infix-if-type:vxlan")) { - if (lydx_get_descendant(lyd_child(dif), "vxlan", NULL)) - return true; -/* - } else if (!strcmp(iftype, "infix-if-type:lag")) { - if (is_phys_addr_deleted(dif)) - return true; - - ... REMEMBER WHEN ADDING BOND SUPPORT ... -*/ + switch (iftype_from_iface(cif)) { + case IFT_BRIDGE: + case IFT_DUMMY: + case IFT_LO: + break; + case IFT_ETH: + case IFT_ETHISH: + /* case IFT_LAG: */ + /* ... REMEMBER WHEN ADDING BOND SUPPORT ... */ + return lydx_get_child(dif, "custom-phys-address"); + case IFT_GRE: + case IFT_GRETAP: + return lydx_get_descendant(lyd_child(dif), "gre", NULL); + case IFT_VLAN: + return lydx_get_descendant(lyd_child(dif), "vlan", NULL); + case IFT_VETH: + return lydx_get_descendant(lyd_child(dif), "veth", NULL); + case IFT_VXLAN: + return lydx_get_descendant(lyd_child(dif), "vxlan", NULL); + case IFT_UNKNOWN: + ERR_IFACE(cif, -EINVAL, "unsupported interface type \"%s\"", + lydx_get_cattr(cif, "type")); + return true; } return false; } -static int netdag_gen_iface_del(struct dagger *net, struct lyd_node *dif, - struct lyd_node *cif, bool fixed) +static int eth_gen_del(struct lyd_node *dif, FILE *ip) { const char *ifname = lydx_get_cattr(dif, "name"); - const char *iftype = lydx_get_cattr(dif, "type"); + char mac[18]; + FILE *pp; + + fprintf(ip, "link set dev %s down", ifname); + + pp = cni_popen("ip -d -j link show dev %s | jq -rM .[].permaddr", ifname); + if (pp) { + if (fgets(mac, sizeof(mac), pp) && !strstr(mac, "null")) + fprintf(ip, " address %s", mac); + pclose(pp); + } + + fputc('\n', ip); + + fprintf(ip, "addr flush dev %s\n", ifname); + return 0; +} + +static int link_gen_del(struct lyd_node *dif, FILE *ip) +{ + fprintf(ip, "link del dev %s\n", lydx_get_cattr(dif, "name")); + return 0; +} + +static int veth_gen_del(struct lyd_node *dif, FILE *ip) +{ + if (!veth_is_primary(dif)) + return 0; + + return link_gen_del(dif, ip); +} + +static int netdag_gen_iface_del(struct dagger *net, struct lyd_node *dif, + struct lyd_node *cif) +{ + const char *ifname = lydx_get_cattr(dif, "name"); + enum iftype type; FILE *ip; DEBUG_IFACE(dif, ""); - if (dagger_should_skip_current(net, ifname)) - return 0; - - if (iftype && !strcmp(iftype, "infix-if-type:veth")) { - struct lyd_node *node; - const char *peer; - - node = lydx_get_descendant(lyd_child(dif), "veth", NULL); - if (!node) - return -EINVAL; - - peer = lydx_get_cattr(node, "peer"); - if (!peer) - return -EINVAL; - - dagger_skip_current_iface(net, peer); - } - ip = dagger_fopen_net_exit(net, ifname, NETDAG_EXIT, "exit.ip"); if (!ip) return -EIO; - if (fixed) { - fprintf(ip, "link set dev %s down\n", ifname); - fprintf(ip, "addr flush dev %s\n", ifname); - } else { - fprintf(ip, "link del dev %s\n", ifname); + type = iftype_from_iface(dif); + if (type == IFT_UNKNOWN) + /* The interface is still in running, so we need to + * get the type from there. This can happen when an + * attribute is changed that require us to delete and + * recreate the interface, e.g. changing the VID of a + * VLAN interface. */ + type = iftype_from_iface(cif); + + switch (type) { + case IFT_ETH: + case IFT_ETHISH: + case IFT_LO: + eth_gen_del(dif, ip); + break; + case IFT_VETH: + veth_gen_del(dif, ip); + break; + case IFT_BRIDGE: + case IFT_DUMMY: + case IFT_GRE: + case IFT_GRETAP: + case IFT_VLAN: + case IFT_VXLAN: + case IFT_UNKNOWN: + link_gen_del(dif, ip); + break; } fclose(ip); @@ -546,7 +539,7 @@ static sr_error_t netdag_gen_iface(sr_session_ctx_t *session, struct dagger *net (op == LYDX_OP_NONE) ? "mod" : ((op == LYDX_OP_CREATE) ? "add" : "del")); if (op == LYDX_OP_DELETE) { - err = netdag_gen_iface_del(net, dif, cif, fixed); + err = netdag_gen_iface_del(net, dif, cif); err += netdag_gen_ipv4_autoconf(net, cif, dif); goto err; } @@ -560,7 +553,7 @@ static sr_error_t netdag_gen_iface(sr_session_ctx_t *session, struct dagger *net if (op != LYDX_OP_CREATE && netdag_must_del(dif, cif)) { DEBUG_IFACE(dif, "Must delete"); - err = netdag_gen_iface_del(net, dif, cif, fixed); + err = netdag_gen_iface_del(net, dif, cif); if (err) goto err; @@ -637,18 +630,49 @@ err: return err ? SR_ERR_INTERNAL : SR_ERR_OK; } +static int netdag_init_iface(struct lyd_node *cif) +{ + int err; + + err = dagger_add_node(&confd.netdag, lydx_get_cattr(cif, "name")); + if (err) + return err; + + switch (iftype_from_iface(cif)) { + case IFT_BRIDGE: + return bridge_add_deps(cif); + /* case IFT_LAG: */ + /* return lag_add_deps(cif); */ + case IFT_VLAN: + return vlan_add_deps(cif); + case IFT_VETH: + return veth_add_deps(cif); + + case IFT_DUMMY: + case IFT_ETH: + case IFT_ETHISH: + case IFT_GRE: + case IFT_GRETAP: + case IFT_LO: + case IFT_VXLAN: + case IFT_UNKNOWN: + break; + } + + return 0; +} + static sr_error_t netdag_init(sr_session_ctx_t *session, struct dagger *net, struct lyd_node *cifs, struct lyd_node *difs) { - struct lyd_node *iface; + struct lyd_node *cif; + int err; - LYX_LIST_FOR_EACH(cifs, iface, "interface") - if (dagger_add_node(net, lydx_get_cattr(iface, "name"))) - return SR_ERR_INTERNAL; - - LYX_LIST_FOR_EACH(difs, iface, "interface") - if (dagger_add_node(net, lydx_get_cattr(iface, "name"))) + LYX_LIST_FOR_EACH(cifs, cif, "interface") { + err = netdag_init_iface(cif); + if (err) return SR_ERR_INTERNAL; + } net->session = session; return SR_ERR_OK; diff --git a/src/confd/src/ietf-interfaces.h b/src/confd/src/ietf-interfaces.h index fa0b06b4..a3cdf5a2 100644 --- a/src/confd/src/ietf-interfaces.h +++ b/src/confd/src/ietf-interfaces.h @@ -21,6 +21,45 @@ #define ONOFF(boolean) boolean ? "on" : "off" +#define IFTYPES(_map) \ + _map(IFT_BRIDGE, "infix-if-type:bridge") \ + _map(IFT_DUMMY, "infix-if-type:dummy") \ + _map(IFT_ETH, "infix-if-type:ethernet") \ + _map(IFT_ETHISH, "infix-if-type:etherlike") \ + _map(IFT_GRE, "infix-if-type:gre") \ + _map(IFT_GRETAP, "infix-if-type:gretap") \ + _map(IFT_LO, "infix-if-type:loopback") \ + _map(IFT_VETH, "infix-if-type:veth") \ + _map(IFT_VLAN, "infix-if-type:vlan") \ + _map(IFT_VXLAN, "infix-if-type:vxlan") \ + /* */ + +enum iftype { +#define ift_enum(_enum, _str) _enum, + IFTYPES(ift_enum) +#undef ift_enum + + IFT_UNKNOWN +}; + +static inline enum iftype iftype_from_str(const char *typestr) +{ +#define ift_cmp(_enum, _str) if (!strcmp(typestr, _str)) return _enum; + IFTYPES(ift_cmp) +#undef ift_cmp + return IFT_UNKNOWN; +} + +static inline enum iftype iftype_from_iface(struct lyd_node *ifn) +{ + const char *typestr = lydx_get_cattr(ifn, "type"); + + if (!typestr) + return IFT_UNKNOWN; + + return iftype_from_str(typestr); +} + static inline const char *bridge_tagtype2str(const char *type) { if (!strcmp(type, "ieee802-dot1q-types:c-vlan")) @@ -46,7 +85,8 @@ static inline bool is_bridge_port(struct lyd_node *cif) int netdag_gen_ethtool(struct dagger *net, struct lyd_node *cif, struct lyd_node *dif); /* ietf-interfaces.c */ -char *get_phys_addr(struct lyd_node *parent, int *deleted); +const char *get_chassis_addr(void); +int link_gen_address(struct lyd_node *cif, FILE *ip); /* ietf-ip.c */ int netdag_gen_ipv6_autoconf(struct dagger *net, struct lyd_node *cif, @@ -59,27 +99,27 @@ int netdag_gen_ip_addrs(struct dagger *net, FILE *ip, const char *proto, /* infix-if-bridge.c */ int bridge_mstpd_gen(struct lyd_node *cifs); int bridge_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip, int add); +int bridge_add_deps(struct lyd_node *cif); /* infix-if-bridge-mcd.c */ int bridge_mcd_gen(struct lyd_node *cifs); /* infix-if-bridge-port.c */ int bridge_port_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip); +/* infix-if-gre.c */ +int gre_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip); + /* infix-if-veth.c */ +bool veth_is_primary(struct lyd_node *cif); int ifchange_cand_infer_veth(sr_session_ctx_t *session, const char *path); -int netdag_gen_veth(struct dagger *net, struct lyd_node *dif, - struct lyd_node *cif, FILE *ip); +int veth_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip); +int veth_add_deps(struct lyd_node *cif); /* infix-if-vlan.c */ int ifchange_cand_infer_vlan(sr_session_ctx_t *session, const char *path); -int netdag_gen_vlan(struct dagger *net, struct lyd_node *dif, - struct lyd_node *cif, FILE *ip); - -/* infix-if-gre.c */ -int gre_gen(struct dagger *net, struct lyd_node *dif, - struct lyd_node *cif, FILE *ip); +int vlan_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip); +int vlan_add_deps(struct lyd_node *cif); /* infix-if-vxlan.c */ -int vxlan_gen(struct dagger *net, struct lyd_node *dif, - struct lyd_node *cif, FILE *ip); +int vxlan_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip); #endif /* CONFD_IETF_INTERFACES_H_ */ diff --git a/src/confd/src/infix-if-bridge-mcd.c b/src/confd/src/infix-if-bridge-mcd.c index 23c20d8a..c54e4573 100644 --- a/src/confd/src/infix-if-bridge-mcd.c +++ b/src/confd/src/infix-if-bridge-mcd.c @@ -97,7 +97,7 @@ int bridge_mcd_gen(struct lyd_node *cifs) return -EIO; LYX_LIST_FOR_EACH(cifs, cif, "interface") { - if (strcmp(lydx_get_cattr(cif, "type"), "infix-if-type:bridge")) + if (iftype_from_iface(cif) != IFT_BRIDGE) continue; err = gen_bridge(cif, conf); diff --git a/src/confd/src/infix-if-bridge-port.c b/src/confd/src/infix-if-bridge-port.c index 42f77f2a..ffb24d5e 100644 --- a/src/confd/src/infix-if-bridge-port.c +++ b/src/confd/src/infix-if-bridge-port.c @@ -198,7 +198,6 @@ static int gen_link(struct lyd_node *dif, struct lyd_node *cif) const char *brname, *iface; int mrouter; FILE *next; - int err; if (!lydx_get_child(dif, "bridge-port")) return 0; @@ -214,10 +213,6 @@ static int gen_link(struct lyd_node *dif, struct lyd_node *cif) iface = lydx_get_cattr(cif, "name"); - err = dagger_add_dep(&confd.netdag, brname, iface); - if (err) - return ERR_IFACE(cif, err, "Unable to add dep \"%s\" to %s", iface, brname); - next = dagger_fopen_net_init(&confd.netdag, brname, NETDAG_INIT_LOWERS, "add-ports.ip"); if (!next) diff --git a/src/confd/src/infix-if-bridge.c b/src/confd/src/infix-if-bridge.c index a0434c6e..3f8d3278 100644 --- a/src/confd/src/infix-if-bridge.c +++ b/src/confd/src/infix-if-bridge.c @@ -400,23 +400,18 @@ static int gen_stp(struct ixif_br *br) static void gen_phys_address(struct ixif_br *br) { - struct json_t *j; - const char *mac; + const char *chassis; + int err; - mac = get_phys_addr(br->cif, NULL); - if (!mac) { - j = json_object_get(confd.root, "mac-address"); - if (j) - mac = json_string_value(j); - } - - if (!mac) - /* Nothing configured, and no chassis mac available, - * let the kernel generate a random one. - */ + err = link_gen_address(br->cif, br->ip); + if (!err) return; - fprintf(br->ip, " address %s", mac); + chassis = get_chassis_addr(); + if (!chassis) + return; + + fprintf(br->ip, " address %s", chassis); } static int init_snippets(struct ixif_br *br, struct lyd_node *dif, struct lyd_node *cif, @@ -535,4 +530,31 @@ out: return err; } +int bridge_add_deps(struct lyd_node *cif) +{ + const char *brname = lydx_get_cattr(cif, "name"); + struct ly_set *brports; + const char *portname; + int err = 0; + uint32_t i; + + brports = lydx_find_xpathf(cif, "../interface[bridge-port/bridge='%s']", brname); + if (!brports) + return ERR_IFACE(cif, -ENOENT, "Unable to fetch bridge ports"); + + + for (i = 0; i < brports->count; i++) { + portname = lydx_get_cattr(brports->dnodes[i], "name"); + + err = dagger_add_dep(&confd.netdag, brname, portname); + if (err) { + ERR_IFACE(cif, err, "Unable to depend on \"%s\"", portname); + break; + } + } + + ly_set_free(brports, NULL); + return err; +} + /* BR */ diff --git a/src/confd/src/infix-if-gre.c b/src/confd/src/infix-if-gre.c index 387fc708..4db1a676 100644 --- a/src/confd/src/infix-if-gre.c +++ b/src/confd/src/infix-if-gre.c @@ -3,39 +3,32 @@ #include "ietf-interfaces.h" -int gre_gen(struct dagger *net, struct lyd_node *dif, - struct lyd_node *cif, FILE *ip) +int gre_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip) { - const char *ifname, *iftype, *local, *remote, *mac = NULL; - struct lyd_node *node = NULL; - char gretype[10] = ""; - int ipv6; + const char *ifname, *local, *remote; + struct lyd_node *gre; + int ipv6; ifname = lydx_get_cattr(cif, "name"); - iftype = lydx_get_cattr(cif, "type"); - - node = lydx_get_descendant(lyd_child(cif), "gre", NULL); - if (!node) - return -EINVAL; - - local = lydx_get_cattr(node, "local"); - remote = lydx_get_cattr(node, "remote"); + gre = lydx_get_child(cif, "gre"); + local = lydx_get_cattr(gre, "local"); + remote = lydx_get_cattr(gre, "remote"); ipv6 = !!strstr(local, ":"); - if (!strcmp(iftype, "infix-if-type:gre")) { - snprintf(gretype, sizeof(gretype), "%sgre", ipv6 ? "ip6" : ""); + fprintf(ip, "link add name %s", ifname); - } - else if (!strcmp(iftype, "infix-if-type:gretap")) { - snprintf(gretype, sizeof(gretype), "%sgretap", ipv6 ? "ip6" : ""); - mac = get_phys_addr(cif, NULL); + switch (iftype_from_iface(cif)) { + case IFT_GRE: + fprintf(ip, " type %sgre", ipv6 ? "ip6": ""); + break; + case IFT_GRETAP: + link_gen_address(cif, ip); + fprintf(ip, " type %sgretap", ipv6 ? "ip6": ""); + break; + default: + return -EINVAL; } - fprintf(ip, "link add name %s type %s local %s remote %s", ifname, gretype, local, remote); - if (mac) - fprintf(ip, "address %s\n", mac); - else - fprintf(ip, "\n"); - + fprintf(ip, " local %s remote %s\n", local, remote); return 0; } diff --git a/src/confd/src/infix-if-veth.c b/src/confd/src/infix-if-veth.c index b4d35868..584ca76a 100644 --- a/src/confd/src/infix-if-veth.c +++ b/src/confd/src/infix-if-veth.c @@ -12,6 +12,34 @@ #include "ietf-interfaces.h" +/* + * While the kernel atomically creates/destroys the pair, in `running` + * the two sides are distinct interfaces. So we need to figure out + * which one is going to create/delete the other - i.e. which side is + * the "primary" + */ +bool veth_is_primary(struct lyd_node *cif) +{ + struct lyd_node *peer, *veth; + const char *peername; + + veth = lydx_get_child(cif, "veth"); + peername = lydx_get_cattr(veth, "peer"); + peer = lydx_find_by_name(lyd_parent(cif), "interface", peername); + + /* At the moment, CNI code relies on one side of the pair + * remaining in the host namespace, and that that interface + * takes care of creating the pair. + */ + if (lydx_get_child(cif, "container-network")) + return false; + if (lydx_get_child(peer, "container-network")) + return true; + + return strcmp(lydx_get_cattr(cif, "name"), + lydx_get_cattr(veth, "peer")) < 0; +} + int ifchange_cand_infer_veth(sr_session_ctx_t *session, const char *path) { char *ifname, *type, *peer, *xpath, *val; @@ -63,40 +91,46 @@ out: return err; } -int netdag_gen_veth(struct dagger *net, struct lyd_node *dif, - struct lyd_node *cif, FILE *ip) +int veth_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip) { const char *ifname = lydx_get_cattr(cif, "name"); - struct lyd_node *node; + struct lyd_node *peer, *veth; + const char *peername; + + if (!veth_is_primary(cif)) + return 0; + + veth = lydx_get_child(cif, "veth"); + if (!veth) + return -EINVAL; + + peername = lydx_get_cattr(veth, "peer"); + peer = lydx_find_by_name(lyd_parent(cif), "interface", peername); + + fprintf(ip, "link add dev %s", ifname); + link_gen_address(cif, ip); + + fprintf(ip, " type veth peer %s", peername); + link_gen_address(peer, ip); + + fputc('\n', ip); + return 0; +} + +int veth_add_deps(struct lyd_node *cif) +{ + struct lyd_node *veth = lydx_get_child(cif, "veth"); const char *peer; int err; - node = lydx_get_descendant(lyd_child(cif), "veth", NULL); - if (!node) - return -EINVAL; + if (veth_is_primary(cif)) + return 0; - peer = lydx_get_cattr(node, "peer"); - if (dagger_should_skip(net, ifname)) { - err = dagger_add_dep(net, ifname, peer); - if (err) - return ERR_IFACE(cif, err, "Unable to add dep \"%s\" to %s", peer, ifname); - } else { - char ifname_args[64] = "", peer_args[64] = ""; - const char *mac; + peer = lydx_get_cattr(veth, "peer"); - dagger_skip_iface(net, peer); - - mac = get_phys_addr(dif, NULL); - if (mac) - snprintf(ifname_args, sizeof(ifname_args), "address %s", mac); - - node = lydx_find_by_name(lyd_parent(cif), "interface", peer); - if (node && (mac = get_phys_addr(node, NULL))) - snprintf(peer_args, sizeof(peer_args), "address %s", mac); - - fprintf(ip, "link add dev %s %s type veth peer %s %s\n", - ifname, ifname_args, peer, peer_args); - } + err = dagger_add_dep(&confd.netdag, lydx_get_cattr(cif, "name"), peer); + if (err) + return ERR_IFACE(cif, err, "Unable to depend on \"%s\"", peer); return 0; } diff --git a/src/confd/src/infix-if-vlan.c b/src/confd/src/infix-if-vlan.c index 25eb0237..06097a08 100644 --- a/src/confd/src/infix-if-vlan.c +++ b/src/confd/src/infix-if-vlan.c @@ -135,8 +135,7 @@ static int netdag_gen_vlan_egress_qos(struct lyd_node *cif, FILE *ip) return ERR_IFACE(cif, -EINVAL, "Unsupported egress priority mode \"%s\"", pcp); } -int netdag_gen_vlan(struct dagger *net, struct lyd_node *dif, - struct lyd_node *cif, FILE *ip) +int vlan_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip) { const char *ifname = lydx_get_cattr(cif, "name"); struct lydx_diff typed, vidd; @@ -160,12 +159,9 @@ int netdag_gen_vlan(struct dagger *net, struct lyd_node *dif, lower_if = lydx_get_cattr(vlan, "lower-layer-if"); DEBUG("ifname %s lower if %s\n", ifname, lower_if); - err = dagger_add_dep(net, ifname, lower_if); - if (err) - return ERR_IFACE(cif, err, "Unable to add dep \"%s\"", lower_if); - - - fprintf(ip, "link add dev %s down link %s type vlan", ifname, lower_if); + fprintf(ip, "link add dev %s link %s", ifname, lower_if); + link_gen_address(cif, ip); + fputs(" type vlan", ip); if (lydx_get_diff(lydx_get_child(vlan, "tag-type"), &typed)) { proto = bridge_tagtype2str(typed.new); @@ -190,3 +186,18 @@ int netdag_gen_vlan(struct dagger *net, struct lyd_node *dif, return 0; } + +int vlan_add_deps(struct lyd_node *cif) +{ + struct lyd_node *vlan = lydx_get_child(cif, "vlan"); + const char *lower; + int err; + + lower = lydx_get_cattr(vlan, "lower-layer-if"); + + err = dagger_add_dep(&confd.netdag, lydx_get_cattr(cif, "name"), lower); + if (err) + return ERR_IFACE(cif, err, "Unable to depend on \"%s\"", lower); + + return 0; +} diff --git a/src/confd/src/infix-if-vxlan.c b/src/confd/src/infix-if-vxlan.c index 956869d3..dda71158 100644 --- a/src/confd/src/infix-if-vxlan.c +++ b/src/confd/src/infix-if-vxlan.c @@ -3,8 +3,7 @@ #include "ietf-interfaces.h" -int vxlan_gen(struct dagger *net, struct lyd_node *dif, - struct lyd_node *cif, FILE *ip) +int vxlan_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip) { const char *ifname, *local, *remote, *mac = NULL; const char *vni, *remote_port;