PORT_PATTERN_BATMAN_ADV="batN"
PORT_PATTERN_BATMAN_ADV_PORT="batpN"
PORT_PATTERN_WIRELESS="wN"
+PORT_PATTERN_WIRELESS_MONITOR="wmonN"
serial_exists ${device}
}
+function device_matches_pattern() {
+ local device="${1}"
+ assert isset device
+
+ local pattern="${2}"
+ assert isset pattern
+
+ pattern="^${pattern//N/[[:digit:]]+}$"
+
+ [[ ${device} =~ ${pattern} ]] \
+ && return ${EXIT_TRUE} || return ${EXIT_FALSE}
+}
+
function device_delete() {
local device=${1}
assert isset device
[ -d "${SYS_CLASS_NET}/${device}/brport" ]
}
+function device_is_wireless_monitor() {
+ local device="${1}"
+ assert isset device
+
+ device_is_wireless "${device}" && \
+ device_matches_pattern "${device}" "${PORT_PATTERN_WIRELESS_MONITOR}"
+}
+
function device_get_bridge() {
local device=${1}
assert isset device
assert isset device
shift
- local monitor_device="mon$$"
+ local monitor_device="$(port_find_free "${PORT_PATTERN_WIRELESS_MONITOR}")"
# Create an 802.11 monitoring device
wireless_create "${monitor_device}" --phy="${device}" --type="monitor"
# Check, if the device is a physical network interface and
# if we can handle it.
if device_exists ${INTERFACE}; then
+ # Skip wireless monitor devices
+ if device_is_wireless_monitor "${INTERFACE}"; then
+ exit ${EXIT_OK}
+ fi
+
type="$(device_get_type "${INTERFACE}")"
case "${type}" in
# Remove automatically created bonding interface without any configuration