Skip to content
Permalink
Browse files

dns-server: fix portfile parsing on macOS 10.15

  • Loading branch information
tobypeterson committed Jul 1, 2019
1 parent e23b38f commit 2bf00cf3a1fa8a2bd7fcbc07f5585bd08ab91946
Showing with 5 additions and 1 deletion.
  1. +5 −1 net/dns-server/Portfile
@@ -34,7 +34,11 @@ set named_host [exec /bin/sh -c "echo ${named_fullhost} | /usr/bin/sed -E -e 's|
set named_domaintld [exec /bin/sh -c "echo ${named_fullhost} | /usr/bin/sed -E -e 's|^(\[\[:alnum:\]_-\]+\\.)*((\[\[:alnum:\]_-\]+\\.)\[a-zA-Z0-9-\]{2,24})\\.?|\\2|'"]
set named_domain [exec /bin/sh -c "echo ${named_domaintld} | /usr/bin/sed -E -e 's|^(\[\[:alnum:\]_-\]+)\\.\[a-zA-Z0-9-\]{2,24}\\.?|\\1|'"]
set named_tld [exec /bin/sh -c "echo ${named_domaintld} | /usr/bin/sed -E -e 's|^\[\[:alnum:\]_-\]+\\.(\[a-zA-Z0-9-\]{2,24})\\.?|\\1|'"]
set host_lan_ip_address [exec /bin/sh -c "/sbin/ifconfig `/usr/sbin/netstat -nr | /usr/bin/awk '{ if (\$1 ~/default/) { print \$6} }' | /usr/bin/head -1` | /usr/bin/awk '{ if (\$1 ~/inet\$/) { print \$2} }'"]
if {${os.platform} eq "darwin" && ${os.major} >= 19} {
set host_lan_ip_address [exec /bin/sh -c "/sbin/ifconfig `/usr/sbin/netstat -nr | /usr/bin/awk '{ if (\$1 ~/default/) { print \$4} }' | /usr/bin/head -1` | /usr/bin/awk '{ if (\$1 ~/inet\$/) { print \$2} }'"]
} else {
set host_lan_ip_address [exec /bin/sh -c "/sbin/ifconfig `/usr/sbin/netstat -nr | /usr/bin/awk '{ if (\$1 ~/default/) { print \$6} }' | /usr/bin/head -1` | /usr/bin/awk '{ if (\$1 ~/inet\$/) { print \$2} }'"]
}
set lan_reverse_ip_subnet [exec /bin/sh -c "echo ${host_lan_ip_address} | /usr/bin/sed -E -e 's|(\[\[:digit:\]\]{1,3})\\.(\[\[:digit:\]\]{1,3})\\.(\[\[:digit:\]\]{1,3})\\.(\[\[:digit:\]\]{1,3})\$|\\3.\\2.\\1|'"]
set host_lan_reverse_ip_address [exec /bin/sh -c "echo ${host_lan_ip_address} | /usr/bin/sed -E -e 's|(\[\[:digit:\]\]{1,3})\\.(\[\[:digit:\]\]{1,3})\\.(\[\[:digit:\]\]{1,3})\\.(\[\[:digit:\]\]{1,3})\$|\\4.\\3.\\2.\\1|'"]
# aribitrary example for client IP address

0 comments on commit 2bf00cf

Please sign in to comment.
You can’t perform that action at this time.