while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
- address=$(cli_get_val ${1})
+ address=$(cli_get_val "${1}")
;;
--mtu=*)
- mtu=$(cli_get_val ${1})
+ mtu=$(cli_get_val "${1}")
;;
*)
error "Unrecognized argument: ${1}"
fi
# If device is already attached, exit silently.
- if listmatch ${device} $(bridge_get_members ${bridge}); then
+ if list_match ${device} $(bridge_get_members ${bridge}); then
return ${EXIT_OK}
fi
device_adjust_mtu "${device}" "${bridge}"
# Actually connect bridge and device.
- cmd_quiet ip link set ${device} master ${bridge}
- local ret=$?
-
- if [ ${ret} -eq ${EXIT_OK} ]; then
- log DEBUG "bridge: device '${device}' has been attached to bridge '${bridge}'"
- else
- log ERROR "bridge: could not attach device '${device}' to bridge '${bridge}': ${ret}"
+ if ! device_set_master "${device}" "${bridge}"; then
+ log ERROR "Could not attach ${device} to bridge ${bridge}"
+ return ${EXIT_ERROR}
fi
- return ${ret}
+ log DEBUG "${device} has been attached to bridge ${bridge}"
+ return ${EXIT_OK}
}
bridge_detach_device() {
fi
# If device is not attched, exit silently.
- if ! listmatch ${device} $(bridge_get_members ${bridge}); then
+ if ! list_match ${device} $(bridge_get_members ${bridge}); then
return ${EXIT_OK}
fi