netfilter_log: Correctly decode binary type prefix

Under Python 3, firewall log prefixes are incorrectly decoded
resulting in a mismatch between the stringy-fied 'prefix' value
and the information available in the prefixes data.

Use oslo.utils safe_decode function to ensure that data is
correctly decoded.

Change-Id: I9742207e98c07f0a4632631631288d9ada8cf8c7
Closes-Bug: 1832210
(cherry picked from commit 652f532d84)
This commit is contained in:
James Page 2019-06-10 10:36:05 +01:00
parent 55a5a41b4c
commit ea7590e4e1
1 changed files with 3 additions and 1 deletions

View File

@ -24,6 +24,7 @@ from eventlet.green import zmq
from neutron_lib.utils import runtime
from oslo_log import log as logging
from oslo_serialization import jsonutils
from oslo_utils import encodeutils
from oslo_utils import excutils
from ryu.lib import addrconv
from ryu.lib.packet import arp
@ -166,7 +167,8 @@ def decode(nfa):
else:
msg += "Does not support hw_proto: " + str(hw_proto)
return {'prefix': str(prefix), 'msg': str(msg)}
return {'prefix': encodeutils.safe_decode(prefix),
'msg': encodeutils.safe_decode(msg)}
class NFLogWrapper(object):