/etc/rdnssd/merge-hook is in rdnssd 1.0.3-3ubuntu2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | #! /bin/sh
#
# resolv.conf merge hook for Debian rdnssd
# *************************************************************************
# * Copyright © 2007-2009, 2017 Pierre Ynard. *
# * This program is free software: you can redistribute and/or modify *
# * it under the terms of the GNU General Public License as published by *
# * the Free Software Foundation, versions 2 or 3 of the license. *
# * *
# * This program is distributed in the hope that it will be useful, *
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
# * GNU General Public License for more details. *
# * *
# * You should have received a copy of the GNU General Public License *
# * along with this program. If not, see <http://www.gnu.org/licenses/>. *
# *************************************************************************
set -e
# Debian modification, use resolvconf if available
INPUT="/var/run/rdnssd/resolv.conf"
if [ -x /sbin/resolvconf ]; then
/sbin/resolvconf -a 000.rdnssd < "$INPUT"
exit 0
fi
# Max number of nameserver options taken into account. Should be as
# defined in <resolv.h>
MAXNS=3
# This script tries to share available nameserver slots with IPv4
# entries, for example to allow fallback to IPv4 if IPv6 fails. If
# there is not enough room for all IPv6 and IPv4 entries, this script
# will limit the IPv6 entries it adds to $RDNSS_LIMIT only.
RDNSS_LIMIT=$(($MAXNS - 1))
sysconfdir='/etc'
localstatedir='/var'
resolvconf="$sysconfdir/resolv.conf"
myresolvconf="$localstatedir/run/rdnssd/resolv.conf"
# These should be POSIX-compliant BREs
RE_NSV4='^nameserver *\([0-9]\{1,3\}\.\)\{3,3\}[0-9]\{1,3\} *$'
RE_NSV4OR6='^nameserver *[a-fA-F0-9:\.]\{1,46\}\(%[a-zA-Z0-9]\{1,\}\)\{,1\} *$'
# Count how many IPv6 nameservers we can fit
limit=$RDNSS_LIMIT
nnsv4=`grep -c "$RE_NSV4" $resolvconf || [ $? -le 1 ]`
room=$(($MAXNS - $nnsv4))
if [ $limit -lt $room ]; then
limit=$room
fi
# Merge and write the result. Let rdnssd assume ownership of all IPv6
# nameservers, and remove extraneous IPv6 entries as expired. However
# DHCPv4 most often sets up search list entries, and rdnssd cannot
# clobber these lest it causes counterintuitive breakage. There is no
# easy way to properly merge and manage DNSSL entries here, so just drop
# them.
{
sed -e "/$RE_NSV4OR6/d" < $resolvconf
grep -m $limit "$RE_NSV4OR6" < $myresolvconf || [ $? -le 1 ]
sed -ne "/$RE_NSV4/p" < $resolvconf
} > $resolvconf.tmp
mv -f $resolvconf.tmp $resolvconf
|