Add allow_interfaces and deny_interfaces configuration options
authorRoy Marples <roy@marples.name>
Tue, 14 Jan 2020 07:06:24 +0000 (07:06 +0000)
committerRoy Marples <roy@marples.name>
Tue, 14 Jan 2020 07:06:24 +0000 (07:06 +0000)
Does what it says on the tin.
For example it could be used on routers where DHCP contains
DNS setup which should be ignored as it rolls it's own and you
can't change the DHCP not to setup DNS.

resolvconf.conf.5.in
resolvconf.in

index 989fc80511db9fca252c48c0e5a45b4784b4d699..23296cca3997f919ad336bd596b5d30e092a1877 100644 (file)
@@ -61,6 +61,10 @@ Set to NO to disable
 .Nm resolvconf
 from running any subscribers.
 Defaults to YES.
+.It Sy allow_interfaces
+If set, only these interfaces will be processed.
+.It Sy deny_interfaces
+If set, these interfaces will not be processed.
 .It Sy interface_order
 These interfaces will always be processed first.
 If unset, defaults to the following:-
index 79e23fe9b39dcf5d1958b9a9c0fe1e3935896a9e..5f537a58f6eaa5517990406986b507ef22251b10 100644 (file)
@@ -494,6 +494,21 @@ list_resolv()
                        fi
                        continue
                fi
+
+               if [ -n "$allow_interfaces" ]; then
+                       x=false
+                       for j in $allow_interfaces; do
+                               if [ "$i" = "$j" ]; then
+                                       x=true
+                               fi
+                       done
+                       $x || continue
+               fi
+               for j in $deny_interfaces; do
+                       if [ "$i" = "$j" ]; then
+                               continue 2
+                       fi
+               done
                
                if [ "$cmd" = i ] || [ "$cmd" = "-i" ]; then
                        printf %s "$i "