]> git.ipfire.org Git - people/ms/network.git/blobdiff - functions.device
bridge: Automatically enable promisc mode.
[people/ms/network.git] / functions.device
index 3bf8df5421220bc6bc06ebca6a74d68b434e0416..8dea6bd692c224ef3659f4d1c3e8a847b49ad3f4 100644 (file)
@@ -276,6 +276,17 @@ function device_is_promisc() {
        ip link show ${device} | grep -qE "<.*PROMISC.*>"
 }
 
+function device_set_promisc() {
+       local device=${1}
+       local state=${2}
+
+       assert device_exists ${device}
+       assert isset state
+       assert isoneof state on off
+
+       ip link set ${device} promisc ${state}
+}
+
 # Check if the device is free
 function device_is_free() {
        ! device_is_used $@