]> git.ipfire.org Git - network.git/commitdiff
bonding; Validate any MAC address passed
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 30 Sep 2018 23:02:27 +0000 (01:02 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 30 Sep 2018 23:02:27 +0000 (01:02 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/hooks/ports/bonding

index 2880a78a370f94251af9b353758aa45ee3a15f94..40d849fba16b2f84abc8a5e94c7cedc0cbcb06e6 100644 (file)
@@ -39,8 +39,14 @@ hook_parse_cmdline() {
        while [ $# -gt 0 ]; do
                case "${1}" in
                        --address=*)
-                               ADDRESS=$(cli_get_val "${1}")
+                               ADDRESS="$(cli_get_val "${1}")"
+
+                               if ! mac_is_valid "${ADDRESS}"; then
+                                       error "Invalid MAC address: ${ADDRESS}"
+                                       return ${EXIT_ERROR}
+                               fi
                                ;;
+
                        --miimon=*)
                                MIIMON=$(cli_get_val "${1}")
                                ;;