Class: DHCP::SubnetSelectionOption

Inherits:
Option
  • Object
show all
Defined in:
lib/net/dhcp/options.rb

Overview

The subnet selection option is a DHCP option. The option contains a single IPv4 address that is the address of a subnet. The value for the subnet address is determined by taking any IPv4 address on the subnet and ANDing that address with the subnet mask (i.e.: the network and subnet bits are left alone and the remaining (address) bits are set to zero). When the DHCP server is configured to respond to this option, is allocating an address, and this option is present then the DHCP server MUST allocate the address on either:

- the subnet specified in the subnet selection option, or;

- a subnet on the same network segment as the subnet specified in the
        subnet selection option.

The code for this option is 118, and its length is 4.

Instance Attribute Summary

Attributes inherited from Option

#len, #payload, #type

Instance Method Summary collapse

Methods inherited from Option

#eql?, #pack, #to_a

Constructor Details

#initialize(params = {}) ⇒ SubnetSelectionOption



574
575
576
577
578
# File 'lib/net/dhcp/options.rb', line 574

def initialize(params={})
  params[:type] =  $DHCP_SUBNET_SELECTION
  params[:payload] = params.fetch(:payload)
  super(params)
end

Instance Method Details

#to_sObject



580
581
582
# File 'lib/net/dhcp/options.rb', line 580

def to_s()
  "Subnet Selection = #{self.payload.join('.')}"
end