Skip to content

Commit

Permalink
some refactoring, some docs
Browse files Browse the repository at this point in the history
  • Loading branch information
HenriWahl committed Jun 4, 2024
1 parent ad7c72d commit 6085fc3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dhcpy6d/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def time(self, new_time):
CONST.OPTION.IA_PD)

# options to be ignored when logging
IGNORED_LOG_OPTIONS = ['options_raw', 'client', 'client_config_dicts', 'timestamp', 'iat1', 'iat2', 'id']
IGNORED_LOG_OPTIONS = ['options', 'client', 'client_config_dicts', 'timestamp', 'iat1', 'iat2', 'id']

# empty options string test
EMPTY_OPTIONS = [None, False, '', []]
Expand Down
10 changes: 7 additions & 3 deletions dhcpy6d/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,13 @@ def build_response(self, message_type_response, transaction, options_request, st
# list of options in answer to be logged
options_answer = []

# Option 20 reconfigure accept - for client compatibility, actually
# not really supported
# https://github.com/HenriWahl/dhcpy6d/issues/64
if CONST.OPTION.RECONF_ACCEPT in transaction.options.keys():
response_string += build_option(CONST.OPTION.RECONF_ACCEPT, '')
options_answer.append(CONST.OPTION.RECONF_ACCEPT)

# build all requested options if they are handled
for number in options_request:
if number in OPTIONS:
Expand Down Expand Up @@ -523,9 +530,6 @@ def build_response(self, message_type_response, transaction, options_request, st
f'transaction: {transaction.id} | '
f'options: {options_answer}')

# just a test for https://github.com/HenriWahl/dhcpy6d/issues/64
response_string += build_option(CONST.OPTION.RECONF_ACCEPT, '')

# handler
self.response = binascii.unhexlify(response_string)

Expand Down
2 changes: 1 addition & 1 deletion dhcpy6d/options/option_39.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Option(OptionTemplate):
regarding RFC 4704 5. there are 3 kinds of client behaviour for N O S:
- client wants to update DNS itself -> sends 0 0 0
- client wants server to update DNS -> sends 0 0 1
- client wants no server DNS update -> sends 1 0 0
- client wants no server DNS update -> sends 1 0 0
"""

def build(self, transaction=None, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion dhcpy6d/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(self, transaction_id, client_llip, interface, message_type, options
# last message for following the protocol
self.last_message_received_type = message_type
# dictionary for options
self.options_raw = options
self.options = options
# default dummy OptionsRequest
self.options_request = list()
# timestamp to manage/clean transactions
Expand Down

0 comments on commit 6085fc3

Please sign in to comment.