diff --git a/lib/net-dhcp/version.rb b/lib/net-dhcp/version.rb index 16f44c9..d945471 100644 --- a/lib/net-dhcp/version.rb +++ b/lib/net-dhcp/version.rb @@ -1,5 +1,5 @@ module Net module Dhcp - VERSION = "1.3.2" + VERSION = "1.3.3" end end diff --git a/lib/net/dhcp/constants.rb b/lib/net/dhcp/constants.rb index 353b183..256c18f 100644 --- a/lib/net/dhcp/constants.rb +++ b/lib/net/dhcp/constants.rb @@ -148,8 +148,8 @@ $DHCP_CLIENTFQDN= 0x51 #rfc4702 -$DHCP_CLIENTARCH= 0x5d #rfc4578 -$DHCP_CLIENTARCH_I386= 0x0000 +$DHCP_CLIENTARCH= 0x5d #rfc4578 +$DHCP_CLIENTARCH_I386= 0x0000 $DHCP_CLIENTARCH_PC98= 0x0001 $DHCP_CLIENTARCH_ITANIUM= 0x0002 $DHCP_CLIENTARCH_ALPHA= 0x0003 @@ -172,11 +172,11 @@ 'EFI x86-64', ] -$DHCP_CLIENTNDI= 0x5e #rfc4578 -#$DHCP_LDAP= 0x5f -$DHCP_UUIDGUID= 0x61 #rfc4578 - -$DHCP_AUTOCONF= 0x74 #rfc2563 -$DHCP_AUTOCONF_NO= 0x00 #rfc2563 -$DHCP_AUTOCONF_YES= 0x01 #rfc2563 +$DHCP_CLIENTNDI= 0x5e #rfc4578 +#$DHCP_LDAP= 0x5f +$DHCP_UUIDGUID= 0x61 #rfc4578 +$DHCP_AUTOCONF= 0x74 #rfc2563 +$DHCP_SUBNET_SELECTION= 0x76 #rfc3011 +$DHCP_AUTOCONF_NO= 0x00 #rfc2563 +$DHCP_AUTOCONF_YES= 0x01 #rfc2563 diff --git a/lib/net/dhcp/options.rb b/lib/net/dhcp/options.rb index b9c080d..9475bec 100644 --- a/lib/net/dhcp/options.rb +++ b/lib/net/dhcp/options.rb @@ -555,6 +555,33 @@ def to_s end end + # 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. + # + class SubnetSelectionOption < Option + def initialize(params={}) + params[:type] = $DHCP_SUBNET_SELECTION + params[:payload] = params.fetch(:payload) + super(params) + end + + def to_s() + "Subnet Selection = #{self.payload.join('.')}" + end + end + $DHCP_MSG_OPTIONS = { $DHCP_SUBNETMASK => SubnetMaskOption, $DHCP_TIMEOFFSET => Option, @@ -638,7 +665,7 @@ def to_s $DHCP_LDAP => Option, $DHCP_UUIDGUID => UUIDGUIDOption, $DHCP_AUTOCONF => AutoConfigurationOption, - + $DHCP_SUBNET_SELECTION => SubnetSelectionOption, } end