Opened 3 years ago

Last modified 3 years ago

#5013 new defect

ugly logging while using eval debug

Reported by: wlodekwencel Owned by:
Priority: medium Milestone: Outstanding Tasks
Component: Unclassified Version: git
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity: N/A
Sub-Project: DHCP Feature Depending on Ticket:
Estimated Difficulty: 0 Add Hours to Ticket: 0
Total Hours: 0 Internal?: no


Kea logs non-string value as a string:

DEBUG [kea-dhcp6.eval/4127] EVAL_DEBUG_VENDOR_CLASS_NO_OPTION Option with code 16 missing, pushing result ''
DEBUG [kea-dhcp6.eval/4127] EVAL_DEBUG_STRING Pushing text string '^@^@^DW'
DEBUG [kea-dhcp6.eval/4127] EVAL_DEBUG_EQUAL Popping 0x00000457 and 0x pushing result 'false'


DEBUG [kea-dhcp6.eval/4127] EVAL_DEBUG_VENDOR_ENTERPRISE_ID Pushing enterprise-id 4491 as result 0x0000118B
DEBUG [kea-dhcp6.eval/4127] EVAL_DEBUG_STRING Pushing text string '^@^@^U<B3>'
DEBUG [kea-dhcp6.eval/4127] EVAL_DEBUG_EQUAL Popping 0x000015B3 and 0x0000118B pushing result 'false'

it happens always while logging eval on the DEBUG mode with classes tests configured with tests using:

  • pkt.len,
  • pkt4.htype,
  • pkt4.hlen,
  • vendor.enterprise,
  • vendor-class.enterprise

full list


Attachments (1)

logfix.diff (3.2 KB) - added by tmark 3 years ago.
patch to correct "ugly" logging issue

Download all attachments as: .zip

Change History (3)

Changed 3 years ago by tmark

patch to correct "ugly" logging issue

comment:1 Changed 3 years ago by tmark

I needed a break from looking at ISC_DHCP code so I dug around on this one. Bascially the issue is that we store binary and text values in std::strings and at the point this log statement occurs we have no context to tell us which to expect. Therefore we just blindly assume it's text and rely on std::string <<. When sent to the console you see but when redirected to a file you see garbage between the quotes. Cute eh?

Attached is a patch that uses a simple function to spit out 'text' if the string contents are all printable bytes or hex digits (0xXXXXXX...) if not. The patch needs the requisite clean up and specific unit tests, but it seems to work just fine.

comment:2 Changed 3 years ago by tomek

  • Milestone changed from Kea-proposed to Outstanding Tasks
Note: See TracTickets for help on using tickets.