Skip to content

Instantly share code, notes, and snippets.

@p120ph37
Last active October 18, 2016 21:15
Show Gist options
  • Save p120ph37/10998096 to your computer and use it in GitHub Desktop.
Save p120ph37/10998096 to your computer and use it in GitHub Desktop.
A patch to vpnc-script to support $SPLIT_DNS when used with openconnect and a Cisco AnyConnect server.
--- vpnc-script.orig 2016-10-18 16:13:30.000000000 -0500
+++ vpnc-script 2016-10-18 16:14:27.000000000 -0500
@@ -435,10 +435,10 @@
# DNS matching when available. When multiple DNS matching
# is present, anything reading the /etc/resolv.conf file
# directly will probably not work as intended.
- #if [ -z "$CISCO_DEF_DOMAIN" ]; then
+ if [ -z "$CISCO_DEF_DOMAIN" ]; then
# Cannot use multiple DNS matching without a domain
OVERRIDE_PRIMARY='d.add OverridePrimary # 1'
- #fi
+ fi
scutil >/dev/null 2>&1 <<-EOF
open
d.init
@@ -459,7 +459,7 @@
get State:/Network/Service/$TUNDEV/DNS
d.add DomainName $CISCO_DEF_DOMAIN
d.add SearchDomains * $CISCO_DEF_DOMAIN
- d.add SupplementalMatchDomains * $CISCO_DEF_DOMAIN
+ d.add SupplementalMatchDomains * $CISCO_DEF_DOMAIN $SPLIT_DNS
set State:/Network/Service/$TUNDEV/DNS
close
EOF
@p120ph37
Copy link
Author

To apply it to vpnc-script, use this command: patch -i vpnc-script.patch vpnc-script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment