mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-11-06 15:51:41 +00:00
Compare commits
17
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7f4020133 | ||
|
|
c46c7c7584 | ||
|
|
552af8b988 | ||
|
|
4f8ff361dc | ||
|
|
0010b47439 | ||
|
|
4b86b65d07 | ||
|
|
248489401a | ||
|
|
bc5992daf6 | ||
|
|
fdacfb0119 | ||
|
|
0d5d35d052 | ||
|
|
843c96b4b3 | ||
|
|
58dc02ebf2 | ||
|
|
c239f7de25 | ||
|
|
ac8540c3c5 | ||
|
|
22d904db95 | ||
|
|
741c2952d4 | ||
|
|
96f6979c4f |
No files matched your search
@@ -45,18 +45,36 @@ version 2.60
|
|||||||
round-robin to multiple servers, in the same way as
|
round-robin to multiple servers, in the same way as
|
||||||
--dhcp-boot. A good suggestion from Cristiano Cumer.
|
--dhcp-boot. A good suggestion from Cristiano Cumer.
|
||||||
|
|
||||||
Support BUILDDIR variable in the Makefile. Allows
|
Support BUILDDIR variable in the Makefile. Allows builds
|
||||||
builds from multiple architectures in the same tree with eg
|
for multiple archs from the same source tree with eg.
|
||||||
make BUILDDIR=linux
|
make BUILDDIR=linux (relative to dnsmasq tree)
|
||||||
|
make BUILDDIR=/tmp/openbsd (absolute path)
|
||||||
If BUILDDIR is not set, compilation happens in the src
|
If BUILDDIR is not set, compilation happens in the src
|
||||||
directory, as before. Suggestion from Mark Mitchell.
|
directory, as before. Suggestion from Mark Mitchell.
|
||||||
|
|
||||||
First cut at supporting DHCPv6. Support is pretty much
|
Support DHCPv6. Support is there for the sort of things
|
||||||
there for the sort of things the existing v4 server does,
|
the existing v4 server does, including tags, options,
|
||||||
including tags, options, static addresses and relay
|
static addresses and relay support. Missing is prefix
|
||||||
support. Missing is prefix delegation. This is lightly
|
delegation, which is probably not required in the dnsmasq
|
||||||
tested alpha code, it is NOT YET PRODUCTION READY. Test
|
niche, and an easy way to accept prefix delegations from
|
||||||
reports would be greatly valued.
|
an upstream DHCPv6 server, which is. Future plans include
|
||||||
|
support for DHCPv6 router option and MAC address option
|
||||||
|
(to make selecting clients by MAC address work like IPv4).
|
||||||
|
These will be added as the standards mature.
|
||||||
|
This code has been tested, but this is the first release,
|
||||||
|
so don't bet the farm on it just yet. Many thanks to all
|
||||||
|
testers who have got it this far.
|
||||||
|
|
||||||
|
Support IPv6 router advertisements. This is a
|
||||||
|
simple-minded implementation, aimed at providing the
|
||||||
|
vestigial RA needed to go alongside IPv6. Is picks up
|
||||||
|
configuration from the DHCPv6 conf, and should just need
|
||||||
|
enabling with --enable-ra.
|
||||||
|
|
||||||
|
Fix long-standing wrinkle with --localise-queries that
|
||||||
|
could result in wrong answers when DNS packets arrive
|
||||||
|
via an interface other than the expected one. Thanks to
|
||||||
|
Lorenzo Milesi and John Hanks for spotting this one.
|
||||||
|
|
||||||
|
|
||||||
version 2.59
|
version 2.59
|
||||||
|
|||||||
@@ -13,52 +13,69 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
PREFIX = /usr/local
|
# NOTE: Building the i18n targets requires GNU-make
|
||||||
BINDIR = ${PREFIX}/sbin
|
|
||||||
MANDIR = ${PREFIX}/share/man
|
|
||||||
LOCALEDIR = ${PREFIX}/share/locale
|
|
||||||
|
|
||||||
BUILDDIR = $(SRC)
|
|
||||||
|
|
||||||
CFLAGS = -Wall -W -O2
|
# Variables you may well want to override.
|
||||||
|
|
||||||
|
PREFIX = /usr/local
|
||||||
|
BINDIR = $(PREFIX)/sbin
|
||||||
|
MANDIR = $(PREFIX)/share/man
|
||||||
|
LOCALEDIR = $(PREFIX)/share/locale
|
||||||
|
BUILDDIR = $(SRC)
|
||||||
|
DESTDIR =
|
||||||
|
CFLAGS = -Wall -W -O2
|
||||||
|
LDFLAGS =
|
||||||
|
COPTS =
|
||||||
|
RPM_OPT_FLAGS =
|
||||||
|
LIBS =
|
||||||
|
|
||||||
#################################################################
|
#################################################################
|
||||||
|
|
||||||
|
# Variables you might want to override.
|
||||||
|
|
||||||
PKG_CONFIG = pkg-config
|
PKG_CONFIG = pkg-config
|
||||||
INSTALL = install
|
INSTALL = install
|
||||||
MSGMERGE = msgmerge
|
MSGMERGE = msgmerge
|
||||||
MSGFMT = msgfmt
|
MSGFMT = msgfmt
|
||||||
XGETTEXT = xgettext
|
XGETTEXT = xgettext
|
||||||
|
|
||||||
SRC = src
|
SRC = src
|
||||||
PO = po
|
PO = po
|
||||||
MAN = man
|
MAN = man
|
||||||
|
|
||||||
DBUS_CFLAGS=`echo $(COPTS) | ../bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --cflags dbus-1`
|
#################################################################
|
||||||
DBUS_LIBS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --libs dbus-1`
|
|
||||||
IDN_CFLAGS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_IDN $(PKG_CONFIG) --cflags libidn`
|
|
||||||
IDN_LIBS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_IDN $(PKG_CONFIG) --libs libidn`
|
|
||||||
CT_CFLAGS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_CONNTRACK $(PKG_CONFIG) --cflags libnetfilter_conntrack`
|
|
||||||
CT_LIBS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_CONNTRACK $(PKG_CONFIG) --libs libnetfilter_conntrack`
|
|
||||||
LUA_CFLAGS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CONFIG) --cflags lua5.1`
|
|
||||||
LUA_LIBS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CONFIG) --libs lua5.1`
|
|
||||||
SUNOS_LIBS= `if uname | grep SunOS 2>&1 >/dev/null; then echo -lsocket -lnsl -lposix4; fi`
|
|
||||||
VERSION= -DVERSION='\"`../bld/get-version`\"'
|
|
||||||
|
|
||||||
OBJS = cache.o rfc1035.o util.o option.o forward.o network.o \
|
# pmake way. (NB no spaces to keep gmake 3.82 happy)
|
||||||
|
top!=pwd
|
||||||
|
# GNU make way.
|
||||||
|
top?=$(CURDIR)
|
||||||
|
|
||||||
|
dbus_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --cflags dbus-1`
|
||||||
|
dbus_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --libs dbus-1`
|
||||||
|
idn_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_IDN $(PKG_CONFIG) --cflags libidn`
|
||||||
|
idn_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_IDN $(PKG_CONFIG) --libs libidn`
|
||||||
|
ct_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_CONNTRACK $(PKG_CONFIG) --cflags libnetfilter_conntrack`
|
||||||
|
ct_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_CONNTRACK $(PKG_CONFIG) --libs libnetfilter_conntrack`
|
||||||
|
lua_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CONFIG) --cflags lua5.1`
|
||||||
|
lua_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CONFIG) --libs lua5.1`
|
||||||
|
sunos_libs = `if uname | grep SunOS >/dev/null 2>&1; then echo -lsocket -lnsl -lposix4; fi`
|
||||||
|
version = -DVERSION='\"`$(top)/bld/get-version $(top)`\"'
|
||||||
|
|
||||||
|
objs = cache.o rfc1035.o util.o option.o forward.o network.o \
|
||||||
dnsmasq.o dhcp.o lease.o rfc2131.o netlink.o dbus.o bpf.o \
|
dnsmasq.o dhcp.o lease.o rfc2131.o netlink.o dbus.o bpf.o \
|
||||||
helper.o tftp.o log.o conntrack.o dhcp6.o rfc3315.o \
|
helper.o tftp.o log.o conntrack.o dhcp6.o rfc3315.o \
|
||||||
dhcp-common.o outpacket.o radv.o
|
dhcp-common.o outpacket.o radv.o
|
||||||
|
|
||||||
HDRS = dnsmasq.h config.h dhcp_protocol.h dhcp6_protocol.h \
|
hdrs = dnsmasq.h config.h dhcp-protocol.h dhcp6-protocol.h \
|
||||||
dns_protocol.h radv_protocol.h
|
dns-protocol.h radv-protocol.h
|
||||||
|
|
||||||
|
|
||||||
all : $(BUILDDIR)
|
all : $(BUILDDIR)
|
||||||
@cd $(BUILDDIR) && $(MAKE) \
|
@cd $(BUILDDIR) && $(MAKE) \
|
||||||
BUILD_CFLAGS="$(VERSION) $(DBUS_CFLAGS) $(IDN_CFLAGS) $(CT_CFLAGS) $(LUA_CFLAGS)" \
|
top="$(top)" \
|
||||||
BUILD_LIBS="$(DBUS_LIBS) $(IDN_LIBS) $(CT_LIBS) $(LUA_LIBS) $(SUNOS_LIBS)" \
|
build_cflags="$(version) $(dbus_cflags) $(idn_cflags) $(ct_cflags) $(lua_cflags)" \
|
||||||
-f ../Makefile dnsmasq
|
build_libs="$(dbus_libs) $(idn_libs) $(ct_libs) $(lua_libs) $(sunos_libs)" \
|
||||||
|
-f $(top)/Makefile dnsmasq
|
||||||
|
|
||||||
clean :
|
clean :
|
||||||
rm -f *~ $(BUILDDIR)/*.mo contrib/*/*~ */*~ $(BUILDDIR)/*.pot
|
rm -f *~ $(BUILDDIR)/*.mo contrib/*/*~ */*~ $(BUILDDIR)/*.pot
|
||||||
@@ -73,45 +90,45 @@ install-common :
|
|||||||
|
|
||||||
all-i18n : $(BUILDDIR)
|
all-i18n : $(BUILDDIR)
|
||||||
@cd $(BUILDDIR) && $(MAKE) \
|
@cd $(BUILDDIR) && $(MAKE) \
|
||||||
I18N=-DLOCALEDIR=\'\"$(LOCALEDIR)\"\' \
|
top="$(top)" \
|
||||||
BUILD_CFLAGS="$(VERSION) $(DBUS_CFLAGS) $(CT_CFLAGS) $(LUA_CFLAGS) `$(PKG_CONFIG) --cflags libidn`" \
|
i18n=-DLOCALEDIR=\'\"$(LOCALEDIR)\"\' \
|
||||||
BUILD_LIBS="$(DBUS_LIBS) $(CT_LIBS) $(LUA_LIBS) $(SUNOS_LIBS) `$(PKG_CONFIG) --libs libidn`" \
|
build_cflags="$(version) $(dbus_cflags) $(ct_cflags) $(lua_cflags) `$(PKG_CONFIG) --cflags libidn`" \
|
||||||
-f ../Makefile dnsmasq
|
build_libs="$(dbus_libs) $(ct_libs) $(lua_libs) $(sunos_libs) `$(PKG_CONFIG) --libs libidn`" \
|
||||||
@cd $(PO); for f in *.po; do \
|
-f $(top)/Makefile dnsmasq
|
||||||
cd ../$(BUILDDIR) && $(MAKE) \
|
for f in `cd $(PO); echo *.po`; do \
|
||||||
-f ../Makefile $${f%.po}.mo; \
|
cd $(top) && cd $(BUILDDIR) && $(MAKE) top="$(top)" -f $(top)/Makefile $${f%.po}.mo; \
|
||||||
done
|
done
|
||||||
|
|
||||||
install-i18n : all-i18n install-common
|
install-i18n : all-i18n install-common
|
||||||
cd $(BUILDDIR); ../bld/install-mo $(DESTDIR)$(LOCALEDIR) $(INSTALL)
|
cd $(BUILDDIR); $(top)/bld/install-mo $(DESTDIR)$(LOCALEDIR) $(INSTALL)
|
||||||
cd $(MAN); ../bld/install-man $(DESTDIR)$(MANDIR) $(INSTALL)
|
cd $(MAN); ../bld/install-man $(DESTDIR)$(MANDIR) $(INSTALL)
|
||||||
|
|
||||||
merge : $(BUILDDIR)
|
merge :
|
||||||
@cd $(BUILDDIR) && $(MAKE) -f ../Makefile dnsmasq.pot
|
@cd $(BUILDDIR) && $(MAKE) -f $(top)/Makefile dnsmasq.pot
|
||||||
@cd $(PO); for f in *.po; do \
|
for f in `cd $(PO); echo *.po`; do \
|
||||||
echo -n msgmerge $$f && $(MSGMERGE) --no-wrap -U $$f ../$(BUILDDIR)/dnsmasq.pot; \
|
echo -n msgmerge $(PO)/$$f && $(MSGMERGE) --no-wrap -U $(PO)/$$f $(BUILDDIR)/dnsmasq.pot; \
|
||||||
done
|
done
|
||||||
|
|
||||||
$(BUILDDIR):
|
$(BUILDDIR):
|
||||||
mkdir $(BUILDDIR)
|
mkdir -p $(BUILDDIR)
|
||||||
|
|
||||||
|
|
||||||
# rules below are targets in recusive makes with cwd=$(SRC)
|
# rules below are targets in recusive makes with cwd=$(SRC)
|
||||||
|
|
||||||
$(OBJS:.o=.c) $(HDRS):
|
$(objs:.o=.c) $(hdrs):
|
||||||
ln -s ../$(SRC)/$@ .
|
ln -s $(top)/$(SRC)/$@ .
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) $(CFLAGS) $(COPTS) $(I18N) $(BUILD_CFLAGS) $(RPM_OPT_FLAGS) -c $<
|
$(CC) $(CFLAGS) $(COPTS) $(i18n) $(build_cflags) $(RPM_OPT_FLAGS) -c $<
|
||||||
|
|
||||||
dnsmasq : $(HDRS) $(OBJS)
|
dnsmasq : $(hdrs) $(objs)
|
||||||
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(BUILD_LIBS) $(LIBS)
|
$(CC) $(LDFLAGS) -o $@ $(objs) $(build_libs) $(LIBS)
|
||||||
|
|
||||||
dnsmasq.pot : $(OBJS:.o=.c) $(HDRS)
|
dnsmasq.pot : $(objs:.o=.c) $(hdrs)
|
||||||
$(XGETTEXT) -d dnsmasq --foreign-user --omit-header --keyword=_ -o $@ -i $(OBJS:.o=.c)
|
$(XGETTEXT) -d dnsmasq --foreign-user --omit-header --keyword=_ -o $@ -i $(objs:.o=.c)
|
||||||
|
|
||||||
%.mo : ../po/%.po dnsmasq.pot
|
%.mo : $(top)/$(PO)/%.po dnsmasq.pot
|
||||||
$(MSGMERGE) -o - ../po/$*.po dnsmasq.pot | $(MSGFMT) -o $*.mo -
|
$(MSGMERGE) -o - $(top)/$(PO)/$*.po dnsmasq.pot | $(MSGFMT) -o $*.mo -
|
||||||
|
|
||||||
|
|
||||||
.PHONY : all clean install install-common all-i18n install-i18n merge
|
.PHONY : all clean install install-common all-i18n install-i18n merge
|
||||||
+6
-9
@@ -9,21 +9,18 @@
|
|||||||
# If we can find one which matches $v[0-9].* then we assume it's
|
# If we can find one which matches $v[0-9].* then we assume it's
|
||||||
# a version-number tag, else we just use the whole string.
|
# a version-number tag, else we just use the whole string.
|
||||||
|
|
||||||
# we're called with pwd == TLD
|
if which git >/dev/null 2>&1 && [ -d $1/.git ]; then
|
||||||
cd ..
|
cd $1; git describe
|
||||||
|
elif grep '\$Format:%d\$' $1/VERSION >/dev/null 2>&1; then
|
||||||
if which git >/dev/null 2>&1 && [ -d .git ]; then
|
|
||||||
git describe
|
|
||||||
elif grep '\$Format:%d\$' VERSION >/dev/null 2>&1; then
|
|
||||||
# unsubstituted VERSION, but no git available.
|
# unsubstituted VERSION, but no git available.
|
||||||
echo UNKNOWN
|
echo UNKNOWN
|
||||||
else
|
else
|
||||||
vers=`cat VERSION | sed 's/[(), ]/\n/ g' | grep $v[0-9] | head -n 1`
|
vers=`cat $1/VERSION | sed 's/[(), ]/,/ g' | tr ',' '\n' | grep $v[0-9]`
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo ${vers#v}
|
echo "${vers}" | head -n 1 | tail -c +2
|
||||||
else
|
else
|
||||||
cat VERSION
|
cat $1/VERSION
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -4,6 +4,6 @@ for f in *; do
|
|||||||
if [ -d $f ]; then
|
if [ -d $f ]; then
|
||||||
$2 -m 755 -d $1/$f/man8
|
$2 -m 755 -d $1/$f/man8
|
||||||
$2 -m 644 $f/dnsmasq.8 $1/$f/man8
|
$2 -m 644 $f/dnsmasq.8 $1/$f/man8
|
||||||
echo installing $1/$f/man8/dnsmasq.8
|
echo installing $f/man8/dnsmasq.8
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
for f in *.mo; do
|
for f in *.mo; do
|
||||||
$2 -m 755 -d $1/${f%.mo}/LC_MESSAGES
|
$2 -m 755 -d $1/${f%.mo}/LC_MESSAGES
|
||||||
$2 -m 644 $f $1/${f%.mo}/LC_MESSAGES/dnsmasq.mo
|
$2 -m 644 $f $1/${f%.mo}/LC_MESSAGES/dnsmasq.mo
|
||||||
echo installing $1/${f%.mo}/LC_MESSAGES/dnsmasq.mo
|
echo installing ${f%.mo}/LC_MESSAGES/dnsmasq.mo
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
@@ -157,6 +157,17 @@
|
|||||||
# an explicit netmask instead.
|
# an explicit netmask instead.
|
||||||
#dhcp-range=192.168.0.0,static
|
#dhcp-range=192.168.0.0,static
|
||||||
|
|
||||||
|
# Enable DHCPv6. Note that the prefix-length does not need to be specified
|
||||||
|
# and defaults to 64 if missing/
|
||||||
|
#dhcp-range=1234::2, 1234::500, 64, 12h
|
||||||
|
|
||||||
|
# Do Router Advertisements, BUT NOT DHCP for this subnet.
|
||||||
|
#dhcp-range=1234::, ra-only
|
||||||
|
|
||||||
|
# Do Router Advertisements, BUT NOT DHCP for this subnet.
|
||||||
|
# Set the lifetime to 46 hours. (Note: minimum lifetime is 2 hours.)
|
||||||
|
#dhcp-range=1234::, ra-only, 48h
|
||||||
|
|
||||||
# Supply parameters for specified hosts using DHCP. There are lots
|
# Supply parameters for specified hosts using DHCP. There are lots
|
||||||
# of valid alternatives, so we will give examples of each. Note that
|
# of valid alternatives, so we will give examples of each. Note that
|
||||||
# IP addresses DO NOT have to be in the range given above, they just
|
# IP addresses DO NOT have to be in the range given above, they just
|
||||||
@@ -219,6 +230,12 @@
|
|||||||
# any machine with Ethernet address starting 11:22:33:
|
# any machine with Ethernet address starting 11:22:33:
|
||||||
#dhcp-host=11:22:33:*:*:*,set:red
|
#dhcp-host=11:22:33:*:*:*,set:red
|
||||||
|
|
||||||
|
# Give a fixed IPv6 address and name to client with
|
||||||
|
# DUID 00:01:00:01:16:d2:83:fc:92:d4:19:e2:d8:b2
|
||||||
|
# Note the MAC addresses CANNOT be used to identify DHCPv6 clients.
|
||||||
|
# Note also the they [] around the IPv6 address are obilgatory.
|
||||||
|
#dhcp-host=id:00:01:00:01:16:d2:83:fc:92:d4:19:e2:d8:b2, fred, [1234::5]
|
||||||
|
|
||||||
# Ignore any clients which are not specified in dhcp-host lines
|
# Ignore any clients which are not specified in dhcp-host lines
|
||||||
# or /etc/ethers. Equivalent to ISC "deny unknown-clients".
|
# or /etc/ethers. Equivalent to ISC "deny unknown-clients".
|
||||||
# This relies on the special "known" tag which is set when
|
# This relies on the special "known" tag which is set when
|
||||||
@@ -270,6 +287,13 @@
|
|||||||
# Set the NTP time server addresses to 192.168.0.4 and 10.10.0.5
|
# Set the NTP time server addresses to 192.168.0.4 and 10.10.0.5
|
||||||
#dhcp-option=option:ntp-server,192.168.0.4,10.10.0.5
|
#dhcp-option=option:ntp-server,192.168.0.4,10.10.0.5
|
||||||
|
|
||||||
|
# Send DHCPv6 option. Note [] around IPv6 addresses.
|
||||||
|
#dhcp-option=option6:dns-server,[1234::77],[1234::88]
|
||||||
|
|
||||||
|
# Send DHCPv6 option for namservers as the machine running
|
||||||
|
# dnsmasq and another.
|
||||||
|
#dhcp-option=option6:dns-server,[::],[1234::88]
|
||||||
|
|
||||||
# Set the NTP time server address to be the same machine as
|
# Set the NTP time server address to be the same machine as
|
||||||
# is running dnsmasq
|
# is running dnsmasq
|
||||||
#dhcp-option=42,0.0.0.0
|
#dhcp-option=42,0.0.0.0
|
||||||
|
|||||||
+9
-3
@@ -704,7 +704,7 @@ and to set the time-server address to 192.168.0.4, do
|
|||||||
.B --dhcp-option = 42,192.168.0.4
|
.B --dhcp-option = 42,192.168.0.4
|
||||||
or
|
or
|
||||||
.B --dhcp-option = option:ntp-server, 192.168.0.4
|
.B --dhcp-option = option:ntp-server, 192.168.0.4
|
||||||
The special address 0.0.0.0 is taken to mean "the address of the
|
The special address 0.0.0.0 (or [::] for DHCPv6) is taken to mean "the address of the
|
||||||
machine running dnsmasq". Data types allowed are comma separated
|
machine running dnsmasq". Data types allowed are comma separated
|
||||||
dotted-quad IP addresses, a decimal number, colon-separated hex digits
|
dotted-quad IP addresses, a decimal number, colon-separated hex digits
|
||||||
and a text string. If the optional tags are given then
|
and a text string. If the optional tags are given then
|
||||||
@@ -1256,9 +1256,15 @@ existing DHCP configuration to provide most data. When RA is enabled,
|
|||||||
dnsmasq will advertise a prefix for each dhcp-range, with default
|
dnsmasq will advertise a prefix for each dhcp-range, with default
|
||||||
router and recursive DNS server as the relevant link-local address on
|
router and recursive DNS server as the relevant link-local address on
|
||||||
the machine running dnsmasq. The "managed address" bits are set,
|
the machine running dnsmasq. The "managed address" bits are set,
|
||||||
except for a dhcp-range which is marked as "ra-only". In which case RA
|
except for a dhcp-range which is marked as "ra-only", in which case RA
|
||||||
is provided by no DHCPv6 service and the managed address bits are
|
is provided by no DHCPv6 service and the managed address bits are
|
||||||
cleared.
|
cleared.
|
||||||
|
.B enable-ra
|
||||||
|
enables router advertisement for prefixes where dnsmasq is doing
|
||||||
|
DHCPv6. It is not needed to "ra-only" prefixes. Creating an "ra-only"
|
||||||
|
prefix and not setting
|
||||||
|
.B enable-ra
|
||||||
|
sends advertisements only to "ra-only" prefixes.
|
||||||
.TP
|
.TP
|
||||||
.B --enable-tftp[=<interface>]
|
.B --enable-tftp[=<interface>]
|
||||||
Enable the TFTP server function. This is deliberately limited to that
|
Enable the TFTP server function. This is deliberately limited to that
|
||||||
|
|||||||
+281
-258
File diff suppressed because it is too large.
Load diff
@@ -358,4 +358,90 @@ void dhcp_update_configs(struct dhcp_config *configs)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
static int join_multicast_worker(struct in6_addr *local, int prefix,
|
||||||
|
int scope, int if_index, int dad, void *vparam)
|
||||||
|
{
|
||||||
|
char ifrn_name[IFNAMSIZ];
|
||||||
|
struct ipv6_mreq mreq;
|
||||||
|
int fd, i, max = *((int *)vparam);
|
||||||
|
struct dhcp_context *context;
|
||||||
|
struct iname *tmp;
|
||||||
|
|
||||||
|
(void)prefix;
|
||||||
|
(void)scope;
|
||||||
|
(void)dad;
|
||||||
|
|
||||||
|
/* record which interfaces we join on, so that we do it at most one per
|
||||||
|
interface, even when they have multiple addresses. Use outpacket
|
||||||
|
as an array of int, since it's always allocated here and easy
|
||||||
|
to expand for theoretical vast numbers of interfaces. */
|
||||||
|
for (i = 0; i < max; i++)
|
||||||
|
if (if_index == ((int *)daemon->outpacket.iov_base)[i])
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if ((fd = socket(PF_INET6, SOCK_DGRAM, 0)) == -1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (!indextoname(fd, if_index, ifrn_name))
|
||||||
|
{
|
||||||
|
close(fd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
|
||||||
|
/* Are we doing DHCP on this interface? */
|
||||||
|
if (!iface_check(AF_INET6, (struct all_addr *)local, ifrn_name))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
for (tmp = daemon->dhcp_except; tmp; tmp = tmp->next)
|
||||||
|
if (tmp->name && (strcmp(tmp->name, ifrn_name) == 0))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
/* weird libvirt-inspired access control */
|
||||||
|
for (context = daemon->dhcp6; context; context = context->next)
|
||||||
|
if (!context->interface || strcmp(context->interface, ifrn_name) == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (!context)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
mreq.ipv6mr_interface = if_index;
|
||||||
|
|
||||||
|
inet_pton(AF_INET6, ALL_RELAY_AGENTS_AND_SERVERS, &mreq.ipv6mr_multiaddr);
|
||||||
|
|
||||||
|
if (daemon->dhcp6 &&
|
||||||
|
setsockopt(daemon->dhcp6fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq, sizeof(mreq)) == -1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
inet_pton(AF_INET6, ALL_SERVERS, &mreq.ipv6mr_multiaddr);
|
||||||
|
|
||||||
|
if (daemon->dhcp6 &&
|
||||||
|
setsockopt(daemon->dhcp6fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq, sizeof(mreq)) == -1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
inet_pton(AF_INET6, ALL_ROUTERS, &mreq.ipv6mr_multiaddr);
|
||||||
|
|
||||||
|
if (daemon->ra_contexts &&
|
||||||
|
setsockopt(daemon->icmp6fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq, sizeof(mreq)) == -1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
expand_buf(&daemon->outpacket, (max+1) * sizeof(int));
|
||||||
|
((int *)daemon->outpacket.iov_base)[max++] = if_index;
|
||||||
|
|
||||||
|
*((int *)vparam) = max;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void join_multicast(void)
|
||||||
|
{
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
if (!iface_enumerate(AF_INET6, &count, join_multicast_worker))
|
||||||
|
die(_("failed to join DHCPv6 multicast group: %s"), NULL, EC_BADNET);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
File renamed without changes.
File renamed without changes.
-88
@@ -24,14 +24,6 @@ struct iface_param {
|
|||||||
int ind;
|
int ind;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct listen_param {
|
|
||||||
int fd_or_iface;
|
|
||||||
struct listen_param *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
static int join_multicast(struct in6_addr *local, int prefix,
|
|
||||||
int scope, int if_index, int dad, void *vparam);
|
|
||||||
|
|
||||||
static int complete_context6(struct in6_addr *local, int prefix,
|
static int complete_context6(struct in6_addr *local, int prefix,
|
||||||
int scope, int if_index, int dad, void *vparam);
|
int scope, int if_index, int dad, void *vparam);
|
||||||
|
|
||||||
@@ -41,7 +33,6 @@ void dhcp6_init(void)
|
|||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
struct sockaddr_in6 saddr;
|
struct sockaddr_in6 saddr;
|
||||||
struct listen_param *listenp, listen;
|
|
||||||
#if defined(IP_TOS) && defined(IPTOS_CLASS_CS6)
|
#if defined(IP_TOS) && defined(IPTOS_CLASS_CS6)
|
||||||
int class = IPTOS_CLASS_CS6;
|
int class = IPTOS_CLASS_CS6;
|
||||||
#endif
|
#endif
|
||||||
@@ -65,88 +56,9 @@ void dhcp6_init(void)
|
|||||||
if (bind(fd, (struct sockaddr *)&saddr, sizeof(struct sockaddr_in6)))
|
if (bind(fd, (struct sockaddr *)&saddr, sizeof(struct sockaddr_in6)))
|
||||||
die(_("failed to bind DHCPv6 server socket: %s"), NULL, EC_BADNET);
|
die(_("failed to bind DHCPv6 server socket: %s"), NULL, EC_BADNET);
|
||||||
|
|
||||||
/* join multicast groups on each interface we're interested in */
|
|
||||||
listen.fd_or_iface = fd;
|
|
||||||
listen.next = NULL;
|
|
||||||
if (!iface_enumerate(AF_INET6, &listen, join_multicast))
|
|
||||||
die(_("failed to join DHCPv6 multicast group: %s"), NULL, EC_BADNET);
|
|
||||||
for (listenp = listen.next; listenp; )
|
|
||||||
{
|
|
||||||
struct listen_param *tmp = listenp->next;
|
|
||||||
free(listenp);
|
|
||||||
listenp = tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
daemon->dhcp6fd = fd;
|
daemon->dhcp6fd = fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int join_multicast(struct in6_addr *local, int prefix,
|
|
||||||
int scope, int if_index, int dad, void *vparam)
|
|
||||||
{
|
|
||||||
char ifrn_name[IFNAMSIZ];
|
|
||||||
struct ipv6_mreq mreq;
|
|
||||||
struct listen_param *listenp, *param = vparam;
|
|
||||||
int fd = param->fd_or_iface;
|
|
||||||
struct dhcp_context *context;
|
|
||||||
struct iname *tmp;
|
|
||||||
|
|
||||||
(void)prefix;
|
|
||||||
(void)scope;
|
|
||||||
(void)dad;
|
|
||||||
|
|
||||||
/* record which interfaces we join on, so
|
|
||||||
that we do it at most one per interface, even when they
|
|
||||||
have multiple addresses */
|
|
||||||
for (listenp = param->next; listenp; listenp = listenp->next)
|
|
||||||
if (if_index == listenp->fd_or_iface)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
if (!indextoname(fd, if_index, ifrn_name))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* Are we doing DHCP on this interface? */
|
|
||||||
if (!iface_check(AF_INET6, (struct all_addr *)local, ifrn_name))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
for (tmp = daemon->dhcp_except; tmp; tmp = tmp->next)
|
|
||||||
if (tmp->name && (strcmp(tmp->name, ifrn_name) == 0))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
/* weird libvirt-inspired access control */
|
|
||||||
for (context = daemon->dhcp6; context; context = context->next)
|
|
||||||
if (!context->interface || strcmp(context->interface, ifrn_name) == 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (!context)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
mreq.ipv6mr_interface = if_index;
|
|
||||||
|
|
||||||
inet_pton(AF_INET6, ALL_RELAY_AGENTS_AND_SERVERS, &mreq.ipv6mr_multiaddr);
|
|
||||||
|
|
||||||
if (setsockopt(fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq, sizeof(mreq)) == -1)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
inet_pton(AF_INET6, ALL_SERVERS, &mreq.ipv6mr_multiaddr);
|
|
||||||
|
|
||||||
if (setsockopt(fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq, sizeof(mreq)) == -1)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
inet_pton(AF_INET6, ALL_ROUTERS, &mreq.ipv6mr_multiaddr);
|
|
||||||
|
|
||||||
if (daemon->icmp6fd != -1 &&
|
|
||||||
setsockopt(daemon->icmp6fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq, sizeof(mreq)) == -1)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
listenp = whine_malloc(sizeof(struct listen_param));
|
|
||||||
listenp->fd_or_iface = if_index;
|
|
||||||
listenp->next = param->next;
|
|
||||||
param->next = listenp;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void dhcp6_packet(time_t now)
|
void dhcp6_packet(time_t now)
|
||||||
{
|
{
|
||||||
struct dhcp_context *context;
|
struct dhcp_context *context;
|
||||||
|
|||||||
File renamed without changes.
+60
-17
@@ -154,24 +154,41 @@ int main (int argc, char **argv)
|
|||||||
before lease_init to allocate buffers it uses.*/
|
before lease_init to allocate buffers it uses.*/
|
||||||
dhcp_common_init();
|
dhcp_common_init();
|
||||||
lease_init(now);
|
lease_init(now);
|
||||||
|
|
||||||
if (daemon->dhcp)
|
if (daemon->dhcp)
|
||||||
dhcp_init();
|
dhcp_init();
|
||||||
#ifdef HAVE_DHCP6
|
|
||||||
daemon->icmp6fd = -1;
|
|
||||||
if (daemon->dhcp6)
|
|
||||||
{
|
|
||||||
/* ra_init before dhcp6_init, so dhcp6_init can setup multicast listening */
|
|
||||||
if (option_bool(OPT_RA))
|
|
||||||
ra_init(now);
|
|
||||||
dhcp6_init();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ifdef HAVE_DHCP6
|
||||||
|
/* Start RA subsystem if --enable-ra OR dhcp-range=<subnet>, ra-only */
|
||||||
|
if (daemon->ra_contexts || option_bool(OPT_RA))
|
||||||
|
{
|
||||||
|
/* link the DHCP6 contexts to the ra-only ones so we can traverse them all
|
||||||
|
from ->ra_contexts, but only the non-ra-onlies from ->dhcp6 */
|
||||||
|
struct dhcp_context *context;
|
||||||
|
|
||||||
|
if (!daemon->ra_contexts)
|
||||||
|
daemon->ra_contexts = daemon->dhcp6;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (context = daemon->ra_contexts; context->next; context = context->next);
|
||||||
|
context->next = daemon->dhcp6;
|
||||||
|
}
|
||||||
|
ra_init(now);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (daemon->dhcp6)
|
||||||
|
dhcp6_init();
|
||||||
|
|
||||||
|
if (daemon->ra_contexts || daemon->dhcp6)
|
||||||
|
join_multicast();
|
||||||
|
# endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!enumerate_interfaces())
|
if (!enumerate_interfaces())
|
||||||
die(_("failed to find list of interfaces: %s"), NULL, EC_MISC);
|
die(_("failed to find list of interfaces: %s"), NULL, EC_MISC);
|
||||||
|
|
||||||
if (option_bool(OPT_NOWILD))
|
if (option_bool(OPT_NOWILD))
|
||||||
{
|
{
|
||||||
create_bound_listeners(1);
|
create_bound_listeners(1);
|
||||||
@@ -211,7 +228,8 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
#if defined(HAVE_SCRIPT)
|
#if defined(HAVE_SCRIPT)
|
||||||
/* Note getpwnam returns static storage */
|
/* Note getpwnam returns static storage */
|
||||||
if ((daemon->dhcp || daemon->dhcp6) && daemon->scriptuser &&
|
if ((daemon->dhcp || daemon->dhcp6) &&
|
||||||
|
daemon->scriptuser &&
|
||||||
(daemon->lease_change_command || daemon->luascript))
|
(daemon->lease_change_command || daemon->luascript))
|
||||||
{
|
{
|
||||||
if ((ent_pw = getpwnam(daemon->scriptuser)))
|
if ((ent_pw = getpwnam(daemon->scriptuser)))
|
||||||
@@ -502,7 +520,7 @@ int main (int argc, char **argv)
|
|||||||
if (daemon->max_logs != 0)
|
if (daemon->max_logs != 0)
|
||||||
my_syslog(LOG_INFO, _("asynchronous logging enabled, queue limit is %d messages"), daemon->max_logs);
|
my_syslog(LOG_INFO, _("asynchronous logging enabled, queue limit is %d messages"), daemon->max_logs);
|
||||||
|
|
||||||
if (option_bool(OPT_RA))
|
if (daemon->ra_contexts)
|
||||||
my_syslog(MS_DHCP | LOG_INFO, _("IPv6 router advertisement enabled"));
|
my_syslog(MS_DHCP | LOG_INFO, _("IPv6 router advertisement enabled"));
|
||||||
|
|
||||||
#ifdef HAVE_DHCP
|
#ifdef HAVE_DHCP
|
||||||
@@ -668,7 +686,7 @@ int main (int argc, char **argv)
|
|||||||
FD_SET(daemon->dhcp6fd, &rset);
|
FD_SET(daemon->dhcp6fd, &rset);
|
||||||
bump_maxfd(daemon->dhcp6fd, &maxfd);
|
bump_maxfd(daemon->dhcp6fd, &maxfd);
|
||||||
|
|
||||||
if (daemon->icmp6fd != -1)
|
if (daemon->ra_contexts)
|
||||||
{
|
{
|
||||||
FD_SET(daemon->icmp6fd, &rset);
|
FD_SET(daemon->icmp6fd, &rset);
|
||||||
bump_maxfd(daemon->icmp6fd, &maxfd);
|
bump_maxfd(daemon->icmp6fd, &maxfd);
|
||||||
@@ -777,7 +795,7 @@ int main (int argc, char **argv)
|
|||||||
if (FD_ISSET(daemon->dhcp6fd, &rset))
|
if (FD_ISSET(daemon->dhcp6fd, &rset))
|
||||||
dhcp6_packet(now);
|
dhcp6_packet(now);
|
||||||
|
|
||||||
if (daemon->icmp6fd != -1 && FD_ISSET(daemon->icmp6fd, &rset))
|
if (daemon->ra_contexts && FD_ISSET(daemon->icmp6fd, &rset))
|
||||||
icmp6_packet();
|
icmp6_packet();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -831,6 +849,11 @@ static void sig_handler(int sig)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void send_alarm(void)
|
||||||
|
{
|
||||||
|
send_event(pipewrite, EVENT_ALARM, 0, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void send_event(int fd, int event, int data, char *msg)
|
void send_event(int fd, int event, int data, char *msg)
|
||||||
{
|
{
|
||||||
struct event_desc ev;
|
struct event_desc ev;
|
||||||
@@ -948,6 +971,16 @@ static void async_event(int pipe, time_t now)
|
|||||||
lease_prune(NULL, now);
|
lease_prune(NULL, now);
|
||||||
lease_update_file(now);
|
lease_update_file(now);
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
else if (daemon->ra_contexts)
|
||||||
|
{
|
||||||
|
/* Not doing DHCP, so no lease system, manage
|
||||||
|
alarms for ra only */
|
||||||
|
time_t next_event = periodic_ra(now);
|
||||||
|
if (next_event != 0)
|
||||||
|
alarm((unsigned)difftime(next_event, now));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1112,6 +1145,16 @@ void clear_cache_and_reload(time_t now)
|
|||||||
lease_update_file(now);
|
lease_update_file(now);
|
||||||
lease_update_dns();
|
lease_update_dns();
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
else if (daemon->ra_contexts)
|
||||||
|
{
|
||||||
|
/* Not doing DHCP, so no lease system, manage
|
||||||
|
alarms for ra only */
|
||||||
|
time_t next_event = periodic_ra(now);
|
||||||
|
if (next_event != 0)
|
||||||
|
alarm((unsigned)difftime(next_event, now));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1397,7 +1440,7 @@ int icmp_ping(struct in_addr addr)
|
|||||||
set_log_writer(&wset, &maxfd);
|
set_log_writer(&wset, &maxfd);
|
||||||
|
|
||||||
#ifdef HAVE_DHCP6
|
#ifdef HAVE_DHCP6
|
||||||
if (daemon->icmp6fd != -1)
|
if (daemon->ra_contexts)
|
||||||
{
|
{
|
||||||
FD_SET(daemon->icmp6fd, &rset);
|
FD_SET(daemon->icmp6fd, &rset);
|
||||||
bump_maxfd(daemon->icmp6fd, &maxfd);
|
bump_maxfd(daemon->icmp6fd, &maxfd);
|
||||||
@@ -1416,7 +1459,7 @@ int icmp_ping(struct in_addr addr)
|
|||||||
check_dns_listeners(&rset, now);
|
check_dns_listeners(&rset, now);
|
||||||
|
|
||||||
#ifdef HAVE_DHCP6
|
#ifdef HAVE_DHCP6
|
||||||
if (daemon->icmp6fd != -1 && FD_ISSET(daemon->icmp6fd, &rset))
|
if (daemon->ra_contexts && FD_ISSET(daemon->icmp6fd, &rset))
|
||||||
icmp6_packet();
|
icmp6_packet();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+8
-4
@@ -56,11 +56,11 @@ typedef unsigned short u16;
|
|||||||
typedef unsigned int u32;
|
typedef unsigned int u32;
|
||||||
typedef unsigned long long u64;
|
typedef unsigned long long u64;
|
||||||
|
|
||||||
#include "dns_protocol.h"
|
#include "dns-protocol.h"
|
||||||
#include "dhcp_protocol.h"
|
#include "dhcp-protocol.h"
|
||||||
#ifdef HAVE_DHCP6
|
#ifdef HAVE_DHCP6
|
||||||
#include "dhcp6_protocol.h"
|
#include "dhcp6-protocol.h"
|
||||||
#include "radv_protocol.h"
|
#include "radv-protocol.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define gettext_noop(S) (S)
|
#define gettext_noop(S) (S)
|
||||||
@@ -967,6 +967,7 @@ unsigned char *extended_hwaddr(int hwtype, int hwlen, unsigned char *hwaddr,
|
|||||||
int make_icmp_sock(void);
|
int make_icmp_sock(void);
|
||||||
int icmp_ping(struct in_addr addr);
|
int icmp_ping(struct in_addr addr);
|
||||||
#endif
|
#endif
|
||||||
|
void send_alarm(void);
|
||||||
void send_event(int fd, int event, int data, char *msg);
|
void send_event(int fd, int event, int data, char *msg);
|
||||||
void clear_cache_and_reload(time_t now);
|
void clear_cache_and_reload(time_t now);
|
||||||
void poll_resolv(int force, int do_reload, time_t now);
|
void poll_resolv(int force, int do_reload, time_t now);
|
||||||
@@ -1058,6 +1059,9 @@ void log_tags(struct dhcp_netid *netid, u32 xid);
|
|||||||
int match_bytes(struct dhcp_opt *o, unsigned char *p, int len);
|
int match_bytes(struct dhcp_opt *o, unsigned char *p, int len);
|
||||||
void dhcp_update_configs(struct dhcp_config *configs);
|
void dhcp_update_configs(struct dhcp_config *configs);
|
||||||
void check_dhcp_hosts(int fatal);
|
void check_dhcp_hosts(int fatal);
|
||||||
|
# ifdef HAVE_DHCP6
|
||||||
|
void join_multicast(void);
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* outpacket.c */
|
/* outpacket.c */
|
||||||
|
|||||||
+30
-6
@@ -106,8 +106,11 @@ void send_from(int fd, int nowild, char *packet, size_t len,
|
|||||||
msg.msg_controllen = 0;
|
msg.msg_controllen = 0;
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retry_send())
|
if (retry_send())
|
||||||
goto retry;
|
goto retry;
|
||||||
|
|
||||||
|
my_syslog(LOG_ERR, _("failed to send packet: %s"), strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -763,12 +766,33 @@ void receive_query(struct listener *listen, time_t now)
|
|||||||
!iface_check(listen->family, &dst_addr, ifr.ifr_name))
|
!iface_check(listen->family, &dst_addr, ifr.ifr_name))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (listen->family == AF_INET &&
|
if (listen->family == AF_INET && option_bool(OPT_LOCALISE))
|
||||||
option_bool(OPT_LOCALISE) &&
|
{
|
||||||
ioctl(listen->fd, SIOCGIFNETMASK, &ifr) == -1)
|
struct irec *iface;
|
||||||
return;
|
|
||||||
|
/* get the netmask of the interface whch has the address we were sent to.
|
||||||
netmask = ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr;
|
This is no neccessarily the interface we arrived on. */
|
||||||
|
|
||||||
|
for (iface = daemon->interfaces; iface; iface = iface->next)
|
||||||
|
if (iface->addr.sa.sa_family == AF_INET &&
|
||||||
|
iface->addr.in.sin_addr.s_addr == dst_addr_4.s_addr)
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* interface may be new */
|
||||||
|
if (!iface)
|
||||||
|
enumerate_interfaces();
|
||||||
|
|
||||||
|
for (iface = daemon->interfaces; iface; iface = iface->next)
|
||||||
|
if (iface->addr.sa.sa_family == AF_INET &&
|
||||||
|
iface->addr.in.sin_addr.s_addr == dst_addr_4.s_addr)
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* If we failed, abandon localisation */
|
||||||
|
if (iface)
|
||||||
|
netmask = iface->netmask;
|
||||||
|
else
|
||||||
|
dst_addr_4.s_addr = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extract_request(header, (size_t)n, daemon->namebuff, &type))
|
if (extract_request(header, (size_t)n, daemon->namebuff, &type))
|
||||||
|
|||||||
+3
-2
@@ -317,7 +317,7 @@ void lease_update_file(time_t now)
|
|||||||
|
|
||||||
#ifdef HAVE_DHCP6
|
#ifdef HAVE_DHCP6
|
||||||
/* do timed RAs and determine when the next is */
|
/* do timed RAs and determine when the next is */
|
||||||
if (option_bool(OPT_RA))
|
if (daemon->ra_contexts)
|
||||||
next_event = periodic_ra(now);
|
next_event = periodic_ra(now);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -614,7 +614,8 @@ void lease_set_expires(struct dhcp_lease *lease, unsigned int len, time_t now)
|
|||||||
if (len != lease->length)
|
if (len != lease->length)
|
||||||
{
|
{
|
||||||
lease->length = len;
|
lease->length = len;
|
||||||
lease->aux_changed = file_dirty = 1;
|
lease->flags |= LEASE_AUX_CHANGED;
|
||||||
|
file_dirty = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -343,12 +343,12 @@ static void nl_routechange(struct nlmsghdr *h)
|
|||||||
|
|
||||||
#ifdef HAVE_DHCP6
|
#ifdef HAVE_DHCP6
|
||||||
/* force RAs to sync new network and pick up new interfaces. */
|
/* force RAs to sync new network and pick up new interfaces. */
|
||||||
if (option_bool(OPT_RA))
|
if (daemon->ra_contexts)
|
||||||
{
|
{
|
||||||
ra_start_unsolicted(dnsmasq_time());
|
ra_start_unsolicted(dnsmasq_time());
|
||||||
/* cause lease_update_file to run after we return, in case we were called from
|
/* cause lease_update_file to run after we return, in case we were called from
|
||||||
iface_enumerate and can't re-enter it now */
|
iface_enumerate and can't re-enter it now */
|
||||||
alarm(1);
|
send_alarm();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -2421,6 +2421,16 @@ static char *one_opt(int option, char *arg, char *gen_prob, int command_line)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
/* lifetimes must be min 2 hrs, by RFC 2462.
|
||||||
|
This gets enforced in radv.c for DHCP ranges
|
||||||
|
which are legitimately less. */
|
||||||
|
if ((new->flags & CONTEXT_RA_ONLY) &&
|
||||||
|
new->lease_time < 7200)
|
||||||
|
new->lease_time = 7200;
|
||||||
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File renamed without changes.
+22
-24
@@ -15,15 +15,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* NB. This code may be called during a DHCPv4 transaction which is in ping-wait
|
/* NB. This code may be called during a DHCPv4 or transaction which is in ping-wait
|
||||||
It therefore cannot use any DHCP buffer resources except outpacket, which is
|
It therefore cannot use any DHCP buffer resources except outpacket, which is
|
||||||
not used by DHCPv4 code. */
|
not used by DHCPv4 code. This code may also be called when DHCP 4 or 6 isn't
|
||||||
|
active, so we ensure that outpacket is allocated here too */
|
||||||
|
|
||||||
#include "dnsmasq.h"
|
#include "dnsmasq.h"
|
||||||
#include <netinet/icmp6.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_DHCP6
|
#ifdef HAVE_DHCP6
|
||||||
|
|
||||||
|
#include <netinet/icmp6.h>
|
||||||
|
|
||||||
struct ra_param {
|
struct ra_param {
|
||||||
int ind, managed, found_context, first;
|
int ind, managed, found_context, first;
|
||||||
char *if_name;
|
char *if_name;
|
||||||
@@ -46,7 +48,6 @@ static time_t ra_short_period_start;
|
|||||||
|
|
||||||
void ra_init(time_t now)
|
void ra_init(time_t now)
|
||||||
{
|
{
|
||||||
struct dhcp_context *context;
|
|
||||||
struct icmp6_filter filter;
|
struct icmp6_filter filter;
|
||||||
int fd;
|
int fd;
|
||||||
#if defined(IP_TOS) && defined(IPTOS_CLASS_CS6)
|
#if defined(IP_TOS) && defined(IPTOS_CLASS_CS6)
|
||||||
@@ -55,6 +56,9 @@ void ra_init(time_t now)
|
|||||||
int val = 255; /* radvd uses this value */
|
int val = 255; /* radvd uses this value */
|
||||||
size_t len = sizeof(int);
|
size_t len = sizeof(int);
|
||||||
|
|
||||||
|
/* ensure this is around even if we're not doing DHCPv6 */
|
||||||
|
expand_buf(&daemon->outpacket, sizeof(struct dhcp_packet));
|
||||||
|
|
||||||
ICMP6_FILTER_SETBLOCKALL(&filter);
|
ICMP6_FILTER_SETBLOCKALL(&filter);
|
||||||
ICMP6_FILTER_SETPASS(ND_ROUTER_SOLICIT, &filter);
|
ICMP6_FILTER_SETPASS(ND_ROUTER_SOLICIT, &filter);
|
||||||
ICMP6_FILTER_SETPASS(ND_ROUTER_ADVERT, &filter);
|
ICMP6_FILTER_SETPASS(ND_ROUTER_ADVERT, &filter);
|
||||||
@@ -73,19 +77,6 @@ void ra_init(time_t now)
|
|||||||
|
|
||||||
daemon->icmp6fd = fd;
|
daemon->icmp6fd = fd;
|
||||||
|
|
||||||
/* link the DHCP6 contexts to the ra-only ones so we can traverse them all
|
|
||||||
from ->ra_contexts, but only the non-ra-onlies from ->dhcp6 */
|
|
||||||
if (!daemon->ra_contexts)
|
|
||||||
daemon->ra_contexts = daemon->dhcp6;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (context = daemon->ra_contexts; context->next; context = context->next);
|
|
||||||
context->next = daemon->dhcp6;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!daemon->dhcp6)
|
|
||||||
die(_("cannot do router advertisement unless DHCPv6 is enabled"), NULL, EC_BADCONF);
|
|
||||||
|
|
||||||
ra_start_unsolicted(now);
|
ra_start_unsolicted(now);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,8 +93,7 @@ void ra_start_unsolicted(time_t now)
|
|||||||
for (context = daemon->ra_contexts; context; context = context->next)
|
for (context = daemon->ra_contexts; context; context = context->next)
|
||||||
context->ra_time = now + (rand16()/13000);
|
context->ra_time = now + (rand16()/13000);
|
||||||
|
|
||||||
/* re-do ras after a short time, in case the first gets lost.
|
/* re-do frequently for a minute or so, in case the first gets lost. */
|
||||||
This is reset once that's done. */
|
|
||||||
ra_short_period_start = now;
|
ra_short_period_start = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,6 +231,9 @@ static void send_ra(int iface, char *iface_name, struct in6_addr *dest)
|
|||||||
|
|
||||||
/* decide where we're sending */
|
/* decide where we're sending */
|
||||||
memset(&addr, 0, sizeof(addr));
|
memset(&addr, 0, sizeof(addr));
|
||||||
|
#ifdef HAVE_SOCKADDR_SA_LEN
|
||||||
|
addr.sin6_len = sizeof(struct sockaddr_in6);
|
||||||
|
#endif
|
||||||
addr.sin6_family = AF_INET6;
|
addr.sin6_family = AF_INET6;
|
||||||
addr.sin6_port = htons(IPPROTO_ICMPV6);
|
addr.sin6_port = htons(IPPROTO_ICMPV6);
|
||||||
if (dest)
|
if (dest)
|
||||||
@@ -251,8 +244,8 @@ static void send_ra(int iface, char *iface_name, struct in6_addr *dest)
|
|||||||
addr.sin6_scope_id = iface;
|
addr.sin6_scope_id = iface;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
inet_pton(AF_INET6, ALL_HOSTS, &addr.sin6_addr);
|
inet_pton(AF_INET6, ALL_HOSTS, &addr.sin6_addr);
|
||||||
|
|
||||||
send_from(daemon->icmp6fd, 0, daemon->outpacket.iov_base, save_counter(0),
|
send_from(daemon->icmp6fd, 0, daemon->outpacket.iov_base, save_counter(0),
|
||||||
(union mysockaddr *)&addr, (struct all_addr *)&parm.link_local, iface);
|
(union mysockaddr *)&addr, (struct all_addr *)&parm.link_local, iface);
|
||||||
|
|
||||||
@@ -282,8 +275,13 @@ static int add_prefixes(struct in6_addr *local, int prefix,
|
|||||||
is_same_net6(local, &context->end6, prefix))
|
is_same_net6(local, &context->end6, prefix))
|
||||||
{
|
{
|
||||||
if (!(context->flags & CONTEXT_RA_ONLY))
|
if (!(context->flags & CONTEXT_RA_ONLY))
|
||||||
param->managed = 1;
|
{
|
||||||
|
/* don't do RA for non-ra-only unless --enable-ra is set */
|
||||||
|
if (!option_bool(OPT_RA))
|
||||||
|
continue;
|
||||||
|
param->managed = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (context->flags & CONTEXT_RA_DONE)
|
if (context->flags & CONTEXT_RA_DONE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -399,7 +397,7 @@ static int iface_search(struct in6_addr *local, int prefix,
|
|||||||
int scope, int if_index, int dad, void *vparam)
|
int scope, int if_index, int dad, void *vparam)
|
||||||
{
|
{
|
||||||
struct search_param *param = vparam;
|
struct search_param *param = vparam;
|
||||||
struct dhcp_context *context, *tmp;
|
struct dhcp_context *context;
|
||||||
|
|
||||||
(void)scope;
|
(void)scope;
|
||||||
(void)dad;
|
(void)dad;
|
||||||
|
|||||||
+24
-9
@@ -1177,11 +1177,27 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
|
|||||||
}
|
}
|
||||||
|
|
||||||
o = new_opt6(opt_cfg->opt);
|
o = new_opt6(opt_cfg->opt);
|
||||||
/* Maye be empty */
|
if (opt_cfg->flags & DHOPT_ADDR6)
|
||||||
if (opt_cfg->val)
|
{
|
||||||
|
int j;
|
||||||
|
struct in6_addr *a = (struct in6_addr *)opt_cfg->val;
|
||||||
|
for (j = 0; j < opt_cfg->len; j+=IN6ADDRSZ, a++)
|
||||||
|
{
|
||||||
|
/* zero means "self" (but not in vendorclass options.) */
|
||||||
|
if (IN6_IS_ADDR_UNSPECIFIED(a))
|
||||||
|
{
|
||||||
|
if (IN6_IS_ADDR_UNSPECIFIED(&context->local6))
|
||||||
|
put_opt6(fallback, IN6ADDRSZ);
|
||||||
|
else
|
||||||
|
put_opt6(&context->local6, IN6ADDRSZ);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
put_opt6(a, IN6ADDRSZ);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (opt_cfg->val)
|
||||||
put_opt6(opt_cfg->val, opt_cfg->len);
|
put_opt6(opt_cfg->val, opt_cfg->len);
|
||||||
end_opt6(o);
|
end_opt6(o);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!done_dns &&
|
if (!done_dns &&
|
||||||
@@ -1200,8 +1216,7 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
|
|||||||
dhcp-option = vi-encap:13,17,....... */
|
dhcp-option = vi-encap:13,17,....... */
|
||||||
for (opt_cfg = daemon->dhcp_opts6; opt_cfg; opt_cfg = opt_cfg->next)
|
for (opt_cfg = daemon->dhcp_opts6; opt_cfg; opt_cfg = opt_cfg->next)
|
||||||
opt_cfg->flags &= ~DHOPT_ENCAP_DONE;
|
opt_cfg->flags &= ~DHOPT_ENCAP_DONE;
|
||||||
|
|
||||||
|
|
||||||
if (oro)
|
if (oro)
|
||||||
for (i = 0; i < opt6_len(oro) - 1; i += 2)
|
for (i = 0; i < opt6_len(oro) - 1; i += 2)
|
||||||
if (opt6_uint(oro, i, 2) == OPTION6_VENDOR_OPTS)
|
if (opt6_uint(oro, i, 2) == OPTION6_VENDOR_OPTS)
|
||||||
@@ -1341,19 +1356,19 @@ static void log6_packet(char *type, unsigned char *clid, int clid_len, struct in
|
|||||||
daemon->dhcp_buff2[0] = 0;
|
daemon->dhcp_buff2[0] = 0;
|
||||||
|
|
||||||
if(option_bool(OPT_LOG_OPTS))
|
if(option_bool(OPT_LOG_OPTS))
|
||||||
my_syslog(MS_DHCP | LOG_INFO, "%u %s(%s) %s %s%s",
|
my_syslog(MS_DHCP | LOG_INFO, "%u %s(%s) %s%s %s",
|
||||||
xid,
|
xid,
|
||||||
type,
|
type,
|
||||||
iface,
|
iface,
|
||||||
daemon->namebuff,
|
|
||||||
daemon->dhcp_buff2,
|
daemon->dhcp_buff2,
|
||||||
|
daemon->namebuff,
|
||||||
string ? string : "");
|
string ? string : "");
|
||||||
else
|
else
|
||||||
my_syslog(MS_DHCP | LOG_INFO, "%s(%s) %s %s%s",
|
my_syslog(MS_DHCP | LOG_INFO, "%s(%s) %s%s %s",
|
||||||
type,
|
type,
|
||||||
iface,
|
iface,
|
||||||
daemon->namebuff,
|
|
||||||
daemon->dhcp_buff2,
|
daemon->dhcp_buff2,
|
||||||
|
daemon->namebuff,
|
||||||
string ? string : "");
|
string ? string : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user