5.7.3. vlcp.utils.dhcp


This document is generated from the source file.

View Source on GitHub

Created on 2016/6/22


See https://tools.ietf.org/html/rfc2131 https://tools.ietf.org/html/rfc2132

vlcp.utils.dhcp.build_options(payload, options, maxsize=576, overload=3, allowpartial=True)

Split a list of options

This is the reverse operation of reassemble_options, it splits dhcp_option into dhcp_option_partial if necessary, and set overload option if field overloading is used.

  • options – a list of dhcp_option
  • maxsize

    Limit the maximum DHCP message size. If options cannot fit into the DHCP message, specified fields are overloaded for options. If options cannot fit after overloading, extra options are DROPPED if allowpartial = True.

    It is important to sort the dhcp options by priority.

  • overload – fields that are allowed to be overloaded
  • allowpartial – When options cannot fit into the DHCP message, allow the rest options to be dropped.

Number of options that are dropped i.e. options[:-return_value] are dropped

vlcp.utils.dhcp.create_dhcp_options(input_dict, ignoreError=False, generateNone=False)

Try best to create dhcp_options from human friendly values, ignoring invalid values

vlcp.utils.dhcp.create_option_from_value(tag, value)

Set DHCP option with human friendly value


Reassemble partial options to options, returns a list of dhcp_option

DHCP options are basically |tag|length|value| structure. When an option is longer than 255 bytes, it can be splitted into multiple structures with the same tag. The splitted structures must be joined back to get the original option.

dhcp_option_partial is used to present the splitted options, and dhcp_option is used for reassembled option.