Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • Kea Kea
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 505
    • Issues 505
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 51
    • Merge requests 51
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • ISC Open Source Projects
  • KeaKea
  • Issues
  • #2077

Closed
Open
Created Sep 01, 2021 by Andrei Pavel@andrei🐧Maintainer

evaluation error on CB class test expressions

  1. Start a Kea with CB and debug logging kea-dhcp4.conf.
  2. Start a kea-ctrl-agent kea-ctrl-agent.conf.
  3. Create a class that tests the equality operator between an option substring and a literal string:
$ curl -X POST 10.1.0.2:8080 -H 'Content-Type: application/json' -d "$(cat <<HERE_DOCUMENT
{
  "arguments": {
    "client-classes": [
      {
        "name": "my-class",
        "test": "substring(option[1].hex, 0, 8) == 'my-value'"
      }
    ],
    "remote": {
      "type": "mysql"
    },
    "server-tags": [
      "all"
    ]
  },
  "command": "remote-class4-set",
  "service": [
    "dhcp4"
  ]
}
HERE_DOCUMENT
)"
[ { "arguments": { "client-classes": [ { "name": "my-class" } ] }, "result": 0, "text": "DHCPv4 client class successfully set." } ]
  1. Wait for Kea to pull configuration signaled through the log message: DEBUG MYSQL_CB_GET_ALL_CLIENT_CLASSES4_RESULT retrieving: 1 elements
  2. Send perfdhcp traffic: perfdhcp -4 -l vethclient -r 1 -t 1.
  3. Observe error log message: ERROR EVAL_RESULT Expression my-class evaluated to Incorrect stack order. Expected exactly 1 value at the end of evaluation, got 0.

Expected result: the my-class expression gets succesfully evaluated to either true or false.

Alternative scenario: configuring the client class in the file configuration evalutes the expression succesfully to true or false.

"client-classes": [
  {
    "name": "my-class",
    "test": "substring(option[1].hex, 0, 8) == 'my-value'"
  }
]
DEBUG EVAL_DEBUG_OPTION Pushing option 1 with value 0x
DEBUG EVAL_DEBUG_STRING Pushing text string '0'
DEBUG EVAL_DEBUG_STRING Pushing text string '8'
DEBUG EVAL_DEBUG_SUBSTRING_EMPTY Popping length 8, start 0, string 0x pushing result 0x
DEBUG EVAL_DEBUG_STRING Pushing text string 'my-value'
DEBUG EVAL_DEBUG_EQUAL Popping 0x6D792D76616C7565 and 0x pushing result 'false'
DEBUG EVAL_RESULT Expression my-class evaluated to 0

Hint: in CB's case, EVAL_DEBUG_* messages are missing from the logs. I would suggest logging them in this MR if the estimated effort is minimal.

RT #18874

Edited Sep 01, 2021 by Peter Davies
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking