Provide Input Validation for Romaing Mobility Domain

Signed-off-by: Kishan Shukla <kishan.shukla@hfcl.com>
This commit is contained in:
Kishan Shukla
2024-02-19 18:05:32 +05:30
committed by John Crispin
parent fda6ded45a
commit a3ea74a914
6 changed files with 16 additions and 13 deletions

View File

@@ -74,6 +74,12 @@ let GeneratorProto = {
'return match(value, /^[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]$/i);'
]
},
"uc-mobility": {
desc: 'Mobility Domain',
code: [
'return match(value, /^[0-9a-f][0-9a-f][0-9a-f][0-9a-f]$/i);'
]
},
"uc-host": {
desc: 'hostname or IP address',
code: [

View File

@@ -21,8 +21,7 @@ properties:
description:
Mobility Domain identifier (dot11FTMobilityDomainID, MDID).
type: string
maxLength: 4
minLength: 4
format: uc-mobility
examples:
- abcd
pmk-r0-key-holder:

View File

@@ -22,6 +22,10 @@ function matchUcMac(value) {
return match(value, /^[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]$/i);
}
function matchUcMobility(value) {
return match(value, /^[0-9a-f][0-9a-f][0-9a-f][0-9a-f]$/i);
}
function matchUcHost(value) {
if (length(iptoarr(value)) != 0) return true;
if (length(value) > 255) return false;
@@ -2812,11 +2816,8 @@ function instantiateInterfaceSsidRoaming(location, value, errors) {
function parseDomainIdentifier(location, value, errors) {
if (type(value) == "string") {
if (length(value) > 4)
push(errors, [ location, "must be at most 4 characters long" ]);
if (length(value) < 4)
push(errors, [ location, "must be at least 4 characters long" ]);
if (!matchUcMobility(value))
push(errors, [ location, "must be a valid Mobility Domain" ]);
}

View File

@@ -1683,8 +1683,7 @@
"domain-identifier": {
"description": "Mobility Domain identifier (dot11FTMobilityDomainID, MDID).",
"type": "string",
"maxLength": 4,
"minLength": 4,
"format": "uc-mobility",
"examples": [
"abcd"
]

View File

@@ -1145,8 +1145,7 @@
},
"domain-identifier": {
"type": "string",
"maxLength": 4,
"minLength": 4,
"format": "uc-mobility",
"examples": [
"abcd"
]

View File

@@ -1293,8 +1293,7 @@
"domain-identifier": {
"description": "Mobility Domain identifier (dot11FTMobilityDomainID, MDID).",
"type": "string",
"maxLength": 4,
"minLength": 4,
"format": "uc-mobility",
"examples": [
"abcd"
]