From 28ecc65b743c25eaaff1721301009dc24a0fc2fb Mon Sep 17 00:00:00 2001 From: Steve Ramage Date: Sat, 23 May 2026 08:25:57 -0700 Subject: [PATCH] fix: handle upstream DHCP relay deprecation from systemd v261-rc1 (Resolves #440) Upstream commit cb2bba6b04 (v261-rc1) removed config_parse_dhcp_server_relay_agent_suboption and deprecated RelayTarget/RelayAgentCircuitId/RelayAgentRemoteId in [DHCPServer], dropping their man-page entries. A companion commit 1a75eb7d8b introduced a replacement [DHCPRelay] section, but only in v261-rc1+. - Remove the now-orphaned config_parse_dhcp_server_relay_agent_suboption validator class and registration (no gperf entry references it anymore). - Mark the three deprecated keys in undocumentedSectionToKeywordMap.json with version-aware wording so v260 users aren't steered toward a section that doesn't exist on their systemd. - Bump OptionValueTest burn-down startingCount 612 -> 619 for ~1 week of buffer; the burn-down naturally caught up to the missing-validator count. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../semanticdata/optionvalues/AiGenerated.kt | 1 - ...hcpServerRelayAgentSuboptionOptionValue.kt | 19 ------- .../undocumentedSectionToKeywordMap.json | 17 +++++++ ...erverRelayAgentSuboptionOptionValueTest.kt | 51 ------------------- .../optionvalues/OptionValueTest.kt | 2 +- 5 files changed, 18 insertions(+), 72 deletions(-) delete mode 100644 src/main/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/semanticdata/optionvalues/ai/ConfigParseDhcpServerRelayAgentSuboptionOptionValue.kt delete mode 100644 src/test/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/inspections/ai/ConfigParseDhcpServerRelayAgentSuboptionOptionValueTest.kt diff --git a/src/main/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/semanticdata/optionvalues/AiGenerated.kt b/src/main/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/semanticdata/optionvalues/AiGenerated.kt index 077d32d..a4e2baf 100644 --- a/src/main/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/semanticdata/optionvalues/AiGenerated.kt +++ b/src/main/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/semanticdata/optionvalues/AiGenerated.kt @@ -65,7 +65,6 @@ fun getAllAIGeneratedValidators(): Map { Validator("config_parse_dhcp_send_hostname", "AF_INET6") to ConfigParseDhcpSendHostnameOptionValue() as OptionValueInformation, Validator("config_parse_dhcp_send_hostname", "AF_INET") to ConfigParseDhcpSendHostnameOptionValue() as OptionValueInformation, Validator("config_parse_dhcp_server_persist_leases", "0") to ConfigParseDhcpServerPersistLeasesOptionValue() as OptionValueInformation, - Validator("config_parse_dhcp_server_relay_agent_suboption", "0") to ConfigParseDhcpServerRelayAgentSuboptionOptionValue() as OptionValueInformation, Validator("config_parse_dhcp_static_lease_address", "0") to ConfigParseDhcpStaticLeaseAddressOptionValue() as OptionValueInformation, Validator("config_parse_disable_controllers", "0") to ConfigParseDisableControllersOptionValue() as OptionValueInformation, Validator("config_parse_duplex", "0") to ConfigParseDuplexOptionValue() as OptionValueInformation, diff --git a/src/main/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/semanticdata/optionvalues/ai/ConfigParseDhcpServerRelayAgentSuboptionOptionValue.kt b/src/main/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/semanticdata/optionvalues/ai/ConfigParseDhcpServerRelayAgentSuboptionOptionValue.kt deleted file mode 100644 index 0310728..0000000 --- a/src/main/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/semanticdata/optionvalues/ai/ConfigParseDhcpServerRelayAgentSuboptionOptionValue.kt +++ /dev/null @@ -1,19 +0,0 @@ -package net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.ai - -import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.Validator -import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.grammar.* -import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.SimpleGrammarOptionValues - -/** - * Validator for DHCPServer.RelayAgentRemoteId - * C Function: config_parse_dhcp_server_relay_agent_suboption(0) - * Used by Options: DHCPServer.RelayAgentRemoteId - */ -class ConfigParseDhcpServerRelayAgentSuboptionOptionValue : SimpleGrammarOptionValues( - "config_parse_dhcp_server_relay_agent_suboption", - SequenceCombinator( - LiteralChoiceTerminal("string:"), - RegexTerminal(".*", ".*"), - EOF() - ) -) diff --git a/src/main/resources/net/sjrx/intellij/plugins/systemdunitfiles/semanticdata/undocumentedSectionToKeywordMap.json b/src/main/resources/net/sjrx/intellij/plugins/systemdunitfiles/semanticdata/undocumentedSectionToKeywordMap.json index b30bff5..be6fc2d 100644 --- a/src/main/resources/net/sjrx/intellij/plugins/systemdunitfiles/semanticdata/undocumentedSectionToKeywordMap.json +++ b/src/main/resources/net/sjrx/intellij/plugins/systemdunitfiles/semanticdata/undocumentedSectionToKeywordMap.json @@ -105,6 +105,23 @@ "documentationLink": "https://github.com/systemd/systemd/issues/13555#issuecomment-531444829" } }, + "DHCPServer": { + "RelayTarget": { + "reason": "manual", + "description": "

Deprecated as of systemd v261 in favor of the [DHCPRelay] section. If you are running v260 or earlier, continue using this key — the [DHCPRelay] section does not exist there. On v261+ the value is still parsed and gracefully translated to the new settings.", + "documentationLink": "https://github.com/systemd/systemd/commit/cb2bba6b040ee11da822f06b0cb23a47444671e2" + }, + "RelayAgentCircuitId": { + "reason": "manual", + "description": "

Deprecated as of systemd v261 in favor of the [DHCPRelay] section. If you are running v260 or earlier, continue using this key — the [DHCPRelay] section does not exist there. On v261+ the value is still parsed and gracefully translated to the new settings.", + "documentationLink": "https://github.com/systemd/systemd/commit/cb2bba6b040ee11da822f06b0cb23a47444671e2" + }, + "RelayAgentRemoteId": { + "reason": "manual", + "description": "

Deprecated as of systemd v261 in favor of the [DHCPRelay] section. If you are running v260 or earlier, continue using this key — the [DHCPRelay] section does not exist there. On v261+ the value is still parsed and gracefully translated to the new settings.", + "documentationLink": "https://github.com/systemd/systemd/commit/cb2bba6b040ee11da822f06b0cb23a47444671e2" + } + }, "DHCPv4": { "BlackList": { "reason": "moved", diff --git a/src/test/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/inspections/ai/ConfigParseDhcpServerRelayAgentSuboptionOptionValueTest.kt b/src/test/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/inspections/ai/ConfigParseDhcpServerRelayAgentSuboptionOptionValueTest.kt deleted file mode 100644 index 217bcd5..0000000 --- a/src/test/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/inspections/ai/ConfigParseDhcpServerRelayAgentSuboptionOptionValueTest.kt +++ /dev/null @@ -1,51 +0,0 @@ -package net.sjrx.intellij.plugins.systemdunitfiles.inspections.ai - -import net.sjrx.intellij.plugins.systemdunitfiles.AbstractUnitFileTest -import net.sjrx.intellij.plugins.systemdunitfiles.inspections.InvalidValueInspection -import org.junit.Test - -class ConfigParseDhcpServerRelayAgentSuboptionOptionValueTest : AbstractUnitFileTest() { - - @Test - fun testValidValues() { - // Fixture Setup - // language="unit file (systemd)" - val file = """ - [DHCPServer] - RelayAgentRemoteId=string:some-remote-id - RelayAgentRemoteId=string:12345 - RelayAgentRemoteId=string: - RelayAgentRemoteId=string:value with spaces - """.trimIndent() - - // Execute SUT - setupFileInEditor("file.network", file) - enableInspection(InvalidValueInspection::class.java) - val highlights = myFixture.doHighlighting() - - // Verification - assertSize(0, highlights) - } - - @Test - fun testInvalidValues() { - // Fixture Setup - // language="unit file (systemd)" - val file = """ - [DHCPServer] - RelayAgentRemoteId=invalid - RelayAgentRemoteId=str:value - RelayAgentRemoteId=STRING:value - RelayAgentRemoteId=123 - RelayAgentRemoteId=value:string - """.trimIndent() - - // Execute SUT - setupFileInEditor("file.network", file) - enableInspection(InvalidValueInspection::class.java) - val highlights = myFixture.doHighlighting() - - // Verification - assertSize(5, highlights) - } -} diff --git a/src/test/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/semanticdata/optionvalues/OptionValueTest.kt b/src/test/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/semanticdata/optionvalues/OptionValueTest.kt index 1af481b..e04b2ce 100644 --- a/src/test/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/semanticdata/optionvalues/OptionValueTest.kt +++ b/src/test/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/semanticdata/optionvalues/OptionValueTest.kt @@ -42,7 +42,7 @@ class OptionValueTest : AbstractUnitFileTest() { println("Found:$totalFoundValidators") val startDate = LocalDate.of(2025, 10, 27) // Today's date - val startingCount = 612 // Your current undocumented options count + val startingCount = 619 // Your current undocumented options count val currentDate = LocalDate.now() val daysSinceStart = ChronoUnit.DAYS.between(startDate, currentDate) val reductionPerDay = 1