Skip to content

Commit

Permalink
ncm-ntpd: Validate interface match option
Browse files Browse the repository at this point in the history
  • Loading branch information
jrha committed Dec 23, 2022
1 parent 6774043 commit 8422f6f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ncm-ntpd/src/main/pan/components/ntpd/schema.pan
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,13 @@ type ntpd_system_options = {
}
type ntpd_interface_options = {
"action" : choice("listen", "ignore", "drop")
"match" : string
"match" : string_trimmed with {
match(SELF, '^(all|ipv4|ipv6|wildcard)$')
|| is_ip(SELF)
|| is_ipv4_netmask_pair(SELF)
|| is_ipv6_network_block(SELF)
|| path_exists(format('/system/network/interfaces/%s', SELF));
}
};

# logging configuration
Expand Down
2 changes: 2 additions & 0 deletions ncm-ntpd/src/test/resources/interface.pan
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ object template interface;

include 'only_timeservers_base';

'/system/network/interfaces/eth0' = dict();

prefix "/software/components/ntpd";

'interface' = append(dict('action', 'listen', 'match', 'eth0'));
Expand Down

0 comments on commit 8422f6f

Please sign in to comment.