1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-24 06:04:05 +03:00

Merge pull request #32067 from ssahani/bareudp1

network: netdev - BareUDP Add support for srcportmin
This commit is contained in:
Yu Watanabe 2024-08-15 05:35:32 +09:00 committed by GitHub
commit 6dd1465b2a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 21 additions and 0 deletions

View File

@ -1017,6 +1017,17 @@
<xi:include href="version-info.xml" xpointer="v247"/>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>MinSourcePort=</varname></term>
<listitem>
<para>Specifies the lowest value of the UDP tunnel source UDP port (in range 1…65535).
Defaults to unset.</para>
<xi:include href="version-info.xml" xpointer="v257"/>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

View File

@ -34,6 +34,12 @@ static int netdev_bare_udp_fill_message_create(NetDev *netdev, Link *link, sd_ne
if (r < 0)
return r;
if (u->min_port > 0) {
r = sd_netlink_message_append_u16(m, IFLA_BAREUDP_SRCPORT_MIN, u->min_port);
if (r < 0)
return r;
}
return 0;
}

View File

@ -23,6 +23,7 @@ struct BareUDP {
BareUDPProtocol iftype;
uint16_t dest_port;
uint16_t min_port;
};
DEFINE_NETDEV_CAST(BAREUDP, BareUDP);

View File

@ -238,6 +238,7 @@ Bridge.FDBMaxLearned, config_parse_bridge_fdb_max_learned,
VRF.TableId, config_parse_uint32, 0, offsetof(Vrf, table) /* deprecated */
VRF.Table, config_parse_uint32, 0, offsetof(Vrf, table)
BareUDP.DestinationPort, config_parse_ip_port, 0, offsetof(BareUDP, dest_port)
BareUDP.MinSourcePort, config_parse_ip_port, 0, offsetof(BareUDP, min_port)
BareUDP.EtherType, config_parse_bare_udp_iftype, 0, offsetof(BareUDP, iftype)
WireGuard.FirewallMark, config_parse_unsigned, 0, offsetof(Wireguard, fwmark)
WireGuard.FwMark, config_parse_unsigned, 0, offsetof(Wireguard, fwmark) /* deprecated */

View File

@ -5,4 +5,5 @@ Name=bareudp99
[BareUDP]
DestinationPort=1000
MinSourcePort=1001
EtherType=ipv4

View File

@ -1556,6 +1556,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
print(output)
self.assertRegex(output, 'dstport 1000 ')
self.assertRegex(output, 'ethertype ip ')
self.assertRegex(output, 'srcportmin 1001 ')
@expectedFailureIfModuleIsNotAvailable('batman-adv')
def test_batadv(self):