diff options
author | Thomas Mangin <thomas.mangin@exa.net.uk> | 2020-03-03 20:01:56 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-03-04 21:43:59 +0100 |
commit | 665d1c5bdb24aa0aef79405dc2f2962b930fb9b3 (patch) | |
tree | 467499a4ce63308ca6d1e349b13f1e807ba4703e /src/validators | |
parent | dac5ad318b00853591121078bce5c849db23c810 (diff) | |
download | vyos-1x-665d1c5bdb24aa0aef79405dc2f2962b930fb9b3.tar.gz vyos-1x-665d1c5bdb24aa0aef79405dc2f2962b930fb9b3.zip |
vrf: T31: initial support for a VRF backend in XML/Python
This is a work in progress to complete T31 whoever thought it was less than
1 hour of work was ..... optimistic.
Only VRF vreation and show is supported right now. No interface can be bound
to any one VRF.
Diffstat (limited to 'src/validators')
-rwxr-xr-x | src/validators/interface-name | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/validators/interface-name b/src/validators/interface-name new file mode 100755 index 000000000..49a833f39 --- /dev/null +++ b/src/validators/interface-name @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2018 VyOS maintainers and contributors +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 or later as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# + +import sys +import re + +if len(sys.argv) == 2: + # https://unix.stackexchange.com/questions/451368/allowed-chars-in-linux-network-interface-names + pattern = "^([^/\s]{1,16}$)$" + if re.match(pattern, sys.argv[1]): + sys.exit(0) + else: + sys.exit(1) + |