From: Susant Sahani Date: Wed, 14 Aug 2024 17:48:20 +0000 (+0530) Subject: network: netdev - BareUDP Add support for srcportmin X-Git-Tag: v257-rc1~704^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79188943022f106adef7afd2680a191d98f5fc84;p=thirdparty%2Fsystemd.git network: netdev - BareUDP Add support for srcportmin Allows to configure the lowest value of the UDP tunnel source port range. --- diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml index 6a217d9cae0..a9ebd153b89 100644 --- a/man/systemd.netdev.xml +++ b/man/systemd.netdev.xml @@ -1017,6 +1017,17 @@ + + + MinSourcePort= + + Specifies the lowest value of the UDP tunnel source UDP port (in range 1…65535). + Defaults to unset. + + + + + diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c index 1df886573ba..fdde8815208 100644 --- a/src/network/netdev/bareudp.c +++ b/src/network/netdev/bareudp.c @@ -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; } diff --git a/src/network/netdev/bareudp.h b/src/network/netdev/bareudp.h index a8a33b3e4de..6672cbde753 100644 --- a/src/network/netdev/bareudp.h +++ b/src/network/netdev/bareudp.h @@ -23,6 +23,7 @@ struct BareUDP { BareUDPProtocol iftype; uint16_t dest_port; + uint16_t min_port; }; DEFINE_NETDEV_CAST(BAREUDP, BareUDP); diff --git a/src/network/netdev/netdev-gperf.gperf b/src/network/netdev/netdev-gperf.gperf index 8325c8779da..2ac92e061fc 100644 --- a/src/network/netdev/netdev-gperf.gperf +++ b/src/network/netdev/netdev-gperf.gperf @@ -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 */