Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,32 @@ fun getAllAIGeneratedValidators(): Map<Validator, OptionValueInformation> {
Validator("config_parse_socket_service", "0") to ConfigParseSocketServiceOptionValue() as OptionValueInformation,
Validator("config_parse_service_sockets", "0") to ConfigParseServiceSocketsOptionValue() as OptionValueInformation,

// Batch 2026-10: qdisc
Validator("config_parse_fq_codel_usec", "QDISC_KIND_FQ_CODEL") to ConfigParseFqCodelUsecOptionValue() as OptionValueInformation,
Validator("config_parse_tbf_rate", "QDISC_KIND_TBF") to ConfigParseTbfRateOptionValue() as OptionValueInformation,
Validator("config_parse_netem_rate", "QDISC_KIND_NETEM") to ConfigParseNetemRateOptionValue() as OptionValueInformation,
Validator("config_parse_netem_delay", "QDISC_KIND_NETEM") to ConfigParseNetemDelayOptionValue() as OptionValueInformation,
Validator("config_parse_htb_class_rate", "TCLASS_KIND_HTB") to ConfigParseHtbClassRateOptionValue() as OptionValueInformation,
Validator("config_parse_gred_u32", "QDISC_KIND_GRED") to ConfigParseGredU32OptionValue() as OptionValueInformation,
Validator("config_parse_fq_codel_u32", "QDISC_KIND_FQ_CODEL") to ConfigParseFqCodelU32OptionValue() as OptionValueInformation,
Validator("config_parse_teql_id", "QDISC_KIND_TEQL") to ConfigParseTeqlIdOptionValue() as OptionValueInformation,
Validator("config_parse_qfq_max_packet", "TCLASS_KIND_QFQ") to ConfigParseQfqMaxPacketOptionValue() as OptionValueInformation,
Validator("config_parse_pie_packet_limit", "QDISC_KIND_PIE") to ConfigParsePiePacketLimitOptionValue() as OptionValueInformation,
Validator("config_parse_htb_u32", "QDISC_KIND_HTB") to ConfigParseHtbU32OptionValue() as OptionValueInformation,
Validator("config_parse_htb_default_class", "QDISC_KIND_HTB") to ConfigParseHtbDefaultClassOptionValue() as OptionValueInformation,
Validator("config_parse_htb_class_u32", "TCLASS_KIND_HTB") to ConfigParseHtbClassU32OptionValue() as OptionValueInformation,
Validator("config_parse_gred_bool", "QDISC_KIND_GRED") to ConfigParseGredBoolOptionValue() as OptionValueInformation,
Validator("config_parse_fq_usec", "QDISC_KIND_FQ") to ConfigParseFqUsecOptionValue() as OptionValueInformation,
Validator("config_parse_fq_max_rate", "QDISC_KIND_FQ") to ConfigParseFqMaxRateOptionValue() as OptionValueInformation,
Validator("config_parse_fq_codel_bool", "QDISC_KIND_FQ_CODEL") to ConfigParseFqCodelBoolOptionValue() as OptionValueInformation,
Validator("config_parse_ets_quanta", "QDISC_KIND_ETS") to ConfigParseEtsQuantaOptionValue() as OptionValueInformation,
Validator("config_parse_ets_prio", "QDISC_KIND_ETS") to ConfigParseEtsPrioOptionValue() as OptionValueInformation,
Validator("config_parse_drr_size", "TCLASS_KIND_DRR") to ConfigParseDrrSizeOptionValue() as OptionValueInformation,
Validator("config_parse_cake_flow_isolation_mode", "QDISC_KIND_CAKE") to ConfigParseCakeFlowIsolationModeOptionValue() as OptionValueInformation,
Validator("config_parse_cake_bandwidth", "QDISC_KIND_CAKE") to ConfigParseCakeBandwidthOptionValue() as OptionValueInformation,
Validator("config_parse_cake_ack_filter", "QDISC_KIND_CAKE") to ConfigParseCakeAckFilterOptionValue() as OptionValueInformation,
Validator("config_parse_bfifo_size", "QDISC_KIND_BFIFO") to ConfigParseBfifoSizeOptionValue() as OptionValueInformation,

)

return allValidators
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.ai

import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.SimpleGrammarOptionValues
import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.grammar.*

/*
* [BFIFO] LimitBytes= (.network)
*
* man https://www.freedesktop.org/software/systemd/man/latest/systemd.network.html#LimitBytes=
* parser https://github.com/systemd/systemd/blob/0f0682b773/src/network/tc/fifo.c#L103-L160 config_parse_bfifo_size (QDISC_KIND_BFIFO)
* leaf https://github.com/systemd/systemd/blob/0f0682b773/src/basic/parse-util.c#L157-L283 parse_size
* tests https://github.com/systemd/systemd/blob/0f0682b773/src/test/test-parse-util.c#L108-L176 TEST(parse_size_iec)
* tests https://github.com/systemd/systemd/blob/0f0682b773/src/test/test-parse-util.c#L178-L246 TEST(parse_size_si)
* tests https://github.com/systemd/systemd/blob/0f0682b773/test/test-network/conf/25-qdisc-htb-fifo.network#L42 LimitBytes=1000000
*/

/**
* Validator for [BFIFO] LimitBytes=.
*
* C function: config_parse_bfifo_size (QDISC_KIND_BFIFO). An empty assignment resets the setting and is
* handled before this grammar runs.
*
* A byte size as parse_size(rvalue, 1024) reads it (see [parseSize]) that must not exceed UINT32_MAX:
* above it the parser logs "Invalid 'LimitBytes=', ignoring assignment". So `4G` is rejected.
*/
class ConfigParseBfifoSizeOptionValue : SimpleGrammarOptionValues(
"config_parse_bfifo_size",
SequenceCombinator(parseSize(1024, maxInclusive = SIZE_UINT32_MAX), EOF()),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.ai

import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.SimpleGrammarOptionValues
import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.grammar.*

/*
* [CAKE] AckFilter= (.network)
*
* man https://www.freedesktop.org/software/systemd/man/latest/systemd.network.html#AckFilter=
* parser https://github.com/systemd/systemd/blob/0f0682b773/src/network/tc/cake.c#L680-L730 config_parse_cake_ack_filter (QDISC_KIND_CAKE)
* leaf https://github.com/systemd/systemd/blob/0f0682b773/src/network/tc/cake.c#L672-L678 cake_ack_filter_table + DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_BOOLEAN
* leaf https://github.com/systemd/systemd/blob/0f0682b773/src/basic/string-table.c#L32-L43 string_table_lookup_from_string_with_boolean
* leaf https://github.com/systemd/systemd/blob/0f0682b773/src/basic/parse-util.c#L23-L46 parse_boolean (case-insensitive)
* tests https://github.com/systemd/systemd/blob/0f0682b773/src/test/test-parse-util.c#L13-L37 TEST(parse_boolean) — "YES", "TRUE", "ON" accepted
* tests https://github.com/systemd/systemd/blob/0f0682b773/test/test-network/conf/25-qdisc-cake.network#L25 AckFilter=aggressive
*/

/**
* Validator for [CAKE] AckFilter=.
*
* C function: config_parse_cake_ack_filter (QDISC_KIND_CAKE). An empty assignment resets the setting and is
* handled before this grammar runs.
*
* A boolean (parse_boolean() is tried first, case-insensitively: `yes` -> filter, `no` -> off) or the
* table word `aggressive`, which is matched exactly (case-sensitive streq). The table's `no`/`yes`
* entries are not listed as names: parse_boolean() already takes them, in any case.
*/
class ConfigParseCakeAckFilterOptionValue : SimpleGrammarOptionValues(
"config_parse_cake_ack_filter",
SequenceCombinator(
PreferValidAlternativeCombinator(
FlexibleLiteralChoiceTerminal("aggressive"),
BOOLEAN,
),
EOF(),
),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.ai

import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.SimpleGrammarOptionValues
import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.grammar.*

/*
* [CAKE] Bandwidth= (.network)
*
* man https://www.freedesktop.org/software/systemd/man/latest/systemd.network.html#Bandwidth=
* parser https://github.com/systemd/systemd/blob/0f0682b773/src/network/tc/cake.c#L141-L193 config_parse_cake_bandwidth (QDISC_KIND_CAKE)
* leaf https://github.com/systemd/systemd/blob/0f0682b773/src/basic/parse-util.c#L157-L283 parse_size
* tests https://github.com/systemd/systemd/blob/0f0682b773/src/test/test-parse-util.c#L108-L176 TEST(parse_size_iec)
* tests https://github.com/systemd/systemd/blob/0f0682b773/src/test/test-parse-util.c#L178-L246 TEST(parse_size_si)
* tests https://github.com/systemd/systemd/blob/0f0682b773/test/test-network/conf/25-qdisc-cake.network#L12 Bandwidth=500M
*/

/**
* Validator for [CAKE] Bandwidth=.
*
* C function: config_parse_cake_bandwidth (QDISC_KIND_CAKE). An empty assignment resets the setting and is
* handled before this grammar runs.
*
* A rate in bits per second as parse_size(rvalue, 1000) reads it (see [parseSize]); the result is
* divided by 8 and stored as a uint64 with no further bound.
*/
class ConfigParseCakeBandwidthOptionValue : SimpleGrammarOptionValues(
"config_parse_cake_bandwidth",
SequenceCombinator(parseSize(1000), EOF()),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.ai

import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.SimpleGrammarOptionValues
import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.grammar.*

/*
* [CAKE] FlowIsolationMode= (.network)
*
* man https://www.freedesktop.org/software/systemd/man/latest/systemd.network.html#FlowIsolationMode=
* parser https://github.com/systemd/systemd/blob/0f0682b773/src/network/tc/cake.c#L442-L492 config_parse_cake_flow_isolation_mode (QDISC_KIND_CAKE)
* leaf https://github.com/systemd/systemd/blob/0f0682b773/src/network/tc/cake.c#L429-L438 cake_flow_isolation_mode_table
* leaf https://github.com/systemd/systemd/blob/0f0682b773/src/network/tc/cake.c#L440 DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING (exact, case-sensitive)
* tests https://github.com/systemd/systemd/blob/0f0682b773/test/test-network/conf/25-qdisc-cake.network#L18 FlowIsolationMode=dual-dst-host
*/

/**
* Validator for [CAKE] FlowIsolationMode=.
*
* C function: config_parse_cake_flow_isolation_mode (QDISC_KIND_CAKE). An empty assignment resets the setting and is
* handled before this grammar runs.
*
* One of `none`, `src-host`, `dst-host`, `hosts`, `flows`, `dual-src-host`, `dual-dst-host`, `triple`,
* matched exactly (string_table_lookup is case-sensitive, and this table has no boolean fallback).
*/
class ConfigParseCakeFlowIsolationModeOptionValue : SimpleGrammarOptionValues(
"config_parse_cake_flow_isolation_mode",
SequenceCombinator(FlexibleLiteralChoiceTerminal("none", "src-host", "dst-host", "hosts", "flows", "dual-src-host", "dual-dst-host", "triple"), EOF()),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.ai

import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.SimpleGrammarOptionValues
import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.grammar.*

/*
* [DeficitRoundRobinSchedulerClass] QuantumBytes= (.network)
*
* man https://www.freedesktop.org/software/systemd/man/latest/systemd.network.html#QuantumBytes=
* parser https://github.com/systemd/systemd/blob/0f0682b773/src/network/tc/drr.c#L45-L102 config_parse_drr_size (TCLASS_KIND_DRR)
* leaf https://github.com/systemd/systemd/blob/0f0682b773/src/basic/parse-util.c#L157-L283 parse_size
* tests https://github.com/systemd/systemd/blob/0f0682b773/src/test/test-parse-util.c#L108-L176 TEST(parse_size_iec)
* tests https://github.com/systemd/systemd/blob/0f0682b773/src/test/test-parse-util.c#L178-L246 TEST(parse_size_si)
* tests https://github.com/systemd/systemd/blob/0f0682b773/test/test-network/conf/25-qdisc-drr.network#L16 QuantumBytes=2000
*/

/**
* Validator for [DeficitRoundRobinSchedulerClass] QuantumBytes=.
*
* C function: config_parse_drr_size (TCLASS_KIND_DRR). An empty assignment resets the setting and is
* handled before this grammar runs.
*
* A byte size as parse_size(rvalue, 1024) reads it (see [parseSize]) that must not exceed UINT32_MAX:
* above it the parser logs "Invalid 'QuantumBytes=', ignoring assignment". So `4G` (4294967296) is
* rejected and `4095M` is accepted.
*/
class ConfigParseDrrSizeOptionValue : SimpleGrammarOptionValues(
"config_parse_drr_size",
SequenceCombinator(parseSize(1024, maxInclusive = SIZE_UINT32_MAX), EOF()),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.ai

import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.SimpleGrammarOptionValues
import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.grammar.*
import java.math.BigInteger

/*
* [EnhancedTransmissionSelection] PriorityMap= (.network)
*
* man https://www.freedesktop.org/software/systemd/man/latest/systemd.network.html#PriorityMap=
* parser https://github.com/systemd/systemd/blob/0f0682b773/src/network/tc/ets.c#L227-L302 config_parse_ets_prio (QDISC_KIND_ETS)
* leaf https://github.com/systemd/systemd/blob/0f0682b773/src/basic/parse-util.c#L429-L478 safe_atou_full
* leaf https://github.com/systemd/systemd/blob/0f0682b773/src/basic/parse-util.c#L403-L427 mangle_base
* leaf https://github.com/systemd/systemd/blob/0f0682b773/src/basic/parse-util.h#L45-L47 safe_atou8
* leaf https://github.com/systemd/systemd/blob/0f0682b773/src/basic/parse-util.c#L583-L597 safe_atou8_full (rejects > UINT8_MAX)
* leaf https://github.com/systemd/systemd/blob/0f0682b773/src/include/uapi/linux/pkt_sched.h#L28 TC_PRIO_MAX = 15
* tests https://github.com/systemd/systemd/blob/0f0682b773/src/test/test-parse-util.c#L489 safe_atou16("+12345") accepted
* tests https://github.com/systemd/systemd/blob/0f0682b773/src/test/test-parse-util.c#L466-L470 0o6 / 0B101 prefixes (safe_atolli, same mangle_base)
* tests https://github.com/systemd/systemd/blob/0f0682b773/test/test-network/conf/25-qdisc-ets.network#L18-L21 PriorityMap=8 7 6 5 / PriorityMap= / PriorityMap=3 4 5
*/

private val ETS_BAND = SafeAtoTerminal(
signed = false,
base = 0,
flags = emptySet(),
minInclusive = BigInteger.ZERO,
maxInclusive = SafeAtoTerminal.UINT8_MAX,
acceptsWhitespace = false,
acceptsMinus = true,
)

/**
* Validator for [EnhancedTransmissionSelection] PriorityMap=.
*
* C function: config_parse_ets_prio (QDISC_KIND_ETS). An empty assignment resets the setting and is
* handled before this grammar runs.
*
* A whitespace-separated list of band numbers, each read with safe_atou8 (base 0, 0…255), at most
* TC_PRIO_MAX + 1 (16) entries per line. Each entry is a word from extract_first_word(), so the number
* cannot contain a blank: `0b+1` is 1, but `0b 1` is the words `0b` (invalid) and `1`. Out-of-range or unparsable entries are logged and skipped by
* the C, and so are flagged here; so is a 17th entry.
*
* Lenient: enhanced_transmission_selection_verify later rejects the whole section if any entry is not
* below the number of bands (at most 16), so values 16…255 can never actually work; they are accepted
* here because the man page documents 0…255 and that is what the parser itself checks. The 16-entry
* cap is cumulative across lines; only the per-line count is checked.
*/
class ConfigParseEtsPrioOptionValue : SimpleGrammarOptionValues(
"config_parse_ets_prio",
SequenceCombinator(ETS_BAND, Repeat(SequenceCombinator(WhitespaceTerminal(), ETS_BAND), 0, 15), EOF()),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.ai

import java.math.BigInteger
import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.SimpleGrammarOptionValues
import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.grammar.*

/*
* [EnhancedTransmissionSelection] QuantumBytes= (.network)
*
* man https://www.freedesktop.org/software/systemd/man/latest/systemd.network.html#QuantumBytes=
* parser https://github.com/systemd/systemd/blob/0f0682b773/src/network/tc/ets.c#L144-L225 config_parse_ets_quanta (QDISC_KIND_ETS)
* leaf https://github.com/systemd/systemd/blob/0f0682b773/src/basic/parse-util.c#L157-L283 parse_size
* leaf https://github.com/systemd/systemd/blob/0f0682b773/src/include/uapi/linux/pkt_sched.h#L1210 TCQ_ETS_MAX_BANDS = 16
* tests https://github.com/systemd/systemd/blob/0f0682b773/src/test/test-parse-util.c#L108-L176 TEST(parse_size_iec)
* tests https://github.com/systemd/systemd/blob/0f0682b773/src/test/test-parse-util.c#L178-L246 TEST(parse_size_si)
* tests https://github.com/systemd/systemd/blob/0f0682b773/test/test-network/conf/25-qdisc-ets.network#L14-L17 QuantumBytes=2 4 6 / QuantumBytes= / QuantumBytes=1001 1002 1003
*/

private val ETS_QUANTUM = parseSize(1024, minInclusive = BigInteger.ONE, maxInclusive = SIZE_UINT32_MAX, allowInnerWhitespace = false)

/**
* Validator for [EnhancedTransmissionSelection] QuantumBytes=.
*
* C function: config_parse_ets_quanta (QDISC_KIND_ETS). An empty assignment resets the setting and is
* handled before this grammar runs.
*
* A whitespace-separated list (extract_first_word, no flags) of byte sizes, each read with
* parse_size(word, 1024) and required to be 1…4294967295; at most TCQ_ETS_MAX_BANDS (16) entries. A
* zero, oversized or unparsable entry is logged and skipped by the C ("ignoring assignment"), and so is
* flagged here; so is a 17th entry on one line.
*
* Because the list is split on whitespace first, each entry is a single word: `1K` or `1K512B` is one
* entry, but `1K 512B` is two.
*
* Lenient: the 16-entry cap is cumulative across repeated QuantumBytes= lines (until an empty
* assignment resets the list); only the per-line count is checked.
*/
class ConfigParseEtsQuantaOptionValue : SimpleGrammarOptionValues(
"config_parse_ets_quanta",
SequenceCombinator(ETS_QUANTUM, Repeat(SequenceCombinator(WhitespaceTerminal(), ETS_QUANTUM), 0, 15), EOF()),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.ai

import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.SimpleGrammarOptionValues
import net.sjrx.intellij.plugins.systemdunitfiles.semanticdata.optionvalues.grammar.*

/*
* [FairQueueingControlledDelay] ECN= (.network)
*
* man https://www.freedesktop.org/software/systemd/man/latest/systemd.network.html#ECN=
* parser https://github.com/systemd/systemd/blob/0f0682b773/src/network/tc/fq-codel.c#L222-L265 config_parse_fq_codel_bool (QDISC_KIND_FQ_CODEL)
* leaf https://github.com/systemd/systemd/blob/0f0682b773/src/basic/parse-util.c#L48-L64 parse_tristate_full
* leaf https://github.com/systemd/systemd/blob/0f0682b773/src/basic/parse-util.c#L23-L46 parse_boolean (STRCASE_IN_SET: case-insensitive)
* tests https://github.com/systemd/systemd/blob/0f0682b773/src/test/test-parse-util.c#L13-L37 TEST(parse_boolean) — "YES", "TRUE", "ON" accepted
* tests https://github.com/systemd/systemd/blob/0f0682b773/test/test-network/conf/25-qdisc-fq_codel.network#L18 ECN=yes
*/

/**
* Validator for [FairQueueingControlledDelay] ECN=.
*
* C function: config_parse_fq_codel_bool (QDISC_KIND_FQ_CODEL). An empty assignment resets the setting and is
* handled before this grammar runs.
*
* A boolean via parse_tristate(): any parse_boolean() spelling, case-insensitively. Empty resets to
* "unset" (handled before the grammar).
*/
class ConfigParseFqCodelBoolOptionValue : SimpleGrammarOptionValues(
"config_parse_fq_codel_bool",
SequenceCombinator(BOOLEAN, EOF()),
)
Loading
Loading