{ # suffix data expression # in fact ISC DHCP suffix can be reduced into Kea substring # empty configs are not accepted by Kea "Dhcp4": { "valid-lifetime": 1800, "client-classes": [ # use suffix in a reductible match /// match: suffix(option dhcp.host-name, 3) { "name": "reductible" }, /// subclass selector 'com' { "name": "sub#reductible#0", "option-data": [ { "space": "dhcp4", "name": "domain-search", "code": 119, // "original-data": "\"example.com\"", "data": "example.com" } ], /// from: match suffix(option dhcp.host-name, 3) /// data: 'com' "test": "substring(option[12].hex,-3,all) == 'com'" }, /// subclass selector 'org' { "name": "sub#reductible#1", "option-data": [ { "space": "dhcp4", "name": "domain-search", "code": 119, // "original-data": "\"example.org\"", "data": "example.org" } ], /// from: match suffix(option dhcp.host-name, 3) /// data: 'org' "test": "substring(option[12].hex,-3,all) == 'org'" }, # reduce literals too { "name": "literal", /// from: match if (option dhcp.domain-name) = (suffix('www.example.com', 3)) "test": "option[15].hex == '.example.com'" } ], "option-data": [ // # raw // { // "space": "dhcp4", // "name": "domain-name", // "code": 15, // "csv-format": false, // "expression": { // "suffix": { // "expression": { // "option": { // "universe": "dhcp", // "name": "domain-name", // "code": 15 // } // }, // "length": 3 // } // } // } ] } } |