nl-linux 0.2.3 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +3 -0
  3. data/CHANGELOG.md +8 -0
  4. data/NLSPEC_VERSION +1 -1
  5. data/Rakefile +13 -3
  6. data/generated/nl/linux/binder.rb +80 -0
  7. data/generated/nl/linux/conntrack.rb +39 -2
  8. data/generated/nl/linux/dev_energymodel.rb +106 -0
  9. data/generated/nl/linux/devlink.rb +1478 -200
  10. data/generated/nl/linux/dpll.rb +790 -66
  11. data/generated/nl/linux/drm_ras.rb +309 -0
  12. data/generated/nl/linux/ethtool.rb +1597 -248
  13. data/generated/nl/linux/fou.rb +82 -13
  14. data/generated/nl/linux/handshake.rb +93 -1
  15. data/generated/nl/linux/lockd.rb +50 -0
  16. data/generated/nl/linux/mptcp_pm.rb +159 -0
  17. data/generated/nl/linux/net_shaper.rb +124 -1
  18. data/generated/nl/linux/netdev.rb +515 -6
  19. data/generated/nl/linux/nfsd.rb +878 -10
  20. data/generated/nl/linux/nftables.rb +2134 -179
  21. data/generated/nl/linux/nl80211.rb +81 -22
  22. data/generated/nl/linux/nlctrl.rb +59 -8
  23. data/generated/nl/linux/ovpn.rb +207 -12
  24. data/generated/nl/linux/ovs_datapath.rb +59 -10
  25. data/generated/nl/linux/ovs_flow.rb +63 -20
  26. data/generated/nl/linux/ovs_packet.rb +277 -0
  27. data/generated/nl/linux/ovs_vport.rb +59 -10
  28. data/generated/nl/linux/psp.rb +453 -6
  29. data/generated/nl/linux/rt_addr.rb +69 -14
  30. data/generated/nl/linux/rt_link.rb +452 -112
  31. data/generated/nl/linux/rt_neigh.rb +227 -16
  32. data/generated/nl/linux/rt_route.rb +92 -49
  33. data/generated/nl/linux/rt_rule.rb +300 -11
  34. data/generated/nl/linux/sunrpc_cache.rb +423 -0
  35. data/generated/nl/linux/tc.rb +168 -54
  36. data/generated/nl/linux/tcp_metrics.rb +69 -12
  37. data/generated/nl/linux/team.rb +80 -0
  38. data/generated/nl/linux/wireguard.rb +99 -7
  39. data/generated/nl/linux.rb +3 -0
  40. data/lib/nl/linux/version.rb +1 -1
  41. data/linux/devlink.yaml +92 -2
  42. data/linux/dpll.yaml +94 -5
  43. data/linux/drm_ras.yaml +126 -0
  44. data/linux/ethtool.yaml +21 -4
  45. data/linux/handshake.yaml +9 -0
  46. data/linux/mptcp_pm.yaml +1 -0
  47. data/linux/net_shaper.yaml +13 -6
  48. data/linux/netdev.yaml +61 -2
  49. data/linux/nfsd.yaml +303 -2
  50. data/linux/nftables.yaml +640 -49
  51. data/linux/ovpn.yaml +26 -1
  52. data/linux/ovs_packet.yaml +130 -0
  53. data/linux/psp.yaml +80 -3
  54. data/linux/rt-link.yaml +70 -24
  55. data/linux/sunrpc_cache.yaml +149 -0
  56. data/linux/tc.yaml +3 -0
  57. metadata +17 -9
@@ -1,5 +1,9 @@
1
1
  # SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
2
2
  #
3
+ # This file is based on Documentation/netlink/specs/ovpn.yaml from Linux v7.2.
4
+ #
5
+ # Original YNL comment:
6
+ #
3
7
  # Author: Antonio Quartulli <antonio@openvpn.net>
4
8
  #
5
9
  # Copyright (c) 2024-2025, OpenVPN Inc.
@@ -14,6 +18,7 @@ module Nl; module Linux
14
18
  class Ovpn < ::Nl::Family
15
19
  NAME = "ovpn"
16
20
  PROTOCOL = Ractor.make_shareable(::Nl::Protocols::Genl.new("ovpn"))
21
+ MCAST_GROUPS = Ractor.make_shareable({:"peers" => ::Nl::McastGroup.new("peers", nil)}) #: Hash[::Symbol, ::Nl::McastGroup]
17
22
  module Structs
18
23
  end
19
24
  module AttributeSets
@@ -84,12 +89,12 @@ class Ovpn < ::Nl::Family
84
89
  class KeepaliveInterval < Attribute
85
90
  TYPE = 13
86
91
  NAME = :"keepalive_interval"
87
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
92
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is greater than maximum 86400" unless it <= 86400 })
88
93
  end
89
94
  class KeepaliveTimeout < Attribute
90
95
  TYPE = 14
91
96
  NAME = :"keepalive_timeout"
92
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
97
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is greater than maximum 86400" unless it <= 86400 })
93
98
  end
94
99
  class DelReason < Attribute
95
100
  TYPE = 15
@@ -136,10 +141,15 @@ class Ovpn < ::Nl::Family
136
141
  NAME = :"link_tx_packets"
137
142
  DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::UINT, check: nil)
138
143
  end
144
+ class TxId < Attribute
145
+ TYPE = 24
146
+ NAME = :"tx_id"
147
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is greater than maximum 16777215" unless it <= 16777215 })
148
+ end
139
149
  # :nodoc:
140
- BY_NAME = Ractor.make_shareable({:"id" => Id, :"remote_ipv4" => RemoteIpv4, :"remote_ipv6" => RemoteIpv6, :"remote_ipv6_scope_id" => RemoteIpv6ScopeId, :"remote_port" => RemotePort, :"socket" => Socket, :"socket_netnsid" => SocketNetnsid, :"vpn_ipv4" => VpnIpv4, :"vpn_ipv6" => VpnIpv6, :"local_ipv4" => LocalIpv4, :"local_ipv6" => LocalIpv6, :"local_port" => LocalPort, :"keepalive_interval" => KeepaliveInterval, :"keepalive_timeout" => KeepaliveTimeout, :"del_reason" => DelReason, :"vpn_rx_bytes" => VpnRxBytes, :"vpn_tx_bytes" => VpnTxBytes, :"vpn_rx_packets" => VpnRxPackets, :"vpn_tx_packets" => VpnTxPackets, :"link_rx_bytes" => LinkRxBytes, :"link_tx_bytes" => LinkTxBytes, :"link_rx_packets" => LinkRxPackets, :"link_tx_packets" => LinkTxPackets}) #: Hash[::Symbol, Attribute]
150
+ BY_NAME = Ractor.make_shareable({:"id" => Id, :"remote_ipv4" => RemoteIpv4, :"remote_ipv6" => RemoteIpv6, :"remote_ipv6_scope_id" => RemoteIpv6ScopeId, :"remote_port" => RemotePort, :"socket" => Socket, :"socket_netnsid" => SocketNetnsid, :"vpn_ipv4" => VpnIpv4, :"vpn_ipv6" => VpnIpv6, :"local_ipv4" => LocalIpv4, :"local_ipv6" => LocalIpv6, :"local_port" => LocalPort, :"keepalive_interval" => KeepaliveInterval, :"keepalive_timeout" => KeepaliveTimeout, :"del_reason" => DelReason, :"vpn_rx_bytes" => VpnRxBytes, :"vpn_tx_bytes" => VpnTxBytes, :"vpn_rx_packets" => VpnRxPackets, :"vpn_tx_packets" => VpnTxPackets, :"link_rx_bytes" => LinkRxBytes, :"link_tx_bytes" => LinkTxBytes, :"link_rx_packets" => LinkRxPackets, :"link_tx_packets" => LinkTxPackets, :"tx_id" => TxId}) #: Hash[::Symbol, Attribute]
141
151
  # :nodoc:
142
- BY_TYPE = Ractor.make_shareable({1 => Id, 2 => RemoteIpv4, 3 => RemoteIpv6, 4 => RemoteIpv6ScopeId, 5 => RemotePort, 6 => Socket, 7 => SocketNetnsid, 8 => VpnIpv4, 9 => VpnIpv6, 10 => LocalIpv4, 11 => LocalIpv6, 12 => LocalPort, 13 => KeepaliveInterval, 14 => KeepaliveTimeout, 15 => DelReason, 16 => VpnRxBytes, 17 => VpnTxBytes, 18 => VpnRxPackets, 19 => VpnTxPackets, 20 => LinkRxBytes, 21 => LinkTxBytes, 22 => LinkRxPackets, 23 => LinkTxPackets}) #: Hash[::Integer, Attribute]
152
+ BY_TYPE = Ractor.make_shareable({1 => Id, 2 => RemoteIpv4, 3 => RemoteIpv6, 4 => RemoteIpv6ScopeId, 5 => RemotePort, 6 => Socket, 7 => SocketNetnsid, 8 => VpnIpv4, 9 => VpnIpv6, 10 => LocalIpv4, 11 => LocalIpv6, 12 => LocalPort, 13 => KeepaliveInterval, 14 => KeepaliveTimeout, 15 => DelReason, 16 => VpnRxBytes, 17 => VpnTxBytes, 18 => VpnRxPackets, 19 => VpnTxPackets, 20 => LinkRxBytes, 21 => LinkTxBytes, 22 => LinkRxPackets, 23 => LinkTxPackets, 24 => TxId}) #: Hash[::Integer, Attribute]
143
153
  class << self
144
154
  # Looks up Attribute class by name.
145
155
  #--
@@ -210,17 +220,22 @@ class Ovpn < ::Nl::Family
210
220
  class KeepaliveInterval < Attribute
211
221
  TYPE = 13
212
222
  NAME = :"keepalive_interval"
213
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
223
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is greater than maximum 86400" unless it <= 86400 })
214
224
  end
215
225
  class KeepaliveTimeout < Attribute
216
226
  TYPE = 14
217
227
  NAME = :"keepalive_timeout"
218
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
228
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is greater than maximum 86400" unless it <= 86400 })
229
+ end
230
+ class TxId < Attribute
231
+ TYPE = 24
232
+ NAME = :"tx_id"
233
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is greater than maximum 16777215" unless it <= 16777215 })
219
234
  end
220
235
  # :nodoc:
221
- BY_NAME = Ractor.make_shareable({:"id" => Id, :"remote_ipv4" => RemoteIpv4, :"remote_ipv6" => RemoteIpv6, :"remote_ipv6_scope_id" => RemoteIpv6ScopeId, :"remote_port" => RemotePort, :"socket" => Socket, :"vpn_ipv4" => VpnIpv4, :"vpn_ipv6" => VpnIpv6, :"local_ipv4" => LocalIpv4, :"local_ipv6" => LocalIpv6, :"keepalive_interval" => KeepaliveInterval, :"keepalive_timeout" => KeepaliveTimeout}) #: Hash[::Symbol, Attribute]
236
+ BY_NAME = Ractor.make_shareable({:"id" => Id, :"remote_ipv4" => RemoteIpv4, :"remote_ipv6" => RemoteIpv6, :"remote_ipv6_scope_id" => RemoteIpv6ScopeId, :"remote_port" => RemotePort, :"socket" => Socket, :"vpn_ipv4" => VpnIpv4, :"vpn_ipv6" => VpnIpv6, :"local_ipv4" => LocalIpv4, :"local_ipv6" => LocalIpv6, :"keepalive_interval" => KeepaliveInterval, :"keepalive_timeout" => KeepaliveTimeout, :"tx_id" => TxId}) #: Hash[::Symbol, Attribute]
222
237
  # :nodoc:
223
- BY_TYPE = Ractor.make_shareable({1 => Id, 2 => RemoteIpv4, 3 => RemoteIpv6, 4 => RemoteIpv6ScopeId, 5 => RemotePort, 6 => Socket, 8 => VpnIpv4, 9 => VpnIpv6, 10 => LocalIpv4, 11 => LocalIpv6, 13 => KeepaliveInterval, 14 => KeepaliveTimeout}) #: Hash[::Integer, Attribute]
238
+ BY_TYPE = Ractor.make_shareable({1 => Id, 2 => RemoteIpv4, 3 => RemoteIpv6, 4 => RemoteIpv6ScopeId, 5 => RemotePort, 6 => Socket, 8 => VpnIpv4, 9 => VpnIpv6, 10 => LocalIpv4, 11 => LocalIpv6, 13 => KeepaliveInterval, 14 => KeepaliveTimeout, 24 => TxId}) #: Hash[::Integer, Attribute]
224
239
  class << self
225
240
  # Looks up Attribute class by name.
226
241
  #--
@@ -286,17 +301,22 @@ class Ovpn < ::Nl::Family
286
301
  class KeepaliveInterval < Attribute
287
302
  TYPE = 13
288
303
  NAME = :"keepalive_interval"
289
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
304
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is greater than maximum 86400" unless it <= 86400 })
290
305
  end
291
306
  class KeepaliveTimeout < Attribute
292
307
  TYPE = 14
293
308
  NAME = :"keepalive_timeout"
294
- DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
309
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is greater than maximum 86400" unless it <= 86400 })
310
+ end
311
+ class TxId < Attribute
312
+ TYPE = 24
313
+ NAME = :"tx_id"
314
+ DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: -> { raise ArgumentError, "Value #{it.inspect} is greater than maximum 16777215" unless it <= 16777215 })
295
315
  end
296
316
  # :nodoc:
297
- BY_NAME = Ractor.make_shareable({:"id" => Id, :"remote_ipv4" => RemoteIpv4, :"remote_ipv6" => RemoteIpv6, :"remote_ipv6_scope_id" => RemoteIpv6ScopeId, :"remote_port" => RemotePort, :"vpn_ipv4" => VpnIpv4, :"vpn_ipv6" => VpnIpv6, :"local_ipv4" => LocalIpv4, :"local_ipv6" => LocalIpv6, :"keepalive_interval" => KeepaliveInterval, :"keepalive_timeout" => KeepaliveTimeout}) #: Hash[::Symbol, Attribute]
317
+ BY_NAME = Ractor.make_shareable({:"id" => Id, :"remote_ipv4" => RemoteIpv4, :"remote_ipv6" => RemoteIpv6, :"remote_ipv6_scope_id" => RemoteIpv6ScopeId, :"remote_port" => RemotePort, :"vpn_ipv4" => VpnIpv4, :"vpn_ipv6" => VpnIpv6, :"local_ipv4" => LocalIpv4, :"local_ipv6" => LocalIpv6, :"keepalive_interval" => KeepaliveInterval, :"keepalive_timeout" => KeepaliveTimeout, :"tx_id" => TxId}) #: Hash[::Symbol, Attribute]
298
318
  # :nodoc:
299
- BY_TYPE = Ractor.make_shareable({1 => Id, 2 => RemoteIpv4, 3 => RemoteIpv6, 4 => RemoteIpv6ScopeId, 5 => RemotePort, 8 => VpnIpv4, 9 => VpnIpv6, 10 => LocalIpv4, 11 => LocalIpv6, 13 => KeepaliveInterval, 14 => KeepaliveTimeout}) #: Hash[::Integer, Attribute]
319
+ BY_TYPE = Ractor.make_shareable({1 => Id, 2 => RemoteIpv4, 3 => RemoteIpv6, 4 => RemoteIpv6ScopeId, 5 => RemotePort, 8 => VpnIpv4, 9 => VpnIpv6, 10 => LocalIpv4, 11 => LocalIpv6, 13 => KeepaliveInterval, 14 => KeepaliveTimeout, 24 => TxId}) #: Hash[::Integer, Attribute]
300
320
  class << self
301
321
  # Looks up Attribute class by name.
302
322
  #--
@@ -741,6 +761,8 @@ class Ovpn < ::Nl::Family
741
761
  end
742
762
  module Messages
743
763
  # Add a remote peer
764
+ #
765
+ # Requires CAP_NET_ADMIN in the initial user namespace.
744
766
  class DoPeerNewRequest < ::Nl::Protocols::Genl::Message
745
767
  TYPE = 1
746
768
  FIXED_HEADER = nil
@@ -756,6 +778,8 @@ class Ovpn < ::Nl::Family
756
778
  def peer; attributes[:"peer"]&.value; end
757
779
  end
758
780
  # modify a remote peer
781
+ #
782
+ # Requires CAP_NET_ADMIN in the initial user namespace.
759
783
  class DoPeerSetRequest < ::Nl::Protocols::Genl::Message
760
784
  TYPE = 2
761
785
  FIXED_HEADER = nil
@@ -771,6 +795,8 @@ class Ovpn < ::Nl::Family
771
795
  def peer; attributes[:"peer"]&.value; end
772
796
  end
773
797
  # Retrieve data about existing remote peers (or a specific one)
798
+ #
799
+ # Requires CAP_NET_ADMIN in the initial user namespace.
774
800
  class DoPeerGetRequest < ::Nl::Protocols::Genl::Message
775
801
  TYPE = 3
776
802
  FIXED_HEADER = nil
@@ -786,6 +812,8 @@ class Ovpn < ::Nl::Family
786
812
  def peer; attributes[:"peer"]&.value; end
787
813
  end
788
814
  # Retrieve data about existing remote peers (or a specific one)
815
+ #
816
+ # Requires CAP_NET_ADMIN in the initial user namespace.
789
817
  class DoPeerGetReply < ::Nl::Protocols::Genl::Message
790
818
  TYPE = 3
791
819
  FIXED_HEADER = nil
@@ -797,6 +825,8 @@ class Ovpn < ::Nl::Family
797
825
  def peer; attributes[:"peer"]&.value; end
798
826
  end
799
827
  # Retrieve data about existing remote peers (or a specific one)
828
+ #
829
+ # Requires CAP_NET_ADMIN in the initial user namespace.
800
830
  class DumpPeerGetRequest < ::Nl::Protocols::Genl::Message
801
831
  TYPE = 3
802
832
  FIXED_HEADER = nil
@@ -808,6 +838,8 @@ class Ovpn < ::Nl::Family
808
838
  def ifindex; attributes[:"ifindex"]&.value; end
809
839
  end
810
840
  # Retrieve data about existing remote peers (or a specific one)
841
+ #
842
+ # Requires CAP_NET_ADMIN in the initial user namespace.
811
843
  class DumpPeerGetReply < ::Nl::Protocols::Genl::Message
812
844
  TYPE = 3
813
845
  FIXED_HEADER = nil
@@ -819,6 +851,8 @@ class Ovpn < ::Nl::Family
819
851
  def peer; attributes[:"peer"]&.value; end
820
852
  end
821
853
  # Delete existing remote peer
854
+ #
855
+ # Requires CAP_NET_ADMIN in the initial user namespace.
822
856
  class DoPeerDelRequest < ::Nl::Protocols::Genl::Message
823
857
  TYPE = 4
824
858
  FIXED_HEADER = nil
@@ -834,6 +868,8 @@ class Ovpn < ::Nl::Family
834
868
  def peer; attributes[:"peer"]&.value; end
835
869
  end
836
870
  # Add a cipher key for a specific peer
871
+ #
872
+ # Requires CAP_NET_ADMIN in the initial user namespace.
837
873
  class DoKeyNewRequest < ::Nl::Protocols::Genl::Message
838
874
  TYPE = 6
839
875
  FIXED_HEADER = nil
@@ -849,6 +885,8 @@ class Ovpn < ::Nl::Family
849
885
  def keyconf; attributes[:"keyconf"]&.value; end
850
886
  end
851
887
  # Retrieve non-sensitive data about peer key and cipher
888
+ #
889
+ # Requires CAP_NET_ADMIN in the initial user namespace.
852
890
  class DoKeyGetRequest < ::Nl::Protocols::Genl::Message
853
891
  TYPE = 7
854
892
  FIXED_HEADER = nil
@@ -864,6 +902,8 @@ class Ovpn < ::Nl::Family
864
902
  def keyconf; attributes[:"keyconf"]&.value; end
865
903
  end
866
904
  # Retrieve non-sensitive data about peer key and cipher
905
+ #
906
+ # Requires CAP_NET_ADMIN in the initial user namespace.
867
907
  class DoKeyGetReply < ::Nl::Protocols::Genl::Message
868
908
  TYPE = 7
869
909
  FIXED_HEADER = nil
@@ -875,6 +915,8 @@ class Ovpn < ::Nl::Family
875
915
  def keyconf; attributes[:"keyconf"]&.value; end
876
916
  end
877
917
  # Swap primary and secondary session keys for a specific peer
918
+ #
919
+ # Requires CAP_NET_ADMIN in the initial user namespace.
878
920
  class DoKeySwapRequest < ::Nl::Protocols::Genl::Message
879
921
  TYPE = 8
880
922
  FIXED_HEADER = nil
@@ -890,6 +932,8 @@ class Ovpn < ::Nl::Family
890
932
  def keyconf; attributes[:"keyconf"]&.value; end
891
933
  end
892
934
  # Delete cipher key for a specific peer
935
+ #
936
+ # Requires CAP_NET_ADMIN in the initial user namespace.
893
937
  class DoKeyDelRequest < ::Nl::Protocols::Genl::Message
894
938
  TYPE = 10
895
939
  FIXED_HEADER = nil
@@ -905,25 +949,75 @@ class Ovpn < ::Nl::Family
905
949
  def keyconf; attributes[:"keyconf"]&.value; end
906
950
  end
907
951
  end
952
+ module Notifications
953
+ # Notification about a peer being deleted
954
+ #
955
+ # Multicast group: `peers`.
956
+ class PeerDelNtf < ::Nl::Protocols::Genl::Message
957
+ TYPE = 5
958
+ FIXED_HEADER = nil
959
+ ATTRIBUTE_SET = AttributeSets::Ovpn
960
+ ATTRIBUTES = Ractor.make_shareable(%i[peer])
961
+ # Gets the value of `peer` attribute in the message.
962
+ #--
963
+ # @rbs return: AttributeSets::Peer
964
+ def peer; attributes[:"peer"]&.value; end
965
+ end
966
+ # Notification about key having exhausted its IV space and requiring renegotiation
967
+ #
968
+ # Multicast group: `peers`.
969
+ class KeySwapNtf < ::Nl::Protocols::Genl::Message
970
+ TYPE = 9
971
+ FIXED_HEADER = nil
972
+ ATTRIBUTE_SET = AttributeSets::OvpnKeyconfGet
973
+ ATTRIBUTES = Ractor.make_shareable(%i[keyconf])
974
+ # Gets the value of `keyconf` attribute in the message.
975
+ #--
976
+ # @rbs return: AttributeSets::Keyconf
977
+ def keyconf; attributes[:"keyconf"]&.value; end
978
+ end
979
+ # Notification about a peer floating (changing its remote UDP endpoint)
980
+ #
981
+ # Multicast group: `peers`.
982
+ class PeerFloatNtf < ::Nl::Protocols::Genl::Message
983
+ TYPE = 11
984
+ FIXED_HEADER = nil
985
+ ATTRIBUTE_SET = AttributeSets::Ovpn
986
+ ATTRIBUTES = Ractor.make_shareable(%i[peer])
987
+ # Gets the value of `peer` attribute in the message.
988
+ #--
989
+ # @rbs return: AttributeSets::Peer
990
+ def peer; attributes[:"peer"]&.value; end
991
+ end
992
+ end
993
+ NOTIFICATIONS = Ractor.make_shareable({5 => Notifications::PeerDelNtf, 9 => Notifications::KeySwapNtf, 11 => Notifications::PeerFloatNtf}) #: Hash[::Integer, ::Class]
908
994
  # Add a remote peer
995
+ #
996
+ # Requires CAP_NET_ADMIN in the initial user namespace.
909
997
  #--
910
998
  # @rbs (?ifindex: ::Integer, ?peer: AttributeSets::Peer) -> void
911
999
  def do_peer_new(**args)
912
1000
  exchange_message(:"do", Messages::DoPeerNewRequest, nil, args)
913
1001
  end
914
1002
  # modify a remote peer
1003
+ #
1004
+ # Requires CAP_NET_ADMIN in the initial user namespace.
915
1005
  #--
916
1006
  # @rbs (?ifindex: ::Integer, ?peer: AttributeSets::Peer) -> void
917
1007
  def do_peer_set(**args)
918
1008
  exchange_message(:"do", Messages::DoPeerSetRequest, nil, args)
919
1009
  end
920
1010
  # Retrieve data about existing remote peers (or a specific one)
1011
+ #
1012
+ # Requires CAP_NET_ADMIN in the initial user namespace.
921
1013
  #--
922
1014
  # @rbs (?ifindex: ::Integer, ?peer: AttributeSets::Peer) -> Messages::DoPeerGetReply
923
1015
  def do_peer_get(**args)
924
1016
  exchange_message(:"do", Messages::DoPeerGetRequest, Messages::DoPeerGetReply, args)
925
1017
  end
926
1018
  # Retrieve data about existing remote peers (or a specific one)
1019
+ #
1020
+ # Requires CAP_NET_ADMIN in the initial user namespace.
927
1021
  #--
928
1022
  # @rbs (?ifindex: ::Integer) -> Enumerable[Messages::DumpPeerGetReply]
929
1023
  # | (?ifindex: ::Integer) { (Messages::DumpPeerGetReply) -> void } -> void
@@ -931,34 +1025,135 @@ class Ovpn < ::Nl::Family
931
1025
  exchange_message(:"dump", Messages::DumpPeerGetRequest, Messages::DumpPeerGetReply, args, &block)
932
1026
  end
933
1027
  # Delete existing remote peer
1028
+ #
1029
+ # Requires CAP_NET_ADMIN in the initial user namespace.
934
1030
  #--
935
1031
  # @rbs (?ifindex: ::Integer, ?peer: AttributeSets::Peer) -> void
936
1032
  def do_peer_del(**args)
937
1033
  exchange_message(:"do", Messages::DoPeerDelRequest, nil, args)
938
1034
  end
939
1035
  # Add a cipher key for a specific peer
1036
+ #
1037
+ # Requires CAP_NET_ADMIN in the initial user namespace.
940
1038
  #--
941
1039
  # @rbs (?ifindex: ::Integer, ?keyconf: AttributeSets::Keyconf) -> void
942
1040
  def do_key_new(**args)
943
1041
  exchange_message(:"do", Messages::DoKeyNewRequest, nil, args)
944
1042
  end
945
1043
  # Retrieve non-sensitive data about peer key and cipher
1044
+ #
1045
+ # Requires CAP_NET_ADMIN in the initial user namespace.
946
1046
  #--
947
1047
  # @rbs (?ifindex: ::Integer, ?keyconf: AttributeSets::Keyconf) -> Messages::DoKeyGetReply
948
1048
  def do_key_get(**args)
949
1049
  exchange_message(:"do", Messages::DoKeyGetRequest, Messages::DoKeyGetReply, args)
950
1050
  end
951
1051
  # Swap primary and secondary session keys for a specific peer
1052
+ #
1053
+ # Requires CAP_NET_ADMIN in the initial user namespace.
952
1054
  #--
953
1055
  # @rbs (?ifindex: ::Integer, ?keyconf: AttributeSets::Keyconf) -> void
954
1056
  def do_key_swap(**args)
955
1057
  exchange_message(:"do", Messages::DoKeySwapRequest, nil, args)
956
1058
  end
957
1059
  # Delete cipher key for a specific peer
1060
+ #
1061
+ # Requires CAP_NET_ADMIN in the initial user namespace.
958
1062
  #--
959
1063
  # @rbs (?ifindex: ::Integer, ?keyconf: AttributeSets::Keyconf) -> void
960
1064
  def do_key_del(**args)
961
1065
  exchange_message(:"do", Messages::DoKeyDelRequest, nil, args)
962
1066
  end
1067
+ class AsyncOperations
1068
+ # :nodoc:
1069
+ def initialize(&exchange)
1070
+ @exchange = exchange
1071
+ end
1072
+ # Add a remote peer
1073
+ #
1074
+ # Requires CAP_NET_ADMIN in the initial user namespace.
1075
+ #--
1076
+ # @rbs (?ifindex: ::Integer, ?peer: AttributeSets::Peer) -> ::Nl::Async::Future[void]
1077
+ def do_peer_new(**args)
1078
+ @exchange.call(:"do", Messages::DoPeerNewRequest, nil, args)
1079
+ end
1080
+ # modify a remote peer
1081
+ #
1082
+ # Requires CAP_NET_ADMIN in the initial user namespace.
1083
+ #--
1084
+ # @rbs (?ifindex: ::Integer, ?peer: AttributeSets::Peer) -> ::Nl::Async::Future[void]
1085
+ def do_peer_set(**args)
1086
+ @exchange.call(:"do", Messages::DoPeerSetRequest, nil, args)
1087
+ end
1088
+ # Retrieve data about existing remote peers (or a specific one)
1089
+ #
1090
+ # Requires CAP_NET_ADMIN in the initial user namespace.
1091
+ #--
1092
+ # @rbs (?ifindex: ::Integer, ?peer: AttributeSets::Peer) -> ::Nl::Async::Future[Messages::DoPeerGetReply]
1093
+ def do_peer_get(**args)
1094
+ @exchange.call(:"do", Messages::DoPeerGetRequest, Messages::DoPeerGetReply, args)
1095
+ end
1096
+ # Retrieve data about existing remote peers (or a specific one)
1097
+ #
1098
+ # Requires CAP_NET_ADMIN in the initial user namespace.
1099
+ #--
1100
+ # @rbs (?ifindex: ::Integer) -> ::Nl::Async::Stream[Messages::DumpPeerGetReply]
1101
+ def dump_peer_get(**args)
1102
+ @exchange.call(:"dump", Messages::DumpPeerGetRequest, Messages::DumpPeerGetReply, args)
1103
+ end
1104
+ # Delete existing remote peer
1105
+ #
1106
+ # Requires CAP_NET_ADMIN in the initial user namespace.
1107
+ #--
1108
+ # @rbs (?ifindex: ::Integer, ?peer: AttributeSets::Peer) -> ::Nl::Async::Future[void]
1109
+ def do_peer_del(**args)
1110
+ @exchange.call(:"do", Messages::DoPeerDelRequest, nil, args)
1111
+ end
1112
+ # Add a cipher key for a specific peer
1113
+ #
1114
+ # Requires CAP_NET_ADMIN in the initial user namespace.
1115
+ #--
1116
+ # @rbs (?ifindex: ::Integer, ?keyconf: AttributeSets::Keyconf) -> ::Nl::Async::Future[void]
1117
+ def do_key_new(**args)
1118
+ @exchange.call(:"do", Messages::DoKeyNewRequest, nil, args)
1119
+ end
1120
+ # Retrieve non-sensitive data about peer key and cipher
1121
+ #
1122
+ # Requires CAP_NET_ADMIN in the initial user namespace.
1123
+ #--
1124
+ # @rbs (?ifindex: ::Integer, ?keyconf: AttributeSets::Keyconf) -> ::Nl::Async::Future[Messages::DoKeyGetReply]
1125
+ def do_key_get(**args)
1126
+ @exchange.call(:"do", Messages::DoKeyGetRequest, Messages::DoKeyGetReply, args)
1127
+ end
1128
+ # Swap primary and secondary session keys for a specific peer
1129
+ #
1130
+ # Requires CAP_NET_ADMIN in the initial user namespace.
1131
+ #--
1132
+ # @rbs (?ifindex: ::Integer, ?keyconf: AttributeSets::Keyconf) -> ::Nl::Async::Future[void]
1133
+ def do_key_swap(**args)
1134
+ @exchange.call(:"do", Messages::DoKeySwapRequest, nil, args)
1135
+ end
1136
+ # Delete cipher key for a specific peer
1137
+ #
1138
+ # Requires CAP_NET_ADMIN in the initial user namespace.
1139
+ #--
1140
+ # @rbs (?ifindex: ::Integer, ?keyconf: AttributeSets::Keyconf) -> ::Nl::Async::Future[void]
1141
+ def do_key_del(**args)
1142
+ @exchange.call(:"do", Messages::DoKeyDelRequest, nil, args)
1143
+ end
1144
+ end
1145
+ # Returns the asynchronous operation facade for this family.
1146
+ #--
1147
+ # @rbs (?stream_capacity: ::Integer?) -> AsyncOperations
1148
+ def async(stream_capacity: nil)
1149
+ return @async_operations ||= build_async_facade(AsyncOperations) if stream_capacity.nil?
1150
+ build_async_facade(AsyncOperations, stream_capacity:)
1151
+ end
1152
+ #--
1153
+ # @rbs (*(:peers) groups) -> self
1154
+ def subscribe(*groups) = super
1155
+ #--
1156
+ # @rbs (*(:peers) groups) -> self
1157
+ def unsubscribe(*groups) = super
963
1158
  end
964
1159
  end; end
@@ -1,4 +1,6 @@
1
1
  # SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
2
+ #
3
+ # This file is based on Documentation/netlink/specs/ovs_datapath.yaml from Linux v7.2.
2
4
  #--
3
5
  # frozen_string_literal: true
4
6
  # rbs_inline: enabled
@@ -9,6 +11,7 @@ module Nl; module Linux
9
11
  class OvsDatapath < ::Nl::Family
10
12
  NAME = "ovs_datapath"
11
13
  PROTOCOL = Ractor.make_shareable(::Nl::Protocols::Genl.new("ovs_datapath"))
14
+ MCAST_GROUPS = Ractor.make_shareable({:"ovs_datapath" => ::Nl::McastGroup.new("ovs_datapath", nil)}) #: Hash[::Symbol, ::Nl::McastGroup]
12
15
  module Structs
13
16
  OvsHeader = Struct.new(
14
17
  :"dp_ifindex", #: ::Integer
@@ -112,24 +115,24 @@ class OvsDatapath < ::Nl::Family
112
115
  DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
113
116
  end
114
117
  class MasksCacheSize < Attribute
115
- TYPE = 6
118
+ TYPE = 7
116
119
  NAME = :"masks_cache_size"
117
120
  DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
118
121
  end
119
122
  class PerCpuPids < Attribute
120
- TYPE = 7
123
+ TYPE = 8
121
124
  NAME = :"per_cpu_pids"
122
125
  DATATYPE = ::Nl::Protocols::Genl::DataTypes::Binary.new(check: nil)
123
126
  end
124
127
  class Ifindex < Attribute
125
- TYPE = 8
128
+ TYPE = 9
126
129
  NAME = :"ifindex"
127
130
  DATATYPE = ::Nl::Protocols::Genl::DataTypes::Scalar.new(::Nl::Endian::Host::U32, check: nil)
128
131
  end
129
132
  # :nodoc:
130
133
  BY_NAME = Ractor.make_shareable({:"name" => Name, :"upcall_pid" => UpcallPid, :"stats" => Stats, :"megaflow_stats" => MegaflowStats, :"user_features" => UserFeatures, :"masks_cache_size" => MasksCacheSize, :"per_cpu_pids" => PerCpuPids, :"ifindex" => Ifindex}) #: Hash[::Symbol, Attribute]
131
134
  # :nodoc:
132
- BY_TYPE = Ractor.make_shareable({1 => Name, 2 => UpcallPid, 3 => Stats, 4 => MegaflowStats, 5 => UserFeatures, 6 => MasksCacheSize, 7 => PerCpuPids, 8 => Ifindex}) #: Hash[::Integer, Attribute]
135
+ BY_TYPE = Ractor.make_shareable({1 => Name, 2 => UpcallPid, 3 => Stats, 4 => MegaflowStats, 5 => UserFeatures, 7 => MasksCacheSize, 8 => PerCpuPids, 9 => Ifindex}) #: Hash[::Integer, Attribute]
133
136
  class << self
134
137
  # Looks up Attribute class by name.
135
138
  #--
@@ -180,11 +183,11 @@ class OvsDatapath < ::Nl::Family
180
183
  def upcall_pid; attributes[:"upcall_pid"]&.value; end
181
184
  # Gets the value of `stats` attribute in the message.
182
185
  #--
183
- # @rbs return: untyped
186
+ # @rbs return: ::String
184
187
  def stats; attributes[:"stats"]&.value; end
185
188
  # Gets the value of `megaflow-stats` attribute in the message.
186
189
  #--
187
- # @rbs return: untyped
190
+ # @rbs return: ::String
188
191
  def megaflow_stats; attributes[:"megaflow_stats"]&.value; end
189
192
  # Gets the value of `user-features` attribute in the message.
190
193
  #--
@@ -196,7 +199,7 @@ class OvsDatapath < ::Nl::Family
196
199
  def masks_cache_size; attributes[:"masks_cache_size"]&.value; end
197
200
  # Gets the value of `per-cpu-pids` attribute in the message.
198
201
  #--
199
- # @rbs return: untyped
202
+ # @rbs return: ::String
200
203
  def per_cpu_pids; attributes[:"per_cpu_pids"]&.value; end
201
204
  end
202
205
  # Get / dump OVS data path configuration and state
@@ -234,11 +237,11 @@ class OvsDatapath < ::Nl::Family
234
237
  def upcall_pid; attributes[:"upcall_pid"]&.value; end
235
238
  # Gets the value of `stats` attribute in the message.
236
239
  #--
237
- # @rbs return: untyped
240
+ # @rbs return: ::String
238
241
  def stats; attributes[:"stats"]&.value; end
239
242
  # Gets the value of `megaflow-stats` attribute in the message.
240
243
  #--
241
- # @rbs return: untyped
244
+ # @rbs return: ::String
242
245
  def megaflow_stats; attributes[:"megaflow_stats"]&.value; end
243
246
  # Gets the value of `user-features` attribute in the message.
244
247
  #--
@@ -250,7 +253,7 @@ class OvsDatapath < ::Nl::Family
250
253
  def masks_cache_size; attributes[:"masks_cache_size"]&.value; end
251
254
  # Gets the value of `per-cpu-pids` attribute in the message.
252
255
  #--
253
- # @rbs return: untyped
256
+ # @rbs return: ::String
254
257
  def per_cpu_pids; attributes[:"per_cpu_pids"]&.value; end
255
258
  end
256
259
  # Create new OVS data path
@@ -292,6 +295,9 @@ class OvsDatapath < ::Nl::Family
292
295
  def name; attributes[:"name"]&.value; end
293
296
  end
294
297
  end
298
+ module Notifications
299
+ end
300
+ NOTIFICATIONS = Ractor.make_shareable({}) #: Hash[::Integer, ::Class]
295
301
  # Get / dump OVS data path configuration and state
296
302
  #--
297
303
  # @rbs (?dp_ifindex: ::Integer, ?name: ::String) -> Messages::DoGetReply
@@ -317,5 +323,48 @@ class OvsDatapath < ::Nl::Family
317
323
  def do_del(**args)
318
324
  exchange_message(:"do", Messages::DoDelRequest, nil, args)
319
325
  end
326
+ class AsyncOperations
327
+ # :nodoc:
328
+ def initialize(&exchange)
329
+ @exchange = exchange
330
+ end
331
+ # Get / dump OVS data path configuration and state
332
+ #--
333
+ # @rbs (?dp_ifindex: ::Integer, ?name: ::String) -> ::Nl::Async::Future[Messages::DoGetReply]
334
+ def do_get(**args)
335
+ @exchange.call(:"do", Messages::DoGetRequest, Messages::DoGetReply, args)
336
+ end
337
+ # Get / dump OVS data path configuration and state
338
+ #--
339
+ # @rbs (?dp_ifindex: ::Integer, ?name: ::String) -> ::Nl::Async::Stream[Messages::DumpGetReply]
340
+ def dump_get(**args)
341
+ @exchange.call(:"dump", Messages::DumpGetRequest, Messages::DumpGetReply, args)
342
+ end
343
+ # Create new OVS data path
344
+ #--
345
+ # @rbs (?dp_ifindex: ::Integer, ?name: ::String, ?upcall_pid: ::Integer, ?user_features: ::Integer) -> ::Nl::Async::Future[void]
346
+ def do_new(**args)
347
+ @exchange.call(:"do", Messages::DoNewRequest, nil, args)
348
+ end
349
+ # Delete existing OVS data path
350
+ #--
351
+ # @rbs (?dp_ifindex: ::Integer, ?name: ::String) -> ::Nl::Async::Future[void]
352
+ def do_del(**args)
353
+ @exchange.call(:"do", Messages::DoDelRequest, nil, args)
354
+ end
355
+ end
356
+ # Returns the asynchronous operation facade for this family.
357
+ #--
358
+ # @rbs (?stream_capacity: ::Integer?) -> AsyncOperations
359
+ def async(stream_capacity: nil)
360
+ return @async_operations ||= build_async_facade(AsyncOperations) if stream_capacity.nil?
361
+ build_async_facade(AsyncOperations, stream_capacity:)
362
+ end
363
+ #--
364
+ # @rbs (*(:ovs_datapath) groups) -> self
365
+ def subscribe(*groups) = super
366
+ #--
367
+ # @rbs (*(:ovs_datapath) groups) -> self
368
+ def unsubscribe(*groups) = super
320
369
  end
321
370
  end; end