exit ${EXIT_OK}
}
+function hook_create() {
+ local port="${1}"
+ assert isset port
+
+ device_exists "${port}" && exit ${EXIT_OK}
+
+ port_settings_read "${port}" ${HOOK_SETTINGS}
+
+ # Check if the PHY is present.
+ local phy="$(phy_get "${PHY}")"
+ if ! isset phy; then
+ log DEBUG "phy '${PHY}' is not present"
+ exit ${EXIT_ERROR}
+ fi
+
+ # Create the wireless device, if it does not exist, yet.
+ wireless_create "${port}" \
+ --address="${ADDRESS}" \
+ --phy="${phy}" \
+ --type="ibss"
+
+ exit ${EXIT_OK}
+}
+
+function hook_remove() {
+ local port="${1}"
+ assert isset port
+
+ if device_exists "${port}"; then
+ wireless_remove "${port}"
+ fi
+
+ exit ${EXIT_OK}
+}
+
function hook_up() {
local port=${1}
assert isset port
# Leave the ad-hoc network.
wireless_ibss_leave "${port}"
- # Remove the device if it is still present.
- wireless_remove "${port}"
-
exit ${EXIT_OK}
}