It's useful to be able to test configurations away from the production
environment, but the `local-addresses-p' check causes the results to be
different. To allow this kind of testing, set the environment variable
`ZONECONF_LOCAL_ADDRESSES' to a `:'-separated list of IP addresses, in
dotted-quad format: then these addresses and no others will be
considered local.
proc local-address-p {addr} {
## Answer whether the ADDR is one of the host's addresses.
+ global env
- if {[catch { set sk [socket -server {} -myaddr $addr 0] }]} {
- return false
+ if {[info exists env(ZONECONF_LOCAL_ADDRESSES)]} {
+ if {[string match "*:$addr:*" ":$env(ZONECONF_LOCAL_ADDRESSES):"]} {
+ return true
+ } else {
+ return false
+ }
} else {
- close $sk
- return true
+ if {[catch { set sk [socket -server {} -myaddr $addr 0] }]} {
+ return false
+ } else {
+ close $sk
+ return true
+ }
}
}