Browse Source

Fix padding logic for UDP health daemon

Should have done "pad to 8 characters" on the hex conversion, but it was
instead hardcoded to pad a single `0`, which is right in a lot of cases
but not all.

For example:
>>> ip1 = ipaddress.ip_address('98.136.140.23')
>>> ip2 = ipaddress.ip_address('10.1.1.1')
>>> "%X" % ip1._ip
'62888C17'
>>> "%X" % ip2._ip
'A010101'

Change-Id: Ia9fec4e72c00f7086489b245d9dc50ed9c27f12a
(cherry picked from commit d27ee3f0ee)
tags/4.1.2
Adam Harwell 3 months ago
committed by Michael Johnson
parent
commit
d3df7e4356
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      octavia/amphorae/backends/utils/keepalivedlvs_query.py

+ 1
- 1
octavia/amphorae/backends/utils/keepalivedlvs_query.py View File

@@ -73,7 +73,7 @@ def get_listener_realserver_mapping(ns_name, listener_ip_port,
ip_obj = ipaddress.ip_address(six.text_type(listener_ip.strip('[]')))
output = read_kernel_file(ns_name, KERNEL_LVS_PATH).split('\n')
if ip_obj.version == 4:
ip_to_hex_format = "0%X" % ip_obj._ip
ip_to_hex_format = "%.8X" % ip_obj._ip
else:
ip_to_hex_format = '\[' + ip_obj.exploded + '\]'
port_hex_format = "%.4X" % int(listener_port)


Loading…
Cancel
Save