| 1 |
{ |
| 2 |
# suffix data expression |
| 3 |
# in fact ISC DHCP suffix can be reduced into Kea substring |
| 4 |
# empty configs are not accepted by Kea |
| 5 |
"Dhcp4": { |
| 6 |
"valid-lifetime": 1800, |
| 7 |
"client-classes": [ |
| 8 |
# use suffix in a reductible match |
| 9 |
/// match: suffix(option dhcp.host-name, 3) |
| 10 |
{ |
| 11 |
"name": "reductible" |
| 12 |
}, |
| 13 |
/// subclass selector 'com' |
| 14 |
{ |
| 15 |
"name": "sub#reductible#0", |
| 16 |
"option-data": [ |
| 17 |
{ |
| 18 |
"space": "dhcp4", |
| 19 |
"name": "domain-search", |
| 20 |
"code": 119, |
| 21 |
// "original-data": "\"example.com\"", |
| 22 |
"data": "example.com" |
| 23 |
} |
| 24 |
], |
| 25 |
/// from: match suffix(option dhcp.host-name, 3) |
| 26 |
/// data: 'com' |
| 27 |
"test": "substring(option[12].hex,-3,all) == 'com'" |
| 28 |
}, |
| 29 |
/// subclass selector 'org' |
| 30 |
{ |
| 31 |
"name": "sub#reductible#1", |
| 32 |
"option-data": [ |
| 33 |
{ |
| 34 |
"space": "dhcp4", |
| 35 |
"name": "domain-search", |
| 36 |
"code": 119, |
| 37 |
// "original-data": "\"example.org\"", |
| 38 |
"data": "example.org" |
| 39 |
} |
| 40 |
], |
| 41 |
/// from: match suffix(option dhcp.host-name, 3) |
| 42 |
/// data: 'org' |
| 43 |
"test": "substring(option[12].hex,-3,all) == 'org'" |
| 44 |
}, |
| 45 |
# reduce literals too |
| 46 |
{ |
| 47 |
"name": "literal", |
| 48 |
/// from: match if (option dhcp.domain-name) = (suffix('www.example.com', 3)) |
| 49 |
"test": "option[15].hex == '.example.com'" |
| 50 |
} |
| 51 |
], |
| 52 |
"option-data": [ |
| 53 |
// # raw |
| 54 |
// { |
| 55 |
// "space": "dhcp4", |
| 56 |
// "name": "domain-name", |
| 57 |
// "code": 15, |
| 58 |
// "csv-format": false, |
| 59 |
// "expression": { |
| 60 |
// "suffix": { |
| 61 |
// "expression": { |
| 62 |
// "option": { |
| 63 |
// "universe": "dhcp", |
| 64 |
// "name": "domain-name", |
| 65 |
// "code": 15 |
| 66 |
// } |
| 67 |
// }, |
| 68 |
// "length": 3 |
| 69 |
// } |
| 70 |
// } |
| 71 |
// } |
| 72 |
] |
| 73 |
} |
| 74 |
} |