# DEVICE equals the actual MAC address of the device.
# If ADDRESS is set, the device will get ADDRESS set for its MAC address.
-HOOK_SETTINGS="HOOK ADDRESS ADVERTISED_LINK_SPEEDS DEVICE OFFLOADING MTU"
+HOOK_SETTINGS="ADDRESS ADVERTISED_LINK_SPEEDS DEVICE OFFLOADING MTU"
hook_check_settings() {
assert ismac DEVICE
if enabled OFFLOADING; then
OFFLOADING="on"
- else
+ elif disabled OFFLOADING; then
OFFLOADING="off"
+ else
+ error "Invalid value for offloading: ${OFFLOADING}"
+ return ${EXIT_ERROR}
fi
;;
done
}
+# This function is only called automatically by hotplug to create
+# a new ethernet port.
+hook_new() {
+ local port="${1}"
+ assert isset port
+
+ local device="${2}"
+ assert isset device
+
+ local DEVICE="$(device_get_address "${device}")"
+
+ if ! port_settings_write "${port}" ${HOOK_SETTINGS}; then
+ log ERROR "Could not write settings for port ${port}"
+ return ${EXIT_ERROR}
+ fi
+
+ return ${EXIT_OK}
+}
+
hook_create() {
return ${EXIT_OK}
}