Class: Nl::Linux::Wireguard::Messages::DoSetDeviceRequest

Inherits:
Genl::Message show all
Defined in:
nl-linux/generated/nl/linux/wireguard.rb

Overview

Set WireGuard device


This command should be called with a wgdevice set, containing one but
not both of ``WGDEVICE_A_IFINDEX`` and ``WGDEVICE_A_IFNAME``.

It is possible that the amount of configuration data exceeds that of the
maximum message length accepted by the kernel. In that case, several
messages should be sent one after another, with each successive one
filling in information not contained in the prior. Note that if
``WGDEVICE_F_REPLACE_PEERS`` is specified in the first message, it
probably should not be specified in fragments that come after, so that
the list of peers is only cleared the first time but appended after.
Likewise for peers, if ``WGPEER_F_REPLACE_ALLOWEDIPS`` is specified in
the first message of a peer, it likely should not be specified in
subsequent fragments.

If an error occurs, ``NLMSG_ERROR`` will reply containing an errno.


Requires CAP_NET_ADMIN in the user namespace owning the network namespace.

Constant Summary collapse

TYPE =
1
FIXED_HEADER =
nil
ATTRIBUTE_SET =
AttributeSets::Wgdevice
ATTRIBUTES =
Ractor.make_shareable(%i[ifindex ifname private_key public_key flags listen_port fwmark peers])

Instance Attribute Summary

Attributes included from StructuredPayload

#attributes, #fixed_header

Instance Method Summary collapse

Methods inherited from Genl::Message

decode

Methods inherited from Raw::Message

#append_attribute, decode, #initialize

Methods included from StructuredPayload

#encode, #initialize

Constructor Details

This class inherits a constructor from Nl::Raw::Message

Instance Method Details

#flags ⇒ Integer

0 or WGDEVICE_F_REPLACE_PEERS if all current peers should be removed prior to adding the list below.

Known flags are defined in Flags::WgdeviceFlags.

Returns:

  • (Integer)

See Also:



657
# File 'nl-linux/generated/nl/linux/wireguard.rb', line 657

def flags; attributes[:"flags"]&.value; end

#fwmark ⇒ Integer

Set as 0 to disable.

Returns:

  • (Integer)

See Also:



667
# File 'nl-linux/generated/nl/linux/wireguard.rb', line 667

def fwmark; attributes[:"fwmark"]&.value; end

#ifindex ⇒ Integer

Returns:

  • (Integer)

See Also:



635
# File 'nl-linux/generated/nl/linux/wireguard.rb', line 635

def ifindex; attributes[:"ifindex"]&.value; end

#ifname ⇒ String

Returns:

  • (String)

See Also:



639
# File 'nl-linux/generated/nl/linux/wireguard.rb', line 639

def ifname; attributes[:"ifname"]&.value; end

#listen_port ⇒ Integer

Set as 0 to choose randomly.

Returns:

  • (Integer)

See Also:



662
# File 'nl-linux/generated/nl/linux/wireguard.rb', line 662

def listen_port; attributes[:"listen_port"]&.value; end

#peers ⇒ Array<AttributeSets::Wgpeer>

The index/type parameter is unused on SET_DEVICE operations and is zero on GET_DEVICE operations.



673
# File 'nl-linux/generated/nl/linux/wireguard.rb', line 673

def peers; attributes[:"peers"]&.value; end

#private_key ⇒ String

Set to all zeros to remove.

Returns:

  • (String)

See Also:



644
# File 'nl-linux/generated/nl/linux/wireguard.rb', line 644

def private_key; attributes[:"private_key"]&.value; end

#public_key ⇒ String

Returns:

  • (String)

See Also:



648
# File 'nl-linux/generated/nl/linux/wireguard.rb', line 648

def public_key; attributes[:"public_key"]&.value; end