Class: DHCP::SubnetMaskOption

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

Overview

The subnet mask option specifies the client’s subnet mask as per RFC 950 [5].

If both the subnet mask and the router option are specified in a DHCP reply, the subnet mask option MUST be first.

The code for the subnet mask option is 1, and its length is 4 octets.

The default value for this option is 255.255.255.255

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 = {}) ⇒ SubnetMaskOption

Returns a new instance of SubnetMaskOption.



84
85
86
87
88
# File 'lib/net/dhcp/options.rb', line 84

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

Instance Method Details

#to_sObject



90
91
92
# File 'lib/net/dhcp/options.rb', line 90

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