]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: netdev - BareUDP Add support for srcportmin
authorSusant Sahani <ssahani@gmail.com>
Wed, 14 Aug 2024 17:48:20 +0000 (23:18 +0530)
committerSusant Sahani <ssahani@gmail.com>
Wed, 14 Aug 2024 17:48:20 +0000 (23:18 +0530)
Allows to configure the lowest value of the UDP tunnel source port range.

man/systemd.netdev.xml
src/network/netdev/bareudp.c
src/network/netdev/bareudp.h
src/network/netdev/netdev-gperf.gperf

index 6a217d9cae0fc7602509253288f721d4933f7c5e..a9ebd153b89550fb24bd5c0196aa7e8de74304f8 100644 (file)
         <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>
 
index 1df886573ba2cd23e330c392dc5b2a7671fd58a8..fdde8815208dcc13cd6fa80b96d4f7b876eba66d 100644 (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;
 }
 
index a8a33b3e4de9884054eb3bbcc86d5a505c210a7f..6672cbde753c6bffc2c9901a982ccf5028463d2b 100644 (file)
@@ -23,6 +23,7 @@ struct BareUDP {
 
         BareUDPProtocol iftype;
         uint16_t dest_port;
+        uint16_t min_port;
 };
 
 DEFINE_NETDEV_CAST(BAREUDP, BareUDP);
index 8325c8779da1c005d24e685f1d8baa12b06077d2..2ac92e061fc9a3ddaf04981f61b9c0460e3c41c9 100644 (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 */