diff options
author | Jose M. Guisado <jguisado@soleta.eu> | 2023-06-27 16:47:43 +0200 |
---|---|---|
committer | Jose M. Guisado <jguisado@soleta.eu> | 2023-06-27 17:06:34 +0200 |
commit | d9f8c9561823daf234e2348b5ea0db2e92d29216 (patch) | |
tree | f11dd91dff3bda776f21dd69367225f8ca75ef1a /ogcp/babel.cfg | |
parent | 9c91fb16b4999160ad8dec4a10e98f0953668eca (diff) |
views: better dhcp conf parsing when importing clients
This new regex allows parsing of:
- Irrelevant options that the user may paste from its config
file, eg. 'option host-name'.
- Allows linebreaks.
Hosts still require to have 'hardware ethernet' first, and then
'fixed-address'.
For example this regex admits dhcp host declarations such as
host pir36-22_78 {
hardware ethernet d8:5e:d3:25:28:9d;
fixed-address 10.1.36.78;
option host-name "pc_78";
}
Summary of the regex:
(?: *host *) # Match host keyword and spaces
([\w.-]*) # Match any word character (alphanum and underscore)
(?:[ \n\r]*{[ \n\r]*) # Match any space or newline, then match { and any following space or newline
(?:[ \t]*hardware *ethernet *) # Match any space or tab character followed by 'hardware ethernet'
((?:[0-9A-Fa-f]{2}[:-]){5}(?:[0-9A-Fa-f]{2})) # Match the mac address using ':' or '-' as separator
(?: *;) # Match any space character before a ';'
(?:[ \t\n\r]*fixed-address *) # Match any space, tab or newline followed by 'fixed address' and any following space
(\d+\.\d+\.\d+\.\d+) # Match an ip address (no validity check)
(?: *;)(?:[ \r\n]*[^}]*}) # Match any space followed by ';', then match any character except '}'
Diffstat (limited to 'ogcp/babel.cfg')
0 files changed, 0 insertions, 0 deletions