mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-11-06 15:51:41 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83e854e359 | ||
|
|
50303b19d8 | ||
|
|
89382bacaa | ||
|
|
6c559c34df | ||
|
|
adaa6888dd | ||
|
|
a813111379 | ||
|
|
18f0fb050b | ||
|
|
05e92e5afe | ||
|
|
4723d49dad | ||
|
|
fbbc14541a | ||
|
|
5ef33279f2 | ||
|
|
1e02a85970 | ||
|
|
0e88d53faa | ||
|
|
01d1b8ddf2 | ||
|
|
c8257540bc | ||
|
|
2240704863 | ||
|
|
e8ca69ea16 | ||
|
|
da632e7cc1 | ||
|
|
30cd96663f | ||
|
|
7dbe98147d | ||
|
|
5d71d83420 | ||
|
|
38a59a9ff7 | ||
|
|
4b028ad612 | ||
|
|
442560beb4 | ||
|
|
7d2b5c9583 | ||
|
|
29689cfa5a | ||
|
|
52d4abf2f9 | ||
|
|
a953096485 | ||
|
|
884a6dfe6d | ||
|
|
0068301d24 | ||
|
|
353ae4d270 | ||
|
|
e759d426fa | ||
|
|
40ef23b547 | ||
|
|
f5e8562f96 | ||
|
|
1567feae3c | ||
|
|
daf061c9de | ||
|
|
d0e2c6c9ab | ||
|
|
8643ec7fea | ||
|
|
5cfea3d402 | ||
|
|
6c8f21e4a4 | ||
|
|
1d0f91c4a9 | ||
|
|
2a82db4caf | ||
|
|
dd88c17f15 | ||
|
|
8b37270410 | ||
|
|
760169fc43 | ||
|
|
7023e38294 | ||
|
|
a7cf58cc47 | ||
|
|
e25d1a2ea2 | ||
|
|
70969c1757 | ||
|
|
3803437dcc | ||
|
|
eabc6dd76a | ||
|
|
e28d2e2b77 | ||
|
|
96fafe2ed6 | ||
|
|
c81d390f84 | ||
|
|
08456c61f6 | ||
|
|
bc26f9a03f | ||
|
|
6ffeff86be | ||
|
|
f444cddbaf | ||
|
|
d13191a46c | ||
|
|
801ca9a7b7 | ||
|
|
df66e341de | ||
|
|
71ee7ee254 | ||
|
|
a156cae901 | ||
|
|
22b135a116 | ||
|
|
0f08983d85 | ||
|
|
e3e86343fc | ||
|
|
7b6dd880f7 | ||
|
|
b7f4020133 | ||
|
|
c46c7c7584 |
No files matched your search
@@ -1,3 +1,83 @@
|
|||||||
|
version 2.61
|
||||||
|
Re-write interface discovery code on *BSD to use
|
||||||
|
getifaddrs. This is more portable, more straightforward,
|
||||||
|
and allows us to find the prefix length for IPv6
|
||||||
|
addresses.
|
||||||
|
|
||||||
|
Add ra-names, ra-stateless and slaac keywords for DHCPv6.
|
||||||
|
Dnsmasq can now synthesise AAAA records for dual-stack
|
||||||
|
hosts which get IPv6 addresses via SLAAC. It is also now
|
||||||
|
possible to use SLAAC and stateless DHCPv6, and to
|
||||||
|
tell clients to use SLAAC addresses as well as DHCP ones.
|
||||||
|
Thanks to Dave Taht for help with this.
|
||||||
|
|
||||||
|
Add --dhcp-duid to allow DUID-EN uids to be used.
|
||||||
|
|
||||||
|
Explicity send DHCPv6 replies to the correct port, instead
|
||||||
|
of relying on clients to send requests with the correct
|
||||||
|
source address, since at least one client in the wild gets
|
||||||
|
this wrong. Thanks to Conrda Kostecki for help tracking
|
||||||
|
this down.
|
||||||
|
|
||||||
|
Send a preference value of 255 in DHCPv6 replies when
|
||||||
|
--dhcp-authoritative is in effect. This tells clients not
|
||||||
|
to wait around for other DHCP servers.
|
||||||
|
|
||||||
|
Better logging of DHCPv6 options.
|
||||||
|
|
||||||
|
Add --host-record. Thanks to Rob Zwissler for the
|
||||||
|
suggestion.
|
||||||
|
|
||||||
|
Invoke the DHCP script with action "tftp" when a TFTP file
|
||||||
|
transfer completes. The size of the file, address to which
|
||||||
|
it was sent and complete pathname are supplied. Note that
|
||||||
|
version 2.60 introduced some script incompatibilties
|
||||||
|
associated with DHCPv6, and this is a further change. To
|
||||||
|
be safe, scripts should ignore unknown actions, and if
|
||||||
|
not IPv6-aware, should exit if the environment
|
||||||
|
variable DNSMASQ_IAID is set. The use-case for this is
|
||||||
|
to track netboot/install. Suggestion from Shantanu
|
||||||
|
Gadgil.
|
||||||
|
|
||||||
|
Update contrib/port-forward/dnsmasq-portforward to reflect
|
||||||
|
the above.
|
||||||
|
|
||||||
|
Set the environment variable DNSMASQ_LOG_DHCP when running
|
||||||
|
the script id --log-dhcp is in effect, so that script can
|
||||||
|
taylor their logging verbosity. Suggestion from Malte
|
||||||
|
Forkel.
|
||||||
|
|
||||||
|
Arrange that addresses specified with --listen-address
|
||||||
|
work even if there is no interface carrying the
|
||||||
|
address. This is chiefly useful for IPv4 loopback
|
||||||
|
addresses, where any address in 127.0.0.0/8 is a valid
|
||||||
|
loopback address, but normally only 127.0.0.1 appears on
|
||||||
|
the lo interface. Thanks to Mathieu Trudel-Lapierre for
|
||||||
|
the idea and initial patch.
|
||||||
|
|
||||||
|
Fix crash, introduced in 2.60, when a DHCPINFORM is
|
||||||
|
received from a network which has no valid dhcp-range.
|
||||||
|
Thanks to Stephane Glondu for the bug report.
|
||||||
|
|
||||||
|
Add a new DHCP lease time keyword, "deprecated" for
|
||||||
|
--dhcp-range. This is only valid for IPv6, and sets the
|
||||||
|
preffered lease time for both DHCP and RA to zero. The
|
||||||
|
effect is that clients can continue to use the address
|
||||||
|
for existing connections, but new connections will use
|
||||||
|
other addresses, if they exist. This makes hitless
|
||||||
|
renumbering at least possible.
|
||||||
|
|
||||||
|
Fix bug in address6_available() which caused DHCPv6 lease
|
||||||
|
aquistion to fail if more than one dhcp-range in use.
|
||||||
|
|
||||||
|
Provide RDNSS and DNSSL data in router advertisements,
|
||||||
|
using the settings provided for DHCP options
|
||||||
|
option6:domain-search and option6:dns-server.
|
||||||
|
|
||||||
|
Tweak logo/favicon.ico to add some transparency. Thanks to
|
||||||
|
SamLT for work on this.
|
||||||
|
|
||||||
|
|
||||||
version 2.60
|
version 2.60
|
||||||
Fix compilation problem in Mac OS X Lion. Thanks to Olaf
|
Fix compilation problem in Mac OS X Lion. Thanks to Olaf
|
||||||
Flebbe for the patch.
|
Flebbe for the patch.
|
||||||
@@ -76,6 +156,10 @@ version 2.60
|
|||||||
via an interface other than the expected one. Thanks to
|
via an interface other than the expected one. Thanks to
|
||||||
Lorenzo Milesi and John Hanks for spotting this one.
|
Lorenzo Milesi and John Hanks for spotting this one.
|
||||||
|
|
||||||
|
Update French translation. Thanks to Gildas Le Nadan.
|
||||||
|
|
||||||
|
Update Polish translation. Thanks to Jan Psota.
|
||||||
|
|
||||||
|
|
||||||
version 2.59
|
version 2.59
|
||||||
Fix regression in 2.58 which caused failure to start up
|
Fix regression in 2.58 which caused failure to start up
|
||||||
|
|||||||
@@ -46,10 +46,10 @@ MAN = man
|
|||||||
|
|
||||||
#################################################################
|
#################################################################
|
||||||
|
|
||||||
# pmake way.
|
# pmake way. (NB no spaces to keep gmake 3.82 happy)
|
||||||
top != pwd
|
top!=pwd
|
||||||
# GNU make way.
|
# GNU make way.
|
||||||
top ?= $(shell pwd)
|
top?=$(CURDIR)
|
||||||
|
|
||||||
dbus_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --cflags dbus-1`
|
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`
|
dbus_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --libs dbus-1`
|
||||||
@@ -65,7 +65,7 @@ version = -DVERSION='\"`$(top)/bld/get-version $(top)`\"'
|
|||||||
objs = cache.o rfc1035.o util.o option.o forward.o network.o \
|
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 slaac.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
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ LOCAL_SRC_FILES := bpf.c cache.c dbus.c dhcp.c dnsmasq.c \
|
|||||||
netlink.c network.c option.c rfc1035.c \
|
netlink.c network.c option.c rfc1035.c \
|
||||||
rfc2131.c tftp.c util.c conntrack.c \
|
rfc2131.c tftp.c util.c conntrack.c \
|
||||||
dhcp6.c rfc3315.c dhcp-common.c outpacket.c \
|
dhcp6.c rfc3315.c dhcp-common.c outpacket.c \
|
||||||
radv.c
|
radv.c slaac.c
|
||||||
|
|
||||||
LOCAL_MODULE := dnsmasq
|
LOCAL_MODULE := dnsmasq
|
||||||
|
|
||||||
|
|||||||
@@ -34,11 +34,21 @@ if [ ${DNSMASQ_OLD_HOSTNAME} ] && [ ${action} = old ] ; then
|
|||||||
hostname=${DNSMASQ_OLD_HOSTNAME}
|
hostname=${DNSMASQ_OLD_HOSTNAME}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# IPv6 leases are not our concern. no NAT there!
|
||||||
|
if [ ${DNSMASQ_IAID} ] ; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# action init is not relevant, and will only be seen when leasefile-ro is set.
|
# action init is not relevant, and will only be seen when leasefile-ro is set.
|
||||||
if [ ${action} = init ] ; then
|
if [ ${action} = init ] ; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# action tftp is not relevant.
|
||||||
|
if [ ${action} = tftp ] ; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ${hostname} ]; then
|
if [ ${hostname} ]; then
|
||||||
ports=$(sed -n -e "/^${hostname}\ .*/ s/^.* //p" ${PORTSFILE})
|
ports=$(sed -n -e "/^${hostname}\ .*/ s/^.* //p" ${PORTSFILE})
|
||||||
|
|
||||||
|
|||||||
Vendored
+15
@@ -1,3 +1,18 @@
|
|||||||
|
dnsmasq (2.61-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* New upstream.
|
||||||
|
* Provide "dump-stats" initscript method. (closes: #654656)
|
||||||
|
* Add (empty) build-indep and build-arch rules targets.
|
||||||
|
* Bump standards-version to 3.9.3
|
||||||
|
|
||||||
|
-- Simon Kelley <simon@thekelleys.org.uk> Tue, 6 Mar 2012 19:45:43 +0000
|
||||||
|
|
||||||
|
dnsmasq (2.60-2) unstable; urgency=high
|
||||||
|
|
||||||
|
* Fix DHCPv4 segfault. (closes: #665008)
|
||||||
|
|
||||||
|
-- Simon Kelley <simon@thekelleys.org.uk> Fri, 23 Mar 2012 09:37:23 +0000
|
||||||
|
|
||||||
dnsmasq (2.60-1) unstable; urgency=low
|
dnsmasq (2.60-1) unstable; urgency=low
|
||||||
|
|
||||||
* New upstream.
|
* New upstream.
|
||||||
|
|||||||
Vendored
+1
-1
@@ -3,7 +3,7 @@ Section: net
|
|||||||
Priority: optional
|
Priority: optional
|
||||||
Build-depends: gettext, libnetfilter-conntrack-dev [linux-any], libidn11-dev, libdbus-1-dev (>=0.61)
|
Build-depends: gettext, libnetfilter-conntrack-dev [linux-any], libidn11-dev, libdbus-1-dev (>=0.61)
|
||||||
Maintainer: Simon Kelley <simon@thekelleys.org.uk>
|
Maintainer: Simon Kelley <simon@thekelleys.org.uk>
|
||||||
Standards-Version: 3.9.2
|
Standards-Version: 3.9.3
|
||||||
|
|
||||||
Package: dnsmasq
|
Package: dnsmasq
|
||||||
Architecture: all
|
Architecture: all
|
||||||
|
|||||||
Vendored
+4
-1
@@ -256,8 +256,11 @@ case "$1" in
|
|||||||
*) log_success_msg "(unknown)" ; exit 4 ;;
|
*) log_success_msg "(unknown)" ; exit 4 ;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
dump-stats)
|
||||||
|
kill -s USR1 `cat /var/run/dnsmasq/$NAME.pid`
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload|status}" >&2
|
echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload|dump-stats|status}" >&2
|
||||||
exit 3
|
exit 3
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
Vendored
+3
@@ -184,7 +184,10 @@ endef
|
|||||||
# Below here is fairly generic really
|
# Below here is fairly generic really
|
||||||
|
|
||||||
binary: binary-arch binary-indep
|
binary: binary-arch binary-indep
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
build-arch:
|
||||||
|
build-indep:
|
||||||
|
|
||||||
checkroot:
|
checkroot:
|
||||||
test root = "`whoami`"
|
test root = "`whoami`"
|
||||||
|
|||||||
@@ -164,10 +164,37 @@
|
|||||||
# Do Router Advertisements, BUT NOT DHCP for this subnet.
|
# Do Router Advertisements, BUT NOT DHCP for this subnet.
|
||||||
#dhcp-range=1234::, ra-only
|
#dhcp-range=1234::, ra-only
|
||||||
|
|
||||||
|
# Do Router Advertisements, BUT NOT DHCP for this subnet, also try and
|
||||||
|
# add names to the DNS for the IPv6 address of SLAAC-configured dual-stack
|
||||||
|
# hosts. Use the DHCPv4 lease to derive the name, network segment and
|
||||||
|
# MAC address and assume that the host will also have an
|
||||||
|
# IPv6 address calculated using the SLAAC alogrithm.
|
||||||
|
#dhcp-range=1234::, ra-names
|
||||||
|
|
||||||
# Do Router Advertisements, BUT NOT DHCP for this subnet.
|
# Do Router Advertisements, BUT NOT DHCP for this subnet.
|
||||||
# Set the lifetime to 46 hours. (Note: minimum lifetime is 2 hours.)
|
# Set the lifetime to 46 hours. (Note: minimum lifetime is 2 hours.)
|
||||||
#dhcp-range=1234::, ra-only, 48h
|
#dhcp-range=1234::, ra-only, 48h
|
||||||
|
|
||||||
|
# Do DHCP and Router Advertisements for this subnet. Set the A bit in the RA
|
||||||
|
# so that clients can use SLAAC addresses as well as DHCP ones.
|
||||||
|
#dhcp-range=1234::2, 1234::500, slaac
|
||||||
|
|
||||||
|
# Do Router Advertisements and stateless DHCP for this subnet. Clients will
|
||||||
|
# not get addresses from DHCP, but they will get other configuration information.
|
||||||
|
# They will use SLAAC for addresses.
|
||||||
|
#dhcp-range=1234::, ra-stateless
|
||||||
|
|
||||||
|
# Do stateless DHCP, SLAAC, and generate DNS names for SLAAC addresses
|
||||||
|
# from DHCPv4 leases.
|
||||||
|
#dhcp-range=1234::, ra-stateless, ra-names
|
||||||
|
|
||||||
|
# Do router advertisements for all subnets where we're doing DHCPv6
|
||||||
|
# Unless overriden by ra-stateless, ra-names, et al, the router
|
||||||
|
# advertisements will have the M and O bits set, so that the clients
|
||||||
|
# get addresses and configuration from DHCPv6, and the A bit reset, so the
|
||||||
|
# clients don't use SLAAC addresses.
|
||||||
|
#enable-ra
|
||||||
|
|
||||||
# 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
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
+111
-29
@@ -23,7 +23,7 @@ options. It includes a secure, read-only,
|
|||||||
TFTP server to allow net/PXE boot of DHCP hosts and also supports BOOTP.
|
TFTP server to allow net/PXE boot of DHCP hosts and also supports BOOTP.
|
||||||
.PP
|
.PP
|
||||||
Dnsmasq
|
Dnsmasq
|
||||||
supports IPv6 for DNS and TFTP, but not DHCP.
|
supports IPv6 for all functions and a minimal router-advertisemnet daemon.
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
Note that in general missing parameters are allowed and switch off
|
Note that in general missing parameters are allowed and switch off
|
||||||
functions, for instance "--pid-file" disables writing a PID file. On
|
functions, for instance "--pid-file" disables writing a PID file. On
|
||||||
@@ -416,6 +416,22 @@ zone files: the port, weight and priority numbers are in a different
|
|||||||
order. More than one SRV record for a given service/domain is allowed,
|
order. More than one SRV record for a given service/domain is allowed,
|
||||||
all that match are returned.
|
all that match are returned.
|
||||||
.TP
|
.TP
|
||||||
|
.B --host-record=<name>[,<name>....][<IPv4-address>],[IPv6-address]
|
||||||
|
Add A, AAAA and PTR records to the DNS. This adds one or more names to
|
||||||
|
the DNS with associated IPv4 (A) and IPv6 (AAAA) records. A name may
|
||||||
|
appear in more than one
|
||||||
|
.B host-record
|
||||||
|
and therefore be assigned more than one address. Only the first
|
||||||
|
address creates a PTR record linking the address to the name. This is
|
||||||
|
the same rule as is used reading hosts-files.
|
||||||
|
.B host-record
|
||||||
|
options are considered to be read before host-files, so a name
|
||||||
|
appearing there inhibits PTR-record creation if it appears in
|
||||||
|
hosts-file also. Unlike host-files, names are not expanded, even when
|
||||||
|
.B expand-hosts
|
||||||
|
is in effect. Short and long names may appear in the same
|
||||||
|
.B host-record, eg. --host-record=laptop,laptop.thekelleys.org,192.168.0.1,1234::100
|
||||||
|
.TP
|
||||||
.B \-Y, --txt-record=<name>[[,<text>],<text>]
|
.B \-Y, --txt-record=<name>[[,<text>],<text>]
|
||||||
Return a TXT DNS record. The value of TXT record is a set of strings,
|
Return a TXT DNS record. The value of TXT record is a set of strings,
|
||||||
so any number may be included, delimited by commas; use quotes to put
|
so any number may be included, delimited by commas; use quotes to put
|
||||||
@@ -494,9 +510,9 @@ compiled in and the kernel must have conntrack support
|
|||||||
included and configured. This option cannot be combined with
|
included and configured. This option cannot be combined with
|
||||||
--query-port.
|
--query-port.
|
||||||
.TP
|
.TP
|
||||||
.B \-F, --dhcp-range=[interface:<interface>,][tag:<tag>[,tag:<tag>],][set:<tag],]<start-addr>,<end-addr>[,<netmask>[,<broadcast>]][,<lease time>]
|
.B \-F, --dhcp-range=[interface:<interface>,][tag:<tag>[,tag:<tag>],][set:<tag],]<start-addr>[,<end-addr>][,<mode>][,<netmask>[,<broadcast>]][,<lease time>]
|
||||||
.TP
|
.TP
|
||||||
.B \-F, --dhcp-range=[interface:<interface>,][tag:<tag>[,tag:<tag>],][set:<tag],]<start-IPv6addr>,<end-IPv6addr>[,<prefix-len>][,<lease time>]
|
.B \-F, --dhcp-range=[interface:<interface>,][tag:<tag>[,tag:<tag>],][set:<tag],]<start-IPv6addr>[,<end-IPv6addr>][,<mode>][,<prefix-len>][,<lease time>]
|
||||||
|
|
||||||
Enable the DHCP server. Addresses will be given out from the range
|
Enable the DHCP server. Addresses will be given out from the range
|
||||||
<start-addr> to <end-addr> and from statically defined addresses given
|
<start-addr> to <end-addr> and from statically defined addresses given
|
||||||
@@ -506,8 +522,12 @@ options. If the lease time is given, then leases
|
|||||||
will be given for that length of time. The lease time is in seconds,
|
will be given for that length of time. The lease time is in seconds,
|
||||||
or minutes (eg 45m) or hours (eg 1h) or "infinite". If not given,
|
or minutes (eg 45m) or hours (eg 1h) or "infinite". If not given,
|
||||||
the default lease time is one hour. The
|
the default lease time is one hour. The
|
||||||
minimum lease time is two minutes. This
|
minimum lease time is two minutes. For IPv6 ranges, the lease time
|
||||||
option may be repeated, with different addresses, to enable DHCP
|
maybe "deprecated"; this sets the preferred lifetime sent in a DHCP
|
||||||
|
lease or router advertisement to zero, which causes clients to use
|
||||||
|
other addresses, if available, for new connections as a prelude to renumbering.
|
||||||
|
|
||||||
|
This option may be repeated, with different addresses, to enable DHCP
|
||||||
service to more than one network. For directly connected networks (ie,
|
service to more than one network. For directly connected networks (ie,
|
||||||
networks on which the machine running dnsmasq has an interface) the
|
networks on which the machine running dnsmasq has an interface) the
|
||||||
netmask is optional: dnsmasq will determine it from the interface
|
netmask is optional: dnsmasq will determine it from the interface
|
||||||
@@ -532,7 +552,7 @@ When it is prefixed with 'tag:' instead, then its meaning changes from setting
|
|||||||
a tag to matching it. Only one tag may be set, but more than one tag
|
a tag to matching it. Only one tag may be set, but more than one tag
|
||||||
may be matched.
|
may be matched.
|
||||||
|
|
||||||
The end address may be replaced by the keyword
|
The optional <mode> keyword may be
|
||||||
.B static
|
.B static
|
||||||
which tells dnsmasq to enable DHCP for the network specified, but not
|
which tells dnsmasq to enable DHCP for the network specified, but not
|
||||||
to dynamically allocate IP addresses: only hosts which have static
|
to dynamically allocate IP addresses: only hosts which have static
|
||||||
@@ -540,23 +560,50 @@ addresses given via
|
|||||||
.B dhcp-host
|
.B dhcp-host
|
||||||
or from /etc/ethers will be served.
|
or from /etc/ethers will be served.
|
||||||
|
|
||||||
The end address may be replaced by
|
Fot IPv4, the <mode> may be
|
||||||
the keyword
|
|
||||||
.B proxy
|
.B proxy
|
||||||
in which case dnsmasq will provide proxy-DHCP on the specified
|
in which case dnsmasq will provide proxy-DHCP on the specified
|
||||||
subnet. (See
|
subnet. (See
|
||||||
.B pxe-prompt
|
.B pxe-prompt
|
||||||
and
|
and
|
||||||
.B pxe-service
|
.B pxe-service
|
||||||
for details, applies to IPv4 only.)
|
for details.)
|
||||||
|
|
||||||
|
For IPv6, the mode may be some combination of
|
||||||
|
.B ra-only, slaac, ra-names, ra-stateless.
|
||||||
|
|
||||||
The end address may be replaced by
|
|
||||||
the keyword
|
|
||||||
.B ra-only
|
.B ra-only
|
||||||
which tells dnsmasq to offer Router Advertisement only on this subnet,
|
tells dnsmasq to offer Router Advertisement only on this subnet,
|
||||||
and not DHCP. This applies to IPv6 only, see
|
and not DHCP.
|
||||||
.B enable-ra
|
|
||||||
for details.
|
.B slaac
|
||||||
|
tells dnsmasq to offer Router Advertisement on this subnet and to set
|
||||||
|
the A bit in the router advertisement, so that the client will use
|
||||||
|
SLAAC addresses. When used with a DHCP range or static DHCP address
|
||||||
|
this results in the client having both a DHCP-assigned and a SLAAC
|
||||||
|
address.
|
||||||
|
|
||||||
|
.B ra-stateless
|
||||||
|
sends router advertisements with the O and A bits set, and provides a
|
||||||
|
stateless DHCP service. The client will use a SLAAC address, and use
|
||||||
|
DHCP for other configuration information.
|
||||||
|
|
||||||
|
.B ra-names
|
||||||
|
enables a mode
|
||||||
|
which gives DNS names to dual-stack hosts which do SLAAC for
|
||||||
|
IPv6. Dnsmasq uses the host's IPv4 lease to derive the name, network
|
||||||
|
segment and MAC address and assumes that the host will also have an
|
||||||
|
IPv6 address calculated using the SLAAC alogrithm, on the same network
|
||||||
|
segment. The address is pinged, and if a reply is received, an AAAA
|
||||||
|
record is added to the DNS for this IPv6
|
||||||
|
address. Note that this is only happens for directly-connected
|
||||||
|
networks, (not one doing DHCP via a relay) and it will not work
|
||||||
|
if a host is using privacy extensions.
|
||||||
|
.B ra-names
|
||||||
|
can be combined with
|
||||||
|
.B ra-stateless
|
||||||
|
and
|
||||||
|
.B slaac.
|
||||||
|
|
||||||
The interface:<interface name> section is not normally used. See the
|
The interface:<interface name> section is not normally used. See the
|
||||||
NOTES section for details of this.
|
NOTES section for details of this.
|
||||||
@@ -595,7 +642,7 @@ A single
|
|||||||
.B dhcp-host
|
.B dhcp-host
|
||||||
may contain an IPv4 address or an IPv6 address, or both. IPv6 addresses must be bracketed by square brackets thus:
|
may contain an IPv4 address or an IPv6 address, or both. IPv6 addresses must be bracketed by square brackets thus:
|
||||||
.B --dhcp-host=laptop,[1234::56]
|
.B --dhcp-host=laptop,[1234::56]
|
||||||
Note that in IPv6 DHCP, the hardware address is not normally available, so a client must be identified by client-id (called client DUID) in IPv6-land) or hostname.
|
Note that in IPv6 DHCP, the hardware address is not normally available, so a client must be identified by client-id (called client DUID in IPv6-land) or hostname.
|
||||||
|
|
||||||
The special option id:* means "ignore any client-id
|
The special option id:* means "ignore any client-id
|
||||||
and use MAC addresses only." This is useful when a client presents a client-id sometimes
|
and use MAC addresses only." This is useful when a client presents a client-id sometimes
|
||||||
@@ -1031,8 +1078,19 @@ the tags used to determine them.
|
|||||||
.B \-l, --dhcp-leasefile=<path>
|
.B \-l, --dhcp-leasefile=<path>
|
||||||
Use the specified file to store DHCP lease information.
|
Use the specified file to store DHCP lease information.
|
||||||
.TP
|
.TP
|
||||||
|
.B --dhcp-duid=<enterprise-id>,<uid>
|
||||||
|
(IPv6 only) Specify the server persistent UID which the DHCPv6 server
|
||||||
|
will use. This option is not normally required as dnsmasq creates a
|
||||||
|
DUID automatically when it is first needed. When given, this option
|
||||||
|
provides dnsmasq the data required to create a DUID-EN type DUID. Note
|
||||||
|
that once set, the DUID is stored in the lease database, so to change between DUID-EN and
|
||||||
|
automatically created DUIDs or vice-versa, the lease database must be
|
||||||
|
re-intialised. The enterprise-id is assigned by IANA, and the uid is a
|
||||||
|
string of hex octets unique to a particular device.
|
||||||
|
.TP
|
||||||
.B \-6 --dhcp-script=<path>
|
.B \-6 --dhcp-script=<path>
|
||||||
Whenever a new DHCP lease is created, or an old one destroyed, the
|
Whenever a new DHCP lease is created, or an old one destroyed, or a
|
||||||
|
TFTP file transfer completes, the
|
||||||
executable specified by this option is run. <path>
|
executable specified by this option is run. <path>
|
||||||
must be an absolute pathname, no PATH search occurs.
|
must be an absolute pathname, no PATH search occurs.
|
||||||
The arguments to the process
|
The arguments to the process
|
||||||
@@ -1082,6 +1140,8 @@ is known.
|
|||||||
DNSMASQ_TAGS contains all the tags set during the
|
DNSMASQ_TAGS contains all the tags set during the
|
||||||
DHCP transaction, separated by spaces.
|
DHCP transaction, separated by spaces.
|
||||||
|
|
||||||
|
DNSMASQ_LOG_DHCP is set if --log-dhcp is in effect.
|
||||||
|
|
||||||
For IPv4 only:
|
For IPv4 only:
|
||||||
|
|
||||||
DNSMASQ_CLIENT_ID if the host provided a client-id.
|
DNSMASQ_CLIENT_ID if the host provided a client-id.
|
||||||
@@ -1108,6 +1168,8 @@ only supplied for
|
|||||||
since these data are not held in dnsmasq's lease
|
since these data are not held in dnsmasq's lease
|
||||||
database.
|
database.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All file descriptors are
|
All file descriptors are
|
||||||
closed except stdin, stdout and stderr which are open to /dev/null
|
closed except stdin, stdout and stderr which are open to /dev/null
|
||||||
(except in debug mode).
|
(except in debug mode).
|
||||||
@@ -1126,6 +1188,17 @@ all existing leases as they are read from the lease file. Expired
|
|||||||
leases will be called with "del" and others with "old". When dnsmasq
|
leases will be called with "del" and others with "old". When dnsmasq
|
||||||
receives a HUP signal, the script will be invoked for existing leases
|
receives a HUP signal, the script will be invoked for existing leases
|
||||||
with an "old " event.
|
with an "old " event.
|
||||||
|
|
||||||
|
|
||||||
|
There are two further actions which may appear as the first argument
|
||||||
|
to the script, "init" and "tftp". More may be added in the future, so
|
||||||
|
scripts should be written to ignore unknown actions. "init" is
|
||||||
|
decsribed below in
|
||||||
|
.B --leasefile-ro
|
||||||
|
The "tftp" action is invoked when a TFTP file transfer completes: the
|
||||||
|
arguments are the file size in bytes, the address to which the file
|
||||||
|
was sent, and the complete pathname of the file.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B --dhcp-luascript=<path>
|
.B --dhcp-luascript=<path>
|
||||||
Specify a script written in Lua, to be run when leases are created,
|
Specify a script written in Lua, to be run when leases are created,
|
||||||
@@ -1139,11 +1212,13 @@ function, and may provide
|
|||||||
and
|
and
|
||||||
.B shutdown
|
.B shutdown
|
||||||
functions, which are called, without arguments when dnsmasq starts up
|
functions, which are called, without arguments when dnsmasq starts up
|
||||||
and terminates.
|
and terminates. It may also provide a
|
||||||
|
.B tftp
|
||||||
|
function.
|
||||||
|
|
||||||
The
|
The
|
||||||
.B lease
|
.B lease
|
||||||
method receives the information detailed in
|
function receives the information detailed in
|
||||||
.B --dhcp-script.
|
.B --dhcp-script.
|
||||||
It gets two arguments, firstly the action, which is a string
|
It gets two arguments, firstly the action, which is a string
|
||||||
containing, "add", "old" or "del", and secondly a table of tag value
|
containing, "add", "old" or "del", and secondly a table of tag value
|
||||||
@@ -1161,6 +1236,15 @@ for IPv4, and
|
|||||||
and
|
and
|
||||||
.B hostname
|
.B hostname
|
||||||
for IPv6.
|
for IPv6.
|
||||||
|
|
||||||
|
The
|
||||||
|
.B tftp
|
||||||
|
function is called in the same way as the lease function, and the
|
||||||
|
table holds the tags
|
||||||
|
.B destination_address,
|
||||||
|
.B file_name
|
||||||
|
and
|
||||||
|
.B file_size.
|
||||||
.TP
|
.TP
|
||||||
.B --dhcp-scriptuser
|
.B --dhcp-scriptuser
|
||||||
Specify the user as which to run the lease-change script or Lua script. This defaults to root, but can be changed to another user using this flag.
|
Specify the user as which to run the lease-change script or Lua script. This defaults to root, but can be changed to another user using this flag.
|
||||||
@@ -1255,16 +1339,14 @@ only a subset of this is needed, and dnsmasq can handle it, using
|
|||||||
existing DHCP configuration to provide most data. When RA is enabled,
|
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. By default, he "managed address" bits are set, and
|
||||||
except for a dhcp-range which is marked as "ra-only", in which case RA
|
the "use SLAAC" bit is reset. This can be changed for individual
|
||||||
is provided by no DHCPv6 service and the managed address bits are
|
subnets with the mode keywords described in
|
||||||
cleared.
|
.B --dhcp-range.
|
||||||
.B enable-ra
|
RFC6106 DNS parameters are included in the advertisements. By default,
|
||||||
enables router advertisement for prefixes where dnsmasq is doing
|
the relevant link-local address of the machine running dnsmasq is sent
|
||||||
DHCPv6. It is not needed to "ra-only" prefixes. Creating an "ra-only"
|
as recursive DNS server. If provided, the DHCPv6 options dns-server and
|
||||||
prefix and not setting
|
domain-search are used for RDNSS and DNSSL.
|
||||||
.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
|
||||||
|
|||||||
+218
-86
@@ -579,7 +579,9 @@ avec le support conntrack, le noyau doit également inclure conntrack et être
|
|||||||
configuré pour cela. Cette option ne peut pas être combinée avec
|
configuré pour cela. Cette option ne peut pas être combinée avec
|
||||||
--query-port.
|
--query-port.
|
||||||
.TP
|
.TP
|
||||||
.B \-F, --dhcp-range=[interface:<interface>,][tag:<label>[,tag:<label>],][set:<label],]<adresse de début>,<adresse de fin>[,<masque de réseau>[,<broadcast>]][,<durée de bail>]
|
.B \-F, --dhcp-range=[interface:<interface>,][tag:<label>[,tag:<label>],][set:<label>],]<adresse de début>,<adresse de fin>[,<masque de réseau>[,<broadcast>]][,<durée de bail>]
|
||||||
|
.TP
|
||||||
|
.B \-F, --dhcp-range=[interface:<interface>,][tag:<label>[,tag:<label>],][set:<label>],]<addresse IPv6 de début>,<adresse IPv6 de fin>[,<longueur de préfixe>][,<durée de bail>]
|
||||||
Active le serveur DHCP. Les adresses seront données dans la plage comprise entre
|
Active le serveur DHCP. Les adresses seront données dans la plage comprise entre
|
||||||
<adresse de début> et <adresse de fin> et à partir des adresses définies
|
<adresse de début> et <adresse de fin> et à partir des adresses définies
|
||||||
statiquement dans l'option
|
statiquement dans l'option
|
||||||
@@ -604,6 +606,14 @@ est toujours optionnelle.
|
|||||||
|
|
||||||
Il est toujours possible d'avoir plus d'une plage DHCP pour un même
|
Il est toujours possible d'avoir plus d'une plage DHCP pour un même
|
||||||
sous-réseau.
|
sous-réseau.
|
||||||
|
|
||||||
|
Pour IPv6, les paramètres sont légèrement différents : au lieu d'un masque de
|
||||||
|
réseau et d'une adresse de broadcast, il existe une longueur de préfixe
|
||||||
|
optionnelle. Si elle est omise, la valeur par défaut est 64. À la différence
|
||||||
|
d'IPv4, la longueur de préfixe n'est pas automatiquement déduite de la
|
||||||
|
configuration de l'interface. La taille minimale pour la longueur de préfixe
|
||||||
|
est 64.
|
||||||
|
|
||||||
L'identifiant de label optionnel
|
L'identifiant de label optionnel
|
||||||
.B set:<label>
|
.B set:<label>
|
||||||
fournie une étiquette alphanumérique qui identifie ce réseau, afin de permettre
|
fournie une étiquette alphanumérique qui identifie ce réseau, afin de permettre
|
||||||
@@ -627,7 +637,15 @@ spécifié. (voir
|
|||||||
.B pxe-prompt
|
.B pxe-prompt
|
||||||
et
|
et
|
||||||
.B pxe-service
|
.B pxe-service
|
||||||
pour plus de détails).
|
pour plus de détails, s'applique à IPv4 seulement).
|
||||||
|
|
||||||
|
L'adresse de fin peut être remplacée par le mot-clef
|
||||||
|
.B ra-only
|
||||||
|
qui indique à dnsmasq de n'effectuer que des annonces de routeur (Router
|
||||||
|
Advertisement, RA) sur ce sous-réseau, et de ne pas faire de DHCP. Ceci
|
||||||
|
s'applique uniquement à IPv6, voir
|
||||||
|
.B enable-ra
|
||||||
|
pour plus de détails.
|
||||||
|
|
||||||
La section interface:<nom d'interface> n'est normalement pas utilisée. Se
|
La section interface:<nom d'interface> n'est normalement pas utilisée. Se
|
||||||
référer aux indications de la section NOTES pour plus de détail à ce sujet.
|
référer aux indications de la section NOTES pour plus de détail à ce sujet.
|
||||||
@@ -663,6 +681,15 @@ spécifier l'identifiant client sous la forme d'une chaîne de caractères, comm
|
|||||||
ceci :
|
ceci :
|
||||||
.B --dhcp-host=id:identifiantclientsousformedechaine,.....
|
.B --dhcp-host=id:identifiantclientsousformedechaine,.....
|
||||||
|
|
||||||
|
Un seul
|
||||||
|
.B dhcp-host
|
||||||
|
peut contenir une adresse IPv4, une adresse IPv6, ou les deux en même temps.
|
||||||
|
Les adresses IPv6 doivent-être mises entre crochets comme suit :
|
||||||
|
.B --dhcp-host=laptop,[1234::56]
|
||||||
|
A noter que pour le DHCP IPv6, l'adresse matérielle n'est en principe pas
|
||||||
|
disponible, aussi un client doit-être identifié par un identifiant de client
|
||||||
|
(appellé "DUID client") ou un nom d'hôte.
|
||||||
|
|
||||||
L'option spéciale id:* signifie : "ignorer tout identifiant client et n'utiliser
|
L'option spéciale id:* signifie : "ignorer tout identifiant client et n'utiliser
|
||||||
que l'adresse matérielle". Cela est utile lorsqu'un client présente un
|
que l'adresse matérielle". Cela est utile lorsqu'un client présente un
|
||||||
identifiant client mais pas les autres.
|
identifiant client mais pas les autres.
|
||||||
@@ -709,7 +736,7 @@ ARP en les précédant du type ARP (en Hexadécimal) et de "-". Ainsi
|
|||||||
coïncidera uniquement avec des adresses matérielles Token-Ring, puisque le type
|
coïncidera uniquement avec des adresses matérielles Token-Ring, puisque le type
|
||||||
ARP pour une adresse Token-Ring est 6.
|
ARP pour une adresse Token-Ring est 6.
|
||||||
|
|
||||||
Un cas spécial correspond à l'inclusion d'une ou plusieurs adresses
|
Un cas spécial, pour IPv4, correspond à l'inclusion d'une ou plusieurs adresses
|
||||||
matérielles, c-à-d :
|
matérielles, c-à-d :
|
||||||
.B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2.
|
.B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2.
|
||||||
Cela permet à une adresse IP d'être associé à plusieurs adresses
|
Cela permet à une adresse IP d'être associé à plusieurs adresses
|
||||||
@@ -750,22 +777,22 @@ une adresse IP sous la forme de 4 chiffres séparés par des points. Lorsque lu
|
|||||||
par Dnsmasq, ces lignes ont exactement le même effet que l'option
|
par Dnsmasq, ces lignes ont exactement le même effet que l'option
|
||||||
.B --dhcp-host
|
.B --dhcp-host
|
||||||
contenant les mêmes informations. /etc/ethers est relu à la réception d'un
|
contenant les mêmes informations. /etc/ethers est relu à la réception d'un
|
||||||
signal SIGHUP par Dnsmasq.
|
signal SIGHUP par Dnsmasq. Les adresses IPv6 ne sont PAS lues dans /etc/ethers.
|
||||||
.TP
|
.TP
|
||||||
.B \-O, --dhcp-option=[tag:<label>,[tag:<label>]][encap:<option>,][vi-encap:<entreprise>,][vendor:[<classe_vendeur>],][<option>|option:<nom d'option>],[<valeur>[,<valeur>]]
|
.B \-O, --dhcp-option=[tag:<label>,[tag:<label>]][encap:<option>,][vi-encap:<entreprise>,][vendor:[<classe_vendeur>],][<option>|option:<nom d'option>|option6:<option>|option6:<nom d'option>],[<valeur>[,<valeur>]]
|
||||||
Spécifie des options différentes ou supplémentaires pour des clients DHCP. Par
|
Spécifie des options différentes ou supplémentaires pour des clients DHCP. Par
|
||||||
défaut, Dnsmasq envoie un ensemble standard d'options aux clients DHCP : le
|
défaut, Dnsmasq envoie un ensemble standard d'options aux clients DHCP : le
|
||||||
masque de réseau et l'adresse de broadcast sont les mêmes que pour l'hôte
|
masque de réseau et l'adresse de broadcast sont les mêmes que pour l'hôte
|
||||||
sur lequel tourne Dnsmasq, et le serveur DNS ainsi que la route par défaut
|
sur lequel tourne Dnsmasq, et le serveur DNS ainsi que la route par défaut
|
||||||
prennent comme valeur l'adresse de la machine sur laquelle tourne Dnsmasq. Si
|
prennent comme valeur l'adresse de la machine sur laquelle tourne Dnsmasq.
|
||||||
une option de nom de domaine a été définie, son contenu est transmis. Cette
|
(Des règles équivalentes s'appliquent en IPv6). Si une option de nom de domaine
|
||||||
option de configuration permet de changer toutes ces valeurs par défaut, ou de
|
a été définie, son contenu est transmis. Cette option de configuration permet
|
||||||
spécifier d'autres options. L'option DHCP à transmettre peut être fournie sous
|
de changer toutes ces valeurs par défaut, ou de spécifier d'autres options.
|
||||||
forme d'un nombre décimal ou sous la forme "option:<nom d'option>". Les nombres
|
L'option DHCP à transmettre peut être fournie sous forme d'un nombre décimal
|
||||||
correspondants aux options sont définis dans la RFC2132 et suivants. Les noms
|
ou sous la forme "option:<nom d'option>". Les nombres correspondants aux options
|
||||||
d'options connus par Dnsmasq peuvent être obtenus via "Dnsmasq --help dhcp".
|
sont définis dans la RFC2132 et suivants. Les noms d'options connus par Dnsmasq
|
||||||
Par exemple, pour définir la route par défaut à 192.168.4.4, il est possible de
|
peuvent être obtenus via "Dnsmasq --help dhcp". Par exemple, pour définir la
|
||||||
faire
|
route par défaut à 192.168.4.4, il est possible de faire
|
||||||
.B --dhcp-option=3,192.168.4.4
|
.B --dhcp-option=3,192.168.4.4
|
||||||
ou
|
ou
|
||||||
.B --dhcp-option = option:router, 192.168.4.4
|
.B --dhcp-option = option:router, 192.168.4.4
|
||||||
@@ -788,6 +815,13 @@ de l'option 120 sont traités conforméments à la RFC 3361. Les adresses IP sou
|
|||||||
forme de 4 chiffres séparés par des points suivies par une barre montante "/",
|
forme de 4 chiffres séparés par des points suivies par une barre montante "/",
|
||||||
puis une taille de masque sont encodés conforméments à la RFC 3442.
|
puis une taille de masque sont encodés conforméments à la RFC 3442.
|
||||||
|
|
||||||
|
Les options IPv6 sont fournies en utilisant le mot-clef
|
||||||
|
.B option6:
|
||||||
|
suivi par le numéro d'option ou le nom d'option. L'espace de nommage des options
|
||||||
|
IPv6 est disjint de l'espace de nommage des options IPv4. Les adresses IPv6
|
||||||
|
en option doivent être entourées de crochets, comme par exemple :
|
||||||
|
.B --dhcp-option=option6:ntp-server,[1234::56]
|
||||||
|
|
||||||
Attention : aucun test n'étant fait pour vérifier que des données d'un type
|
Attention : aucun test n'étant fait pour vérifier que des données d'un type
|
||||||
adéquat sont envoyées pour un numéro d'option donné, il est tout à fait possible
|
adéquat sont envoyées pour un numéro d'option donné, il est tout à fait possible
|
||||||
de persuader Dnsmasq de générer des paquets DHCP illégaux par une utilisation
|
de persuader Dnsmasq de générer des paquets DHCP illégaux par une utilisation
|
||||||
@@ -806,8 +840,8 @@ d'une chaîne de caractères comme nom de serveur TFTP, il est nécessaire de fa
|
|||||||
comme suit :
|
comme suit :
|
||||||
.B --dhcp-option=66,"1.2.3.4"
|
.B --dhcp-option=66,"1.2.3.4"
|
||||||
|
|
||||||
Les options encapsulées de classes de vendeurs peuvent-être aussi spécifiées en
|
Les options encapsulées de classes de vendeurs peuvent-être aussi spécifiées
|
||||||
utilisant
|
(pour IPv4 seulement) en utilisant
|
||||||
.B --dhcp-option
|
.B --dhcp-option
|
||||||
: par exemple
|
: par exemple
|
||||||
.B --dhcp-option=vendor:PXEClient,1,0.0.0.0
|
.B --dhcp-option=vendor:PXEClient,1,0.0.0.0
|
||||||
@@ -823,7 +857,7 @@ par le client. Il est possible d'omettre complètement une classe de vendeur :
|
|||||||
.B --dhcp-option=vendor:,1,0.0.0.0
|
.B --dhcp-option=vendor:,1,0.0.0.0
|
||||||
Dans ce cas l'option encapsulée est toujours envoyée.
|
Dans ce cas l'option encapsulée est toujours envoyée.
|
||||||
|
|
||||||
Les options peuvent-être encapsulées au sein d'autres options :
|
En IPv4, les options peuvent-être encapsulées au sein d'autres options :
|
||||||
par exemple
|
par exemple
|
||||||
.B --dhcp-option=encap:175, 190, "iscsi-client0"
|
.B --dhcp-option=encap:175, 190, "iscsi-client0"
|
||||||
enverra l'option 175, au sein de laquelle se trouve l'option 190.
|
enverra l'option 175, au sein de laquelle se trouve l'option 190.
|
||||||
@@ -836,7 +870,8 @@ identifiant le vendeur" ("Vendor-Identifying Vendor Options") telle que
|
|||||||
décrite dans le RFC3925. Celles-ci sont spécifiées comme suit :
|
décrite dans le RFC3925. Celles-ci sont spécifiées comme suit :
|
||||||
.B --dhcp-option=vi-encap:2, 10, "text"
|
.B --dhcp-option=vi-encap:2, 10, "text"
|
||||||
Le numéro dans la section vi-encap: est le numéro IANA de l'entreprise servant
|
Le numéro dans la section vi-encap: est le numéro IANA de l'entreprise servant
|
||||||
à identifier cette option.
|
à identifier cette option. Cette forme d'encapsulation est également supportée
|
||||||
|
en IPv6.
|
||||||
|
|
||||||
L'adresse 0.0.0.0 n'est pas traitée de manière particulière lorsque fournie dans
|
L'adresse 0.0.0.0 n'est pas traitée de manière particulière lorsque fournie dans
|
||||||
une option encapsulée.
|
une option encapsulée.
|
||||||
@@ -849,8 +884,8 @@ dans la liste de paramêtres requis. Cela est parfois nécessaire, par exemple l
|
|||||||
de la fourniture d'options à PXELinux.
|
de la fourniture d'options à PXELinux.
|
||||||
.TP
|
.TP
|
||||||
.B --dhcp-no-override
|
.B --dhcp-no-override
|
||||||
Désactive la réutilisation des champs DHCP nom de serveur et nom de
|
(IPv4 seulement) Désactive la réutilisation des champs DHCP nom de serveur et
|
||||||
fichier comme espace supplémentaire pour les options. Si cela est
|
nom de fichier comme espace supplémentaire pour les options. Si cela est
|
||||||
possible, dnsmasq déplace les informations sur le serveur de démarrage
|
possible, dnsmasq déplace les informations sur le serveur de démarrage
|
||||||
et le nom de fichier (fournis par 'dhcp-boot') en dehors des champs
|
et le nom de fichier (fournis par 'dhcp-boot') en dehors des champs
|
||||||
dédiés à cet usage dans les options DHCP. Cet espace supplémentaire est
|
dédiés à cet usage dans les options DHCP. Cet espace supplémentaire est
|
||||||
@@ -859,7 +894,8 @@ quelques rares cas, perturber des clients vieux ou défectueux. Cette
|
|||||||
option force le comportement à l'utilisation des valeurs "simples et sûres"
|
option force le comportement à l'utilisation des valeurs "simples et sûres"
|
||||||
afin d'éviter des problèmes dans de tels cas.
|
afin d'éviter des problèmes dans de tels cas.
|
||||||
.TP
|
.TP
|
||||||
.B \-U, --dhcp-vendorclass=set:<label>,<classe de vendeur>
|
.B \-U, --dhcp-vendorclass=set:<label>,[enterprise:<numéro IANA d'enterprise>,]<classe de vendeur>
|
||||||
|
|
||||||
Associe une chaîne de classe de vendeur à un label. La plupart
|
Associe une chaîne de classe de vendeur à un label. La plupart
|
||||||
des clients DHCP fournissent une "classe de vendeur" ("vendor class") qui
|
des clients DHCP fournissent une "classe de vendeur" ("vendor class") qui
|
||||||
représente, d'une certaine façon, le type d'hôte. Cette option associe des
|
représente, d'une certaine façon, le type d'hôte. Cette option associe des
|
||||||
@@ -875,6 +911,11 @@ en temps que sous-chaîne de caractères au sein de la classe de vendeur fournie
|
|||||||
par le client, de façon à permettre la recherche d'un sous-ensemble de la chaîne
|
par le client, de façon à permettre la recherche d'un sous-ensemble de la chaîne
|
||||||
de caractères ("fuzzy matching"). Le préfixe set: est optionnel mais autorisé
|
de caractères ("fuzzy matching"). Le préfixe set: est optionnel mais autorisé
|
||||||
afin de conserver une certaine homogénéité.
|
afin de conserver une certaine homogénéité.
|
||||||
|
|
||||||
|
Notez qu'en IPv6 (et seulement en IPv6), les noms de classes de vendeurs
|
||||||
|
sont dans un espace de nom associé au numéro attribué à l'entreprise par
|
||||||
|
l'IANA. Ce numéro est fourni par le biais du mot-clef enterprise: et seules
|
||||||
|
les classes de vendeurs associées au numéro spécifié seront cherchées.
|
||||||
.TP
|
.TP
|
||||||
.B \-j, --dhcp-userclass=set:<label>,<classe utilisateur>
|
.B \-j, --dhcp-userclass=set:<label>,<classe utilisateur>
|
||||||
Associe une chaîne de classe d'utilisateur à un label (effectue la
|
Associe une chaîne de classe d'utilisateur à un label (effectue la
|
||||||
@@ -887,7 +928,7 @@ d'impression différent pour les hôtes de la classe "comptes" et ceux de la
|
|||||||
classe "ingénierie".
|
classe "ingénierie".
|
||||||
.TP
|
.TP
|
||||||
.B \-4, --dhcp-mac=set:<label>,<adresse MAC>
|
.B \-4, --dhcp-mac=set:<label>,<adresse MAC>
|
||||||
Associe une adresse matérielle (MAC) à un label. L'adresse
|
(IPv4 uniquement) Associe une adresse matérielle (MAC) à un label. L'adresse
|
||||||
matérielle peut inclure des jokers. Par exemple
|
matérielle peut inclure des jokers. Par exemple
|
||||||
.B --dhcp-mac=set:3com,01:34:23:*:*:*
|
.B --dhcp-mac=set:3com,01:34:23:*:*:*
|
||||||
permet de définir le label "3com" pour n'importe quel hôte dont l'adresse
|
permet de définir le label "3com" pour n'importe quel hôte dont l'adresse
|
||||||
@@ -901,16 +942,19 @@ chaîne de valeurs hexadécimales séparées par des ":", mais il est également
|
|||||||
possible qu'elle le soit sous la forme d'une simple chaîne de caractères. Si
|
possible qu'elle le soit sous la forme d'une simple chaîne de caractères. Si
|
||||||
l'identifiant de circuit ou d'agent correspond exactement à celui fourni par le
|
l'identifiant de circuit ou d'agent correspond exactement à celui fourni par le
|
||||||
relais DHCP, alors le label est apposé.
|
relais DHCP, alors le label est apposé.
|
||||||
|
.B dhcp-remoteid
|
||||||
|
est supporté en IPv6 (mais non dhcp-circuitid).
|
||||||
.TP
|
.TP
|
||||||
.B --dhcp-subscrid=set:<label>,<identifiant d'abonné>
|
.B --dhcp-subscrid=set:<label>,<identifiant d'abonné>
|
||||||
Associe des options de relais DHCP issues de la RFC3993 à des labels.
|
(IPv4 et IPv6) Associe des options de relais DHCP issues de la RFC3993 à des
|
||||||
|
labels.
|
||||||
.TP
|
.TP
|
||||||
.B --dhcp-proxy[=<adresse ip>]......
|
.B --dhcp-proxy[=<adresse ip>]......
|
||||||
Un agent relai DHCP normal est uniquement utilisé pour faire suivre les
|
(IPv4 seulement) Un agent relai DHCP normal est uniquement utilisé pour faire
|
||||||
éléments initiaux de l'interaction avec le serveur DHCP. Une fois que le
|
suivre les éléments initiaux de l'interaction avec le serveur DHCP. Une fois
|
||||||
client est configuré, il communique directement avec le serveur. Cela n'est pas
|
que le client est configuré, il communique directement avec le serveur. Cela
|
||||||
souhaitable si le relais rajoute des informations supplémentaires aux paquets
|
n'est pas souhaitable si le relais rajoute des informations supplémentaires
|
||||||
DHCP, telles que celles utilisées dans
|
aux paquets DHCP, telles que celles utilisées dans
|
||||||
.B dhcp-circuitid
|
.B dhcp-circuitid
|
||||||
et
|
et
|
||||||
.B dhcp-remoteid.
|
.B dhcp-remoteid.
|
||||||
@@ -973,26 +1017,28 @@ configuration dhcp-host de Dnsmasq, ainsi que le contenu des fichiers /etc/hosts
|
|||||||
et /etc/ethers.
|
et /etc/ethers.
|
||||||
.TP
|
.TP
|
||||||
.B --dhcp-generate-names=tag:<label>[,tag:<label>]
|
.B --dhcp-generate-names=tag:<label>[,tag:<label>]
|
||||||
Générer un nom pour les clients DHCP qui autrement n'en aurait pas, en
|
(IPv4 seulement) Générer un nom pour les clients DHCP qui autrement n'en aurait
|
||||||
utilisant l'adresse MAC sous sa forme hexadécimale, séparée par des tirets.
|
pas, en utilisant l'adresse MAC sous sa forme hexadécimale, séparée par des
|
||||||
|
tirets.
|
||||||
Noter que si un hôte fourni un nom, celui-ci sera utilisé de préférence au nom
|
Noter que si un hôte fourni un nom, celui-ci sera utilisé de préférence au nom
|
||||||
autogénéré, à moins que
|
autogénéré, à moins que
|
||||||
.B --dhcp-ignore-names
|
.B --dhcp-ignore-names
|
||||||
ne soit positionné.
|
ne soit positionné.
|
||||||
.TP
|
.TP
|
||||||
.B --dhcp-broadcast=[tag:<label>[,tag:<label>]]
|
.B --dhcp-broadcast=[tag:<label>[,tag:<label>]]
|
||||||
Lorsque tous les labels fournis dans l'option sont présents, toujours utiliser
|
(IPv4 seulement) Lorsque tous les labels fournis dans l'option sont présents,
|
||||||
le broadcast pour communiquer avec l'hôte lorsque celui-ci n'est
|
toujours utiliser le broadcast pour communiquer avec l'hôte lorsque celui-ci
|
||||||
pas configuré. Il est possible de ne spécifier aucun label, auquel cas cette
|
n'est pas configuré. Il est possible de ne spécifier aucun label, auquel cas
|
||||||
option s'applique inconditionnellement. La plupart des clients DHCP nécessitant une réponse par le biais
|
cette option s'applique inconditionnellement. La plupart des clients DHCP
|
||||||
d'un broadcast activent une option dans leur requête, ce qui fait que cela
|
nécessitant une réponse par le biais d'un broadcast activent une option dans
|
||||||
se fait automatiquement, mais ce n'est pas la cas de certains vieux clients BOOTP.
|
leur requête, ce qui fait que cela se fait automatiquement, mais ce n'est pas
|
||||||
|
le cas de certains vieux clients BOOTP.
|
||||||
.TP
|
.TP
|
||||||
.B \-M, --dhcp-boot=[tag:<label>,]<nom de fichier>,[<nom de serveur>[,<adresse de serveur>|<nom du serveur tftp>]]
|
.B \-M, --dhcp-boot=[tag:<label>,]<nom de fichier>,[<nom de serveur>[,<adresse de serveur>|<nom du serveur tftp>]]
|
||||||
Spécifie les options BOOTP devant être retournées par le serveur DHCP. Le nom de
|
(IPv4 seulement) Spécifie les options BOOTP devant être retournées par le
|
||||||
serveur ainsi que l'adresse sont optionnels : s'ils ne sont pas fournis, le nom
|
serveur DHCP. Le nom de serveur ainsi que l'adresse sont optionnels : s'ils
|
||||||
est laissé vide et l'adresse fournie est celle de la machine sur laquelle
|
ne sont pas fournis, le nom est laissé vide et l'adresse fournie est celle de
|
||||||
s'exécute Dnsmasq. Si Dnsmasq founit un service TFTP (voir
|
la machine sur laquelle s'exécute Dnsmasq. Si Dnsmasq founit un service TFTP (voir
|
||||||
.B --enable-tftp
|
.B --enable-tftp
|
||||||
), alors seul un nom de fichier est requis ici pour permettre un démarrage par
|
), alors seul un nom de fichier est requis ici pour permettre un démarrage par
|
||||||
le réseau.
|
le réseau.
|
||||||
@@ -1018,7 +1064,7 @@ Veuillez noter que dans ce mode séquentiel, les clients qui laissent expirer
|
|||||||
leur bail ont beaucoup plus de chance de voir leur adresse IP changer, aussi
|
leur bail ont beaucoup plus de chance de voir leur adresse IP changer, aussi
|
||||||
cette option ne devrait pas être utilisée dans un cas général.
|
cette option ne devrait pas être utilisée dans un cas général.
|
||||||
.TP
|
.TP
|
||||||
.B --pxe-service=[tag:<label>,]<CSA>,<entrée de menu>[,<nom de fichier>|<type de service de démarrage>][,<adresse de serveur>]
|
.B --pxe-service=[tag:<label>,]<CSA>,<entrée de menu>[,<nom de fichier>|<type de service de démarrage>][,<adresse de serveur>|<nom de serveur>]
|
||||||
La plupart des ROMS de démarrage PXE ne permettent au système PXE que la simple
|
La plupart des ROMS de démarrage PXE ne permettent au système PXE que la simple
|
||||||
obtention d'une adresse IP, le téléchargement du fichier spécifié dans
|
obtention d'une adresse IP, le téléchargement du fichier spécifié dans
|
||||||
.B dhcp-boot
|
.B dhcp-boot
|
||||||
@@ -1036,17 +1082,20 @@ client PXE qu'il faut télécharger ce fichier via TFTP, soit depuis ce serveur
|
|||||||
(l'option
|
(l'option
|
||||||
.B enable-tftp
|
.B enable-tftp
|
||||||
doit être spécifiée pour que cela marche), soit depuis un autre serveur TFTP
|
doit être spécifiée pour que cela marche), soit depuis un autre serveur TFTP
|
||||||
si une adresse de serveur est fournie.
|
si une adresse ou un nom de serveur est fournie.
|
||||||
Veuillez noter que le suffixe de "couche" (en principe ".0") est fourni par PXE
|
Veuillez noter que le suffixe de "couche" (en principe ".0") est fourni par PXE
|
||||||
et ne doit pas être rajouté au nom de fichier. Si une valeur numérique entière
|
et ne doit pas être rajouté au nom de fichier. Si une valeur numérique entière
|
||||||
est fournir pour le type de démarrage, en remplacement du nom de fichier, le
|
est fournir pour le type de démarrage, en remplacement du nom de fichier, le
|
||||||
client PXE devra chercher un service de démarrage de ce type sur le réseau.
|
client PXE devra chercher un service de démarrage de ce type sur le réseau.
|
||||||
Cette recherche peut être faite via broadcast ou directement auprès d'un
|
Cette recherche peut être faite via broadcast ou directement auprès d'un
|
||||||
serveur si son adresse IP est fournie dans l'option.
|
serveur si son adresse IP ou son nom sont fournis dans l'option.
|
||||||
Si aucun nom de fichier n'est donné ni aucune valeur de type de service de
|
Si aucun nom de fichier n'est donné ni aucune valeur de type de service de
|
||||||
démarrage n'est fournie (ou qu'une valeur de 0 est donnée pour le type de
|
démarrage n'est fournie (ou qu'une valeur de 0 est donnée pour le type de
|
||||||
service), alors l'entrée de menu provoque l'interruption du démarrage par
|
service), alors l'entrée de menu provoque l'interruption du démarrage par
|
||||||
le réseau et la poursuite du démarrage sur un média local.
|
le réseau et la poursuite du démarrage sur un média local. L'adresse de serveur
|
||||||
|
peut être donnée sous la forme de nom de domaine qui est recherché dans
|
||||||
|
/etc/hosts. Ce nom peut-être associé à plusieurs adresses IP, qui dans ce cas
|
||||||
|
sont utilisées à tour de rôle (en "round-robin").
|
||||||
.TP
|
.TP
|
||||||
.B --pxe-prompt=[tag:<label>,]<invite>[,<délai>]
|
.B --pxe-prompt=[tag:<label>,]<invite>[,<délai>]
|
||||||
Cette option permet d'afficher une invite à la suite du démarrage PXE. Si un
|
Cette option permet d'afficher une invite à la suite du démarrage PXE. Si un
|
||||||
@@ -1079,38 +1128,39 @@ créant des milliers de baux et utilisant beaucoup de mémoire dans le processus
|
|||||||
Dnsmasq.
|
Dnsmasq.
|
||||||
.TP
|
.TP
|
||||||
.B \-K, --dhcp-authoritative
|
.B \-K, --dhcp-authoritative
|
||||||
Cette option doit être donnée lorsque Dnsmasq est le seul serveur DHCP sur le
|
(IPv4 seulement) Cette option doit être donnée lorsque Dnsmasq est le seul
|
||||||
réseau. Cela change le comportement par défaut qui est celui d'un strict respect
|
serveur DHCP sur le réseau. Cela change le comportement par défaut qui est
|
||||||
des RFC, afin que les requêtes DHCP pour des baux inconnus par des hôtes
|
celui d'un strict respect des RFC, afin que les requêtes DHCP pour des baux
|
||||||
inconnus ne soient pas ignorées. Cela permet à de nouveaux hôtes d'obtenir des
|
inconnus par des hôtes inconnus ne soient pas ignorées. Cela permet à de
|
||||||
baux sans tenir compte de fastidieuses temporisations ("timeout"). Cela permet
|
nouveaux hôtes d'obtenir des baux sans tenir compte de fastidieuses
|
||||||
également à Dnsmasq de reconstruire sa base de donnée contenant les baux sans
|
temporisations ("timeout"). Cela permet également à Dnsmasq de reconstruire
|
||||||
que les clients n'aient besoin de redemander un bail, si celle-ci est perdue.
|
sa base de données contenant les baux sans que les clients n'aient besoin de
|
||||||
|
redemander un bail, si celle-ci est perdue.
|
||||||
.TP
|
.TP
|
||||||
.B --dhcp-alternate-port[=<port serveur>[,<port client>]]
|
.B --dhcp-alternate-port[=<port serveur>[,<port client>]]
|
||||||
Change les ports utilisés par défaut pour le DHCP. Si cette option est donnée
|
(IPv4 seulement) Change les ports utilisés par défaut pour le DHCP. Si cette
|
||||||
toute seule sans arguments, alors change les ports utilisés pour le DHCP
|
option est donnée seule sans argument, alors change les ports utilisés pour le
|
||||||
de 67 et 68 respectivement à 1067 et 1068. Si un seul argument est donné, ce
|
DHCP de 67 et 68 respectivement à 1067 et 1068. Si un seul argument est donné, ce
|
||||||
numéro est utilisé pour le port serveur et ce numéro plus 1 est utilisé pour le
|
numéro est utilisé pour le port serveur et ce numéro plus 1 est utilisé pour le
|
||||||
port client. Enfin, en fournissant deux numéros de ports, il est possible de
|
port client. Enfin, en fournissant deux numéros de ports, il est possible de
|
||||||
spécifier arbitrairement 2 ports à la fois pour le serveur et pour le client DHCP.
|
spécifier arbitrairement 2 ports à la fois pour le serveur et pour le client DHCP.
|
||||||
.TP
|
.TP
|
||||||
.B \-3, --bootp-dynamic[=<identifiant de réseau>[,<identifiant de réseau>]]
|
.B \-3, --bootp-dynamic[=<identifiant de réseau>[,<identifiant de réseau>]]
|
||||||
Permet l'allocation dynamique d'adresses IP à des clients BOOTP. Utiliser cette
|
(IPv4 seulement) Permet l'allocation dynamique d'adresses IP à des clients BOOTP.
|
||||||
option avec précaution, une adresse allouée à un client BOOTP étant perpétuelle,
|
Utiliser cette option avec précaution, une adresse allouée à un client BOOTP
|
||||||
et de fait n'est plus disponibles pour d'autres hôtes. Si aucun argument n'est
|
étant perpétuelle, et de fait n'est plus disponibles pour d'autres hôtes. Si
|
||||||
donné, alors cette option permet une allocation dynamique dans tous les cas. Si
|
aucun argument n'est donné, alors cette option permet une allocation dynamique
|
||||||
des arguments sont spécifiés, alors l'allocation ne se fait que lorsque tous
|
dans tous les cas. Si des arguments sont spécifiés, alors l'allocation ne se
|
||||||
les identifiants coïncident. Il est possible de répeter cette option avec
|
fait que lorsque tous les identifiants coïncident. Il est possible de répeter
|
||||||
plusieurs jeux d'arguments.
|
cette option avec plusieurs jeux d'arguments.
|
||||||
.TP
|
.TP
|
||||||
.B \-5, --no-ping
|
.B \-5, --no-ping
|
||||||
Par défaut, le serveur DHCP tente de s'assurer qu'une adresse n'est pas utilisée
|
(IPv4 seulement) Par défaut, le serveur DHCP tente de s'assurer qu'une adresse
|
||||||
avant de l'allouer à un hôte. Cela est fait en envoyant une requête ICMP de type
|
n'est pas utilisée avant de l'allouer à un hôte. Cela est fait en envoyant une
|
||||||
"echo request" (aussi connue sous le nom de "ping") à l'adresse en question. Si
|
requête ICMP de type "echo request" (aussi connue sous le nom de "ping") à
|
||||||
le serveur obtient une réponse, alors l'adresse doit déjà être utilisée et une
|
l'adresse en question. Si le serveur obtient une réponse, alors l'adresse doit
|
||||||
autre est essayée. Cette option permet de supprimer cette vérification. A
|
déjà être utilisée et une autre est essayée. Cette option permet de supprimer
|
||||||
utiliser avec précaution.
|
cette vérification. A utiliser avec précaution.
|
||||||
.TP
|
.TP
|
||||||
.B --log-dhcp
|
.B --log-dhcp
|
||||||
Traces additionnelles pour le service DHCP : enregistre toutes les options
|
Traces additionnelles pour le service DHCP : enregistre toutes les options
|
||||||
@@ -1127,11 +1177,11 @@ chemin est spécifié est exécuté. Le <chemin de fichier> doit être un chemi
|
|||||||
absolu, aucune recherche n'est effectuée via la variable d'environnement PATH.
|
absolu, aucune recherche n'est effectuée via la variable d'environnement PATH.
|
||||||
Les arguments fournis à celui-ci sont soit
|
Les arguments fournis à celui-ci sont soit
|
||||||
"add" ("ajouter"), "old" ("ancien") ou "del" ("supprimer"), suivi de l'adresse
|
"add" ("ajouter"), "old" ("ancien") ou "del" ("supprimer"), suivi de l'adresse
|
||||||
MAC de l'hôte puis l'adresse IP et le nom d'hôte si celui-ci est
|
MAC de l'hôte (ou le DUID pour IPv6) puis l'adresse IP et le nom d'hôte si
|
||||||
connu."add" signifie qu'un bail a été créé, "del" signifie qu'il a été supprimé,
|
celui-ci est connu."add" signifie qu'un bail a été créé, "del" signifie qu'il a
|
||||||
"old" notifie que le bail existait au lancement de Dnsmasq, ou un changement
|
été supprimé, "old" notifie que le bail existait au lancement de Dnsmasq, ou un
|
||||||
d'adresse MAC ou de nom d'hôte pour un bail existant (ou, dans le cas où
|
changement d'adresse MAC ou de nom d'hôte pour un bail existant (ou, dans le cas
|
||||||
leasefile-ro est spécifié, un changement de durée de bail ou d'identifiant
|
où leasefile-ro est spécifié, un changement de durée de bail ou d'identifiant
|
||||||
d'hôte). Si l'adresse Mac est d'un type de réseau autre qu'ethernet, il est
|
d'hôte). Si l'adresse Mac est d'un type de réseau autre qu'ethernet, il est
|
||||||
nécessaire de la préceder du type de réseau, par exemple "06-01:23:45:67:89:ab"
|
nécessaire de la préceder du type de réseau, par exemple "06-01:23:45:67:89:ab"
|
||||||
pour du token ring. Le processus est exécuté en temps que super-utilisateur
|
pour du token ring. Le processus est exécuté en temps que super-utilisateur
|
||||||
@@ -1141,18 +1191,16 @@ pour changer son UID pour celle d'un utilisateur non-privilégié.
|
|||||||
L'environnement est hérité de celui de l'invocation du processus Dnsmasq,
|
L'environnement est hérité de celui de l'invocation du processus Dnsmasq,
|
||||||
auquel se rajoute quelques unes ou toutes les variables décrites ci-dessous :
|
auquel se rajoute quelques unes ou toutes les variables décrites ci-dessous :
|
||||||
|
|
||||||
DNSMASQ_CLIENT_ID, si l'hôte a fourni un identifiant de client.
|
Pour IPv4 et IPv6 :
|
||||||
|
|
||||||
DNSMASQ_DOMAIN si le nom de domaine pleinement qualifié de l'hôte est connu, la
|
DNSMASQ_DOMAIN si le nom de domaine pleinement qualifié de l'hôte est connu, la
|
||||||
part relative au domaine y est stockée. (Notez que le nom d'hôte transmis comme
|
part relative au domaine y est stockée. (Notez que le nom d'hôte transmis comme
|
||||||
argument au script n'est jamais pleinement qualifié).
|
argument au script n'est jamais pleinement qualifié).
|
||||||
|
|
||||||
Si le client fournit une information de classe de vendeur, un nom d'hôte, ou
|
Si le client fournit un nom d'hôte, DNSMASQ_SUPPLIED_HOSTNAME.
|
||||||
des classes d'utilisateur, celles-ci sont fournies dans les
|
|
||||||
variables DNSMASQ_VENDOR_CLASS et DNSMASQ_USER_CLASS0 à DNSMASQ_USER_CLASSn
|
Si le client fournit des classes d'utilisateur, DNSMASQ_USER_CLASS0 à
|
||||||
et DNSMASQ_SUPPLIED_HOSTNAME respectivement, mais seulement pour les actions
|
DNSMASQ_USER_CLASSn.
|
||||||
"add" et "old" lorsqu'un hôte reprend un bail existant, ces variables n'étant
|
|
||||||
pas stockées dans la base de baux de Dnsmasq.
|
|
||||||
|
|
||||||
Si Dnsmasq a été compilé avec l'option HAVE_BROKEN_RTC ("horloge RTC
|
Si Dnsmasq a été compilé avec l'option HAVE_BROKEN_RTC ("horloge RTC
|
||||||
défectueuse"), alors la durée du bail (en secondes) est stockée dans la
|
défectueuse"), alors la durée du bail (en secondes) est stockée dans la
|
||||||
@@ -1175,6 +1223,29 @@ relai DHCP pour contacter Dnsmasq, si l'adresse IP du relai est connue.
|
|||||||
DNSMASQ_TAGS contient tous les labels fournis pendant la transaction DHCP,
|
DNSMASQ_TAGS contient tous les labels fournis pendant la transaction DHCP,
|
||||||
séparés par des espaces.
|
séparés par des espaces.
|
||||||
|
|
||||||
|
Pour IPv4 seulement :
|
||||||
|
|
||||||
|
DNSMASQ_CLIENT_ID, si l'hôte a fourni un identifiant de client.
|
||||||
|
|
||||||
|
Si le client fournit une information de classe de vendeur, DNSMASQ_VENDOR_CLASS.
|
||||||
|
|
||||||
|
Pour IPv6 seulement :
|
||||||
|
|
||||||
|
Si le client fournit une classe de vendeur (vendor-class), positionne
|
||||||
|
DNSMASQ_VENDOR_CLASS_ID avec comme contenu le numéro IANA de l'entreprise pour
|
||||||
|
la classe, et DNSMASQ_VENDOR_CLASS0..DNSMASQ_VENDOR_CLASSn pour les données.
|
||||||
|
|
||||||
|
DNSMASQ_SERVER_DUID contient le DUID du serveur : cette valeur est la même
|
||||||
|
pour chaque appel au script.
|
||||||
|
|
||||||
|
DNSMASQ_IAID contenant l'IAID pour le bail. Si le bail est une allocation
|
||||||
|
temporaire, cela est préfixé par le caractère 'T'.
|
||||||
|
|
||||||
|
A noter que le nom d'hôte fourni, la classe de vendeur ou les données de classe
|
||||||
|
d'utilisateur sont uniquement fournies pour les actions "add" ou l'action "old"
|
||||||
|
lorsqu'un hôte reprend un bail existant, puisque ces informations ne sont pas
|
||||||
|
conservées dans la base de baux de dnsmasq.
|
||||||
|
|
||||||
Tous les descripteurs de fichiers sont fermés, sauf stdin, stdout et stderr qui
|
Tous les descripteurs de fichiers sont fermés, sauf stdin, stdout et stderr qui
|
||||||
sont ouverts sur /dev/null (sauf en mode déverminage).
|
sont ouverts sur /dev/null (sauf en mode déverminage).
|
||||||
|
|
||||||
@@ -1192,10 +1263,49 @@ dans le fichier des baux. Le script sera lancé avec l'action "del" pour les
|
|||||||
baux expirés, et "old" pour les autres. Lorsque Dnsmasq reçoit un signal HUP,
|
baux expirés, et "old" pour les autres. Lorsque Dnsmasq reçoit un signal HUP,
|
||||||
le script sera invoqué avec une action "old" pour tous les baux existants.
|
le script sera invoqué avec une action "old" pour tous les baux existants.
|
||||||
.TP
|
.TP
|
||||||
|
.B --dhcp-luascript=<chemin>
|
||||||
|
Spécifie un script écrit en Lua, devant être exécuté lorsque des baux sont
|
||||||
|
créés, détruits ou modifiés. Pour utiliser cette option, dnsmasq doit être
|
||||||
|
compilé avec avec le support de Lua. L'interpréteur Lua est initialisé une
|
||||||
|
seule fois, lorsque dnsmasq démarre, ce qui fait que les variables globales
|
||||||
|
persistent entre les évênements liés aux baux. Le code Lua doit définir une
|
||||||
|
fonction
|
||||||
|
.B lease
|
||||||
|
et peut fournir des fonctions
|
||||||
|
.B init
|
||||||
|
et
|
||||||
|
.B shutdown
|
||||||
|
qui sont appellées, sans arguments, lorsque dnsmasq démarre ou s'arrête.
|
||||||
|
|
||||||
|
La méthode
|
||||||
|
.B lease
|
||||||
|
reçoit les informations détaillées dans
|
||||||
|
.B --dhcp-script.
|
||||||
|
Il reçoit deux arguments. Le premier spécifie l'action, qui est une chaîne de
|
||||||
|
caractères contenant les valeurs "add" (ajout), "old" (réactivation d'un bail
|
||||||
|
existant) ou "del" (suppression). Le deuxième est une table contenant des
|
||||||
|
paires de valeurs de labels. Les labels correspondent pour l'essentiel aux
|
||||||
|
valeurs d'environnement détaillées ci-dessus, ainsi le label "domain" (domaine)
|
||||||
|
contient les mêmes données que la variable d'environnement DNSMASQ_DOMAIN. Il
|
||||||
|
existe quelques labels supplémentaires contenant les données fournies comme
|
||||||
|
arguments à
|
||||||
|
.B --dhcp-script.
|
||||||
|
Ces labels sont
|
||||||
|
.B mac_address, ip_address
|
||||||
|
(pour respectivement l'adresse MAC et l'adresse IP)
|
||||||
|
et
|
||||||
|
.B hostname
|
||||||
|
(le nom d'hôte) dans le cas d'IPv4, et
|
||||||
|
.B client_duid, ip_address
|
||||||
|
(valeur DUID du client et adresse IP respectivement)
|
||||||
|
ainsi que
|
||||||
|
.B hostname
|
||||||
|
(le nom d'hôte) dans le cas d'IPv6.
|
||||||
|
.TP
|
||||||
.B --dhcp-scriptuser
|
.B --dhcp-scriptuser
|
||||||
Spécifie l'utilisateur sous lequel le script lease-change doit être exécuté. La
|
Spécifie l'utilisateur sous lequel le script shell lease-change ou le script
|
||||||
valeur par défaut correspond à l'utilisateur root mais peut-être changée par le
|
doivent être exécutés. La valeur par défaut correspond à l'utilisateur root
|
||||||
biais de cette option.
|
mais peut-être changée par le biais de cette option.
|
||||||
.TP
|
.TP
|
||||||
.B \-9, --leasefile-ro
|
.B \-9, --leasefile-ro
|
||||||
Supprimer complètement l'usage du fichier servant de base de donnée pour les
|
Supprimer complètement l'usage du fichier servant de base de donnée pour les
|
||||||
@@ -1280,6 +1390,32 @@ sans gamme d'adresses de spécifié lorsque l'option
|
|||||||
.B --dhcp-fqdn
|
.B --dhcp-fqdn
|
||||||
est configurée.
|
est configurée.
|
||||||
.TP
|
.TP
|
||||||
|
.B --dhcp-client-update
|
||||||
|
Normalement, lorsque dnsmasq fournit un bail DHCP, il positionne un label
|
||||||
|
dans l'option FQDN pour indiquer au client qu'il ne doit pas tenter de faire
|
||||||
|
une mise à jour DDNS avec son nom et son adresse IP. Ceci parce que la paire
|
||||||
|
Nom-IP est rajoutée automatiquement dans la partie DNS de dnsmasq. Cette option
|
||||||
|
inhibe ce comportement ce qui est utile, par exemple, pour permettre aux clients
|
||||||
|
Windows de la mise à jour de serveurs Active Directory. Voir la RFC 4702 pour
|
||||||
|
plus de détails.
|
||||||
|
.TP
|
||||||
|
.B --enable-ra
|
||||||
|
Active la fonctionalité d'annonces routeurs IPv6 ("IPv6 Router Advertisement").
|
||||||
|
DHCPv6 ne gère pas la configuration complète du réseau de la même façon que
|
||||||
|
DHCPv4. La découverte de routeurs et la découverte (éventuelle) de préfixes pour
|
||||||
|
la création autonome d'adresse sont gérées par un protocole différent.
|
||||||
|
Lorsque DHCP est utilisé, seul un sous-ensemble de tout ceci est nécessaire et
|
||||||
|
dnsmasq est à même de le gérer, en utilisant la configuration DHCP présente pour
|
||||||
|
fournir la majorité des données. Lorsque les annonces routeurs (RA pour "Router
|
||||||
|
Advertisement") sont activées, dnsmasq va annoncer un préfixe pour chaque
|
||||||
|
dhcp-range et, par défaut, fournir comme valeur de routeur et de DNS récursif
|
||||||
|
la valeur d'adresse link-local appropriée parmi celles de la machine sur
|
||||||
|
laquelle tourne dnsmasq.
|
||||||
|
Les bits "managed address" sont positionnés, sauf pour un dhcp-range marqué
|
||||||
|
comme "ra-only" (annonce routeur uniquement). Dans ce cas le service d'annonce
|
||||||
|
routeur est rendu mais aucun service DHCPv6 n'est assuré, et les bits "managed
|
||||||
|
address" ne sont pas positionnés.
|
||||||
|
.TP
|
||||||
.B --enable-tftp[=<interface>]
|
.B --enable-tftp[=<interface>]
|
||||||
Active la fonction serveur TFTP. Celui-ci est de manière délibérée limité aux
|
Active la fonction serveur TFTP. Celui-ci est de manière délibérée limité aux
|
||||||
fonctions nécessaires au démarrage par le réseau ("net-boot") d'un client. Seul
|
fonctions nécessaires au démarrage par le réseau ("net-boot") d'un client. Seul
|
||||||
@@ -1547,10 +1683,6 @@ ligne de commande au lieu d'un fichier de configuration, ne pas oublier
|
|||||||
d'échapper le caractère !, qui est un méta-caractère d'interpréteur de commande
|
d'échapper le caractère !, qui est un méta-caractère d'interpréteur de commande
|
||||||
shell).
|
shell).
|
||||||
|
|
||||||
+When selecting dhcp-options, a tag from dhcp-range is second class
|
|
||||||
+relative to other tags, to make it easy to override options for
|
|
||||||
+individual hosts, so
|
|
||||||
|
|
||||||
Lors de la sélection d'une option, une étiquette spécifiée par dhcp-range
|
Lors de la sélection d'une option, une étiquette spécifiée par dhcp-range
|
||||||
passe après les autres étiquettes, ce qui permet de facilement remplacer des
|
passe après les autres étiquettes, ce qui permet de facilement remplacer des
|
||||||
option génériques pour des hôtes spécifiques, ainsi :
|
option génériques pour des hôtes spécifiques, ainsi :
|
||||||
|
|||||||
@@ -1128,9 +1128,10 @@ msgstr "DHCP, Proxy im Subnetz %.0s%s%.0s"
|
|||||||
msgid "DHCP, IP range %s -- %s, lease time %s"
|
msgid "DHCP, IP range %s -- %s, lease time %s"
|
||||||
msgstr "DHCP, IP-Bereich %s - %s, Lease-Zeit %s "
|
msgstr "DHCP, IP-Bereich %s - %s, Lease-Zeit %s "
|
||||||
|
|
||||||
|
# FIXME: this and the next few must be full strings to be translatable - do not assemble in code"
|
||||||
#: dnsmasq.c:588
|
#: dnsmasq.c:588
|
||||||
msgid "root is "
|
msgid "root is "
|
||||||
msgstr "FIXME: this and the next few must be full strings to be translatable - do not assemble in code"
|
msgstr ""
|
||||||
|
|
||||||
#: dnsmasq.c:588
|
#: dnsmasq.c:588
|
||||||
msgid "enabled"
|
msgid "enabled"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ msgstr ""
|
|||||||
"Project-Id-Version: dnsmasq 2.56\n"
|
"Project-Id-Version: dnsmasq 2.56\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2009-06-18 12:24+0100\n"
|
"POT-Creation-Date: 2009-06-18 12:24+0100\n"
|
||||||
"PO-Revision-Date: 2011-08-16 14:17+0100\n"
|
"PO-Revision-Date: 2012-03-02 16:26+0100\n"
|
||||||
"Last-Translator: Gildas Le Nadan <3ntr0p13@gmail.com>\n"
|
"Last-Translator: Gildas Le Nadan <3ntr0p13@gmail.com>\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=ISO-8859-1\n"
|
"Content-Type: text/plain; charset=ISO-8859-1\n"
|
||||||
@@ -410,17 +410,14 @@ msgid "Disable ICMP echo address checking in the DHCP server."
|
|||||||
msgstr "Supprime la vérification d'adresse sur le serveur au moyen de paquets ICMP echo"
|
msgstr "Supprime la vérification d'adresse sur le serveur au moyen de paquets ICMP echo"
|
||||||
|
|
||||||
#: option.c:325
|
#: option.c:325
|
||||||
#, fuzzy
|
|
||||||
msgid "Shell script to run on DHCP lease creation and destruction."
|
msgid "Shell script to run on DHCP lease creation and destruction."
|
||||||
msgstr "Script à exécuter lors de la création ou destruction de bail DHCP."
|
msgstr "Script shell à exécuter lors de la création ou destruction de bail DHCP."
|
||||||
|
|
||||||
#: option.c:326
|
#: option.c:326
|
||||||
#, fuzzy
|
|
||||||
msgid "Lua script to run on DHCP lease creation and destruction."
|
msgid "Lua script to run on DHCP lease creation and destruction."
|
||||||
msgstr "Script à exécuter lors de la création ou destruction de bail DHCP."
|
msgstr "Script Lua à exécuter lors de la création ou destruction de bail DHCP."
|
||||||
|
|
||||||
#: option.c:327
|
#: option.c:327
|
||||||
#, fuzzy
|
|
||||||
msgid "Run lease-change scripts as this user."
|
msgid "Run lease-change scripts as this user."
|
||||||
msgstr "Lancer le script 'lease-change' avec cet utilisateur."
|
msgstr "Lancer le script 'lease-change' avec cet utilisateur."
|
||||||
|
|
||||||
@@ -573,11 +570,11 @@ msgstr "Copie les marques de suivi de connexion pour les requ
|
|||||||
|
|
||||||
#: option.c:363
|
#: option.c:363
|
||||||
msgid "Allow DHCP clients to do their own DDNS updates."
|
msgid "Allow DHCP clients to do their own DDNS updates."
|
||||||
msgstr ""
|
msgstr "Autoriser les clients DHCP à faire leurs propres mises à jour DDNS (Dynamic DNS)"
|
||||||
|
|
||||||
#: option.c:364
|
#: option.c:364
|
||||||
msgid "Send router-advertisements for interfaces doing DHCPv6"
|
msgid "Send router-advertisements for interfaces doing DHCPv6"
|
||||||
msgstr ""
|
msgstr "envoyer des annonces de routeurs pour toutes les interfaces faisant du DHCPv6"
|
||||||
|
|
||||||
#: option.c:782
|
#: option.c:782
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -604,13 +601,13 @@ msgid "Known DHCP options:\n"
|
|||||||
msgstr "Options DHCP connues :\n"
|
msgstr "Options DHCP connues :\n"
|
||||||
|
|
||||||
#: option.c:838
|
#: option.c:838
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "Known DHCPv6 options:\n"
|
msgid "Known DHCPv6 options:\n"
|
||||||
msgstr "Options DHCP connues :\n"
|
msgstr "Options DHCPv6 connues :\n"
|
||||||
|
|
||||||
#: option.c:973
|
#: option.c:973
|
||||||
msgid "unsupported encapsulation for IPv6 option"
|
msgid "unsupported encapsulation for IPv6 option"
|
||||||
msgstr ""
|
msgstr "encapsulation d'option non supportée pour IPv6"
|
||||||
|
|
||||||
#: option.c:1001
|
#: option.c:1001
|
||||||
msgid "bad dhcp-option"
|
msgid "bad dhcp-option"
|
||||||
@@ -623,9 +620,8 @@ msgstr "mauvaise adresse IP"
|
|||||||
|
|
||||||
#
|
#
|
||||||
#: option.c:1071 option.c:1177 option.c:2511
|
#: option.c:1071 option.c:1177 option.c:2511
|
||||||
#, fuzzy
|
|
||||||
msgid "bad IPv6 address"
|
msgid "bad IPv6 address"
|
||||||
msgstr "mauvaise adresse IP"
|
msgstr "mauvaise adresse IPv6"
|
||||||
|
|
||||||
#: option.c:1205
|
#: option.c:1205
|
||||||
msgid "bad domain in dhcp-option"
|
msgid "bad domain in dhcp-option"
|
||||||
@@ -683,12 +679,11 @@ msgstr "ne peut ex
|
|||||||
|
|
||||||
#: option.c:1603
|
#: option.c:1603
|
||||||
msgid "recompile with HAVE_SCRIPT defined to enable lease-change scripts"
|
msgid "recompile with HAVE_SCRIPT defined to enable lease-change scripts"
|
||||||
msgstr "pour permettre l'exécution de scripts au changement de bail (lease-change), recompiler en définissant HAVE_SCRIPT"
|
msgstr "recompiler en définissant HAVE_SCRIPT pour permettre l'exécution de scripts shell au changement de bail (lease-change)"
|
||||||
|
|
||||||
#: option.c:1607
|
#: option.c:1607
|
||||||
#, fuzzy
|
|
||||||
msgid "recompile with HAVE_LUASCRIPT defined to enable Lua scripts"
|
msgid "recompile with HAVE_LUASCRIPT defined to enable Lua scripts"
|
||||||
msgstr "pour permettre l'exécution de scripts au changement de bail (lease-change), recompiler en définissant HAVE_SCRIPT"
|
msgstr "recompiler en définissant HAVE_LUASCRIPT pour permettre l'exécution de scripts LUA au changement de bail (lease-change)"
|
||||||
|
|
||||||
#: option.c:1988 option.c:1992
|
#: option.c:1988 option.c:1992
|
||||||
msgid "bad port"
|
msgid "bad port"
|
||||||
@@ -726,12 +721,11 @@ msgstr "plage d'adresses DHCP incoh
|
|||||||
|
|
||||||
#: option.c:2374
|
#: option.c:2374
|
||||||
msgid "prefix must be at least 64"
|
msgid "prefix must be at least 64"
|
||||||
msgstr ""
|
msgstr "la valeur de préfixe doit être au minimum 64"
|
||||||
|
|
||||||
#: option.c:2378
|
#: option.c:2378
|
||||||
#, fuzzy
|
|
||||||
msgid "inconsistent DHCPv6 range"
|
msgid "inconsistent DHCPv6 range"
|
||||||
msgstr "plage d'adresses DHCP incohérente"
|
msgstr "plage d'adresses DHCPv6 incohérente"
|
||||||
|
|
||||||
#: option.c:2481 option.c:2521
|
#: option.c:2481 option.c:2521
|
||||||
msgid "bad hex constant"
|
msgid "bad hex constant"
|
||||||
@@ -851,7 +845,7 @@ msgid "Dnsmasq version %s %s\n"
|
|||||||
msgstr "Version de Dnsmasq %s %s\n"
|
msgstr "Version de Dnsmasq %s %s\n"
|
||||||
|
|
||||||
#: option.c:3781
|
#: option.c:3781
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"Compile time options: %s\n"
|
"Compile time options: %s\n"
|
||||||
"\n"
|
"\n"
|
||||||
@@ -919,9 +913,9 @@ msgid "syntax check OK"
|
|||||||
msgstr "vérification de syntaxe OK"
|
msgstr "vérification de syntaxe OK"
|
||||||
|
|
||||||
#: forward.c:113
|
#: forward.c:113
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "failed to send packet: %s"
|
msgid "failed to send packet: %s"
|
||||||
msgstr "impossible de lire sur la socket : %s"
|
msgstr "impossible d'envoyer le paquet : %s"
|
||||||
|
|
||||||
#: forward.c:474
|
#: forward.c:474
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -1108,7 +1102,7 @@ msgstr "mode asynchrone d'
|
|||||||
|
|
||||||
#: dnsmasq.c:524
|
#: dnsmasq.c:524
|
||||||
msgid "IPv6 router advertisement enabled"
|
msgid "IPv6 router advertisement enabled"
|
||||||
msgstr ""
|
msgstr "annonces de routeur IPv6 activées"
|
||||||
|
|
||||||
#: dnsmasq.c:554
|
#: dnsmasq.c:554
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -1116,9 +1110,9 @@ msgid "DHCP, static leases only on %.0s%s, lease time %s"
|
|||||||
msgstr "baux statiques DHCP seulement sur %.0s%s, durée de validité de bail %s"
|
msgstr "baux statiques DHCP seulement sur %.0s%s, durée de validité de bail %s"
|
||||||
|
|
||||||
#: dnsmasq.c:556
|
#: dnsmasq.c:556
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "router advertisement only on %.0s%s, lifetime %s"
|
msgid "router advertisement only on %.0s%s, lifetime %s"
|
||||||
msgstr "baux statiques DHCP seulement sur %.0s%s, durée de validité de bail %s"
|
msgstr "annonces de routeurs seulement sur %.0s%s, durée de validité %s"
|
||||||
|
|
||||||
#: dnsmasq.c:558
|
#: dnsmasq.c:558
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -1183,25 +1177,25 @@ msgid "failed to open pidfile %s: %s"
|
|||||||
msgstr "impossible de lire le fichier de PID %s : %s"
|
msgstr "impossible de lire le fichier de PID %s : %s"
|
||||||
|
|
||||||
#: dnsmasq.c:930
|
#: dnsmasq.c:930
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "cannot open log %s: %s"
|
msgid "cannot open log %s: %s"
|
||||||
msgstr "Ne peut pas lire %s : %s"
|
msgstr "Ne peut ouvrir le fichier de log %s : %s"
|
||||||
|
|
||||||
#
|
#
|
||||||
#: dnsmasq.c:933
|
#: dnsmasq.c:933
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "failed to load Lua script: %s"
|
msgid "failed to load Lua script: %s"
|
||||||
msgstr "impossible de charger %s : %m"
|
msgstr "impossible de charger le script Lua : %s"
|
||||||
|
|
||||||
#: dnsmasq.c:1002
|
#: dnsmasq.c:1002
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "script process killed by signal %d"
|
msgid "script process killed by signal %d"
|
||||||
msgstr "Le processus fils a été terminé par le signal %d"
|
msgstr "Le script a été terminé par le signal %d"
|
||||||
|
|
||||||
#: dnsmasq.c:1006
|
#: dnsmasq.c:1006
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "script process exited with status %d"
|
msgid "script process exited with status %d"
|
||||||
msgstr "Le processus fils s'est terminé avec le statut %d"
|
msgstr "Le script s'est terminé avec le statut %d"
|
||||||
|
|
||||||
#: dnsmasq.c:1010
|
#: dnsmasq.c:1010
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -1506,7 +1500,7 @@ msgstr "requ
|
|||||||
|
|
||||||
#: helper.c:140
|
#: helper.c:140
|
||||||
msgid "lease() function missing in Lua script"
|
msgid "lease() function missing in Lua script"
|
||||||
msgstr ""
|
msgstr "la fonction lease() est absente du script Lua"
|
||||||
|
|
||||||
#: tftp.c:285
|
#: tftp.c:285
|
||||||
msgid "unable to get free port for TFTP"
|
msgid "unable to get free port for TFTP"
|
||||||
@@ -1557,29 +1551,29 @@ msgid "Conntrack connection mark retrieval failed: %s"
|
|||||||
msgstr "La récupération de la marque de suivi de connexion a échoué : %s"
|
msgstr "La récupération de la marque de suivi de connexion a échoué : %s"
|
||||||
|
|
||||||
#: dhcp6.c:46
|
#: dhcp6.c:46
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "cannot create DHCPv6 socket: %s"
|
msgid "cannot create DHCPv6 socket: %s"
|
||||||
msgstr "ne peut créer la socket DHCP: %s"
|
msgstr "ne peut créer la socket DHCPv6: %s"
|
||||||
|
|
||||||
#: dhcp6.c:57
|
#: dhcp6.c:57
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "failed to bind DHCPv6 server socket: %s"
|
msgid "failed to bind DHCPv6 server socket: %s"
|
||||||
msgstr "impossible de lier la socket serveur DHCP : %s"
|
msgstr "impossible de lier la socket serveur DHCPv6 : %s"
|
||||||
|
|
||||||
#: rfc3315.c:94
|
#: rfc3315.c:94
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "no address range available for DHCPv6 request from relay at %s"
|
msgid "no address range available for DHCPv6 request from relay at %s"
|
||||||
msgstr "pas de plage d'adresse disponible pour la requête DHCP %s %s"
|
msgstr "pas de plage d'adresse disponible pour la requête DHCPv6 transmise via le relai %s"
|
||||||
|
|
||||||
#: rfc3315.c:103
|
#: rfc3315.c:103
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "no address range available for DHCPv6 request via %s"
|
msgid "no address range available for DHCPv6 request via %s"
|
||||||
msgstr "pas de plage d'adresse disponible pour la requête DHCP %s %s"
|
msgstr "pas de plage d'adresse disponible pour la requête DHCPv6 via %s"
|
||||||
|
|
||||||
#: rfc3315.c:206
|
#: rfc3315.c:206
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "%u available DHCPv6 subnet: %s/%d"
|
msgid "%u available DHCPv6 subnet: %s/%d"
|
||||||
msgstr "%u sous-réseaux DHCP disponibles : %s/%s"
|
msgstr "%u sous-réseaux DHCPv6 disponibles : %s/%d"
|
||||||
|
|
||||||
#: dhcp-common.c:138
|
#: dhcp-common.c:138
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -1612,16 +1606,15 @@ msgid "duplicate IP address %s (%s) in dhcp-config directive"
|
|||||||
msgstr "adresse IP %s (%s) dupliquée dans la directive dhcp-config."
|
msgstr "adresse IP %s (%s) dupliquée dans la directive dhcp-config."
|
||||||
|
|
||||||
#: dhcp-common.c:443
|
#: dhcp-common.c:443
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "failed to join DHCPv6 multicast group: %s"
|
msgid "failed to join DHCPv6 multicast group: %s"
|
||||||
msgstr "impossible de lier la socket serveur DHCP : %s"
|
msgstr "impossible de rejoindre le groupe de multicast DHCPv6 : %s"
|
||||||
|
|
||||||
#: radv.c:76
|
#: radv.c:76
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "cannot create ICMPv6 socket: %s"
|
msgid "cannot create ICMPv6 socket: %s"
|
||||||
msgstr "ne peut créer la socket DHCP: %s"
|
msgstr "ne peut créer la socket ICMPv6: %s"
|
||||||
|
|
||||||
#, fuzzy
|
|
||||||
#~ msgid "Specify path to Lua script (no default)."
|
#~ msgid "Specify path to Lua script (no default)."
|
||||||
#~ msgstr "Spécifie un chemin pour le fichier PID (par défaut : %s)."
|
#~ msgstr "Spécifie un chemin pour le fichier PID (par défaut : %s)."
|
||||||
|
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ msgstr ""
|
|||||||
"Project-Id-Version: pl\n"
|
"Project-Id-Version: pl\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2009-06-10 20:57+0100\n"
|
"POT-Creation-Date: 2009-06-10 20:57+0100\n"
|
||||||
"PO-Revision-Date: 2011-08-25 09:50+0200\n"
|
"PO-Revision-Date: 2012-03-04 01:45+0100\n"
|
||||||
"Last-Translator: Jan Psota <jasiupsota@gmail.com>\n"
|
"Last-Translator: Jan Psota <jasiupsota@gmail.com>\n"
|
||||||
"Language-Team: polski <>\n"
|
"Language-Team: polski <>\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
||||||
"X-Generator: Lokalize 1.1\n"
|
"X-Generator: poedit-1.4.6.1\n"
|
||||||
"X-Language: pl_PL\n"
|
"X-Language: pl_PL\n"
|
||||||
|
|
||||||
#: cache.c:764
|
#: cache.c:764
|
||||||
@@ -25,17 +25,20 @@ msgstr ""
|
|||||||
msgid "failed to load names from %s: %s"
|
msgid "failed to load names from %s: %s"
|
||||||
msgstr "nie potrafię wczytać nazw z %s: %s"
|
msgstr "nie potrafię wczytać nazw z %s: %s"
|
||||||
|
|
||||||
#: cache.c:797 dhcp.c:855
|
#: cache.c:797
|
||||||
|
#: dhcp.c:855
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "bad address at %s line %d"
|
msgid "bad address at %s line %d"
|
||||||
msgstr "błędny adres w pliku %s, w linii %d"
|
msgstr "błędny adres w pliku %s, w linii %d"
|
||||||
|
|
||||||
#: cache.c:846 dhcp.c:871
|
#: cache.c:846
|
||||||
|
#: dhcp.c:871
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "bad name at %s line %d"
|
msgid "bad name at %s line %d"
|
||||||
msgstr "błędna nazwa w pliku %s, w linii %d"
|
msgstr "błędna nazwa w pliku %s, w linii %d"
|
||||||
|
|
||||||
#: cache.c:853 dhcp.c:946
|
#: cache.c:853
|
||||||
|
#: dhcp.c:946
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "read %s - %d addresses"
|
msgid "read %s - %d addresses"
|
||||||
msgstr "wczytałem %s - %d adresów"
|
msgstr "wczytałem %s - %d adresów"
|
||||||
@@ -88,7 +91,8 @@ msgstr "brak możliwości użycia generatora liczb losowych: %s"
|
|||||||
msgid "failed to allocate memory"
|
msgid "failed to allocate memory"
|
||||||
msgstr "nie udało się przydzielić pamięci"
|
msgstr "nie udało się przydzielić pamięci"
|
||||||
|
|
||||||
#: util.c:227 option.c:717
|
#: util.c:227
|
||||||
|
#: option.c:717
|
||||||
msgid "could not get memory"
|
msgid "could not get memory"
|
||||||
msgstr "nie można dostać pamięci"
|
msgstr "nie można dostać pamięci"
|
||||||
|
|
||||||
@@ -406,19 +410,16 @@ msgid "Disable ICMP echo address checking in the DHCP server."
|
|||||||
msgstr "Pominięcie sprawdzania za pomocą ICMP niezajętości adresu przed jego wydzierżawieniem."
|
msgstr "Pominięcie sprawdzania za pomocą ICMP niezajętości adresu przed jego wydzierżawieniem."
|
||||||
|
|
||||||
#: option.c:325
|
#: option.c:325
|
||||||
#, fuzzy
|
|
||||||
msgid "Shell script to run on DHCP lease creation and destruction."
|
msgid "Shell script to run on DHCP lease creation and destruction."
|
||||||
msgstr "Wskazanie skryptu uruchamianego w przypadku wydzierżawienia adresu lub wygaśnięcia dzierżawy."
|
msgstr "Skrypt powłoki uruchamiany po przyznaniu lub zwolnieniu adresu."
|
||||||
|
|
||||||
#: option.c:326
|
#: option.c:326
|
||||||
#, fuzzy
|
|
||||||
msgid "Lua script to run on DHCP lease creation and destruction."
|
msgid "Lua script to run on DHCP lease creation and destruction."
|
||||||
msgstr "Wskazanie skryptu uruchamianego w przypadku wydzierżawienia adresu lub wygaśnięcia dzierżawy."
|
msgstr "Skrypt Lua uruchamiany po przyznaniu lub zwolnieniu adresu."
|
||||||
|
|
||||||
#: option.c:327
|
#: option.c:327
|
||||||
#, fuzzy
|
|
||||||
msgid "Run lease-change scripts as this user."
|
msgid "Run lease-change scripts as this user."
|
||||||
msgstr "Uruchamianie skryptu dhcp-script jako wskazany użytkownik."
|
msgstr "Wskazanie użytkownika z którego uprawnieniami będą uruchamiane skrypty."
|
||||||
|
|
||||||
#: option.c:328
|
#: option.c:328
|
||||||
msgid "Read configuration from all the files in this directory."
|
msgid "Read configuration from all the files in this directory."
|
||||||
@@ -565,11 +566,11 @@ msgstr "Zachowanie znacznika połączenia z odebranego zapytania DNS w ruchu zew
|
|||||||
|
|
||||||
#: option.c:363
|
#: option.c:363
|
||||||
msgid "Allow DHCP clients to do their own DDNS updates."
|
msgid "Allow DHCP clients to do their own DDNS updates."
|
||||||
msgstr ""
|
msgstr "Zezwolenie klientom DHCP na uaktualnianie DDNS-ów."
|
||||||
|
|
||||||
#: option.c:364
|
#: option.c:364
|
||||||
msgid "Send router-advertisements for interfaces doing DHCPv6"
|
msgid "Send router-advertisements for interfaces doing DHCPv6"
|
||||||
msgstr ""
|
msgstr "Załączenie anonsowania (RA) na interfejsach serwujących DHCPv6"
|
||||||
|
|
||||||
#: option.c:782
|
#: option.c:782
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -596,13 +597,13 @@ msgid "Known DHCP options:\n"
|
|||||||
msgstr "Znane opcje DHCP:\n"
|
msgstr "Znane opcje DHCP:\n"
|
||||||
|
|
||||||
#: option.c:838
|
#: option.c:838
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "Known DHCPv6 options:\n"
|
msgid "Known DHCPv6 options:\n"
|
||||||
msgstr "Znane opcje DHCP:\n"
|
msgstr "Rozpoznawane opcje DHCPv6:\n"
|
||||||
|
|
||||||
#: option.c:973
|
#: option.c:973
|
||||||
msgid "unsupported encapsulation for IPv6 option"
|
msgid "unsupported encapsulation for IPv6 option"
|
||||||
msgstr ""
|
msgstr "nieobsługiwany rodzaj enkapsulacji opcji IPv6"
|
||||||
|
|
||||||
#: option.c:1001
|
#: option.c:1001
|
||||||
msgid "bad dhcp-option"
|
msgid "bad dhcp-option"
|
||||||
@@ -612,10 +613,11 @@ msgstr "błąd w dhcp-option"
|
|||||||
msgid "bad IP address"
|
msgid "bad IP address"
|
||||||
msgstr "zły adres IP"
|
msgstr "zły adres IP"
|
||||||
|
|
||||||
#: option.c:1071 option.c:1177 option.c:2511
|
#: option.c:1071
|
||||||
#, fuzzy
|
#: option.c:1177
|
||||||
|
#: option.c:2511
|
||||||
msgid "bad IPv6 address"
|
msgid "bad IPv6 address"
|
||||||
msgstr "zły adres IP"
|
msgstr "zły adres IPv6"
|
||||||
|
|
||||||
#: option.c:1205
|
#: option.c:1205
|
||||||
msgid "bad domain in dhcp-option"
|
msgid "bad domain in dhcp-option"
|
||||||
@@ -637,12 +639,14 @@ msgstr "wielokrotne użycie opcji niedozwolone (pojawiła się wcześniej w lini
|
|||||||
msgid "illegal repeated keyword"
|
msgid "illegal repeated keyword"
|
||||||
msgstr "wielokrotne użycie opcji niedozwolone (pojawiła się wsześniej w pliku konfiguracyjnym)"
|
msgstr "wielokrotne użycie opcji niedozwolone (pojawiła się wsześniej w pliku konfiguracyjnym)"
|
||||||
|
|
||||||
#: option.c:1452 option.c:3536
|
#: option.c:1452
|
||||||
|
#: option.c:3536
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "cannot access directory %s: %s"
|
msgid "cannot access directory %s: %s"
|
||||||
msgstr "brak dostępu do katalogu %s: %s"
|
msgstr "brak dostępu do katalogu %s: %s"
|
||||||
|
|
||||||
#: option.c:1483 tftp.c:464
|
#: option.c:1483
|
||||||
|
#: tftp.c:464
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "cannot access %s: %s"
|
msgid "cannot access %s: %s"
|
||||||
msgstr "brak dostępu do %s: %s"
|
msgstr "brak dostępu do %s: %s"
|
||||||
@@ -676,19 +680,21 @@ msgid "recompile with HAVE_SCRIPT defined to enable lease-change scripts"
|
|||||||
msgstr "żeby mieć możliwość używania skryptów wywoływanych przy zmianie dzierżawy, przekompiluj dnsmasq-a z włączoną flagą HAVE_SCRIPT"
|
msgstr "żeby mieć możliwość używania skryptów wywoływanych przy zmianie dzierżawy, przekompiluj dnsmasq-a z włączoną flagą HAVE_SCRIPT"
|
||||||
|
|
||||||
#: option.c:1607
|
#: option.c:1607
|
||||||
#, fuzzy
|
|
||||||
msgid "recompile with HAVE_LUASCRIPT defined to enable Lua scripts"
|
msgid "recompile with HAVE_LUASCRIPT defined to enable Lua scripts"
|
||||||
msgstr "żeby mieć możliwość używania skryptów wywoływanych przy zmianie dzierżawy, przekompiluj dnsmasq-a z włączoną flagą HAVE_SCRIPT"
|
msgstr "używanie skryptów Lua, wymaga skompilowania dnsmasq-a z flagą HAVE_LUASCRIPT"
|
||||||
|
|
||||||
#: option.c:1988 option.c:1992
|
#: option.c:1988
|
||||||
|
#: option.c:1992
|
||||||
msgid "bad port"
|
msgid "bad port"
|
||||||
msgstr "nieprawidłowy numer portu"
|
msgstr "nieprawidłowy numer portu"
|
||||||
|
|
||||||
#: option.c:2015 option.c:2046
|
#: option.c:2015
|
||||||
|
#: option.c:2046
|
||||||
msgid "interface binding not supported"
|
msgid "interface binding not supported"
|
||||||
msgstr "nie ma możliwości dowiązywania do interfejsu"
|
msgstr "nie ma możliwości dowiązywania do interfejsu"
|
||||||
|
|
||||||
#: option.c:2026 option.c:3088
|
#: option.c:2026
|
||||||
|
#: option.c:3088
|
||||||
msgid "bad interface name"
|
msgid "bad interface name"
|
||||||
msgstr "nieprawidłowa nazwa interfejsu"
|
msgstr "nieprawidłowa nazwa interfejsu"
|
||||||
|
|
||||||
@@ -714,14 +720,14 @@ msgstr "niespójny zakres adresów DHCP"
|
|||||||
|
|
||||||
#: option.c:2374
|
#: option.c:2374
|
||||||
msgid "prefix must be at least 64"
|
msgid "prefix must be at least 64"
|
||||||
msgstr ""
|
msgstr "prefix musi mieć wartość >=64"
|
||||||
|
|
||||||
#: option.c:2378
|
#: option.c:2378
|
||||||
#, fuzzy
|
|
||||||
msgid "inconsistent DHCPv6 range"
|
msgid "inconsistent DHCPv6 range"
|
||||||
msgstr "niespójny zakres adresów DHCP"
|
msgstr "niespójny zakres adresów DHCPv6"
|
||||||
|
|
||||||
#: option.c:2481 option.c:2521
|
#: option.c:2481
|
||||||
|
#: option.c:2521
|
||||||
msgid "bad hex constant"
|
msgid "bad hex constant"
|
||||||
msgstr "zapis niezgodny z formatem szesnastkowym"
|
msgstr "zapis niezgodny z formatem szesnastkowym"
|
||||||
|
|
||||||
@@ -737,7 +743,8 @@ msgstr "niedopuszczalna nazwa komputera w dhcp-host"
|
|||||||
msgid "bad tag-if"
|
msgid "bad tag-if"
|
||||||
msgstr "nieprawidłowa składnia 'tag-if'"
|
msgstr "nieprawidłowa składnia 'tag-if'"
|
||||||
|
|
||||||
#: option.c:2973 option.c:3258
|
#: option.c:2973
|
||||||
|
#: option.c:3258
|
||||||
msgid "invalid port number"
|
msgid "invalid port number"
|
||||||
msgstr "nieprawidłowy numer portu"
|
msgstr "nieprawidłowy numer portu"
|
||||||
|
|
||||||
@@ -814,12 +821,14 @@ msgstr "błąd"
|
|||||||
msgid "%s at line %d of %%s"
|
msgid "%s at line %d of %%s"
|
||||||
msgstr "%s w linii %d pliku %%s"
|
msgstr "%s w linii %d pliku %%s"
|
||||||
|
|
||||||
#: option.c:3491 tftp.c:627
|
#: option.c:3491
|
||||||
|
#: tftp.c:627
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "cannot read %s: %s"
|
msgid "cannot read %s: %s"
|
||||||
msgstr "błąd odczytu z pliku %s: %s"
|
msgstr "błąd odczytu z pliku %s: %s"
|
||||||
|
|
||||||
#: option.c:3657 option.c:3693
|
#: option.c:3657
|
||||||
|
#: option.c:3693
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "read %s"
|
msgid "read %s"
|
||||||
msgstr "przeczytałem %s"
|
msgstr "przeczytałem %s"
|
||||||
@@ -834,7 +843,7 @@ msgid "Dnsmasq version %s %s\n"
|
|||||||
msgstr "Dnsmasq, wersja %s %s\n"
|
msgstr "Dnsmasq, wersja %s %s\n"
|
||||||
|
|
||||||
#: option.c:3781
|
#: option.c:3781
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"Compile time options: %s\n"
|
"Compile time options: %s\n"
|
||||||
"\n"
|
"\n"
|
||||||
@@ -883,7 +892,9 @@ msgstr "w trybie no-poll można wskazać najwyżej jeden plik resolv.conf."
|
|||||||
msgid "must have exactly one resolv.conf to read domain from."
|
msgid "must have exactly one resolv.conf to read domain from."
|
||||||
msgstr "musisz mieć dokładnie jeden plik resolv.conf do odczytu domen."
|
msgstr "musisz mieć dokładnie jeden plik resolv.conf do odczytu domen."
|
||||||
|
|
||||||
#: option.c:3882 network.c:822 dhcp.c:804
|
#: option.c:3882
|
||||||
|
#: network.c:822
|
||||||
|
#: dhcp.c:804
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "failed to read %s: %s"
|
msgid "failed to read %s: %s"
|
||||||
msgstr "nie udało się odczytać %s: %s"
|
msgstr "nie udało się odczytać %s: %s"
|
||||||
@@ -902,9 +913,9 @@ msgid "syntax check OK"
|
|||||||
msgstr "składnia sprawdzona, jest prawidłowa"
|
msgstr "składnia sprawdzona, jest prawidłowa"
|
||||||
|
|
||||||
#: forward.c:113
|
#: forward.c:113
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "failed to send packet: %s"
|
msgid "failed to send packet: %s"
|
||||||
msgstr "błąd przy włączaniu nasłuchu na gnieździe: %s"
|
msgstr "wysyłanie pakietu nie powiodło się: %s"
|
||||||
|
|
||||||
#: forward.c:474
|
#: forward.c:474
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -1012,7 +1023,8 @@ msgstr "nieznany interfejs %s"
|
|||||||
msgid "no interface with address %s"
|
msgid "no interface with address %s"
|
||||||
msgstr "brak interfejsu z adresem %s"
|
msgstr "brak interfejsu z adresem %s"
|
||||||
|
|
||||||
#: dnsmasq.c:220 dnsmasq.c:770
|
#: dnsmasq.c:220
|
||||||
|
#: dnsmasq.c:770
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "DBus error: %s"
|
msgid "DBus error: %s"
|
||||||
msgstr "błąd DBus: %s"
|
msgstr "błąd DBus: %s"
|
||||||
@@ -1088,7 +1100,7 @@ msgstr "włączono asynchroniczny tryb zapisu do logów z kolejką na %d komunik
|
|||||||
|
|
||||||
#: dnsmasq.c:524
|
#: dnsmasq.c:524
|
||||||
msgid "IPv6 router advertisement enabled"
|
msgid "IPv6 router advertisement enabled"
|
||||||
msgstr ""
|
msgstr "anonsowanie routera IPv4 włączone"
|
||||||
|
|
||||||
#: dnsmasq.c:554
|
#: dnsmasq.c:554
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -1096,9 +1108,9 @@ msgid "DHCP, static leases only on %.0s%s, lease time %s"
|
|||||||
msgstr "DHCP: tylko statyczne dzierżawy na %.0s%s, czas dzierżawy %s"
|
msgstr "DHCP: tylko statyczne dzierżawy na %.0s%s, czas dzierżawy %s"
|
||||||
|
|
||||||
#: dnsmasq.c:556
|
#: dnsmasq.c:556
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "router advertisement only on %.0s%s, lifetime %s"
|
msgid "router advertisement only on %.0s%s, lifetime %s"
|
||||||
msgstr "DHCP: tylko statyczne dzierżawy na %.0s%s, czas dzierżawy %s"
|
msgstr "tylko anonsowanie routera na %.0s%s, czas życia %s"
|
||||||
|
|
||||||
#: dnsmasq.c:558
|
#: dnsmasq.c:558
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -1162,24 +1174,24 @@ msgid "failed to open pidfile %s: %s"
|
|||||||
msgstr "nie udało się otworzyć pliku z PID-em %s: %s"
|
msgstr "nie udało się otworzyć pliku z PID-em %s: %s"
|
||||||
|
|
||||||
#: dnsmasq.c:930
|
#: dnsmasq.c:930
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "cannot open log %s: %s"
|
msgid "cannot open log %s: %s"
|
||||||
msgstr "nie można otworzyć %s: %s"
|
msgstr "nie udało się otworzyć logu %s: %s"
|
||||||
|
|
||||||
#: dnsmasq.c:933
|
#: dnsmasq.c:933
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "failed to load Lua script: %s"
|
msgid "failed to load Lua script: %s"
|
||||||
msgstr "nie udało się odczytać %s: %s"
|
msgstr "nie udało się wczytać skryptu Lua: %s"
|
||||||
|
|
||||||
#: dnsmasq.c:1002
|
#: dnsmasq.c:1002
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "script process killed by signal %d"
|
msgid "script process killed by signal %d"
|
||||||
msgstr "proces potomny zabity sygnałem %d"
|
msgstr "skrypt został zabity sygnałem %d"
|
||||||
|
|
||||||
#: dnsmasq.c:1006
|
#: dnsmasq.c:1006
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "script process exited with status %d"
|
msgid "script process exited with status %d"
|
||||||
msgstr "proces potomny zakończył się z kodem powrotu %d"
|
msgstr "skrypt zakończył się z kodem powrotu %d"
|
||||||
|
|
||||||
#: dnsmasq.c:1010
|
#: dnsmasq.c:1010
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -1302,7 +1314,8 @@ msgstr "przez"
|
|||||||
msgid "%u available DHCP subnet: %s/%s"
|
msgid "%u available DHCP subnet: %s/%s"
|
||||||
msgstr "%u dostępna podsieć DHCP: %s/%s"
|
msgstr "%u dostępna podsieć DHCP: %s/%s"
|
||||||
|
|
||||||
#: rfc2131.c:353 rfc3315.c:209
|
#: rfc2131.c:353
|
||||||
|
#: rfc3315.c:209
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%u available DHCP range: %s -- %s"
|
msgid "%u available DHCP range: %s -- %s"
|
||||||
msgstr "%u dostępny zakres adresów DHCP: %s -- %s"
|
msgstr "%u dostępny zakres adresów DHCP: %s -- %s"
|
||||||
@@ -1311,19 +1324,24 @@ msgstr "%u dostępny zakres adresów DHCP: %s -- %s"
|
|||||||
msgid "disabled"
|
msgid "disabled"
|
||||||
msgstr "wyłączony(a)"
|
msgstr "wyłączony(a)"
|
||||||
|
|
||||||
#: rfc2131.c:423 rfc2131.c:941 rfc2131.c:1341
|
#: rfc2131.c:423
|
||||||
|
#: rfc2131.c:941
|
||||||
|
#: rfc2131.c:1341
|
||||||
msgid "ignored"
|
msgid "ignored"
|
||||||
msgstr "ignoruję"
|
msgstr "ignoruję"
|
||||||
|
|
||||||
#: rfc2131.c:438 rfc2131.c:1179
|
#: rfc2131.c:438
|
||||||
|
#: rfc2131.c:1179
|
||||||
msgid "address in use"
|
msgid "address in use"
|
||||||
msgstr "adres jest w użyciu"
|
msgstr "adres jest w użyciu"
|
||||||
|
|
||||||
#: rfc2131.c:452 rfc2131.c:995
|
#: rfc2131.c:452
|
||||||
|
#: rfc2131.c:995
|
||||||
msgid "no address available"
|
msgid "no address available"
|
||||||
msgstr "brak dostępnego adresu"
|
msgstr "brak dostępnego adresu"
|
||||||
|
|
||||||
#: rfc2131.c:459 rfc2131.c:1142
|
#: rfc2131.c:459
|
||||||
|
#: rfc2131.c:1142
|
||||||
msgid "wrong network"
|
msgid "wrong network"
|
||||||
msgstr "nieprawidłowa sieć"
|
msgstr "nieprawidłowa sieć"
|
||||||
|
|
||||||
@@ -1331,11 +1349,13 @@ msgstr "nieprawidłowa sieć"
|
|||||||
msgid "no address configured"
|
msgid "no address configured"
|
||||||
msgstr "brak skonfigurowanego adresu"
|
msgstr "brak skonfigurowanego adresu"
|
||||||
|
|
||||||
#: rfc2131.c:480 rfc2131.c:1192
|
#: rfc2131.c:480
|
||||||
|
#: rfc2131.c:1192
|
||||||
msgid "no leases left"
|
msgid "no leases left"
|
||||||
msgstr "brak wolnych dzierżaw"
|
msgstr "brak wolnych dzierżaw"
|
||||||
|
|
||||||
#: rfc2131.c:564 rfc3315.c:362
|
#: rfc2131.c:564
|
||||||
|
#: rfc3315.c:362
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%u client provides name: %s"
|
msgid "%u client provides name: %s"
|
||||||
msgstr "klient %u przedstawia się jako %s"
|
msgstr "klient %u przedstawia się jako %s"
|
||||||
@@ -1354,7 +1374,8 @@ msgstr "%u klasa użytkownika: %s"
|
|||||||
msgid "PXE BIS not supported"
|
msgid "PXE BIS not supported"
|
||||||
msgstr "PXE BIS nie jest obsługiwane"
|
msgstr "PXE BIS nie jest obsługiwane"
|
||||||
|
|
||||||
#: rfc2131.c:911 rfc3315.c:1098
|
#: rfc2131.c:911
|
||||||
|
#: rfc3315.c:1098
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "disabling DHCP static address %s for %s"
|
msgid "disabling DHCP static address %s for %s"
|
||||||
msgstr "wyłączam statyczne przypisanie adresu %s dla %s"
|
msgstr "wyłączam statyczne przypisanie adresu %s dla %s"
|
||||||
@@ -1363,7 +1384,8 @@ msgstr "wyłączam statyczne przypisanie adresu %s dla %s"
|
|||||||
msgid "unknown lease"
|
msgid "unknown lease"
|
||||||
msgstr "nieznana dzierżawa"
|
msgstr "nieznana dzierżawa"
|
||||||
|
|
||||||
#: rfc2131.c:964 rfc3315.c:556
|
#: rfc2131.c:964
|
||||||
|
#: rfc3315.c:556
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "not using configured address %s because it is leased to %s"
|
msgid "not using configured address %s because it is leased to %s"
|
||||||
msgstr "nie proponuję zakładanego w konfiguracji adresu %s, bo jest on już wydzierżawiony komputerowi %s"
|
msgstr "nie proponuję zakładanego w konfiguracji adresu %s, bo jest on już wydzierżawiony komputerowi %s"
|
||||||
@@ -1373,12 +1395,14 @@ msgstr "nie proponuję zakładanego w konfiguracji adresu %s, bo jest on już wy
|
|||||||
msgid "not using configured address %s because it is in use by the server or relay"
|
msgid "not using configured address %s because it is in use by the server or relay"
|
||||||
msgstr "nie proponuję zakładanego w konfiguracji adresu %s, bo używa go któryś z serwerów"
|
msgstr "nie proponuję zakładanego w konfiguracji adresu %s, bo używa go któryś z serwerów"
|
||||||
|
|
||||||
#: rfc2131.c:977 rfc3315.c:560
|
#: rfc2131.c:977
|
||||||
|
#: rfc3315.c:560
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "not using configured address %s because it was previously declined"
|
msgid "not using configured address %s because it was previously declined"
|
||||||
msgstr "nie proponuję zakładanego w konfiguracji adresu %s, bo już poprzednio został odrzucony"
|
msgstr "nie proponuję zakładanego w konfiguracji adresu %s, bo już poprzednio został odrzucony"
|
||||||
|
|
||||||
#: rfc2131.c:993 rfc2131.c:1185
|
#: rfc2131.c:993
|
||||||
|
#: rfc2131.c:1185
|
||||||
msgid "no unique-id"
|
msgid "no unique-id"
|
||||||
msgstr "brak unikalnego id"
|
msgstr "brak unikalnego id"
|
||||||
|
|
||||||
@@ -1440,7 +1464,8 @@ msgstr "nie mam możliwości wysłania opcji %d DHCP/BOOTP: niedostateczna iloś
|
|||||||
msgid "PXE menu too large"
|
msgid "PXE menu too large"
|
||||||
msgstr "menu PXE zbyt duże"
|
msgstr "menu PXE zbyt duże"
|
||||||
|
|
||||||
#: rfc2131.c:2117 rfc3315.c:1294
|
#: rfc2131.c:2117
|
||||||
|
#: rfc3315.c:1294
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%u requested options: %s"
|
msgid "%u requested options: %s"
|
||||||
msgstr "%u zażądano: %s"
|
msgstr "%u zażądano: %s"
|
||||||
@@ -1484,7 +1509,7 @@ msgstr "żądanie DHCP od urządzenia nieobsługiwanego typu (%d) odebrano na %s
|
|||||||
|
|
||||||
#: helper.c:140
|
#: helper.c:140
|
||||||
msgid "lease() function missing in Lua script"
|
msgid "lease() function missing in Lua script"
|
||||||
msgstr ""
|
msgstr "w skrypcie Lua brak funkcji lease()"
|
||||||
|
|
||||||
#: tftp.c:285
|
#: tftp.c:285
|
||||||
msgid "unable to get free port for TFTP"
|
msgid "unable to get free port for TFTP"
|
||||||
@@ -1535,29 +1560,29 @@ msgid "Conntrack connection mark retrieval failed: %s"
|
|||||||
msgstr "Nie udało się odcztać znacznika połączenia (conntrack): %s"
|
msgstr "Nie udało się odcztać znacznika połączenia (conntrack): %s"
|
||||||
|
|
||||||
#: dhcp6.c:46
|
#: dhcp6.c:46
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "cannot create DHCPv6 socket: %s"
|
msgid "cannot create DHCPv6 socket: %s"
|
||||||
msgstr "nie udało się utworzyć gniazda dla DHCP: %s"
|
msgstr "nie udało się utworzyć gniazda dla DHCPv6: %s"
|
||||||
|
|
||||||
#: dhcp6.c:57
|
#: dhcp6.c:57
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "failed to bind DHCPv6 server socket: %s"
|
msgid "failed to bind DHCPv6 server socket: %s"
|
||||||
msgstr "błąd przy przyznawaniu nazwy gniazdu serwera DHCP: %s"
|
msgstr "dowiązywanie gniazda serwera DHCPv6 zakończone niepowodzeniem: %s"
|
||||||
|
|
||||||
#: rfc3315.c:94
|
#: rfc3315.c:94
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "no address range available for DHCPv6 request from relay at %s"
|
msgid "no address range available for DHCPv6 request from relay at %s"
|
||||||
msgstr "nie zdefiniowano zakresu adresów odpowiedniego dla żądania %s %s"
|
msgstr "nie zdefiniowano zakresu adresów odpowiedniego dla żądania DHCPv6 przekazanego przez %s"
|
||||||
|
|
||||||
#: rfc3315.c:103
|
#: rfc3315.c:103
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "no address range available for DHCPv6 request via %s"
|
msgid "no address range available for DHCPv6 request via %s"
|
||||||
msgstr "nie zdefiniowano zakresu adresów odpowiedniego dla żądania %s %s"
|
msgstr "nie zdefiniowano zakresu adresów odpowiedniego dla żądania DHCPv6 od %s"
|
||||||
|
|
||||||
#: rfc3315.c:206
|
#: rfc3315.c:206
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "%u available DHCPv6 subnet: %s/%d"
|
msgid "%u available DHCPv6 subnet: %s/%d"
|
||||||
msgstr "%u dostępna podsieć DHCP: %s/%s"
|
msgstr "%u dostępna podsieć DHCPv6: %s/%d"
|
||||||
|
|
||||||
#: dhcp-common.c:138
|
#: dhcp-common.c:138
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -1590,14 +1615,14 @@ msgid "duplicate IP address %s (%s) in dhcp-config directive"
|
|||||||
msgstr "powtórzenie adresu IP %s (%s) w opcji dhcp-config"
|
msgstr "powtórzenie adresu IP %s (%s) w opcji dhcp-config"
|
||||||
|
|
||||||
#: dhcp-common.c:443
|
#: dhcp-common.c:443
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "failed to join DHCPv6 multicast group: %s"
|
msgid "failed to join DHCPv6 multicast group: %s"
|
||||||
msgstr "błąd przy przyznawaniu nazwy gniazdu serwera DHCP: %s"
|
msgstr "nie udało się przyłączyć do grupy rozgłoszeniowej DHCPv6: %s"
|
||||||
|
|
||||||
#: radv.c:76
|
#: radv.c:76
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "cannot create ICMPv6 socket: %s"
|
msgid "cannot create ICMPv6 socket: %s"
|
||||||
msgstr "nie udało się utworzyć gniazda dla DHCP: %s"
|
msgstr "nie udało się utworzyć gniazda dla ICMPv6: %s"
|
||||||
|
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
#~ msgid "Specify path to Lua script (no default)."
|
#~ msgid "Specify path to Lua script (no default)."
|
||||||
|
|||||||
@@ -17,19 +17,9 @@
|
|||||||
#include "dnsmasq.h"
|
#include "dnsmasq.h"
|
||||||
|
|
||||||
#if defined(HAVE_BSD_NETWORK) || defined(HAVE_SOLARIS_NETWORK)
|
#if defined(HAVE_BSD_NETWORK) || defined(HAVE_SOLARIS_NETWORK)
|
||||||
|
#include <ifaddrs.h>
|
||||||
static struct iovec ifconf = {
|
|
||||||
.iov_base = NULL,
|
|
||||||
.iov_len = 0
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct iovec ifreq = {
|
|
||||||
.iov_base = NULL,
|
|
||||||
.iov_len = 0
|
|
||||||
};
|
|
||||||
|
|
||||||
#if defined(HAVE_BSD_NETWORK) && !defined(__APPLE__)
|
#if defined(HAVE_BSD_NETWORK) && !defined(__APPLE__)
|
||||||
|
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#include <net/route.h>
|
#include <net/route.h>
|
||||||
#include <net/if_dl.h>
|
#include <net/if_dl.h>
|
||||||
@@ -50,8 +40,12 @@ int arp_enumerate(void *parm, int (*callback)())
|
|||||||
struct rt_msghdr *rtm;
|
struct rt_msghdr *rtm;
|
||||||
struct sockaddr_inarp *sin2;
|
struct sockaddr_inarp *sin2;
|
||||||
struct sockaddr_dl *sdl;
|
struct sockaddr_dl *sdl;
|
||||||
|
struct iovec buff;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
buff.iov_base = NULL;
|
||||||
|
buff.iov_len = 0;
|
||||||
|
|
||||||
mib[0] = CTL_NET;
|
mib[0] = CTL_NET;
|
||||||
mib[1] = PF_ROUTE;
|
mib[1] = PF_ROUTE;
|
||||||
mib[2] = 0;
|
mib[2] = 0;
|
||||||
@@ -67,9 +61,9 @@ int arp_enumerate(void *parm, int (*callback)())
|
|||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (!expand_buf(&ifconf, needed))
|
if (!expand_buf(&buff, needed))
|
||||||
return 0;
|
return 0;
|
||||||
if ((rc = sysctl(mib, 6, ifconf.iov_base, &needed, NULL, 0)) == 0 ||
|
if ((rc = sysctl(mib, 6, buff.iov_base, &needed, NULL, 0)) == 0 ||
|
||||||
errno != ENOMEM)
|
errno != ENOMEM)
|
||||||
break;
|
break;
|
||||||
needed += needed / 8;
|
needed += needed / 8;
|
||||||
@@ -77,7 +71,7 @@ int arp_enumerate(void *parm, int (*callback)())
|
|||||||
if (rc == -1)
|
if (rc == -1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (next = ifconf.iov_base ; next < (char *)ifconf.iov_base + needed; next += rtm->rtm_msglen)
|
for (next = buff.iov_base ; next < (char *)buff.iov_base + needed; next += rtm->rtm_msglen)
|
||||||
{
|
{
|
||||||
rtm = (struct rt_msghdr *)next;
|
rtm = (struct rt_msghdr *)next;
|
||||||
sin2 = (struct sockaddr_inarp *)(rtm + 1);
|
sin2 = (struct sockaddr_inarp *)(rtm + 1);
|
||||||
@@ -88,18 +82,13 @@ int arp_enumerate(void *parm, int (*callback)())
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int iface_enumerate(int family, void *parm, int (*callback)())
|
int iface_enumerate(int family, void *parm, int (*callback)())
|
||||||
{
|
{
|
||||||
char *ptr;
|
struct ifaddrs *head, *addrs;
|
||||||
struct ifreq *ifr;
|
int errsav, ret = 0;
|
||||||
struct ifconf ifc;
|
|
||||||
int fd, errsav, ret = 0;
|
|
||||||
int lastlen = 0;
|
|
||||||
size_t len = 0;
|
|
||||||
|
|
||||||
if (family == AF_UNSPEC)
|
if (family == AF_UNSPEC)
|
||||||
#if defined(HAVE_BSD_NETWORK) && !defined(__APPLE__)
|
#if defined(HAVE_BSD_NETWORK) && !defined(__APPLE__)
|
||||||
@@ -112,95 +101,62 @@ int iface_enumerate(int family, void *parm, int (*callback)())
|
|||||||
if (family == AF_LOCAL)
|
if (family == AF_LOCAL)
|
||||||
family = AF_LINK;
|
family = AF_LINK;
|
||||||
|
|
||||||
if ((fd = socket(PF_INET, SOCK_DGRAM, 0)) == -1)
|
if (getifaddrs(&head) == -1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
while(1)
|
for (addrs = head; addrs; addrs = addrs->ifa_next)
|
||||||
{
|
{
|
||||||
len += 10*sizeof(struct ifreq);
|
if (addrs->ifa_addr->sa_family == family)
|
||||||
|
|
||||||
if (!expand_buf(&ifconf, len))
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
ifc.ifc_len = len;
|
|
||||||
ifc.ifc_buf = ifconf.iov_base;
|
|
||||||
|
|
||||||
if (ioctl(fd, SIOCGIFCONF, &ifc) == -1)
|
|
||||||
{
|
{
|
||||||
if (errno != EINVAL || lastlen != 0)
|
int iface_index = if_nametoindex(addrs->ifa_name);
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (ifc.ifc_len == lastlen)
|
|
||||||
break; /* got a big enough buffer now */
|
|
||||||
lastlen = ifc.ifc_len;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (ptr = ifc.ifc_buf; ptr < (char *)(ifc.ifc_buf + ifc.ifc_len); ptr += len)
|
if (iface_index == 0)
|
||||||
{
|
continue;
|
||||||
/* subsequent entries may not be aligned, so copy into
|
|
||||||
an aligned buffer to avoid nasty complaints about
|
|
||||||
unaligned accesses. */
|
|
||||||
|
|
||||||
len = sizeof(struct ifreq);
|
|
||||||
|
|
||||||
#ifdef HAVE_SOCKADDR_SA_LEN
|
|
||||||
ifr = (struct ifreq *)ptr;
|
|
||||||
if (ifr->ifr_addr.sa_len > sizeof(ifr->ifr_ifru))
|
|
||||||
len = ifr->ifr_addr.sa_len + offsetof(struct ifreq, ifr_ifru);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!expand_buf(&ifreq, len))
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
ifr = (struct ifreq *)ifreq.iov_base;
|
|
||||||
memcpy(ifr, ptr, len);
|
|
||||||
|
|
||||||
if (ifr->ifr_addr.sa_family == family)
|
|
||||||
{
|
|
||||||
if (family == AF_INET)
|
if (family == AF_INET)
|
||||||
{
|
{
|
||||||
struct in_addr addr, netmask, broadcast;
|
struct in_addr addr, netmask, broadcast;
|
||||||
broadcast.s_addr = 0;
|
addr = ((struct sockaddr_in *) addrs->ifa_addr)->sin_addr;
|
||||||
addr = ((struct sockaddr_in *) &ifr->ifr_addr)->sin_addr;
|
netmask = ((struct sockaddr_in *) addrs->ifa_netmask)->sin_addr;
|
||||||
if (ioctl(fd, SIOCGIFNETMASK, ifr) == -1)
|
broadcast = ((struct sockaddr_in *) addrs->ifa_broadaddr)->sin_addr;
|
||||||
continue;
|
if (!((*callback)(addr, iface_index, netmask, broadcast, parm)))
|
||||||
netmask = ((struct sockaddr_in *) &ifr->ifr_addr)->sin_addr;
|
|
||||||
if (ioctl(fd, SIOCGIFBRDADDR, ifr) != -1)
|
|
||||||
broadcast = ((struct sockaddr_in *) &ifr->ifr_addr)->sin_addr;
|
|
||||||
if (!((*callback)(addr,
|
|
||||||
(int)if_nametoindex(ifr->ifr_name),
|
|
||||||
netmask, broadcast,
|
|
||||||
parm)))
|
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
else if (family == AF_INET6)
|
else if (family == AF_INET6)
|
||||||
{
|
{
|
||||||
struct in6_addr *addr = &((struct sockaddr_in6 *)&ifr->ifr_addr)->sin6_addr;
|
struct in6_addr *addr = &((struct sockaddr_in6 *) addrs->ifa_addr)->sin6_addr;
|
||||||
|
unsigned char *netmask = (unsigned char *) &((struct sockaddr_in6 *) addrs->ifa_netmask)->sin6_addr;
|
||||||
|
int scope_id = ((struct sockaddr_in6 *) addrs->ifa_addr)->sin6_scope_id;
|
||||||
|
int i, j, prefix = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < IN6ADDRSZ; i++, prefix += 8)
|
||||||
|
if (netmask[i] != 0xff)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (i != IN6ADDRSZ && netmask[i])
|
||||||
|
for (j = 7; j > 0; j--, prefix++)
|
||||||
|
if ((netmask[i] & (1 << j)) == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
/* voodoo to clear interface field in address */
|
/* voodoo to clear interface field in address */
|
||||||
if (!option_bool(OPT_NOWILD) && IN6_IS_ADDR_LINKLOCAL(addr))
|
if (!option_bool(OPT_NOWILD) && IN6_IS_ADDR_LINKLOCAL(addr))
|
||||||
{
|
{
|
||||||
addr->s6_addr[2] = 0;
|
addr->s6_addr[2] = 0;
|
||||||
addr->s6_addr[3] = 0;
|
addr->s6_addr[3] = 0;
|
||||||
}
|
}
|
||||||
/* We have no way to determine the prefix, so we assume it's 64 for now....... */
|
|
||||||
if (!((*callback)(addr, 64,
|
if (!((*callback)(addr, prefix, scope_id, iface_index, 0, parm)))
|
||||||
(int)((struct sockaddr_in6 *)&ifr->ifr_addr)->sin6_scope_id,
|
|
||||||
(int)if_nametoindex(ifr->ifr_name), 0,
|
|
||||||
parm)))
|
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_DHCP6
|
#ifdef HAVE_DHCP6
|
||||||
else if (family == AF_LINK)
|
else if (family == AF_LINK)
|
||||||
{
|
{
|
||||||
/* Assume ethernet again here */
|
/* Assume ethernet again here */
|
||||||
struct sockaddr_dl *sdl = (struct sockaddr_dl *)&ifr->ifr_addr;
|
struct sockaddr_dl *sdl = (struct sockaddr_dl *) addrs->ifa_addr;
|
||||||
if (sdl->sdl_alen != 0 && !((*callback)((int)if_nametoindex(ifr->ifr_name),
|
if (sdl->sdl_alen != 0 &&
|
||||||
ARPHRD_ETHER, LLADDR(sdl), sdl->sdl_alen, parm)))
|
!((*callback)(iface_index, ARPHRD_ETHER, LLADDR(sdl), sdl->sdl_alen, parm)))
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -211,7 +167,7 @@ int iface_enumerate(int family, void *parm, int (*callback)())
|
|||||||
|
|
||||||
err:
|
err:
|
||||||
errsav = errno;
|
errsav = errno;
|
||||||
close(fd);
|
freeifaddrs(head);
|
||||||
errno = errsav;
|
errno = errsav;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@@ -228,13 +184,10 @@ void init_bpf(void)
|
|||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
/* useful size which happens to be sufficient */
|
sprintf(daemon->dhcp_buff, "/dev/bpf%d", i++);
|
||||||
if (expand_buf(&ifreq, sizeof(struct ifreq)))
|
if ((daemon->dhcp_raw_fd = open(daemon->dhcp_buff, O_RDWR, 0)) != -1)
|
||||||
{
|
return;
|
||||||
sprintf(ifreq.iov_base, "/dev/bpf%d", i++);
|
|
||||||
if ((daemon->dhcp_raw_fd = open(ifreq.iov_base, O_RDWR, 0)) != -1)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (errno != EBUSY)
|
if (errno != EBUSY)
|
||||||
die(_("cannot create DHCP BPF socket: %s"), NULL, EC_BADNET);
|
die(_("cannot create DHCP BPF socket: %s"), NULL, EC_BADNET);
|
||||||
}
|
}
|
||||||
|
|||||||
+41
-22
@@ -634,10 +634,11 @@ struct crec *cache_find_by_addr(struct crec *crecp, struct all_addr *addr,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void add_hosts_entry(struct crec *cache, struct all_addr *addr, int addrlen,
|
static void add_hosts_entry(struct crec *cache, struct all_addr *addr, int addrlen,
|
||||||
unsigned short flags, int index, struct crec **rhash, int hashsz)
|
int index, struct crec **rhash, int hashsz)
|
||||||
{
|
{
|
||||||
struct crec *lookup = cache_find_by_name(NULL, cache->name.sname, 0, flags & (F_IPV4 | F_IPV6));
|
struct crec *lookup = cache_find_by_name(NULL, cache_get_name(cache), 0, cache->flags & (F_IPV4 | F_IPV6));
|
||||||
int i, nameexists = 0;
|
int i, nameexists = 0;
|
||||||
struct cname *a;
|
struct cname *a;
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
@@ -670,10 +671,10 @@ static void add_hosts_entry(struct crec *cache, struct all_addr *addr, int addrl
|
|||||||
j = (j*2 +((unsigned char *)addr)[i]) % hashsz;
|
j = (j*2 +((unsigned char *)addr)[i]) % hashsz;
|
||||||
|
|
||||||
for (lookup = rhash[j]; lookup; lookup = lookup->next)
|
for (lookup = rhash[j]; lookup; lookup = lookup->next)
|
||||||
if ((lookup->flags & flags & (F_IPV4 | F_IPV6)) &&
|
if ((lookup->flags & cache->flags & (F_IPV4 | F_IPV6)) &&
|
||||||
memcmp(&lookup->addr.addr, addr, addrlen) == 0)
|
memcmp(&lookup->addr.addr, addr, addrlen) == 0)
|
||||||
{
|
{
|
||||||
flags &= ~F_REVERSE;
|
cache->flags &= ~F_REVERSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -684,7 +685,6 @@ static void add_hosts_entry(struct crec *cache, struct all_addr *addr, int addrl
|
|||||||
rhash[j] = cache;
|
rhash[j] = cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
cache->flags = flags;
|
|
||||||
cache->uid = index;
|
cache->uid = index;
|
||||||
memcpy(&cache->addr.addr, addr, addrlen);
|
memcpy(&cache->addr.addr, addr, addrlen);
|
||||||
cache_hash(cache);
|
cache_hash(cache);
|
||||||
@@ -692,7 +692,7 @@ static void add_hosts_entry(struct crec *cache, struct all_addr *addr, int addrl
|
|||||||
/* don't need to do alias stuff for second and subsequent addresses. */
|
/* don't need to do alias stuff for second and subsequent addresses. */
|
||||||
if (!nameexists)
|
if (!nameexists)
|
||||||
for (a = daemon->cnames; a; a = a->next)
|
for (a = daemon->cnames; a; a = a->next)
|
||||||
if (hostname_isequal(cache->name.sname, a->target) &&
|
if (hostname_isequal(cache_get_name(cache), a->target) &&
|
||||||
(lookup = whine_malloc(sizeof(struct crec))))
|
(lookup = whine_malloc(sizeof(struct crec))))
|
||||||
{
|
{
|
||||||
lookup->flags = F_FORWARD | F_IMMORTAL | F_NAMEP | F_HOSTS | F_CNAME;
|
lookup->flags = F_FORWARD | F_IMMORTAL | F_NAMEP | F_HOSTS | F_CNAME;
|
||||||
@@ -771,26 +771,19 @@ static int read_hostsfile(char *filename, int index, int cache_size, struct crec
|
|||||||
{
|
{
|
||||||
lineno++;
|
lineno++;
|
||||||
|
|
||||||
#ifdef HAVE_IPV6
|
|
||||||
if (inet_pton(AF_INET, token, &addr) > 0)
|
if (inet_pton(AF_INET, token, &addr) > 0)
|
||||||
{
|
{
|
||||||
flags = F_HOSTS | F_IMMORTAL | F_FORWARD | F_REVERSE | F_IPV4;
|
flags = F_HOSTS | F_IMMORTAL | F_FORWARD | F_REVERSE | F_IPV4;
|
||||||
addrlen = INADDRSZ;
|
addrlen = INADDRSZ;
|
||||||
domain_suffix = get_domain(addr.addr.addr4);
|
domain_suffix = get_domain(addr.addr.addr4);
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_IPV6
|
||||||
else if (inet_pton(AF_INET6, token, &addr) > 0)
|
else if (inet_pton(AF_INET6, token, &addr) > 0)
|
||||||
{
|
{
|
||||||
flags = F_HOSTS | F_IMMORTAL | F_FORWARD | F_REVERSE | F_IPV6;
|
flags = F_HOSTS | F_IMMORTAL | F_FORWARD | F_REVERSE | F_IPV6;
|
||||||
addrlen = IN6ADDRSZ;
|
addrlen = IN6ADDRSZ;
|
||||||
domain_suffix = get_domain6(&addr.addr.addr6);
|
domain_suffix = get_domain6(&addr.addr.addr6);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if ((addr.addr.addr4.s_addr = inet_addr(token)) != (in_addr_t) -1)
|
|
||||||
{
|
|
||||||
flags = F_HOSTS | F_IMMORTAL | F_FORWARD | F_REVERSE | F_IPV4;
|
|
||||||
addrlen = INADDRSZ;
|
|
||||||
domain_suffix = get_domain(addr.addr.addr4);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -830,13 +823,15 @@ static int read_hostsfile(char *filename, int index, int cache_size, struct crec
|
|||||||
strcpy(cache->name.sname, canon);
|
strcpy(cache->name.sname, canon);
|
||||||
strcat(cache->name.sname, ".");
|
strcat(cache->name.sname, ".");
|
||||||
strcat(cache->name.sname, domain_suffix);
|
strcat(cache->name.sname, domain_suffix);
|
||||||
add_hosts_entry(cache, &addr, addrlen, flags, index, rhash, hashsz);
|
cache->flags = flags;
|
||||||
|
add_hosts_entry(cache, &addr, addrlen, index, rhash, hashsz);
|
||||||
name_count++;
|
name_count++;
|
||||||
}
|
}
|
||||||
if ((cache = whine_malloc(sizeof(struct crec) + strlen(canon)+1-SMALLDNAME)))
|
if ((cache = whine_malloc(sizeof(struct crec) + strlen(canon)+1-SMALLDNAME)))
|
||||||
{
|
{
|
||||||
strcpy(cache->name.sname, canon);
|
strcpy(cache->name.sname, canon);
|
||||||
add_hosts_entry(cache, &addr, addrlen, flags, index, rhash, hashsz);
|
cache->flags = flags;
|
||||||
|
add_hosts_entry(cache, &addr, addrlen, index, rhash, hashsz);
|
||||||
name_count++;
|
name_count++;
|
||||||
}
|
}
|
||||||
free(canon);
|
free(canon);
|
||||||
@@ -860,6 +855,8 @@ void cache_reload(void)
|
|||||||
struct crec *cache, **up, *tmp;
|
struct crec *cache, **up, *tmp;
|
||||||
int revhashsz, i, total_size = daemon->cachesize;
|
int revhashsz, i, total_size = daemon->cachesize;
|
||||||
struct hostsfile *ah;
|
struct hostsfile *ah;
|
||||||
|
struct host_record *hr;
|
||||||
|
struct name_list *nl;
|
||||||
|
|
||||||
cache_inserted = cache_live_freed = 0;
|
cache_inserted = cache_live_freed = 0;
|
||||||
|
|
||||||
@@ -886,6 +883,34 @@ void cache_reload(void)
|
|||||||
up = &cache->hash_next;
|
up = &cache->hash_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* borrow the packet buffer for a temporary by-address hash */
|
||||||
|
memset(daemon->packet, 0, daemon->packet_buff_sz);
|
||||||
|
revhashsz = daemon->packet_buff_sz / sizeof(struct crec *);
|
||||||
|
/* we overwrote the buffer... */
|
||||||
|
daemon->srv_save = NULL;
|
||||||
|
|
||||||
|
/* Do host_records in config. */
|
||||||
|
for (hr = daemon->host_records; hr; hr = hr->next)
|
||||||
|
for (nl = hr->names; nl; nl = nl->next)
|
||||||
|
{
|
||||||
|
if (hr->addr.s_addr != 0 &&
|
||||||
|
(cache = whine_malloc(sizeof(struct crec))))
|
||||||
|
{
|
||||||
|
cache->name.namep = nl->name;
|
||||||
|
cache->flags = F_HOSTS | F_IMMORTAL | F_FORWARD | F_REVERSE | F_IPV4 | F_NAMEP | F_CONFIG;
|
||||||
|
add_hosts_entry(cache, (struct all_addr *)&hr->addr, INADDRSZ, 0, (struct crec **)daemon->packet, revhashsz);
|
||||||
|
}
|
||||||
|
#ifdef HAVE_IPV6
|
||||||
|
if (!IN6_IS_ADDR_UNSPECIFIED(&hr->addr6) &&
|
||||||
|
(cache = whine_malloc(sizeof(struct crec))))
|
||||||
|
{
|
||||||
|
cache->name.namep = nl->name;
|
||||||
|
cache->flags = F_HOSTS | F_IMMORTAL | F_FORWARD | F_REVERSE | F_IPV6 | F_NAMEP | F_CONFIG;
|
||||||
|
add_hosts_entry(cache, (struct all_addr *)&hr->addr6, IN6ADDRSZ, 0, (struct crec **)daemon->packet, revhashsz);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if (option_bool(OPT_NO_HOSTS) && !daemon->addn_hosts)
|
if (option_bool(OPT_NO_HOSTS) && !daemon->addn_hosts)
|
||||||
{
|
{
|
||||||
if (daemon->cachesize > 0)
|
if (daemon->cachesize > 0)
|
||||||
@@ -893,12 +918,6 @@ void cache_reload(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* borrow the packet buffer for a temporary by-address hash */
|
|
||||||
memset(daemon->packet, 0, daemon->packet_buff_sz);
|
|
||||||
revhashsz = daemon->packet_buff_sz / sizeof(struct crec *);
|
|
||||||
/* we overwrote the buffer... */
|
|
||||||
daemon->srv_save = NULL;
|
|
||||||
|
|
||||||
if (!option_bool(OPT_NO_HOSTS))
|
if (!option_bool(OPT_NO_HOSTS))
|
||||||
total_size = read_hostsfile(HOSTSFILE, 0, total_size, (struct crec **)daemon->packet, revhashsz);
|
total_size = read_hostsfile(HOSTSFILE, 0, total_size, (struct crec **)daemon->packet, revhashsz);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -167,7 +167,7 @@ HAVE_SOLARIS_NETWORK
|
|||||||
define exactly one of these to alter interaction with kernel networking.
|
define exactly one of these to alter interaction with kernel networking.
|
||||||
|
|
||||||
HAVE_GETOPT_LONG
|
HAVE_GETOPT_LONG
|
||||||
defined when GNU-sty;e getopt_long available.
|
defined when GNU-style getopt_long available.
|
||||||
|
|
||||||
HAVE_ARC4RANDOM
|
HAVE_ARC4RANDOM
|
||||||
defined if arc4random() available to get better security from DNS spoofs
|
defined if arc4random() available to get better security from DNS spoofs
|
||||||
|
|||||||
+16
-7
@@ -396,7 +396,7 @@ void emit_dbus_signal(int action, struct dhcp_lease *lease, char *hostname)
|
|||||||
DBusConnection *connection = (DBusConnection *)daemon->dbus;
|
DBusConnection *connection = (DBusConnection *)daemon->dbus;
|
||||||
DBusMessage* message = NULL;
|
DBusMessage* message = NULL;
|
||||||
DBusMessageIter args;
|
DBusMessageIter args;
|
||||||
char *action_str, *addr, *mac = daemon->namebuff;
|
char *action_str, *mac = daemon->namebuff;
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -406,9 +406,20 @@ void emit_dbus_signal(int action, struct dhcp_lease *lease, char *hostname)
|
|||||||
if (!hostname)
|
if (!hostname)
|
||||||
hostname = "";
|
hostname = "";
|
||||||
|
|
||||||
p = extended_hwaddr(lease->hwaddr_type, lease->hwaddr_len,
|
#ifdef HAVE_DHCP6
|
||||||
lease->hwaddr, lease->clid_len, lease->clid, &i);
|
if (lease->flags & (LEASE_TA | LEASE_NA))
|
||||||
print_mac(mac, p, i);
|
{
|
||||||
|
print_mac(mac, lease->clid, lease->clid_len);
|
||||||
|
inet_ntop(AF_INET6, lease->hwaddr, daemon->addrbuff, ADDRSTRLEN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
p = extended_hwaddr(lease->hwaddr_type, lease->hwaddr_len,
|
||||||
|
lease->hwaddr, lease->clid_len, lease->clid, &i);
|
||||||
|
print_mac(mac, p, i);
|
||||||
|
inet_ntop(AF_INET, &lease->addr, daemon->addrbuff, ADDRSTRLEN);
|
||||||
|
}
|
||||||
|
|
||||||
if (action == ACTION_DEL)
|
if (action == ACTION_DEL)
|
||||||
action_str = "DhcpLeaseDeleted";
|
action_str = "DhcpLeaseDeleted";
|
||||||
@@ -419,14 +430,12 @@ void emit_dbus_signal(int action, struct dhcp_lease *lease, char *hostname)
|
|||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
addr = inet_ntoa(lease->addr);
|
|
||||||
|
|
||||||
if (!(message = dbus_message_new_signal(DNSMASQ_PATH, DNSMASQ_SERVICE, action_str)))
|
if (!(message = dbus_message_new_signal(DNSMASQ_PATH, DNSMASQ_SERVICE, action_str)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dbus_message_iter_init_append(message, &args);
|
dbus_message_iter_init_append(message, &args);
|
||||||
|
|
||||||
if (dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &addr) &&
|
if (dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &daemon->addrbuff) &&
|
||||||
dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &mac) &&
|
dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &mac) &&
|
||||||
dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &hostname))
|
dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &hostname))
|
||||||
dbus_connection_send(connection, message, NULL);
|
dbus_connection_send(connection, message, NULL);
|
||||||
|
|||||||
@@ -111,6 +111,13 @@ struct dhcp_netid *option_filter(struct dhcp_netid *tags, struct dhcp_netid *con
|
|||||||
last_tag->next = tags;
|
last_tag->next = tags;
|
||||||
tagif = run_tag_if(context_tags);
|
tagif = run_tag_if(context_tags);
|
||||||
|
|
||||||
|
/* reset stuff with tag:!<tag> which now matches. */
|
||||||
|
for (opt = opts; opt; opt = opt->next)
|
||||||
|
if (!(opt->flags & (DHOPT_ENCAPSULATE | DHOPT_VENDOR | DHOPT_RFC3925)) &&
|
||||||
|
(opt->flags & DHOPT_TAGOK) &&
|
||||||
|
!match_netid(opt->netid, tagif, 0))
|
||||||
|
opt->flags &= ~DHOPT_TAGOK;
|
||||||
|
|
||||||
for (opt = opts; opt; opt = opt->next)
|
for (opt = opts; opt; opt = opt->next)
|
||||||
if (!(opt->flags & (DHOPT_ENCAPSULATE | DHOPT_VENDOR | DHOPT_RFC3925 | DHOPT_TAGOK)) &&
|
if (!(opt->flags & (DHOPT_ENCAPSULATE | DHOPT_VENDOR | DHOPT_RFC3925 | DHOPT_TAGOK)) &&
|
||||||
match_netid(opt->netid, tagif, 0))
|
match_netid(opt->netid, tagif, 0))
|
||||||
@@ -444,4 +451,305 @@ void join_multicast(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
static const struct opttab_t {
|
||||||
|
char *name;
|
||||||
|
u16 val, size;
|
||||||
|
} opttab[] = {
|
||||||
|
{ "netmask", 1, OT_ADDR_LIST },
|
||||||
|
{ "time-offset", 2, 4 },
|
||||||
|
{ "router", 3, OT_ADDR_LIST },
|
||||||
|
{ "dns-server", 6, OT_ADDR_LIST },
|
||||||
|
{ "log-server", 7, OT_ADDR_LIST },
|
||||||
|
{ "lpr-server", 9, OT_ADDR_LIST },
|
||||||
|
{ "hostname", 12, OT_INTERNAL | OT_NAME },
|
||||||
|
{ "boot-file-size", 13, 2 | OT_DEC },
|
||||||
|
{ "domain-name", 15, OT_NAME },
|
||||||
|
{ "swap-server", 16, OT_ADDR_LIST },
|
||||||
|
{ "root-path", 17, OT_NAME },
|
||||||
|
{ "extension-path", 18, OT_NAME },
|
||||||
|
{ "ip-forward-enable", 19, 1 },
|
||||||
|
{ "non-local-source-routing", 20, 1 },
|
||||||
|
{ "policy-filter", 21, OT_ADDR_LIST },
|
||||||
|
{ "max-datagram-reassembly", 22, 2 | OT_DEC },
|
||||||
|
{ "default-ttl", 23, 1 | OT_DEC },
|
||||||
|
{ "mtu", 26, 2 | OT_DEC },
|
||||||
|
{ "all-subnets-local", 27, 1 },
|
||||||
|
{ "broadcast", 28, OT_INTERNAL | OT_ADDR_LIST },
|
||||||
|
{ "router-discovery", 31, 1 },
|
||||||
|
{ "router-solicitation", 32, OT_ADDR_LIST },
|
||||||
|
{ "static-route", 33, OT_ADDR_LIST },
|
||||||
|
{ "trailer-encapsulation", 34, 1 },
|
||||||
|
{ "arp-timeout", 35, 4 | OT_DEC },
|
||||||
|
{ "ethernet-encap", 36, 1 },
|
||||||
|
{ "tcp-ttl", 37, 1 },
|
||||||
|
{ "tcp-keepalive", 38, 4 | OT_DEC },
|
||||||
|
{ "nis-domain", 40, OT_NAME },
|
||||||
|
{ "nis-server", 41, OT_ADDR_LIST },
|
||||||
|
{ "ntp-server", 42, OT_ADDR_LIST },
|
||||||
|
{ "vendor-encap", 43, OT_INTERNAL },
|
||||||
|
{ "netbios-ns", 44, OT_ADDR_LIST },
|
||||||
|
{ "netbios-dd", 45, OT_ADDR_LIST },
|
||||||
|
{ "netbios-nodetype", 46, 1 },
|
||||||
|
{ "netbios-scope", 47, 0 },
|
||||||
|
{ "x-windows-fs", 48, OT_ADDR_LIST },
|
||||||
|
{ "x-windows-dm", 49, OT_ADDR_LIST },
|
||||||
|
{ "requested-address", 50, OT_INTERNAL | OT_ADDR_LIST },
|
||||||
|
{ "lease-time", 51, OT_INTERNAL | OT_DEC },
|
||||||
|
{ "option-overload", 52, OT_INTERNAL },
|
||||||
|
{ "message-type", 53, OT_INTERNAL | OT_DEC },
|
||||||
|
{ "server-identifier", 54, OT_INTERNAL | OT_ADDR_LIST },
|
||||||
|
{ "parameter-request", 55, OT_INTERNAL },
|
||||||
|
{ "message", 56, OT_INTERNAL },
|
||||||
|
{ "max-message-size", 57, OT_INTERNAL },
|
||||||
|
{ "T1", 58, OT_INTERNAL | OT_DEC},
|
||||||
|
{ "T2", 59, OT_INTERNAL | OT_DEC},
|
||||||
|
{ "vendor-class", 60, 0 },
|
||||||
|
{ "client-id", 61, OT_INTERNAL },
|
||||||
|
{ "nis+-domain", 64, OT_NAME },
|
||||||
|
{ "nis+-server", 65, OT_ADDR_LIST },
|
||||||
|
{ "tftp-server", 66, OT_NAME },
|
||||||
|
{ "bootfile-name", 67, OT_NAME },
|
||||||
|
{ "mobile-ip-home", 68, OT_ADDR_LIST },
|
||||||
|
{ "smtp-server", 69, OT_ADDR_LIST },
|
||||||
|
{ "pop3-server", 70, OT_ADDR_LIST },
|
||||||
|
{ "nntp-server", 71, OT_ADDR_LIST },
|
||||||
|
{ "irc-server", 74, OT_ADDR_LIST },
|
||||||
|
{ "user-class", 77, 0 },
|
||||||
|
{ "FQDN", 81, OT_INTERNAL },
|
||||||
|
{ "agent-id", 82, OT_INTERNAL },
|
||||||
|
{ "client-arch", 93, 2 | OT_DEC },
|
||||||
|
{ "client-interface-id", 94, 0 },
|
||||||
|
{ "client-machine-id", 97, 0 },
|
||||||
|
{ "subnet-select", 118, OT_INTERNAL },
|
||||||
|
{ "domain-search", 119, OT_RFC1035_NAME },
|
||||||
|
{ "sip-server", 120, 0 },
|
||||||
|
{ "classless-static-route", 121, 0 },
|
||||||
|
{ "vendor-id-encap", 125, 0 },
|
||||||
|
{ "server-ip-address", 255, OT_ADDR_LIST }, /* special, internal only, sets siaddr */
|
||||||
|
{ NULL, 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
static const struct opttab_t opttab6[] = {
|
||||||
|
{ "client-id", 1, OT_INTERNAL },
|
||||||
|
{ "server-id", 2, OT_INTERNAL },
|
||||||
|
{ "ia-na", 3, OT_INTERNAL },
|
||||||
|
{ "ia-ta", 4, OT_INTERNAL },
|
||||||
|
{ "iaaddr", 5, OT_INTERNAL },
|
||||||
|
{ "oro", 6, OT_INTERNAL },
|
||||||
|
{ "preference", 7, OT_INTERNAL | OT_DEC },
|
||||||
|
{ "unicast", 12, OT_INTERNAL },
|
||||||
|
{ "status", 13, OT_INTERNAL },
|
||||||
|
{ "rapid-commit", 14, OT_INTERNAL },
|
||||||
|
{ "user-class", 15, OT_INTERNAL | OT_CSTRING },
|
||||||
|
{ "vendor-class", 16, OT_INTERNAL | OT_CSTRING },
|
||||||
|
{ "vendor-opts", 17, OT_INTERNAL },
|
||||||
|
{ "sip-server-domain", 21, OT_RFC1035_NAME },
|
||||||
|
{ "sip-server", 22, OT_ADDR_LIST },
|
||||||
|
{ "dns-server", 23, OT_ADDR_LIST },
|
||||||
|
{ "domain-search", 24, OT_RFC1035_NAME },
|
||||||
|
{ "nis-server", 27, OT_ADDR_LIST },
|
||||||
|
{ "nis+-server", 28, OT_ADDR_LIST },
|
||||||
|
{ "nis-domain", 29, OT_RFC1035_NAME },
|
||||||
|
{ "nis+-domain", 30, OT_RFC1035_NAME },
|
||||||
|
{ "sntp-server", 31, OT_ADDR_LIST },
|
||||||
|
{ "FQDN", 39, OT_INTERNAL | OT_RFC1035_NAME },
|
||||||
|
{ "ntp-server", 56, OT_ADDR_LIST },
|
||||||
|
{ "bootfile-url", 59, OT_NAME },
|
||||||
|
{ "bootfile-param", 60, OT_CSTRING },
|
||||||
|
{ NULL, 0, 0 }
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void display_opts(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
printf(_("Known DHCP options:\n"));
|
||||||
|
|
||||||
|
for (i = 0; opttab[i].name; i++)
|
||||||
|
if (!(opttab[i].size & OT_INTERNAL))
|
||||||
|
printf("%3d %s\n", opttab[i].val, opttab[i].name);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
void display_opts6(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
printf(_("Known DHCPv6 options:\n"));
|
||||||
|
|
||||||
|
for (i = 0; opttab6[i].name; i++)
|
||||||
|
if (!(opttab6[i].size & OT_INTERNAL))
|
||||||
|
printf("%3d %s\n", opttab6[i].val, opttab6[i].name);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
u16 lookup_dhcp_opt(int prot, char *name)
|
||||||
|
{
|
||||||
|
const struct opttab_t *t;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
if (prot == AF_INET6)
|
||||||
|
t = opttab6;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
t = opttab;
|
||||||
|
|
||||||
|
for (i = 0; t[i].name; i++)
|
||||||
|
if (!(t[i].size & OT_INTERNAL) &&
|
||||||
|
strcasecmp(t[i].name, name) == 0)
|
||||||
|
return t[i].val;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u16 lookup_dhcp_len(int prot, u16 val)
|
||||||
|
{
|
||||||
|
const struct opttab_t *t;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
if (prot == AF_INET6)
|
||||||
|
t = opttab6;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
t = opttab;
|
||||||
|
|
||||||
|
for (i = 0; t[i].name; i++)
|
||||||
|
if (val == t[i].val)
|
||||||
|
{
|
||||||
|
if (t[i].size & OT_INTERNAL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return t[i].size & ~OT_DEC;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *option_string(int prot, unsigned int opt, unsigned char *val, int opt_len, char *buf, int buf_len)
|
||||||
|
{
|
||||||
|
int o, i, j, nodecode = 0;
|
||||||
|
const struct opttab_t *ot = opttab;
|
||||||
|
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
if (prot == AF_INET6)
|
||||||
|
ot = opttab6;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (o = 0; ot[o].name; o++)
|
||||||
|
if (ot[o].val == opt)
|
||||||
|
{
|
||||||
|
if (buf)
|
||||||
|
{
|
||||||
|
memset(buf, 0, buf_len);
|
||||||
|
|
||||||
|
if (ot[o].size & OT_ADDR_LIST)
|
||||||
|
{
|
||||||
|
struct all_addr addr;
|
||||||
|
int addr_len = INADDRSZ;
|
||||||
|
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
if (prot == AF_INET6)
|
||||||
|
addr_len = IN6ADDRSZ;
|
||||||
|
#endif
|
||||||
|
for (buf[0]= 0, i = 0; i <= opt_len - addr_len; i += addr_len)
|
||||||
|
{
|
||||||
|
if (i != 0)
|
||||||
|
strncat(buf, ", ", buf_len - strlen(buf));
|
||||||
|
/* align */
|
||||||
|
memcpy(&addr, &val[i], addr_len);
|
||||||
|
inet_ntop(prot, &val[i], daemon->addrbuff, ADDRSTRLEN);
|
||||||
|
strncat(buf, daemon->addrbuff, buf_len - strlen(buf));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (ot[o].size & OT_NAME)
|
||||||
|
for (i = 0, j = 0; i < opt_len && j < buf_len ; i++)
|
||||||
|
{
|
||||||
|
char c = val[i];
|
||||||
|
if (isprint((int)c))
|
||||||
|
buf[j++] = c;
|
||||||
|
}
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
/* We don't handle compressed rfc1035 names, so no good in IPv4 land */
|
||||||
|
else if ((ot[o].size & OT_RFC1035_NAME) && prot == AF_INET6)
|
||||||
|
{
|
||||||
|
i = 0, j = 0;
|
||||||
|
while (i < opt_len && val[i] != 0)
|
||||||
|
{
|
||||||
|
int k, l = i + val[i] + 1;
|
||||||
|
for (k = i + 1; k < opt_len && k < l && j < buf_len ; k++)
|
||||||
|
{
|
||||||
|
char c = val[k];
|
||||||
|
if (isprint((int)c))
|
||||||
|
buf[j++] = c;
|
||||||
|
}
|
||||||
|
i = l;
|
||||||
|
if (val[i] != 0 && j < buf_len)
|
||||||
|
buf[j++] = '.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ((ot[o].size & OT_CSTRING))
|
||||||
|
{
|
||||||
|
int k, len;
|
||||||
|
unsigned char *p;
|
||||||
|
|
||||||
|
i = 0, j = 0;
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
p = &val[i];
|
||||||
|
GETSHORT(len, p);
|
||||||
|
for (k = 0; k < len && j < buf_len; k++)
|
||||||
|
{
|
||||||
|
char c = *p++;
|
||||||
|
if (isprint((int)c))
|
||||||
|
buf[j++] = c;
|
||||||
|
}
|
||||||
|
i += len +2;
|
||||||
|
if (i >= opt_len)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (j < buf_len)
|
||||||
|
buf[j++] = ',';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
else if ((ot[o].size & OT_DEC) && opt_len != 0)
|
||||||
|
{
|
||||||
|
unsigned int dec = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < opt_len; i++)
|
||||||
|
dec = (dec << 8) | val[i];
|
||||||
|
|
||||||
|
sprintf(buf, "%u", dec);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
nodecode = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opt_len != 0 && buf && (!ot[o].name || nodecode))
|
||||||
|
{
|
||||||
|
int trunc = 0;
|
||||||
|
if (opt_len > 14)
|
||||||
|
{
|
||||||
|
trunc = 1;
|
||||||
|
opt_len = 14;
|
||||||
|
}
|
||||||
|
print_mac(buf, val, opt_len);
|
||||||
|
if (trunc)
|
||||||
|
strncat(buf, "...", buf_len - strlen(buf));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return ot[o].name ? ot[o].name : "";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+1
-1
@@ -299,7 +299,7 @@ void dhcp_packet(time_t now, int pxe_fd)
|
|||||||
iov.iov_len = dhcp_reply(parm.current, ifr.ifr_name, iface_index, (size_t)sz,
|
iov.iov_len = dhcp_reply(parm.current, ifr.ifr_name, iface_index, (size_t)sz,
|
||||||
now, unicast_dest, &is_inform, pxe_fd, iface_addr);
|
now, unicast_dest, &is_inform, pxe_fd, iface_addr);
|
||||||
lease_update_file(now);
|
lease_update_file(now);
|
||||||
lease_update_dns();
|
lease_update_dns(0);
|
||||||
|
|
||||||
if (iov.iov_len == 0)
|
if (iov.iov_len == 0)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
#define OPTION6_RECONFIGURE_MSG 19
|
#define OPTION6_RECONFIGURE_MSG 19
|
||||||
#define OPTION6_RECONF_ACCEPT 20
|
#define OPTION6_RECONF_ACCEPT 20
|
||||||
#define OPTION6_DNS_SERVER 23
|
#define OPTION6_DNS_SERVER 23
|
||||||
|
#define OPTION6_DOMAIN_SEARCH 24
|
||||||
#define OPTION6_REMOTE_ID 37
|
#define OPTION6_REMOTE_ID 37
|
||||||
#define OPTION6_SUBSCRIBER_ID 38
|
#define OPTION6_SUBSCRIBER_ID 38
|
||||||
#define OPTION6_FQDN 39
|
#define OPTION6_FQDN 39
|
||||||
|
|||||||
+51
-27
@@ -33,12 +33,12 @@ void dhcp6_init(void)
|
|||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
struct sockaddr_in6 saddr;
|
struct sockaddr_in6 saddr;
|
||||||
#if defined(IP_TOS) && defined(IPTOS_CLASS_CS6)
|
#if defined(IPV6_TCLASS) && defined(IPTOS_CLASS_CS6)
|
||||||
int class = IPTOS_CLASS_CS6;
|
int class = IPTOS_CLASS_CS6;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((fd = socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP)) == -1 ||
|
if ((fd = socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP)) == -1 ||
|
||||||
#if defined(IP_TOS) && defined(IPTOS_CLASS_CS6)
|
#if defined(IPV6_TCLASS) && defined(IPTOS_CLASS_CS6)
|
||||||
setsockopt(fd, IPPROTO_IPV6, IPV6_TCLASS, &class, sizeof(class)) == -1 ||
|
setsockopt(fd, IPPROTO_IPV6, IPV6_TCLASS, &class, sizeof(class)) == -1 ||
|
||||||
#endif
|
#endif
|
||||||
!fix_fd(fd) ||
|
!fix_fd(fd) ||
|
||||||
@@ -75,6 +75,7 @@ void dhcp6_packet(time_t now)
|
|||||||
ssize_t sz;
|
ssize_t sz;
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
struct iname *tmp;
|
struct iname *tmp;
|
||||||
|
unsigned short port;
|
||||||
|
|
||||||
msg.msg_control = control_u.control6;
|
msg.msg_control = control_u.control6;
|
||||||
msg.msg_controllen = sizeof(control_u);
|
msg.msg_controllen = sizeof(control_u);
|
||||||
@@ -84,7 +85,7 @@ void dhcp6_packet(time_t now)
|
|||||||
msg.msg_iov = &daemon->dhcp_packet;
|
msg.msg_iov = &daemon->dhcp_packet;
|
||||||
msg.msg_iovlen = 1;
|
msg.msg_iovlen = 1;
|
||||||
|
|
||||||
if ((sz = recv_dhcp_packet(daemon->dhcp6fd, &msg)) == -1 || sz <= 4)
|
if ((sz = recv_dhcp_packet(daemon->dhcp6fd, &msg)) == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (cmptr = CMSG_FIRSTHDR(&msg); cmptr; cmptr = CMSG_NXTHDR(&msg, cmptr))
|
for (cmptr = CMSG_FIRSTHDR(&msg); cmptr; cmptr = CMSG_NXTHDR(&msg, cmptr))
|
||||||
@@ -134,15 +135,23 @@ void dhcp6_packet(time_t now)
|
|||||||
|
|
||||||
lease_prune(NULL, now); /* lose any expired leases */
|
lease_prune(NULL, now); /* lose any expired leases */
|
||||||
|
|
||||||
sz = dhcp6_reply(parm.current, if_index, ifr.ifr_name, &parm.fallback,
|
port = dhcp6_reply(parm.current, if_index, ifr.ifr_name, &parm.fallback,
|
||||||
sz, IN6_IS_ADDR_MULTICAST(&from.sin6_addr), now);
|
sz, IN6_IS_ADDR_MULTICAST(&from.sin6_addr), now);
|
||||||
|
|
||||||
lease_update_file(now);
|
lease_update_file(now);
|
||||||
lease_update_dns();
|
lease_update_dns(0);
|
||||||
|
|
||||||
if (sz != 0)
|
/* The port in the source address of the original request should
|
||||||
while (sendto(daemon->dhcp6fd, daemon->outpacket.iov_base, sz, 0, (struct sockaddr *)&from, sizeof(from)) == -1 &&
|
be correct, but at least once client sends from the server port,
|
||||||
|
so we explicitly send to the client port to a client, and the
|
||||||
|
server port to a relay. */
|
||||||
|
if (port != 0)
|
||||||
|
{
|
||||||
|
from.sin6_port = htons(port);
|
||||||
|
while (sendto(daemon->dhcp6fd, daemon->outpacket.iov_base, save_counter(0),
|
||||||
|
0, (struct sockaddr *)&from, sizeof(from)) == -1 &&
|
||||||
retry_send());
|
retry_send());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int complete_context6(struct in6_addr *local, int prefix,
|
static int complete_context6(struct in6_addr *local, int prefix,
|
||||||
@@ -220,7 +229,7 @@ int address6_allocate(struct dhcp_context *context, unsigned char *clid, int cl
|
|||||||
|
|
||||||
for (pass = 0; pass <= 1; pass++)
|
for (pass = 0; pass <= 1; pass++)
|
||||||
for (c = context; c; c = c->current)
|
for (c = context; c; c = c->current)
|
||||||
if (c->flags & (CONTEXT_STATIC | CONTEXT_PROXY))
|
if (c->flags & (CONTEXT_DEPRECATE | CONTEXT_STATIC | CONTEXT_RA_STATELESS))
|
||||||
continue;
|
continue;
|
||||||
else if (!match_netid(c->filter, netids, pass))
|
else if (!match_netid(c->filter, netids, pass))
|
||||||
continue;
|
continue;
|
||||||
@@ -273,9 +282,9 @@ struct dhcp_context *address6_available(struct dhcp_context *context,
|
|||||||
start = addr6part(&tmp->start6);
|
start = addr6part(&tmp->start6);
|
||||||
end = addr6part(&tmp->end6);
|
end = addr6part(&tmp->end6);
|
||||||
|
|
||||||
if (!(tmp->flags & (CONTEXT_STATIC | CONTEXT_PROXY)) &&
|
if (!(tmp->flags & (CONTEXT_STATIC | CONTEXT_RA_STATELESS)) &&
|
||||||
is_same_net6(&context->start6, taddr, context->prefix) &&
|
is_same_net6(&tmp->start6, taddr, tmp->prefix) &&
|
||||||
is_same_net6(&context->end6, taddr, context->prefix) &&
|
is_same_net6(&tmp->end6, taddr, tmp->prefix) &&
|
||||||
addr >= start &&
|
addr >= start &&
|
||||||
addr <= end &&
|
addr <= end &&
|
||||||
match_netid(tmp->filter, netids, 1))
|
match_netid(tmp->filter, netids, 1))
|
||||||
@@ -365,36 +374,51 @@ struct dhcp_config *find_config6(struct dhcp_config *configs,
|
|||||||
|
|
||||||
void make_duid(time_t now)
|
void make_duid(time_t now)
|
||||||
{
|
{
|
||||||
/* rebase epoch to 1/1/2000 */
|
if (daemon->duid_config)
|
||||||
time_t newnow = now - 946684800;
|
{
|
||||||
|
unsigned char *p;
|
||||||
|
|
||||||
iface_enumerate(AF_LOCAL, &newnow, make_duid1);
|
daemon->duid = p = safe_malloc(daemon->duid_config_len + 6);
|
||||||
|
daemon->duid_len = daemon->duid_config_len + 6;
|
||||||
|
PUTSHORT(2, p); /* DUID_EN */
|
||||||
|
PUTLONG(daemon->duid_enterprise, p);
|
||||||
|
memcpy(p, daemon->duid_config, daemon->duid_config_len);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* rebase epoch to 1/1/2000 */
|
||||||
|
time_t newnow = now - 946684800;
|
||||||
|
|
||||||
if(!daemon->duid)
|
iface_enumerate(AF_LOCAL, &newnow, make_duid1);
|
||||||
die("Cannot create DHCPv6 server DUID: %s", NULL, EC_MISC);
|
|
||||||
|
if(!daemon->duid)
|
||||||
|
die("Cannot create DHCPv6 server DUID: %s", NULL, EC_MISC);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int make_duid1(int index, unsigned int type, char *mac, size_t maclen, void *parm)
|
static int make_duid1(int index, unsigned int type, char *mac, size_t maclen, void *parm)
|
||||||
{
|
{
|
||||||
/* create DUID as specified in RFC3315. We use the MAC of the
|
/* create DUID as specified in RFC3315. We use the MAC of the
|
||||||
first interface we find that isn't loopback or P-to-P */
|
first interface we find that isn't loopback or P-to-P and
|
||||||
|
has address-type < 256. Address types above 256 are things like
|
||||||
|
tunnels which don't have usable MAC addresses. */
|
||||||
|
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
|
|
||||||
(void)index;
|
(void)index;
|
||||||
|
|
||||||
daemon->duid = p = safe_malloc(maclen + 8);
|
if (type >= 256)
|
||||||
daemon->duid_len = maclen + 8;
|
return 1;
|
||||||
|
|
||||||
#ifdef HAVE_BROKEN_RTC
|
#ifdef HAVE_BROKEN_RTC
|
||||||
|
daemon->duid = p = safe_malloc(maclen + 4);
|
||||||
|
daemon->duid_len = maclen + 4;
|
||||||
PUTSHORT(3, p); /* DUID_LL */
|
PUTSHORT(3, p); /* DUID_LL */
|
||||||
#else
|
|
||||||
PUTSHORT(1, p); /* DUID_LLT */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PUTSHORT(type, p); /* address type */
|
PUTSHORT(type, p); /* address type */
|
||||||
|
#else
|
||||||
#ifndef HAVE_BROKEN_RTC
|
daemon->duid = p = safe_malloc(maclen + 8);
|
||||||
|
daemon->duid_len = maclen + 8;
|
||||||
|
PUTSHORT(1, p); /* DUID_LLT */
|
||||||
|
PUTSHORT(type, p); /* address type */
|
||||||
PUTLONG(*((time_t *)parm), p); /* time */
|
PUTLONG(*((time_t *)parm), p); /* time */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+104
-51
@@ -106,16 +106,14 @@ int main (int argc, char **argv)
|
|||||||
else
|
else
|
||||||
open("/dev/null", O_RDWR);
|
open("/dev/null", O_RDWR);
|
||||||
|
|
||||||
#ifdef HAVE_LINUX_NETWORK
|
#ifndef HAVE_LINUX_NETWORK
|
||||||
netlink_init();
|
# if !(defined(IP_RECVDSTADDR) && defined(IP_RECVIF) && defined(IP_SENDSRCADDR))
|
||||||
#elif !(defined(IP_RECVDSTADDR) && \
|
|
||||||
defined(IP_RECVIF) && \
|
|
||||||
defined(IP_SENDSRCADDR))
|
|
||||||
if (!option_bool(OPT_NOWILD))
|
if (!option_bool(OPT_NOWILD))
|
||||||
{
|
{
|
||||||
bind_fallback = 1;
|
bind_fallback = 1;
|
||||||
set_option_bool(OPT_NOWILD);
|
set_option_bool(OPT_NOWILD);
|
||||||
}
|
}
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_TFTP
|
#ifndef HAVE_TFTP
|
||||||
@@ -180,10 +178,25 @@ int main (int argc, char **argv)
|
|||||||
if (daemon->dhcp6)
|
if (daemon->dhcp6)
|
||||||
dhcp6_init();
|
dhcp6_init();
|
||||||
|
|
||||||
if (daemon->ra_contexts || daemon->dhcp6)
|
|
||||||
join_multicast();
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LINUX_NETWORK
|
||||||
|
/* After lease_init */
|
||||||
|
netlink_init();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
/* after netlink_init */
|
||||||
|
if (daemon->ra_contexts || daemon->dhcp6)
|
||||||
|
join_multicast();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_DHCP
|
||||||
|
/* after netlink_init */
|
||||||
|
if (daemon->dhcp || daemon->dhcp6)
|
||||||
|
lease_find_interfaces(now);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!enumerate_interfaces())
|
if (!enumerate_interfaces())
|
||||||
@@ -196,13 +209,6 @@ int main (int argc, char **argv)
|
|||||||
for (if_tmp = daemon->if_names; if_tmp; if_tmp = if_tmp->next)
|
for (if_tmp = daemon->if_names; if_tmp; if_tmp = if_tmp->next)
|
||||||
if (if_tmp->name && !if_tmp->used)
|
if (if_tmp->name && !if_tmp->used)
|
||||||
die(_("unknown interface %s"), if_tmp->name, EC_BADNET);
|
die(_("unknown interface %s"), if_tmp->name, EC_BADNET);
|
||||||
|
|
||||||
for (if_tmp = daemon->if_addrs; if_tmp; if_tmp = if_tmp->next)
|
|
||||||
if (!if_tmp->used)
|
|
||||||
{
|
|
||||||
prettyprint_addr(&if_tmp->addr, daemon->namebuff);
|
|
||||||
die(_("no interface with address %s"), daemon->namebuff, EC_BADNET);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
create_wildcard_listeners();
|
create_wildcard_listeners();
|
||||||
@@ -524,7 +530,7 @@ int main (int argc, char **argv)
|
|||||||
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
|
||||||
if (daemon->dhcp || daemon->dhcp6)
|
if (daemon->dhcp || daemon->dhcp6 || daemon->ra_contexts)
|
||||||
{
|
{
|
||||||
struct dhcp_context *dhcp_tmp;
|
struct dhcp_context *dhcp_tmp;
|
||||||
int family = AF_INET;
|
int family = AF_INET;
|
||||||
@@ -543,21 +549,50 @@ int main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
start = &dhcp_tmp->start6;
|
start = &dhcp_tmp->start6;
|
||||||
end = &dhcp_tmp->end6;
|
end = &dhcp_tmp->end6;
|
||||||
|
struct in6_addr subnet = dhcp_tmp->start6;
|
||||||
|
setaddr6part(&subnet, 0);
|
||||||
|
inet_ntop(AF_INET6, &subnet, daemon->addrbuff, 256);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
prettyprint_time(daemon->dhcp_buff2, dhcp_tmp->lease_time);
|
if (family != AF_INET && (dhcp_tmp->flags & CONTEXT_DEPRECATE))
|
||||||
inet_ntop(family, start, daemon->dhcp_buff, 256);
|
strcpy(daemon->namebuff, _("prefix deprecated"));
|
||||||
inet_ntop(family, end, daemon->dhcp_buff3, 256);
|
else
|
||||||
my_syslog(MS_DHCP | LOG_INFO,
|
{
|
||||||
(dhcp_tmp->flags & CONTEXT_STATIC) ?
|
char *p = daemon->namebuff;
|
||||||
_("DHCP, static leases only on %.0s%s, lease time %s") :
|
p += sprintf(p, _("lease time "));
|
||||||
(dhcp_tmp->flags & CONTEXT_RA_ONLY) ?
|
prettyprint_time(p, dhcp_tmp->lease_time);
|
||||||
_("router advertisement only on %.0s%s, lifetime %s") :
|
}
|
||||||
(dhcp_tmp->flags & CONTEXT_PROXY) ?
|
|
||||||
_("DHCP, proxy on subnet %.0s%s%.0s") :
|
if (daemon->dhcp_buff)
|
||||||
_("DHCP, IP range %s -- %s, lease time %s"),
|
inet_ntop(family, start, daemon->dhcp_buff, 256);
|
||||||
daemon->dhcp_buff, daemon->dhcp_buff3, daemon->dhcp_buff2);
|
if (daemon->dhcp_buff3)
|
||||||
|
inet_ntop(family, end, daemon->dhcp_buff3, 256);
|
||||||
|
if ((dhcp_tmp->flags & CONTEXT_DHCP) || family == AF_INET)
|
||||||
|
my_syslog(MS_DHCP | LOG_INFO,
|
||||||
|
(dhcp_tmp->flags & CONTEXT_RA_STATELESS) ?
|
||||||
|
_("stateless DHCPv6 on %s%.0s%.0s") :
|
||||||
|
(dhcp_tmp->flags & CONTEXT_STATIC) ?
|
||||||
|
_("DHCP, static leases only on %.0s%s, %s") :
|
||||||
|
(dhcp_tmp->flags & CONTEXT_PROXY) ?
|
||||||
|
_("DHCP, proxy on subnet %.0s%s%.0s") :
|
||||||
|
_("DHCP, IP range %s -- %s, %s"),
|
||||||
|
daemon->dhcp_buff, daemon->dhcp_buff3, daemon->namebuff);
|
||||||
|
|
||||||
|
if (dhcp_tmp->flags & CONTEXT_RA_NAME)
|
||||||
|
my_syslog(MS_DHCP | LOG_INFO, _("DHCPv4-derived IPv6 names on %s"),
|
||||||
|
daemon->addrbuff);
|
||||||
|
if (dhcp_tmp->flags & (CONTEXT_RA_ONLY | CONTEXT_RA_NAME | CONTEXT_RA_STATELESS))
|
||||||
|
{
|
||||||
|
if (!(dhcp_tmp->flags & CONTEXT_DEPRECATE))
|
||||||
|
{
|
||||||
|
char *p = daemon->namebuff;
|
||||||
|
p += sprintf(p, _("prefix valid "));
|
||||||
|
prettyprint_time(p, dhcp_tmp->lease_time > 7200 ? dhcp_tmp->lease_time : 7200);
|
||||||
|
}
|
||||||
|
my_syslog(MS_DHCP | LOG_INFO, _("SLAAC on %s %s"),
|
||||||
|
daemon->addrbuff, daemon->namebuff);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_DHCP6
|
#ifdef HAVE_DHCP6
|
||||||
@@ -685,12 +720,12 @@ 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->ra_contexts)
|
if (daemon->ra_contexts)
|
||||||
{
|
{
|
||||||
FD_SET(daemon->icmp6fd, &rset);
|
FD_SET(daemon->icmp6fd, &rset);
|
||||||
bump_maxfd(daemon->icmp6fd, &maxfd);
|
bump_maxfd(daemon->icmp6fd, &maxfd);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -706,6 +741,10 @@ int main (int argc, char **argv)
|
|||||||
# ifdef HAVE_SCRIPT
|
# ifdef HAVE_SCRIPT
|
||||||
while (helper_buf_empty() && do_script_run(now));
|
while (helper_buf_empty() && do_script_run(now));
|
||||||
|
|
||||||
|
# ifdef HAVE_TFTP
|
||||||
|
while (helper_buf_empty() && do_tftp_script_run());
|
||||||
|
# endif
|
||||||
|
|
||||||
if (!helper_buf_empty())
|
if (!helper_buf_empty())
|
||||||
{
|
{
|
||||||
FD_SET(daemon->helperfd, &wset);
|
FD_SET(daemon->helperfd, &wset);
|
||||||
@@ -714,6 +753,11 @@ int main (int argc, char **argv)
|
|||||||
# else
|
# else
|
||||||
/* need this for other side-effects */
|
/* need this for other side-effects */
|
||||||
while (do_script_run(now));
|
while (do_script_run(now));
|
||||||
|
|
||||||
|
# ifdef HAVE_TFTP
|
||||||
|
while (do_tftp_script_run());
|
||||||
|
# endif
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -849,9 +893,17 @@ static void sig_handler(int sig)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_alarm(void)
|
/* now == 0 -> queue immediate callback */
|
||||||
|
void send_alarm(time_t event, time_t now)
|
||||||
{
|
{
|
||||||
send_event(pipewrite, EVENT_ALARM, 0, NULL);
|
if (now == 0 || event != 0)
|
||||||
|
{
|
||||||
|
/* alarm(0) or alarm(-ve) doesn't do what we want.... */
|
||||||
|
if ((now == 0 || difftime(event, now) <= 0.0))
|
||||||
|
send_event(pipewrite, EVENT_ALARM, 0, NULL);
|
||||||
|
else
|
||||||
|
alarm((unsigned)difftime(event, now));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_event(int fd, int event, int data, char *msg)
|
void send_event(int fd, int event, int data, char *msg)
|
||||||
@@ -973,13 +1025,8 @@ static void async_event(int pipe, time_t now)
|
|||||||
}
|
}
|
||||||
#ifdef HAVE_DHCP6
|
#ifdef HAVE_DHCP6
|
||||||
else if (daemon->ra_contexts)
|
else if (daemon->ra_contexts)
|
||||||
{
|
/* Not doing DHCP, so no lease system, manage alarms for ra only */
|
||||||
/* Not doing DHCP, so no lease system, manage
|
send_alarm(periodic_ra(now), now);
|
||||||
alarms for ra only */
|
|
||||||
time_t next_event = periodic_ra(now);
|
|
||||||
if (next_event != 0)
|
|
||||||
alarm((unsigned)difftime(next_event, now));
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
@@ -1143,7 +1190,7 @@ void clear_cache_and_reload(time_t now)
|
|||||||
check_dhcp_hosts(0);
|
check_dhcp_hosts(0);
|
||||||
lease_update_from_configs();
|
lease_update_from_configs();
|
||||||
lease_update_file(now);
|
lease_update_file(now);
|
||||||
lease_update_dns();
|
lease_update_dns(1);
|
||||||
}
|
}
|
||||||
#ifdef HAVE_DHCP6
|
#ifdef HAVE_DHCP6
|
||||||
else if (daemon->ra_contexts)
|
else if (daemon->ra_contexts)
|
||||||
@@ -1257,18 +1304,19 @@ static void check_dns_listeners(fd_set *set, time_t now)
|
|||||||
int confd;
|
int confd;
|
||||||
struct irec *iface = NULL;
|
struct irec *iface = NULL;
|
||||||
pid_t p;
|
pid_t p;
|
||||||
|
union mysockaddr tcp_addr;
|
||||||
|
socklen_t tcp_len = sizeof(union mysockaddr);
|
||||||
|
|
||||||
while((confd = accept(listener->tcpfd, NULL, NULL)) == -1 && errno == EINTR);
|
while ((confd = accept(listener->tcpfd, NULL, NULL)) == -1 && errno == EINTR);
|
||||||
|
|
||||||
if (confd == -1)
|
if (confd == -1 ||
|
||||||
|
getsockname(confd, (struct sockaddr *)&tcp_addr, &tcp_len) == -1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (option_bool(OPT_NOWILD))
|
if (option_bool(OPT_NOWILD))
|
||||||
iface = listener->iface;
|
iface = listener->iface; /* May be NULL */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
union mysockaddr tcp_addr;
|
|
||||||
socklen_t tcp_len = sizeof(union mysockaddr);
|
|
||||||
/* Check for allowed interfaces when binding the wildcard address:
|
/* Check for allowed interfaces when binding the wildcard address:
|
||||||
we do this by looking for an interface with the same address as
|
we do this by looking for an interface with the same address as
|
||||||
the local address of the TCP connection, then looking to see if that's
|
the local address of the TCP connection, then looking to see if that's
|
||||||
@@ -1276,14 +1324,13 @@ static void check_dns_listeners(fd_set *set, time_t now)
|
|||||||
interface too, for localisation. */
|
interface too, for localisation. */
|
||||||
|
|
||||||
/* interface may be new since startup */
|
/* interface may be new since startup */
|
||||||
if (enumerate_interfaces() &&
|
if (enumerate_interfaces())
|
||||||
getsockname(confd, (struct sockaddr *)&tcp_addr, &tcp_len) != -1)
|
|
||||||
for (iface = daemon->interfaces; iface; iface = iface->next)
|
for (iface = daemon->interfaces; iface; iface = iface->next)
|
||||||
if (sockaddr_isequal(&iface->addr, &tcp_addr))
|
if (sockaddr_isequal(&iface->addr, &tcp_addr))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!iface)
|
if (!iface && !option_bool(OPT_NOWILD))
|
||||||
{
|
{
|
||||||
shutdown(confd, SHUT_RDWR);
|
shutdown(confd, SHUT_RDWR);
|
||||||
close(confd);
|
close(confd);
|
||||||
@@ -1309,6 +1356,12 @@ static void check_dns_listeners(fd_set *set, time_t now)
|
|||||||
unsigned char *buff;
|
unsigned char *buff;
|
||||||
struct server *s;
|
struct server *s;
|
||||||
int flags;
|
int flags;
|
||||||
|
struct in_addr netmask;
|
||||||
|
|
||||||
|
if (iface)
|
||||||
|
netmask = iface->netmask;
|
||||||
|
else
|
||||||
|
netmask.s_addr = 0;
|
||||||
|
|
||||||
#ifndef NO_FORK
|
#ifndef NO_FORK
|
||||||
/* Arrange for SIGALARM after CHILD_LIFETIME seconds to
|
/* Arrange for SIGALARM after CHILD_LIFETIME seconds to
|
||||||
@@ -1327,7 +1380,7 @@ static void check_dns_listeners(fd_set *set, time_t now)
|
|||||||
if ((flags = fcntl(confd, F_GETFL, 0)) != -1)
|
if ((flags = fcntl(confd, F_GETFL, 0)) != -1)
|
||||||
fcntl(confd, F_SETFL, flags & ~O_NONBLOCK);
|
fcntl(confd, F_SETFL, flags & ~O_NONBLOCK);
|
||||||
|
|
||||||
buff = tcp_request(confd, now, &iface->addr, iface->netmask);
|
buff = tcp_request(confd, now, &tcp_addr, netmask);
|
||||||
|
|
||||||
shutdown(confd, SHUT_RDWR);
|
shutdown(confd, SHUT_RDWR);
|
||||||
close(confd);
|
close(confd);
|
||||||
|
|||||||
+77
-18
@@ -274,6 +274,18 @@ struct cname {
|
|||||||
struct cname *next;
|
struct cname *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct host_record {
|
||||||
|
struct name_list {
|
||||||
|
char *name;
|
||||||
|
struct name_list *next;
|
||||||
|
} *names;
|
||||||
|
struct in_addr addr;
|
||||||
|
#ifdef HAVE_IPV6
|
||||||
|
struct in6_addr addr6;
|
||||||
|
#endif
|
||||||
|
struct host_record *next;
|
||||||
|
};
|
||||||
|
|
||||||
struct interface_name {
|
struct interface_name {
|
||||||
char *name; /* domain name */
|
char *name; /* domain name */
|
||||||
char *intr; /* interface name */
|
char *intr; /* interface name */
|
||||||
@@ -383,7 +395,7 @@ struct irec {
|
|||||||
|
|
||||||
struct listener {
|
struct listener {
|
||||||
int fd, tcpfd, tftpfd, family;
|
int fd, tcpfd, tftpfd, family;
|
||||||
struct irec *iface; /* only valid for non-wildcard */
|
struct irec *iface; /* only sometimes valid for non-wildcard */
|
||||||
struct listener *next;
|
struct listener *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -432,11 +444,21 @@ struct frec {
|
|||||||
struct frec *next;
|
struct frec *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* flags in top of length field for DHCP-option tables */
|
||||||
|
#define OT_ADDR_LIST 0x8000
|
||||||
|
#define OT_RFC1035_NAME 0x4000
|
||||||
|
#define OT_INTERNAL 0x2000
|
||||||
|
#define OT_NAME 0x1000
|
||||||
|
#define OT_CSTRING 0x0800
|
||||||
|
#define OT_DEC 0x0400
|
||||||
|
|
||||||
|
|
||||||
/* actions in the daemon->helper RPC */
|
/* actions in the daemon->helper RPC */
|
||||||
#define ACTION_DEL 1
|
#define ACTION_DEL 1
|
||||||
#define ACTION_OLD_HOSTNAME 2
|
#define ACTION_OLD_HOSTNAME 2
|
||||||
#define ACTION_OLD 3
|
#define ACTION_OLD 3
|
||||||
#define ACTION_ADD 4
|
#define ACTION_ADD 4
|
||||||
|
#define ACTION_TFTP 5
|
||||||
|
|
||||||
#define LEASE_NEW 1 /* newly created */
|
#define LEASE_NEW 1 /* newly created */
|
||||||
#define LEASE_CHANGED 2 /* modified */
|
#define LEASE_CHANGED 2 /* modified */
|
||||||
@@ -445,6 +467,7 @@ struct frec {
|
|||||||
#define LEASE_USED 16 /* used this DHCPv6 transaction */
|
#define LEASE_USED 16 /* used this DHCPv6 transaction */
|
||||||
#define LEASE_NA 32 /* IPv6 no-temporary lease */
|
#define LEASE_NA 32 /* IPv6 no-temporary lease */
|
||||||
#define LEASE_TA 64 /* IPv6 temporary lease */
|
#define LEASE_TA 64 /* IPv6 temporary lease */
|
||||||
|
#define LEASE_HAVE_HWADDR 128 /* Have set hwaddress */
|
||||||
|
|
||||||
struct dhcp_lease {
|
struct dhcp_lease {
|
||||||
int clid_len; /* length of client identifier */
|
int clid_len; /* length of client identifier */
|
||||||
@@ -462,6 +485,14 @@ struct dhcp_lease {
|
|||||||
unsigned char *extradata;
|
unsigned char *extradata;
|
||||||
unsigned int extradata_len, extradata_size;
|
unsigned int extradata_len, extradata_size;
|
||||||
int last_interface;
|
int last_interface;
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
struct slaac_address {
|
||||||
|
struct in6_addr addr, local;
|
||||||
|
time_t ping_time;
|
||||||
|
int backoff; /* zero -> confirmed */
|
||||||
|
struct slaac_address *next;
|
||||||
|
} *slaac_address;
|
||||||
|
#endif
|
||||||
struct dhcp_lease *next;
|
struct dhcp_lease *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -606,7 +637,7 @@ struct dhcp_context {
|
|||||||
#ifdef HAVE_DHCP6
|
#ifdef HAVE_DHCP6
|
||||||
struct in6_addr start6, end6; /* range of available addresses */
|
struct in6_addr start6, end6; /* range of available addresses */
|
||||||
struct in6_addr local6;
|
struct in6_addr local6;
|
||||||
int prefix;
|
int prefix, if_index;
|
||||||
time_t ra_time;
|
time_t ra_time;
|
||||||
#endif
|
#endif
|
||||||
int flags;
|
int flags;
|
||||||
@@ -615,12 +646,16 @@ struct dhcp_context {
|
|||||||
struct dhcp_context *next, *current;
|
struct dhcp_context *next, *current;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CONTEXT_STATIC 1
|
#define CONTEXT_STATIC 1
|
||||||
#define CONTEXT_NETMASK 2
|
#define CONTEXT_NETMASK 2
|
||||||
#define CONTEXT_BRDCAST 4
|
#define CONTEXT_BRDCAST 4
|
||||||
#define CONTEXT_PROXY 8
|
#define CONTEXT_PROXY 8
|
||||||
#define CONTEXT_RA_ONLY 16
|
#define CONTEXT_RA_ONLY 16
|
||||||
#define CONTEXT_RA_DONE 32
|
#define CONTEXT_RA_DONE 32
|
||||||
|
#define CONTEXT_RA_NAME 64
|
||||||
|
#define CONTEXT_RA_STATELESS 128
|
||||||
|
#define CONTEXT_DHCP 256
|
||||||
|
#define CONTEXT_DEPRECATE 512
|
||||||
|
|
||||||
struct ping_result {
|
struct ping_result {
|
||||||
struct in_addr addr;
|
struct in_addr addr;
|
||||||
@@ -678,6 +713,7 @@ extern struct daemon {
|
|||||||
struct naptr *naptr;
|
struct naptr *naptr;
|
||||||
struct txt_record *txt;
|
struct txt_record *txt;
|
||||||
struct ptr_record *ptr;
|
struct ptr_record *ptr;
|
||||||
|
struct host_record *host_records, *host_records_tail;
|
||||||
struct cname *cnames;
|
struct cname *cnames;
|
||||||
struct interface_name *int_names;
|
struct interface_name *int_names;
|
||||||
char *mxtarget;
|
char *mxtarget;
|
||||||
@@ -723,6 +759,8 @@ extern struct daemon {
|
|||||||
struct tftp_prefix *if_prefix; /* per-interface TFTP prefixes */
|
struct tftp_prefix *if_prefix; /* per-interface TFTP prefixes */
|
||||||
struct interface_list *tftp_interfaces; /* interfaces for limited TFTP service */
|
struct interface_list *tftp_interfaces; /* interfaces for limited TFTP service */
|
||||||
int tftp_unlimited;
|
int tftp_unlimited;
|
||||||
|
unsigned int duid_enterprise, duid_config_len;
|
||||||
|
unsigned char *duid_config;
|
||||||
|
|
||||||
/* globally used stuff for DNS */
|
/* globally used stuff for DNS */
|
||||||
char *packet; /* packet buffer */
|
char *packet; /* packet buffer */
|
||||||
@@ -769,7 +807,7 @@ extern struct daemon {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* TFTP stuff */
|
/* TFTP stuff */
|
||||||
struct tftp_transfer *tftp_trans;
|
struct tftp_transfer *tftp_trans, *tftp_done_trans;
|
||||||
|
|
||||||
/* utility string buffer, hold max sized IP address as string */
|
/* utility string buffer, hold max sized IP address as string */
|
||||||
char *addrbuff;
|
char *addrbuff;
|
||||||
@@ -876,7 +914,7 @@ unsigned char *tcp_request(int confd, time_t now,
|
|||||||
union mysockaddr *local_addr, struct in_addr netmask);
|
union mysockaddr *local_addr, struct in_addr netmask);
|
||||||
void server_gone(struct server *server);
|
void server_gone(struct server *server);
|
||||||
struct frec *get_new_frec(time_t now, int *wait);
|
struct frec *get_new_frec(time_t now, int *wait);
|
||||||
void send_from(int fd, int nowild, char *packet, size_t len,
|
int send_from(int fd, int nowild, char *packet, size_t len,
|
||||||
union mysockaddr *to, struct all_addr *source,
|
union mysockaddr *to, struct all_addr *source,
|
||||||
unsigned int iface);
|
unsigned int iface);
|
||||||
|
|
||||||
@@ -925,7 +963,7 @@ char *host_from_dns(struct in_addr addr);
|
|||||||
/* lease.c */
|
/* lease.c */
|
||||||
#ifdef HAVE_DHCP
|
#ifdef HAVE_DHCP
|
||||||
void lease_update_file(time_t now);
|
void lease_update_file(time_t now);
|
||||||
void lease_update_dns();
|
void lease_update_dns(int force);
|
||||||
void lease_init(time_t now);
|
void lease_init(time_t now);
|
||||||
struct dhcp_lease *lease4_allocate(struct in_addr addr);
|
struct dhcp_lease *lease4_allocate(struct in_addr addr);
|
||||||
#ifdef HAVE_DHCP6
|
#ifdef HAVE_DHCP6
|
||||||
@@ -934,12 +972,13 @@ struct dhcp_lease *lease6_find(unsigned char *clid, int clid_len,
|
|||||||
int lease_type, int iaid, struct in6_addr *addr);
|
int lease_type, int iaid, struct in6_addr *addr);
|
||||||
struct dhcp_lease *lease6_find_by_addr(struct in6_addr *net, int prefix, u64 addr);
|
struct dhcp_lease *lease6_find_by_addr(struct in6_addr *net, int prefix, u64 addr);
|
||||||
u64 lease_find_max_addr6(struct dhcp_context *context);
|
u64 lease_find_max_addr6(struct dhcp_context *context);
|
||||||
|
void lease_ping_reply(struct in6_addr *sender, unsigned char *packet, char *interface);
|
||||||
#endif
|
#endif
|
||||||
void lease_set_hwaddr(struct dhcp_lease *lease, unsigned char *hwaddr,
|
void lease_set_hwaddr(struct dhcp_lease *lease, unsigned char *hwaddr,
|
||||||
unsigned char *clid, int hw_len, int hw_type, int clid_len);
|
unsigned char *clid, int hw_len, int hw_type, int clid_len, time_t now);
|
||||||
void lease_set_hostname(struct dhcp_lease *lease, char *name, int auth, char *domain, char *config_domain);
|
void lease_set_hostname(struct dhcp_lease *lease, char *name, int auth, char *domain, char *config_domain);
|
||||||
void lease_set_expires(struct dhcp_lease *lease, unsigned int len, time_t now);
|
void lease_set_expires(struct dhcp_lease *lease, unsigned int len, time_t now);
|
||||||
void lease_set_interface(struct dhcp_lease *lease, int interface);
|
void lease_set_interface(struct dhcp_lease *lease, int interface, time_t now);
|
||||||
struct dhcp_lease *lease_find_by_client(unsigned char *hwaddr, int hw_len, int hw_type,
|
struct dhcp_lease *lease_find_by_client(unsigned char *hwaddr, int hw_len, int hw_type,
|
||||||
unsigned char *clid, int clid_len);
|
unsigned char *clid, int clid_len);
|
||||||
struct dhcp_lease *lease_find_by_addr(struct in_addr addr);
|
struct dhcp_lease *lease_find_by_addr(struct in_addr addr);
|
||||||
@@ -948,6 +987,7 @@ void lease_prune(struct dhcp_lease *target, time_t now);
|
|||||||
void lease_update_from_configs(void);
|
void lease_update_from_configs(void);
|
||||||
int do_script_run(time_t now);
|
int do_script_run(time_t now);
|
||||||
void rerun_scripts(void);
|
void rerun_scripts(void);
|
||||||
|
void lease_find_interfaces(time_t now);
|
||||||
#ifdef HAVE_SCRIPT
|
#ifdef HAVE_SCRIPT
|
||||||
void lease_add_extradata(struct dhcp_lease *lease, unsigned char *data,
|
void lease_add_extradata(struct dhcp_lease *lease, unsigned char *data,
|
||||||
unsigned int len, int delim);
|
unsigned int len, int delim);
|
||||||
@@ -967,7 +1007,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_alarm(time_t event, time_t now);
|
||||||
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);
|
||||||
@@ -999,11 +1039,14 @@ void emit_dbus_signal(int action, struct dhcp_lease *lease, char *hostname);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* helper.c */
|
/* helper.c */
|
||||||
#if defined(HAVE_DHCP) && !defined(NO_FORK)
|
#if defined(HAVE_SCRIPT)
|
||||||
int create_helper(int event_fd, int err_fd, uid_t uid, gid_t gid, long max_fd);
|
int create_helper(int event_fd, int err_fd, uid_t uid, gid_t gid, long max_fd);
|
||||||
void helper_write(void);
|
void helper_write(void);
|
||||||
void queue_script(int action, struct dhcp_lease *lease,
|
void queue_script(int action, struct dhcp_lease *lease,
|
||||||
char *hostname, time_t now);
|
char *hostname, time_t now);
|
||||||
|
#ifdef HAVE_TFTP
|
||||||
|
void queue_tftp(off_t file_len, char *filename, union mysockaddr *peer);
|
||||||
|
#endif
|
||||||
int helper_buf_empty(void);
|
int helper_buf_empty(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1011,6 +1054,7 @@ int helper_buf_empty(void);
|
|||||||
#ifdef HAVE_TFTP
|
#ifdef HAVE_TFTP
|
||||||
void tftp_request(struct listener *listen, time_t now);
|
void tftp_request(struct listener *listen, time_t now);
|
||||||
void check_tftp_listeners(fd_set *rset, time_t now);
|
void check_tftp_listeners(fd_set *rset, time_t now);
|
||||||
|
int do_tftp_script_run(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* conntrack.c */
|
/* conntrack.c */
|
||||||
@@ -1042,8 +1086,8 @@ void make_duid(time_t now);
|
|||||||
|
|
||||||
/* rfc3315.c */
|
/* rfc3315.c */
|
||||||
#ifdef HAVE_DHCP6
|
#ifdef HAVE_DHCP6
|
||||||
size_t dhcp6_reply(struct dhcp_context *context, int interface, char *iface_name,
|
unsigned short dhcp6_reply(struct dhcp_context *context, int interface, char *iface_name,
|
||||||
struct in6_addr *fallback, size_t sz, int is_multicast, time_t now);
|
struct in6_addr *fallback, size_t sz, int is_multicast, time_t now);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* dhcp-common.c */
|
/* dhcp-common.c */
|
||||||
@@ -1059,7 +1103,13 @@ 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);
|
||||||
|
void display_opts(void);
|
||||||
|
u16 lookup_dhcp_opt(int prot, char *name);
|
||||||
|
u16 lookup_dhcp_len(int prot, u16 val);
|
||||||
|
char *option_string(int prot, unsigned int opt, unsigned char *val,
|
||||||
|
int opt_len, char *buf, int buf_len);
|
||||||
# ifdef HAVE_DHCP6
|
# ifdef HAVE_DHCP6
|
||||||
|
void display_opts6(void);
|
||||||
void join_multicast(void);
|
void join_multicast(void);
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
@@ -1082,5 +1132,14 @@ void put_opt6_string(char *s);
|
|||||||
void ra_init(time_t now);
|
void ra_init(time_t now);
|
||||||
void icmp6_packet(void);
|
void icmp6_packet(void);
|
||||||
time_t periodic_ra(time_t now);
|
time_t periodic_ra(time_t now);
|
||||||
void ra_start_unsolicted(time_t now);
|
void ra_start_unsolicted(time_t now, struct dhcp_context *context);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* slaac.c */
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
void build_subnet_map(void);
|
||||||
|
void slaac_add_addrs(struct dhcp_lease *lease, time_t now);
|
||||||
|
time_t periodic_slaac(time_t now, struct dhcp_lease *leases);
|
||||||
|
void slaac_ping_reply(struct in6_addr *sender, unsigned char *packet, char *interface, struct dhcp_lease *leases);
|
||||||
|
void schedule_subnet_map(void);
|
||||||
#endif
|
#endif
|
||||||
+8
-4
@@ -26,9 +26,9 @@ static struct randfd *allocate_rfd(int family);
|
|||||||
|
|
||||||
/* Send a UDP packet with its source address set as "source"
|
/* Send a UDP packet with its source address set as "source"
|
||||||
unless nowild is true, when we just send it with the kernel default */
|
unless nowild is true, when we just send it with the kernel default */
|
||||||
void send_from(int fd, int nowild, char *packet, size_t len,
|
int send_from(int fd, int nowild, char *packet, size_t len,
|
||||||
union mysockaddr *to, struct all_addr *source,
|
union mysockaddr *to, struct all_addr *source,
|
||||||
unsigned int iface)
|
unsigned int iface)
|
||||||
{
|
{
|
||||||
struct msghdr msg;
|
struct msghdr msg;
|
||||||
struct iovec iov[1];
|
struct iovec iov[1];
|
||||||
@@ -111,7 +111,11 @@ void send_from(int fd, int nowild, char *packet, size_t len,
|
|||||||
goto retry;
|
goto retry;
|
||||||
|
|
||||||
my_syslog(LOG_ERR, _("failed to send packet: %s"), strerror(errno));
|
my_syslog(LOG_ERR, _("failed to send packet: %s"), strerror(errno));
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int search_servers(time_t now, struct all_addr **addrpp,
|
static unsigned int search_servers(time_t now, struct all_addr **addrpp,
|
||||||
@@ -660,7 +664,7 @@ void receive_query(struct listener *listen, time_t now)
|
|||||||
/* packet buffer overwritten */
|
/* packet buffer overwritten */
|
||||||
daemon->srv_save = NULL;
|
daemon->srv_save = NULL;
|
||||||
|
|
||||||
if (listen->family == AF_INET && option_bool(OPT_NOWILD))
|
if (listen->iface && listen->family == AF_INET && option_bool(OPT_NOWILD))
|
||||||
{
|
{
|
||||||
dst_addr_4 = listen->iface->addr.in.sin_addr;
|
dst_addr_4 = listen->iface->addr.in.sin_addr;
|
||||||
netmask = listen->iface->netmask;
|
netmask = listen->iface->netmask;
|
||||||
|
|||||||
+241
-168
@@ -193,16 +193,22 @@ int create_helper(int event_fd, int err_fd, uid_t uid, gid_t gid, long max_fd)
|
|||||||
_exit(0);
|
_exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is6 = !!(data.flags & (LEASE_TA | LEASE_NA));
|
||||||
|
|
||||||
if (data.action == ACTION_DEL)
|
if (data.action == ACTION_DEL)
|
||||||
action_str = "del";
|
action_str = "del";
|
||||||
else if (data.action == ACTION_ADD)
|
else if (data.action == ACTION_ADD)
|
||||||
action_str = "add";
|
action_str = "add";
|
||||||
else if (data.action == ACTION_OLD || data.action == ACTION_OLD_HOSTNAME)
|
else if (data.action == ACTION_OLD || data.action == ACTION_OLD_HOSTNAME)
|
||||||
action_str = "old";
|
action_str = "old";
|
||||||
|
else if (data.action == ACTION_TFTP)
|
||||||
|
{
|
||||||
|
action_str = "tftp";
|
||||||
|
is6 = (data.flags != AF_INET);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
is6 = !!(data.flags & (LEASE_TA | LEASE_NA));
|
|
||||||
|
|
||||||
if (!is6)
|
if (!is6)
|
||||||
{
|
{
|
||||||
@@ -271,12 +277,15 @@ int create_helper(int event_fd, int err_fd, uid_t uid, gid_t gid, long max_fd)
|
|||||||
char *dot;
|
char *dot;
|
||||||
hostname = (char *)buf;
|
hostname = (char *)buf;
|
||||||
hostname[data.hostname_len - 1] = 0;
|
hostname[data.hostname_len - 1] = 0;
|
||||||
if (!legal_hostname(hostname))
|
if (data.action != ACTION_TFTP)
|
||||||
hostname = NULL;
|
|
||||||
else if ((dot = strchr(hostname, '.')))
|
|
||||||
{
|
{
|
||||||
domain = dot+1;
|
if (!legal_hostname(hostname))
|
||||||
*dot = 0;
|
hostname = NULL;
|
||||||
|
else if ((dot = strchr(hostname, '.')))
|
||||||
|
{
|
||||||
|
domain = dot+1;
|
||||||
|
*dot = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,116 +298,141 @@ int create_helper(int event_fd, int err_fd, uid_t uid, gid_t gid, long max_fd)
|
|||||||
inet_ntop(AF_INET6, &data.hwaddr, daemon->addrbuff, ADDRSTRLEN);
|
inet_ntop(AF_INET6, &data.hwaddr, daemon->addrbuff, ADDRSTRLEN);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* file length */
|
||||||
|
if (data.action == ACTION_TFTP)
|
||||||
|
sprintf(daemon->dhcp_buff, "%u", data.hwaddr_len);
|
||||||
|
|
||||||
#ifdef HAVE_LUASCRIPT
|
#ifdef HAVE_LUASCRIPT
|
||||||
if (daemon->luascript)
|
if (daemon->luascript)
|
||||||
{
|
{
|
||||||
lua_getglobal(lua, "lease"); /* function to call */
|
if (data.action == ACTION_TFTP)
|
||||||
lua_pushstring(lua, action_str); /* arg1 - action */
|
|
||||||
lua_newtable(lua); /* arg2 - data table */
|
|
||||||
|
|
||||||
if (is6)
|
|
||||||
{
|
{
|
||||||
lua_pushstring(lua, daemon->dhcp_buff);
|
lua_getglobal(lua, "tftp");
|
||||||
lua_setfield(lua, -2, "client_duid");
|
if (lua_type(lua, -1) != LUA_TFUNCTION)
|
||||||
lua_pushstring(lua, daemon->packet);
|
lua_pop(lua, 1); /* tftp function optional */
|
||||||
lua_setfield(lua, -2, "server_duid");
|
else
|
||||||
lua_pushstring(lua, daemon->dhcp_buff3);
|
{
|
||||||
lua_setfield(lua, -2, "iaid");
|
lua_pushstring(lua, action_str); /* arg1 - action */
|
||||||
|
lua_newtable(lua); /* arg2 - data table */
|
||||||
|
lua_pushstring(lua, daemon->addrbuff);
|
||||||
|
lua_setfield(lua, -2, "destination_address");
|
||||||
|
lua_pushstring(lua, hostname);
|
||||||
|
lua_setfield(lua, -2, "file_name");
|
||||||
|
lua_pushstring(lua, daemon->dhcp_buff);
|
||||||
|
lua_setfield(lua, -2, "file_size");
|
||||||
|
lua_call(lua, 2, 0); /* pass 2 values, expect 0 */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (!is6 && data.clid_len != 0)
|
|
||||||
{
|
{
|
||||||
lua_pushstring(lua, daemon->packet);
|
lua_getglobal(lua, "lease"); /* function to call */
|
||||||
lua_setfield(lua, -2, "client_id");
|
lua_pushstring(lua, action_str); /* arg1 - action */
|
||||||
}
|
lua_newtable(lua); /* arg2 - data table */
|
||||||
|
|
||||||
if (strlen(data.interface) != 0)
|
if (is6)
|
||||||
{
|
{
|
||||||
lua_pushstring(lua, data.interface);
|
lua_pushstring(lua, daemon->dhcp_buff);
|
||||||
lua_setfield(lua, -2, "interface");
|
lua_setfield(lua, -2, "client_duid");
|
||||||
}
|
lua_pushstring(lua, daemon->packet);
|
||||||
|
lua_setfield(lua, -2, "server_duid");
|
||||||
|
lua_pushstring(lua, daemon->dhcp_buff3);
|
||||||
|
lua_setfield(lua, -2, "iaid");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is6 && data.clid_len != 0)
|
||||||
|
{
|
||||||
|
lua_pushstring(lua, daemon->packet);
|
||||||
|
lua_setfield(lua, -2, "client_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen(data.interface) != 0)
|
||||||
|
{
|
||||||
|
lua_pushstring(lua, data.interface);
|
||||||
|
lua_setfield(lua, -2, "interface");
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_BROKEN_RTC
|
#ifdef HAVE_BROKEN_RTC
|
||||||
lua_pushnumber(lua, data.length);
|
lua_pushnumber(lua, data.length);
|
||||||
lua_setfield(lua, -2, "lease_length");
|
lua_setfield(lua, -2, "lease_length");
|
||||||
#else
|
#else
|
||||||
lua_pushnumber(lua, data.expires);
|
lua_pushnumber(lua, data.expires);
|
||||||
lua_setfield(lua, -2, "lease_expires");
|
lua_setfield(lua, -2, "lease_expires");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (hostname)
|
if (hostname)
|
||||||
{
|
{
|
||||||
lua_pushstring(lua, hostname);
|
lua_pushstring(lua, hostname);
|
||||||
lua_setfield(lua, -2, "hostname");
|
lua_setfield(lua, -2, "hostname");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (domain)
|
if (domain)
|
||||||
{
|
{
|
||||||
lua_pushstring(lua, domain);
|
lua_pushstring(lua, domain);
|
||||||
lua_setfield(lua, -2, "domain");
|
lua_setfield(lua, -2, "domain");
|
||||||
}
|
}
|
||||||
|
|
||||||
end = extradata + data.ed_len;
|
end = extradata + data.ed_len;
|
||||||
buf = extradata;
|
buf = extradata;
|
||||||
|
|
||||||
if (!is6)
|
if (!is6)
|
||||||
buf = grab_extradata_lua(buf, end, "vendor_class");
|
buf = grab_extradata_lua(buf, end, "vendor_class");
|
||||||
#ifdef HAVE_DHCP6
|
#ifdef HAVE_DHCP6
|
||||||
else
|
else
|
||||||
for (i = 0; i < data.hwaddr_len; i++)
|
for (i = 0; i < data.hwaddr_len; i++)
|
||||||
{
|
{
|
||||||
sprintf(daemon->dhcp_buff2, "vendor_class%i", i);
|
sprintf(daemon->dhcp_buff2, "vendor_class%i", i);
|
||||||
buf = grab_extradata_lua(buf, end, daemon->dhcp_buff2);
|
buf = grab_extradata_lua(buf, end, daemon->dhcp_buff2);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
buf = grab_extradata_lua(buf, end, "supplied_hostname");
|
buf = grab_extradata_lua(buf, end, "supplied_hostname");
|
||||||
|
|
||||||
if (!is6)
|
if (!is6)
|
||||||
{
|
{
|
||||||
buf = grab_extradata_lua(buf, end, "cpewan_oui");
|
buf = grab_extradata_lua(buf, end, "cpewan_oui");
|
||||||
buf = grab_extradata_lua(buf, end, "cpewan_serial");
|
buf = grab_extradata_lua(buf, end, "cpewan_serial");
|
||||||
buf = grab_extradata_lua(buf, end, "cpewan_class");
|
buf = grab_extradata_lua(buf, end, "cpewan_class");
|
||||||
|
}
|
||||||
|
|
||||||
|
buf = grab_extradata_lua(buf, end, "tags");
|
||||||
|
|
||||||
|
if (is6)
|
||||||
|
buf = grab_extradata_lua(buf, end, "relay_address");
|
||||||
|
else if (data.giaddr.s_addr != 0)
|
||||||
|
{
|
||||||
|
lua_pushstring(lua, inet_ntoa(data.giaddr));
|
||||||
|
lua_setfield(lua, -2, "relay_address");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; buf; i++)
|
||||||
|
{
|
||||||
|
sprintf(daemon->dhcp_buff2, "user_class%i", i);
|
||||||
|
buf = grab_extradata_lua(buf, end, daemon->dhcp_buff2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.action != ACTION_DEL && data.remaining_time != 0)
|
||||||
|
{
|
||||||
|
lua_pushnumber(lua, data.remaining_time);
|
||||||
|
lua_setfield(lua, -2, "time_remaining");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.action == ACTION_OLD_HOSTNAME && hostname)
|
||||||
|
{
|
||||||
|
lua_pushstring(lua, hostname);
|
||||||
|
lua_setfield(lua, -2, "old_hostname");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is6)
|
||||||
|
{
|
||||||
|
lua_pushstring(lua, daemon->dhcp_buff);
|
||||||
|
lua_setfield(lua, -2, "mac_address");
|
||||||
|
}
|
||||||
|
|
||||||
|
lua_pushstring(lua, daemon->addrbuff);
|
||||||
|
lua_setfield(lua, -2, "ip_address");
|
||||||
|
|
||||||
|
lua_call(lua, 2, 0); /* pass 2 values, expect 0 */
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = grab_extradata_lua(buf, end, "tags");
|
|
||||||
|
|
||||||
if (is6)
|
|
||||||
buf = grab_extradata_lua(buf, end, "relay_address");
|
|
||||||
else if (data.giaddr.s_addr != 0)
|
|
||||||
{
|
|
||||||
lua_pushstring(lua, inet_ntoa(data.giaddr));
|
|
||||||
lua_setfield(lua, -2, "relay_address");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; buf; i++)
|
|
||||||
{
|
|
||||||
sprintf(daemon->dhcp_buff2, "user_class%i", i);
|
|
||||||
buf = grab_extradata_lua(buf, end, daemon->dhcp_buff2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.action != ACTION_DEL && data.remaining_time != 0)
|
|
||||||
{
|
|
||||||
lua_pushnumber(lua, data.remaining_time);
|
|
||||||
lua_setfield(lua, -2, "time_remaining");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.action == ACTION_OLD_HOSTNAME && hostname)
|
|
||||||
{
|
|
||||||
lua_pushstring(lua, hostname);
|
|
||||||
lua_setfield(lua, -2, "old_hostname");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is6)
|
|
||||||
{
|
|
||||||
lua_pushstring(lua, daemon->dhcp_buff);
|
|
||||||
lua_setfield(lua, -2, "mac_address");
|
|
||||||
}
|
|
||||||
|
|
||||||
lua_pushstring(lua, daemon->addrbuff);
|
|
||||||
lua_setfield(lua, -2, "ip_address");
|
|
||||||
|
|
||||||
lua_call(lua, 2, 0); /* pass 2 values, expect 0 */
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -439,80 +473,86 @@ int create_helper(int event_fd, int err_fd, uid_t uid, gid_t gid, long max_fd)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is6)
|
if (data.action != ACTION_TFTP)
|
||||||
{
|
{
|
||||||
my_setenv("DNSMASQ_IAID", daemon->dhcp_buff3, &err);
|
if (is6)
|
||||||
my_setenv("DNSMASQ_SERVER_DUID", daemon->packet, &err);
|
{
|
||||||
}
|
my_setenv("DNSMASQ_IAID", daemon->dhcp_buff3, &err);
|
||||||
|
my_setenv("DNSMASQ_SERVER_DUID", daemon->packet, &err);
|
||||||
|
}
|
||||||
|
|
||||||
if (!is6 && data.clid_len != 0)
|
if (!is6 && data.clid_len != 0)
|
||||||
my_setenv("DNSMASQ_CLIENT_ID", daemon->packet, &err);
|
my_setenv("DNSMASQ_CLIENT_ID", daemon->packet, &err);
|
||||||
|
|
||||||
if (strlen(data.interface) != 0)
|
if (strlen(data.interface) != 0)
|
||||||
my_setenv("DNSMASQ_INTERFACE", data.interface, &err);
|
my_setenv("DNSMASQ_INTERFACE", data.interface, &err);
|
||||||
|
|
||||||
#ifdef HAVE_BROKEN_RTC
|
#ifdef HAVE_BROKEN_RTC
|
||||||
my_setenv("DNSMASQ_LEASE_LENGTH", daemon->dhcp_buff2, &err);
|
my_setenv("DNSMASQ_LEASE_LENGTH", daemon->dhcp_buff2, &err);
|
||||||
#else
|
#else
|
||||||
my_setenv("DNSMASQ_LEASE_EXPIRES", daemon->dhcp_buff2, &err);
|
my_setenv("DNSMASQ_LEASE_EXPIRES", daemon->dhcp_buff2, &err);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (domain)
|
if (domain)
|
||||||
my_setenv("DNSMASQ_DOMAIN", domain, &err);
|
my_setenv("DNSMASQ_DOMAIN", domain, &err);
|
||||||
|
|
||||||
end = extradata + data.ed_len;
|
end = extradata + data.ed_len;
|
||||||
buf = extradata;
|
buf = extradata;
|
||||||
|
|
||||||
if (!is6)
|
if (!is6)
|
||||||
buf = grab_extradata(buf, end, "DNSMASQ_VENDOR_CLASS", &err);
|
buf = grab_extradata(buf, end, "DNSMASQ_VENDOR_CLASS", &err);
|
||||||
#ifdef HAVE_DHCP6
|
#ifdef HAVE_DHCP6
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if (data.hwaddr_len != 0)
|
|
||||||
{
|
{
|
||||||
buf = grab_extradata(buf, end, "DNSMASQ_VENDOR_CLASS_ID", &err);
|
if (data.hwaddr_len != 0)
|
||||||
for (i = 0; i < data.hwaddr_len - 1; i++)
|
|
||||||
{
|
{
|
||||||
sprintf(daemon->dhcp_buff2, "DNSMASQ_VENDOR_CLASS%i", i);
|
buf = grab_extradata(buf, end, "DNSMASQ_VENDOR_CLASS_ID", &err);
|
||||||
buf = grab_extradata(buf, end, daemon->dhcp_buff2, &err);
|
for (i = 0; i < data.hwaddr_len - 1; i++)
|
||||||
|
{
|
||||||
|
sprintf(daemon->dhcp_buff2, "DNSMASQ_VENDOR_CLASS%i", i);
|
||||||
|
buf = grab_extradata(buf, end, daemon->dhcp_buff2, &err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
buf = grab_extradata(buf, end, "DNSMASQ_SUPPLIED_HOSTNAME", &err);
|
buf = grab_extradata(buf, end, "DNSMASQ_SUPPLIED_HOSTNAME", &err);
|
||||||
|
|
||||||
if (!is6)
|
if (!is6)
|
||||||
{
|
{
|
||||||
buf = grab_extradata(buf, end, "DNSMASQ_CPEWAN_OUI", &err);
|
buf = grab_extradata(buf, end, "DNSMASQ_CPEWAN_OUI", &err);
|
||||||
buf = grab_extradata(buf, end, "DNSMASQ_CPEWAN_SERIAL", &err);
|
buf = grab_extradata(buf, end, "DNSMASQ_CPEWAN_SERIAL", &err);
|
||||||
buf = grab_extradata(buf, end, "DNSMASQ_CPEWAN_CLASS", &err);
|
buf = grab_extradata(buf, end, "DNSMASQ_CPEWAN_CLASS", &err);
|
||||||
|
}
|
||||||
|
|
||||||
|
buf = grab_extradata(buf, end, "DNSMASQ_TAGS", &err);
|
||||||
|
|
||||||
|
if (is6)
|
||||||
|
buf = grab_extradata(buf, end, "DNSMASQ_RELAY_ADDRESS", &err);
|
||||||
|
else if (data.giaddr.s_addr != 0)
|
||||||
|
my_setenv("DNSMASQ_RELAY_ADDRESS", inet_ntoa(data.giaddr), &err);
|
||||||
|
|
||||||
|
for (i = 0; buf; i++)
|
||||||
|
{
|
||||||
|
sprintf(daemon->dhcp_buff2, "DNSMASQ_USER_CLASS%i", i);
|
||||||
|
buf = grab_extradata(buf, end, daemon->dhcp_buff2, &err);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.action != ACTION_DEL && data.remaining_time != 0)
|
||||||
|
{
|
||||||
|
sprintf(daemon->dhcp_buff2, "%u", data.remaining_time);
|
||||||
|
my_setenv("DNSMASQ_TIME_REMAINING", daemon->dhcp_buff2, &err);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.action == ACTION_OLD_HOSTNAME && hostname)
|
||||||
|
{
|
||||||
|
my_setenv("DNSMASQ_OLD_HOSTNAME", hostname, &err);
|
||||||
|
hostname = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = grab_extradata(buf, end, "DNSMASQ_TAGS", &err);
|
if (option_bool(OPT_LOG_OPTS))
|
||||||
|
my_setenv("DNSMASQ_LOG_DHCP", "1", &err);
|
||||||
if (is6)
|
|
||||||
buf = grab_extradata(buf, end, "DNSMASQ_RELAY_ADDRESS", &err);
|
|
||||||
else if (data.giaddr.s_addr != 0)
|
|
||||||
my_setenv("DNSMASQ_RELAY_ADDRESS", inet_ntoa(data.giaddr), &err);
|
|
||||||
|
|
||||||
for (i = 0; buf; i++)
|
|
||||||
{
|
|
||||||
sprintf(daemon->dhcp_buff2, "DNSMASQ_USER_CLASS%i", i);
|
|
||||||
buf = grab_extradata(buf, end, daemon->dhcp_buff2, &err);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.action != ACTION_DEL && data.remaining_time != 0)
|
|
||||||
{
|
|
||||||
sprintf(daemon->dhcp_buff2, "%u", data.remaining_time);
|
|
||||||
my_setenv("DNSMASQ_TIME_REMAINING", daemon->dhcp_buff2, &err);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.action == ACTION_OLD_HOSTNAME && hostname)
|
|
||||||
{
|
|
||||||
my_setenv("DNSMASQ_OLD_HOSTNAME", hostname, &err);
|
|
||||||
hostname = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* we need to have the event_fd around if exec fails */
|
/* we need to have the event_fd around if exec fails */
|
||||||
if ((i = fcntl(event_fd, F_GETFD)) != -1)
|
if ((i = fcntl(event_fd, F_GETFD)) != -1)
|
||||||
@@ -584,11 +624,29 @@ static unsigned char *grab_extradata_lua(unsigned char *buf, unsigned char *end,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void buff_alloc(size_t size)
|
||||||
|
{
|
||||||
|
if (size > buf_size)
|
||||||
|
{
|
||||||
|
struct script_data *new;
|
||||||
|
|
||||||
|
/* start with reasonable size, will almost never need extending. */
|
||||||
|
if (size < sizeof(struct script_data) + 200)
|
||||||
|
size = sizeof(struct script_data) + 200;
|
||||||
|
|
||||||
|
if (!(new = whine_malloc(size)))
|
||||||
|
return;
|
||||||
|
if (buf)
|
||||||
|
free(buf);
|
||||||
|
buf = new;
|
||||||
|
buf_size = size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* pack up lease data into a buffer */
|
/* pack up lease data into a buffer */
|
||||||
void queue_script(int action, struct dhcp_lease *lease, char *hostname, time_t now)
|
void queue_script(int action, struct dhcp_lease *lease, char *hostname, time_t now)
|
||||||
{
|
{
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
size_t size;
|
|
||||||
unsigned int hostname_len = 0, clid_len = 0, ed_len = 0;
|
unsigned int hostname_len = 0, clid_len = 0, ed_len = 0;
|
||||||
int fd = daemon->dhcpfd;
|
int fd = daemon->dhcpfd;
|
||||||
|
|
||||||
@@ -608,23 +666,7 @@ void queue_script(int action, struct dhcp_lease *lease, char *hostname, time_t n
|
|||||||
if (hostname)
|
if (hostname)
|
||||||
hostname_len = strlen(hostname) + 1;
|
hostname_len = strlen(hostname) + 1;
|
||||||
|
|
||||||
size = sizeof(struct script_data) + clid_len + ed_len + hostname_len;
|
buff_alloc(sizeof(struct script_data) + clid_len + ed_len + hostname_len);
|
||||||
|
|
||||||
if (size > buf_size)
|
|
||||||
{
|
|
||||||
struct script_data *new;
|
|
||||||
|
|
||||||
/* start with reasonable size, will almost never need extending. */
|
|
||||||
if (size < sizeof(struct script_data) + 200)
|
|
||||||
size = sizeof(struct script_data) + 200;
|
|
||||||
|
|
||||||
if (!(new = whine_malloc(size)))
|
|
||||||
return;
|
|
||||||
if (buf)
|
|
||||||
free(buf);
|
|
||||||
buf = new;
|
|
||||||
buf_size = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
buf->action = action;
|
buf->action = action;
|
||||||
buf->flags = lease->flags;
|
buf->flags = lease->flags;
|
||||||
@@ -669,6 +711,37 @@ void queue_script(int action, struct dhcp_lease *lease, char *hostname, time_t n
|
|||||||
bytes_in_buf = p - (unsigned char *)buf;
|
bytes_in_buf = p - (unsigned char *)buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_TFTP
|
||||||
|
/* This nastily re-uses DHCP-fields for TFTP stuff */
|
||||||
|
void queue_tftp(off_t file_len, char *filename, union mysockaddr *peer)
|
||||||
|
{
|
||||||
|
unsigned int filename_len;
|
||||||
|
|
||||||
|
/* no script */
|
||||||
|
if (daemon->helperfd == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
filename_len = strlen(filename) + 1;
|
||||||
|
buff_alloc(sizeof(struct script_data) + filename_len);
|
||||||
|
memset(buf, 0, sizeof(struct script_data));
|
||||||
|
|
||||||
|
buf->action = ACTION_TFTP;
|
||||||
|
buf->hostname_len = filename_len;
|
||||||
|
buf->hwaddr_len = file_len;
|
||||||
|
|
||||||
|
if ((buf->flags = peer->sa.sa_family) == AF_INET)
|
||||||
|
buf->addr = peer->in.sin_addr;
|
||||||
|
#ifdef HAVE_IPV6
|
||||||
|
else
|
||||||
|
memcpy(buf->hwaddr, &peer->in6.sin6_addr, IN6ADDRSZ);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
memcpy((unsigned char *)(buf+1), filename, filename_len);
|
||||||
|
|
||||||
|
bytes_in_buf = sizeof(struct script_data) + filename_len;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int helper_buf_empty(void)
|
int helper_buf_empty(void)
|
||||||
{
|
{
|
||||||
return bytes_in_buf == 0;
|
return bytes_in_buf == 0;
|
||||||
|
|||||||
+133
-21
@@ -97,7 +97,8 @@ void lease_init(time_t now)
|
|||||||
if (hw_type == 0 && hw_len != 0)
|
if (hw_type == 0 && hw_len != 0)
|
||||||
hw_type = ARPHRD_ETHER;
|
hw_type = ARPHRD_ETHER;
|
||||||
|
|
||||||
lease_set_hwaddr(lease, (unsigned char *)daemon->dhcp_buff2, (unsigned char *)daemon->packet, hw_len, hw_type, clid_len);
|
lease_set_hwaddr(lease, (unsigned char *)daemon->dhcp_buff2, (unsigned char *)daemon->packet,
|
||||||
|
hw_len, hw_type, clid_len, now);
|
||||||
|
|
||||||
if (strcmp(daemon->dhcp_buff, "*") != 0)
|
if (strcmp(daemon->dhcp_buff, "*") != 0)
|
||||||
lease_set_hostname(lease, daemon->dhcp_buff, 0, get_domain(lease->addr), NULL);
|
lease_set_hostname(lease, daemon->dhcp_buff, 0, get_domain(lease->addr), NULL);
|
||||||
@@ -118,7 +119,7 @@ void lease_init(time_t now)
|
|||||||
|
|
||||||
if ((lease = lease6_allocate(&addr.addr.addr6, lease_type)))
|
if ((lease = lease6_allocate(&addr.addr.addr6, lease_type)))
|
||||||
{
|
{
|
||||||
lease_set_hwaddr(lease, NULL, (unsigned char *)daemon->packet, 0, hw_type, clid_len);
|
lease_set_hwaddr(lease, NULL, (unsigned char *)daemon->packet, 0, hw_type, clid_len, now);
|
||||||
|
|
||||||
if (strcmp(daemon->dhcp_buff, "*") != 0)
|
if (strcmp(daemon->dhcp_buff, "*") != 0)
|
||||||
lease_set_hostname(lease, daemon->dhcp_buff, 0, get_domain6((struct in6_addr *)lease->hwaddr), NULL);
|
lease_set_hostname(lease, daemon->dhcp_buff, 0, get_domain6((struct in6_addr *)lease->hwaddr), NULL);
|
||||||
@@ -175,16 +176,6 @@ void lease_init(time_t now)
|
|||||||
file_dirty = 0;
|
file_dirty = 0;
|
||||||
lease_prune(NULL, now);
|
lease_prune(NULL, now);
|
||||||
dns_dirty = 1;
|
dns_dirty = 1;
|
||||||
|
|
||||||
#ifdef HAVE_DHCP6
|
|
||||||
/* If we're not doing DHCPv6, and there are not v6 leases, don't add the DUID to the database */
|
|
||||||
if (!daemon->duid && daemon->dhcp6)
|
|
||||||
{
|
|
||||||
file_dirty = 1;
|
|
||||||
make_duid(now);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void lease_update_from_configs(void)
|
void lease_update_from_configs(void)
|
||||||
@@ -316,9 +307,16 @@ void lease_update_file(time_t now)
|
|||||||
next_event = 0;
|
next_event = 0;
|
||||||
|
|
||||||
#ifdef HAVE_DHCP6
|
#ifdef HAVE_DHCP6
|
||||||
/* do timed RAs and determine when the next is */
|
/* do timed RAs and determine when the next is, also pings to potential SLAAC addresses */
|
||||||
if (daemon->ra_contexts)
|
if (daemon->ra_contexts)
|
||||||
next_event = periodic_ra(now);
|
{
|
||||||
|
time_t ra_event = periodic_slaac(now, leases);
|
||||||
|
|
||||||
|
next_event = periodic_ra(now);
|
||||||
|
|
||||||
|
if (next_event == 0 || difftime(next_event, ra_event) > 0.0)
|
||||||
|
next_event = ra_event;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (lease = leases; lease; lease = lease->next)
|
for (lease = leases; lease; lease = lease->next)
|
||||||
@@ -336,24 +334,107 @@ void lease_update_file(time_t now)
|
|||||||
(unsigned int)difftime(next_event, now));
|
(unsigned int)difftime(next_event, now));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (next_event != 0)
|
send_alarm(next_event, now);
|
||||||
alarm((unsigned)difftime(next_event, now));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void lease_update_dns(void)
|
|
||||||
|
static int find_interface_v4(struct in_addr local, int if_index,
|
||||||
|
struct in_addr netmask, struct in_addr broadcast, void *vparam)
|
||||||
{
|
{
|
||||||
struct dhcp_lease *lease;
|
struct dhcp_lease *lease;
|
||||||
|
|
||||||
if (daemon->port != 0 && dns_dirty)
|
(void) broadcast;
|
||||||
|
(void) vparam;
|
||||||
|
|
||||||
|
for (lease = leases; lease; lease = lease->next)
|
||||||
|
if (!(lease->flags & (LEASE_TA | LEASE_NA)))
|
||||||
|
if (is_same_net(local, lease->addr, netmask))
|
||||||
|
lease_set_interface(lease, if_index, *((time_t *)vparam));
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
static int find_interface_v6(struct in6_addr *local, int prefix,
|
||||||
|
int scope, int if_index, int dad, void *vparam)
|
||||||
|
{
|
||||||
|
struct dhcp_lease *lease;
|
||||||
|
|
||||||
|
(void)scope;
|
||||||
|
(void)dad;
|
||||||
|
|
||||||
|
for (lease = leases; lease; lease = lease->next)
|
||||||
|
if ((lease->flags & (LEASE_TA | LEASE_NA)))
|
||||||
|
if (is_same_net6(local, (struct in6_addr *)&lease->hwaddr, prefix))
|
||||||
|
lease_set_interface(lease, if_index, *((time_t *)vparam));
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void lease_ping_reply(struct in6_addr *sender, unsigned char *packet, char *interface)
|
||||||
|
{
|
||||||
|
/* We may be doing RA but not DHCPv4, in which case the lease
|
||||||
|
database may not exist and we have nothing to do anyway */
|
||||||
|
if (daemon->dhcp)
|
||||||
|
slaac_ping_reply(sender, packet, interface, leases);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Find interfaces associated with leases at start-up. This gets updated as
|
||||||
|
we do DHCP transactions, but information about directly-connected subnets
|
||||||
|
is useful from scrips and necessary for determining SLAAC addresses from
|
||||||
|
start-time. */
|
||||||
|
void lease_find_interfaces(time_t now)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
build_subnet_map();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
iface_enumerate(AF_INET, &now, find_interface_v4);
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
iface_enumerate(AF_INET6, &now, find_interface_v6);
|
||||||
|
|
||||||
|
/* If we're not doing DHCPv6, and there are not v6 leases, don't add the DUID to the database */
|
||||||
|
if (!daemon->duid && daemon->dhcp6)
|
||||||
|
{
|
||||||
|
file_dirty = 1;
|
||||||
|
make_duid(now);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void lease_update_dns(int force)
|
||||||
|
{
|
||||||
|
struct dhcp_lease *lease;
|
||||||
|
|
||||||
|
if (daemon->port != 0 && (dns_dirty || force))
|
||||||
{
|
{
|
||||||
cache_unhash_dhcp();
|
cache_unhash_dhcp();
|
||||||
|
|
||||||
for (lease = leases; lease; lease = lease->next)
|
for (lease = leases; lease; lease = lease->next)
|
||||||
{
|
{
|
||||||
int prot = AF_INET;
|
int prot = AF_INET;
|
||||||
|
|
||||||
#ifdef HAVE_DHCP6
|
#ifdef HAVE_DHCP6
|
||||||
if (lease->flags & (LEASE_TA | LEASE_NA))
|
if (lease->flags & (LEASE_TA | LEASE_NA))
|
||||||
prot = AF_INET6;
|
prot = AF_INET6;
|
||||||
|
else if (lease->hostname || lease->fqdn)
|
||||||
|
{
|
||||||
|
struct slaac_address *slaac;
|
||||||
|
|
||||||
|
for (slaac = lease->slaac_address; slaac; slaac = slaac->next)
|
||||||
|
if (slaac->backoff == 0)
|
||||||
|
{
|
||||||
|
if (lease->fqdn)
|
||||||
|
cache_add_dhcp_entry(lease->fqdn, AF_INET6, (struct all_addr *)&slaac->addr, lease->expires);
|
||||||
|
if (!option_bool(OPT_DHCP_FQDN) && lease->hostname)
|
||||||
|
cache_add_dhcp_entry(lease->hostname, AF_INET6, (struct all_addr *)&slaac->addr, lease->expires);
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (lease->fqdn)
|
if (lease->fqdn)
|
||||||
@@ -614,14 +695,20 @@ 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
|
||||||
}
|
}
|
||||||
|
|
||||||
void lease_set_hwaddr(struct dhcp_lease *lease, unsigned char *hwaddr,
|
void lease_set_hwaddr(struct dhcp_lease *lease, unsigned char *hwaddr,
|
||||||
unsigned char *clid, int hw_len, int hw_type, int clid_len)
|
unsigned char *clid, int hw_len, int hw_type, int clid_len, time_t now)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
int change = 0;
|
||||||
|
lease->flags |= LEASE_HAVE_HWADDR;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (hw_len != lease->hwaddr_len ||
|
if (hw_len != lease->hwaddr_len ||
|
||||||
hw_type != lease->hwaddr_type ||
|
hw_type != lease->hwaddr_type ||
|
||||||
(hw_len != 0 && memcmp(lease->hwaddr, hwaddr, hw_len) != 0))
|
(hw_len != 0 && memcmp(lease->hwaddr, hwaddr, hw_len) != 0))
|
||||||
@@ -632,6 +719,9 @@ void lease_set_hwaddr(struct dhcp_lease *lease, unsigned char *hwaddr,
|
|||||||
lease->hwaddr_type = hw_type;
|
lease->hwaddr_type = hw_type;
|
||||||
lease->flags |= LEASE_CHANGED;
|
lease->flags |= LEASE_CHANGED;
|
||||||
file_dirty = 1; /* run script on change */
|
file_dirty = 1; /* run script on change */
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
change = 1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* only update clid when one is available, stops packets
|
/* only update clid when one is available, stops packets
|
||||||
@@ -649,17 +739,27 @@ void lease_set_hwaddr(struct dhcp_lease *lease, unsigned char *hwaddr,
|
|||||||
free(lease->clid);
|
free(lease->clid);
|
||||||
if (!(lease->clid = whine_malloc(clid_len)))
|
if (!(lease->clid = whine_malloc(clid_len)))
|
||||||
return;
|
return;
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
change = 1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (memcmp(lease->clid, clid, clid_len) != 0)
|
else if (memcmp(lease->clid, clid, clid_len) != 0)
|
||||||
{
|
{
|
||||||
lease->flags |= LEASE_AUX_CHANGED;
|
lease->flags |= LEASE_AUX_CHANGED;
|
||||||
file_dirty = 1;
|
file_dirty = 1;
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
change = 1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
lease->clid_len = clid_len;
|
lease->clid_len = clid_len;
|
||||||
memcpy(lease->clid, clid, clid_len);
|
memcpy(lease->clid, clid, clid_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
if (change)
|
||||||
|
slaac_add_addrs(lease, now);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void kill_name(struct dhcp_lease *lease)
|
static void kill_name(struct dhcp_lease *lease)
|
||||||
@@ -777,13 +877,17 @@ void lease_set_hostname(struct dhcp_lease *lease, char *name, int auth, char *do
|
|||||||
lease->flags |= LEASE_CHANGED; /* run script on change */
|
lease->flags |= LEASE_CHANGED; /* run script on change */
|
||||||
}
|
}
|
||||||
|
|
||||||
void lease_set_interface(struct dhcp_lease *lease, int interface)
|
void lease_set_interface(struct dhcp_lease *lease, int interface, time_t now)
|
||||||
{
|
{
|
||||||
if (lease->last_interface == interface)
|
if (lease->last_interface == interface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lease->last_interface = interface;
|
lease->last_interface = interface;
|
||||||
lease->flags |= LEASE_CHANGED;
|
lease->flags |= LEASE_CHANGED;
|
||||||
|
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
slaac_add_addrs(lease, now);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void rerun_scripts(void)
|
void rerun_scripts(void)
|
||||||
@@ -826,6 +930,14 @@ int do_script_run(time_t now)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
struct slaac_address *slaac, *tmp;
|
||||||
|
for (slaac = lease->slaac_address; slaac; slaac = tmp)
|
||||||
|
{
|
||||||
|
tmp = slaac->next;
|
||||||
|
free(slaac);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
kill_name(lease);
|
kill_name(lease);
|
||||||
#ifdef HAVE_SCRIPT
|
#ifdef HAVE_SCRIPT
|
||||||
queue_script(ACTION_DEL, lease, lease->old_hostname, now);
|
queue_script(ACTION_DEL, lease, lease->old_hostname, now);
|
||||||
|
|||||||
+3
-2
@@ -345,10 +345,11 @@ static void nl_routechange(struct nlmsghdr *h)
|
|||||||
/* force RAs to sync new network and pick up new interfaces. */
|
/* force RAs to sync new network and pick up new interfaces. */
|
||||||
if (daemon->ra_contexts)
|
if (daemon->ra_contexts)
|
||||||
{
|
{
|
||||||
ra_start_unsolicted(dnsmasq_time());
|
schedule_subnet_map();
|
||||||
|
ra_start_unsolicted(dnsmasq_time(), NULL);
|
||||||
/* 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 */
|
||||||
send_alarm();
|
send_alarm(0, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -511,6 +511,7 @@ void create_bound_listeners(int dienow)
|
|||||||
{
|
{
|
||||||
struct listener *new;
|
struct listener *new;
|
||||||
struct irec *iface;
|
struct irec *iface;
|
||||||
|
struct iname *if_tmp;
|
||||||
|
|
||||||
for (iface = daemon->interfaces; iface; iface = iface->next)
|
for (iface = daemon->interfaces; iface; iface = iface->next)
|
||||||
if (!iface->done && !iface->dad &&
|
if (!iface->done && !iface->dad &&
|
||||||
@@ -521,6 +522,25 @@ void create_bound_listeners(int dienow)
|
|||||||
daemon->listeners = new;
|
daemon->listeners = new;
|
||||||
iface->done = 1;
|
iface->done = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check for --listen-address options that haven't been used because there's
|
||||||
|
no interface with a matching address. These may be valid: eg it's possible
|
||||||
|
to listen on 127.0.1.1 even if the loopback interface is 127.0.0.1
|
||||||
|
|
||||||
|
If the address isn't valid the bind() will fail and we'll die().
|
||||||
|
|
||||||
|
The resulting listeners have the ->iface field NULL, and this has to be
|
||||||
|
handled by the DNS and TFTP code. It disables --localise-queries processing
|
||||||
|
(no netmask) and some MTU login the tftp code. */
|
||||||
|
|
||||||
|
for (if_tmp = daemon->if_addrs; if_tmp; if_tmp = if_tmp->next)
|
||||||
|
if (!if_tmp->used &&
|
||||||
|
(new = create_listeners(&if_tmp->addr, 1, dienow)))
|
||||||
|
{
|
||||||
|
new->iface = NULL;
|
||||||
|
new->next = daemon->listeners;
|
||||||
|
daemon->listeners = new;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int is_dad_listeners(void)
|
int is_dad_listeners(void)
|
||||||
|
|||||||
+146
-347
@@ -115,6 +115,8 @@ struct myoption {
|
|||||||
#define LOPT_FQDN 304
|
#define LOPT_FQDN 304
|
||||||
#define LOPT_LUASCRIPT 305
|
#define LOPT_LUASCRIPT 305
|
||||||
#define LOPT_RA 306
|
#define LOPT_RA 306
|
||||||
|
#define LOPT_DUID 307
|
||||||
|
#define LOPT_HOST_REC 308
|
||||||
|
|
||||||
#ifdef HAVE_GETOPT_LONG
|
#ifdef HAVE_GETOPT_LONG
|
||||||
static const struct option opts[] =
|
static const struct option opts[] =
|
||||||
@@ -235,6 +237,8 @@ static const struct myoption opts[] =
|
|||||||
{ "dhcp-client-update", 0, 0, LOPT_FQDN },
|
{ "dhcp-client-update", 0, 0, LOPT_FQDN },
|
||||||
{ "dhcp-luascript", 1, 0, LOPT_LUASCRIPT },
|
{ "dhcp-luascript", 1, 0, LOPT_LUASCRIPT },
|
||||||
{ "enable-ra", 0, 0, LOPT_RA },
|
{ "enable-ra", 0, 0, LOPT_RA },
|
||||||
|
{ "dhcp-duid", 1, 0, LOPT_DUID },
|
||||||
|
{ "host-record", 1, 0, LOPT_HOST_REC },
|
||||||
{ NULL, 0, 0, 0 }
|
{ NULL, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -362,242 +366,11 @@ static struct {
|
|||||||
{ LOPT_CONNTRACK, OPT_CONNTRACK, NULL, gettext_noop("Copy connection-track mark from queries to upstream connections."), NULL },
|
{ LOPT_CONNTRACK, OPT_CONNTRACK, NULL, gettext_noop("Copy connection-track mark from queries to upstream connections."), NULL },
|
||||||
{ LOPT_FQDN, OPT_FQDN_UPDATE, NULL, gettext_noop("Allow DHCP clients to do their own DDNS updates."), NULL },
|
{ LOPT_FQDN, OPT_FQDN_UPDATE, NULL, gettext_noop("Allow DHCP clients to do their own DDNS updates."), NULL },
|
||||||
{ LOPT_RA, OPT_RA, NULL, gettext_noop("Send router-advertisements for interfaces doing DHCPv6"), NULL },
|
{ LOPT_RA, OPT_RA, NULL, gettext_noop("Send router-advertisements for interfaces doing DHCPv6"), NULL },
|
||||||
|
{ LOPT_DUID, ARG_ONE, "<enterprise>,<duid>", gettext_noop("Specify DUID_EN-type DHCPv6 server DUID"), NULL },
|
||||||
|
{ LOPT_HOST_REC, ARG_DUP, "<name>,<address>", gettext_noop("Specify host (A/AAAA and PTR) records"), NULL },
|
||||||
{ 0, 0, NULL, NULL, NULL }
|
{ 0, 0, NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HAVE_DHCP
|
|
||||||
|
|
||||||
#define OT_ADDR_LIST 0x8000
|
|
||||||
#define OT_RFC1035_NAME 0x4000
|
|
||||||
#define OT_INTERNAL 0x2000
|
|
||||||
#define OT_NAME 0x1000
|
|
||||||
#define OT_CSTRING 0x0800
|
|
||||||
|
|
||||||
static const struct opttab_t {
|
|
||||||
char *name;
|
|
||||||
u16 val, size;
|
|
||||||
} opttab[] = {
|
|
||||||
{ "netmask", 1, OT_ADDR_LIST },
|
|
||||||
{ "time-offset", 2, 4 },
|
|
||||||
{ "router", 3, OT_ADDR_LIST },
|
|
||||||
{ "dns-server", 6, OT_ADDR_LIST },
|
|
||||||
{ "log-server", 7, OT_ADDR_LIST },
|
|
||||||
{ "lpr-server", 9, OT_ADDR_LIST },
|
|
||||||
{ "hostname", 12, OT_INTERNAL | OT_NAME },
|
|
||||||
{ "boot-file-size", 13, 2 },
|
|
||||||
{ "domain-name", 15, OT_NAME },
|
|
||||||
{ "swap-server", 16, OT_ADDR_LIST },
|
|
||||||
{ "root-path", 17, OT_NAME },
|
|
||||||
{ "extension-path", 18, OT_NAME },
|
|
||||||
{ "ip-forward-enable", 19, 1 },
|
|
||||||
{ "non-local-source-routing", 20, 1 },
|
|
||||||
{ "policy-filter", 21, OT_ADDR_LIST },
|
|
||||||
{ "max-datagram-reassembly", 22, 2 },
|
|
||||||
{ "default-ttl", 23, 1 },
|
|
||||||
{ "mtu", 26, 2 },
|
|
||||||
{ "all-subnets-local", 27, 1 },
|
|
||||||
{ "broadcast", 28, OT_INTERNAL | OT_ADDR_LIST },
|
|
||||||
{ "router-discovery", 31, 1 },
|
|
||||||
{ "router-solicitation", 32, OT_ADDR_LIST },
|
|
||||||
{ "static-route", 33, OT_ADDR_LIST },
|
|
||||||
{ "trailer-encapsulation", 34, 1 },
|
|
||||||
{ "arp-timeout", 35, 4 },
|
|
||||||
{ "ethernet-encap", 36, 1 },
|
|
||||||
{ "tcp-ttl", 37, 1 },
|
|
||||||
{ "tcp-keepalive", 38, 4 },
|
|
||||||
{ "nis-domain", 40, OT_NAME },
|
|
||||||
{ "nis-server", 41, OT_ADDR_LIST },
|
|
||||||
{ "ntp-server", 42, OT_ADDR_LIST },
|
|
||||||
{ "vendor-encap", 43, OT_INTERNAL },
|
|
||||||
{ "netbios-ns", 44, OT_ADDR_LIST },
|
|
||||||
{ "netbios-dd", 45, OT_ADDR_LIST },
|
|
||||||
{ "netbios-nodetype", 46, 1 },
|
|
||||||
{ "netbios-scope", 47, 0 },
|
|
||||||
{ "x-windows-fs", 48, OT_ADDR_LIST },
|
|
||||||
{ "x-windows-dm", 49, OT_ADDR_LIST },
|
|
||||||
{ "requested-address", 50, OT_INTERNAL | OT_ADDR_LIST },
|
|
||||||
{ "lease-time", 51, OT_INTERNAL },
|
|
||||||
{ "option-overload", 52, OT_INTERNAL },
|
|
||||||
{ "message-type", 53, OT_INTERNAL, },
|
|
||||||
{ "server-identifier", 54, OT_INTERNAL | OT_ADDR_LIST },
|
|
||||||
{ "parameter-request", 55, OT_INTERNAL },
|
|
||||||
{ "message", 56, OT_INTERNAL },
|
|
||||||
{ "max-message-size", 57, OT_INTERNAL },
|
|
||||||
{ "T1", 58, OT_INTERNAL },
|
|
||||||
{ "T2", 59, OT_INTERNAL },
|
|
||||||
{ "vendor-class", 60, 0 },
|
|
||||||
{ "client-id", 61, OT_INTERNAL },
|
|
||||||
{ "nis+-domain", 64, OT_NAME },
|
|
||||||
{ "nis+-server", 65, OT_ADDR_LIST },
|
|
||||||
{ "tftp-server", 66, OT_NAME },
|
|
||||||
{ "bootfile-name", 67, OT_NAME },
|
|
||||||
{ "mobile-ip-home", 68, OT_ADDR_LIST },
|
|
||||||
{ "smtp-server", 69, OT_ADDR_LIST },
|
|
||||||
{ "pop3-server", 70, OT_ADDR_LIST },
|
|
||||||
{ "nntp-server", 71, OT_ADDR_LIST },
|
|
||||||
{ "irc-server", 74, OT_ADDR_LIST },
|
|
||||||
{ "user-class", 77, 0 },
|
|
||||||
{ "FQDN", 81, OT_INTERNAL },
|
|
||||||
{ "agent-id", 82, OT_INTERNAL },
|
|
||||||
{ "client-arch", 93, 2 },
|
|
||||||
{ "client-interface-id", 94, 0 },
|
|
||||||
{ "client-machine-id", 97, 0 },
|
|
||||||
{ "subnet-select", 118, OT_INTERNAL },
|
|
||||||
{ "domain-search", 119, OT_RFC1035_NAME },
|
|
||||||
{ "sip-server", 120, 0 },
|
|
||||||
{ "classless-static-route", 121, 0 },
|
|
||||||
{ "vendor-id-encap", 125, 0 },
|
|
||||||
{ "server-ip-address", 255, OT_ADDR_LIST }, /* special, internal only, sets siaddr */
|
|
||||||
{ NULL, 0, 0 }
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef HAVE_DHCP6
|
|
||||||
static const struct opttab_t opttab6[] = {
|
|
||||||
{ "client-id", 1, OT_INTERNAL },
|
|
||||||
{ "server-id", 2, OT_INTERNAL },
|
|
||||||
{ "ia-na", 3, OT_INTERNAL },
|
|
||||||
{ "ia-ta", 4, OT_INTERNAL },
|
|
||||||
{ "iaaddr", 5, OT_INTERNAL },
|
|
||||||
{ "oro", 6, OT_INTERNAL },
|
|
||||||
{ "preference", 7, OT_INTERNAL },
|
|
||||||
{ "unicast", 12, OT_INTERNAL },
|
|
||||||
{ "status-code", 13, OT_INTERNAL },
|
|
||||||
{ "rapid-commit", 14, OT_INTERNAL },
|
|
||||||
{ "user-class", 15, OT_INTERNAL | OT_CSTRING },
|
|
||||||
{ "vendor-class", 16, OT_INTERNAL | OT_CSTRING },
|
|
||||||
{ "vendor-opts", 17, OT_INTERNAL },
|
|
||||||
{ "sip-server-domain", 21, OT_RFC1035_NAME },
|
|
||||||
{ "sip-server", 22, OT_ADDR_LIST },
|
|
||||||
{ "dns-server", 23, OT_ADDR_LIST },
|
|
||||||
{ "domain-search", 24, OT_RFC1035_NAME },
|
|
||||||
{ "nis-server", 27, OT_ADDR_LIST },
|
|
||||||
{ "nis+-server", 28, OT_ADDR_LIST },
|
|
||||||
{ "nis-domain", 29, OT_RFC1035_NAME },
|
|
||||||
{ "nis+-domain", 30, OT_RFC1035_NAME },
|
|
||||||
{ "sntp-server", 31, OT_ADDR_LIST },
|
|
||||||
{ "FQDN", 39, OT_INTERNAL | OT_RFC1035_NAME },
|
|
||||||
{ "ntp-server", 56, OT_ADDR_LIST },
|
|
||||||
{ "bootfile-url", 59, OT_NAME },
|
|
||||||
{ "bootfile-param", 60, OT_CSTRING },
|
|
||||||
{ NULL, 0, 0 }
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
char *option_string(int prot, unsigned int opt, unsigned char *val, int opt_len, char *buf, int buf_len)
|
|
||||||
{
|
|
||||||
int o, i, j, nodecode = 0;
|
|
||||||
const struct opttab_t *ot = opttab;
|
|
||||||
|
|
||||||
#ifdef HAVE_DHCP6
|
|
||||||
if (prot == AF_INET6)
|
|
||||||
ot = opttab6;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (o = 0; ot[o].name; o++)
|
|
||||||
if (ot[o].val == opt)
|
|
||||||
{
|
|
||||||
if (buf)
|
|
||||||
{
|
|
||||||
memset(buf, 0, buf_len);
|
|
||||||
|
|
||||||
if (ot[o].size & OT_ADDR_LIST)
|
|
||||||
{
|
|
||||||
struct all_addr addr;
|
|
||||||
int addr_len = INADDRSZ;
|
|
||||||
|
|
||||||
#ifdef HAVE_DHCP6
|
|
||||||
if (prot == AF_INET6)
|
|
||||||
addr_len = IN6ADDRSZ;
|
|
||||||
#endif
|
|
||||||
for (buf[0]= 0, i = 0; i <= opt_len - addr_len; i += addr_len)
|
|
||||||
{
|
|
||||||
if (i != 0)
|
|
||||||
strncat(buf, ", ", buf_len - strlen(buf));
|
|
||||||
/* align */
|
|
||||||
memcpy(&addr, &val[i], addr_len);
|
|
||||||
inet_ntop(prot, &val[i], daemon->addrbuff, ADDRSTRLEN);
|
|
||||||
strncat(buf, daemon->addrbuff, buf_len - strlen(buf));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (ot[o].size & OT_NAME)
|
|
||||||
for (i = 0, j = 0; i < opt_len && j < buf_len ; i++)
|
|
||||||
{
|
|
||||||
char c = val[i];
|
|
||||||
if (isprint((int)c))
|
|
||||||
buf[j++] = c;
|
|
||||||
}
|
|
||||||
#ifdef HAVE_DHCP6
|
|
||||||
/* We don't handle compressed rfc1035 names, so no good in IPv4 land */
|
|
||||||
else if ((ot[o].size & OT_RFC1035_NAME) && prot == AF_INET6)
|
|
||||||
{
|
|
||||||
i = 0, j = 0;
|
|
||||||
while (i < opt_len && val[i] != 0)
|
|
||||||
{
|
|
||||||
int k, l = i + val[i] + 1;
|
|
||||||
for (k = i + 1; k < opt_len && k < l && j < buf_len ; k++)
|
|
||||||
{
|
|
||||||
char c = val[k];
|
|
||||||
if (isprint((int)c))
|
|
||||||
buf[j++] = c;
|
|
||||||
}
|
|
||||||
i = l;
|
|
||||||
if (val[i] != 0 && j < buf_len)
|
|
||||||
buf[j++] = '.';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ((ot[o].size & OT_CSTRING))
|
|
||||||
{
|
|
||||||
int k, len;
|
|
||||||
unsigned char *p;
|
|
||||||
|
|
||||||
i = 0, j = 0;
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
p = &val[i];
|
|
||||||
GETSHORT(len, p);
|
|
||||||
for (k = 0; k < len && j < buf_len; k++)
|
|
||||||
{
|
|
||||||
char c = *p++;
|
|
||||||
if (isprint((int)c))
|
|
||||||
buf[j++] = c;
|
|
||||||
}
|
|
||||||
i += len +2;
|
|
||||||
if (i >= opt_len)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (j < buf_len)
|
|
||||||
buf[j++] = ',';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else
|
|
||||||
nodecode = 1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buf && (!ot[o].name || nodecode))
|
|
||||||
{
|
|
||||||
int trunc = 0;
|
|
||||||
if (opt_len > 13)
|
|
||||||
{
|
|
||||||
trunc = 1;
|
|
||||||
opt_len = 13;
|
|
||||||
}
|
|
||||||
print_mac(buf, val, opt_len);
|
|
||||||
if (trunc)
|
|
||||||
strncat(buf, "...", buf_len - strlen(buf));
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return ot[o].name ? ot[o].name : "";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* We hide metacharaters in quoted strings by mapping them into the ASCII control
|
/* We hide metacharaters in quoted strings by mapping them into the ASCII control
|
||||||
character space. Note that the \0, \t \b \r \033 and \n characters are carefully placed in the
|
character space. Note that the \0, \t \b \r \033 and \n characters are carefully placed in the
|
||||||
following sequence so that they map to themselves: it is therefore possible to call
|
following sequence so that they map to themselves: it is therefore possible to call
|
||||||
@@ -820,29 +593,6 @@ static void do_usage(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_DHCP
|
#ifdef HAVE_DHCP
|
||||||
static void display_opts(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
printf(_("Known DHCP options:\n"));
|
|
||||||
|
|
||||||
for (i = 0; opttab[i].name; i++)
|
|
||||||
if (!(opttab[i].size & OT_INTERNAL))
|
|
||||||
printf("%3d %s\n", opttab[i].val, opttab[i].name);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_DHCP6
|
|
||||||
static void display_opts6(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
printf(_("Known DHCPv6 options:\n"));
|
|
||||||
|
|
||||||
for (i = 0; opttab6[i].name; i++)
|
|
||||||
if (!(opttab6[i].size & OT_INTERNAL))
|
|
||||||
printf("%3d %s\n", opttab6[i].val, opttab6[i].name);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static int is_tag_prefix(char *arg)
|
static int is_tag_prefix(char *arg)
|
||||||
{
|
{
|
||||||
@@ -865,7 +615,7 @@ static char *parse_dhcp_opt(char *arg, int flags)
|
|||||||
{
|
{
|
||||||
struct dhcp_opt *new = opt_malloc(sizeof(struct dhcp_opt));
|
struct dhcp_opt *new = opt_malloc(sizeof(struct dhcp_opt));
|
||||||
char lenchar = 0, *cp;
|
char lenchar = 0, *cp;
|
||||||
int i, addrs, digs, is_addr, is_addr6, is_hex, is_dec, is_string, dots;
|
int addrs, digs, is_addr, is_addr6, is_hex, is_dec, is_string, dots;
|
||||||
char *comma = NULL, *problem = NULL;
|
char *comma = NULL, *problem = NULL;
|
||||||
struct dhcp_netid *np = NULL;
|
struct dhcp_netid *np = NULL;
|
||||||
u16 opt_len = 0;
|
u16 opt_len = 0;
|
||||||
@@ -894,14 +644,8 @@ static char *parse_dhcp_opt(char *arg, int flags)
|
|||||||
|
|
||||||
if (strstr(arg, "option:") == arg)
|
if (strstr(arg, "option:") == arg)
|
||||||
{
|
{
|
||||||
for (i = 0; opttab[i].name; i++)
|
new->opt = lookup_dhcp_opt(AF_INET, arg+7);
|
||||||
if (!(opttab[i].size & OT_INTERNAL) &&
|
opt_len = lookup_dhcp_len(AF_INET, new->opt);
|
||||||
strcasecmp(opttab[i].name, arg+7) == 0)
|
|
||||||
{
|
|
||||||
new->opt = opttab[i].val;
|
|
||||||
opt_len = opttab[i].size;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* option:<optname> must follow tag and vendor string. */
|
/* option:<optname> must follow tag and vendor string. */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -918,14 +662,10 @@ static char *parse_dhcp_opt(char *arg, int flags)
|
|||||||
opt_len = 0;
|
opt_len = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
for (i = 0; opttab6[i].name; i++)
|
{
|
||||||
if (!(opttab6[i].size & OT_INTERNAL) &&
|
new->opt = lookup_dhcp_opt(AF_INET6, arg+8);
|
||||||
strcasecmp(opttab6[i].name, arg+8) == 0)
|
opt_len = lookup_dhcp_len(AF_INET6, new->opt);
|
||||||
{
|
}
|
||||||
new->opt = opttab6[i].val;
|
|
||||||
opt_len = opttab6[i].size;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* option6:<opt>|<optname> must follow tag and vendor string. */
|
/* option6:<opt>|<optname> must follow tag and vendor string. */
|
||||||
is6 = 1;
|
is6 = 1;
|
||||||
break;
|
break;
|
||||||
@@ -974,27 +714,13 @@ static char *parse_dhcp_opt(char *arg, int flags)
|
|||||||
|
|
||||||
if (opt_len == 0 &&
|
if (opt_len == 0 &&
|
||||||
!(new->flags & DHOPT_RFC3925))
|
!(new->flags & DHOPT_RFC3925))
|
||||||
for (i = 0; opttab6[i].name; i++)
|
opt_len = lookup_dhcp_len(AF_INET6 ,new->opt);
|
||||||
if (new->opt == opttab6[i].val)
|
|
||||||
{
|
|
||||||
opt_len = opttab6[i].size;
|
|
||||||
if (opt_len & OT_INTERNAL)
|
|
||||||
opt_len = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (opt_len == 0 &&
|
if (opt_len == 0 &&
|
||||||
!(new->flags & (DHOPT_VENDOR | DHOPT_ENCAPSULATE | DHOPT_RFC3925)))
|
!(new->flags & (DHOPT_VENDOR | DHOPT_ENCAPSULATE | DHOPT_RFC3925)))
|
||||||
for (i = 0; opttab[i].name; i++)
|
opt_len = lookup_dhcp_len(AF_INET ,new->opt);
|
||||||
if (new->opt == opttab[i].val)
|
|
||||||
{
|
|
||||||
opt_len = opttab[i].size;
|
|
||||||
if (opt_len & OT_INTERNAL)
|
|
||||||
opt_len = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* option may be missing with rfc3925 match */
|
/* option may be missing with rfc3925 match */
|
||||||
if (new->opt == 0)
|
if (new->opt == 0)
|
||||||
@@ -1259,10 +985,10 @@ static char *parse_dhcp_opt(char *arg, int flags)
|
|||||||
else if (comma && (opt_len & OT_CSTRING))
|
else if (comma && (opt_len & OT_CSTRING))
|
||||||
{
|
{
|
||||||
/* length fields are two bytes so need 16 bits for each string */
|
/* length fields are two bytes so need 16 bits for each string */
|
||||||
int commas = 1;
|
int i, commas = 1;
|
||||||
unsigned char *p, *newp;
|
unsigned char *p, *newp;
|
||||||
|
|
||||||
for(i = 0; comma[i]; i++)
|
for (i = 0; comma[i]; i++)
|
||||||
if (comma[i] == ',')
|
if (comma[i] == ',')
|
||||||
commas++;
|
commas++;
|
||||||
|
|
||||||
@@ -1274,6 +1000,7 @@ static char *parse_dhcp_opt(char *arg, int flags)
|
|||||||
while (arg && *arg)
|
while (arg && *arg)
|
||||||
{
|
{
|
||||||
u16 len = strlen(arg);
|
u16 len = strlen(arg);
|
||||||
|
unhide_metas(arg);
|
||||||
PUTSHORT(len, p);
|
PUTSHORT(len, p);
|
||||||
memcpy(p, arg, len);
|
memcpy(p, arg, len);
|
||||||
p += len;
|
p += len;
|
||||||
@@ -1287,29 +1014,40 @@ static char *parse_dhcp_opt(char *arg, int flags)
|
|||||||
}
|
}
|
||||||
else if (comma && (opt_len & OT_RFC1035_NAME))
|
else if (comma && (opt_len & OT_RFC1035_NAME))
|
||||||
{
|
{
|
||||||
int commas = 1;
|
unsigned char *p = NULL, *newp, *end;
|
||||||
unsigned char *p, *newp;
|
int len = 0;
|
||||||
|
|
||||||
for(i = 0; comma[i]; i++)
|
|
||||||
if (comma[i] == ',')
|
|
||||||
commas++;
|
|
||||||
|
|
||||||
newp = opt_malloc(strlen(comma)+(2*commas));
|
|
||||||
p = newp;
|
|
||||||
arg = comma;
|
arg = comma;
|
||||||
comma = split(arg);
|
comma = split(arg);
|
||||||
|
|
||||||
while (arg && *arg)
|
while (arg && *arg)
|
||||||
{
|
{
|
||||||
p = do_rfc1035_name(p, arg);
|
char *dom = canonicalise_opt(arg);
|
||||||
*p++ = 0;
|
if (!dom)
|
||||||
|
{
|
||||||
|
problem = _("bad domain in dhcp-option");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
newp = opt_malloc(len + strlen(dom) + 2);
|
||||||
|
|
||||||
|
if (p)
|
||||||
|
{
|
||||||
|
memcpy(newp, p, len);
|
||||||
|
free(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
p = newp;
|
||||||
|
end = do_rfc1035_name(p + len, dom);
|
||||||
|
*end++ = 0;
|
||||||
|
len = end - p;
|
||||||
|
free(dom);
|
||||||
|
|
||||||
arg = comma;
|
arg = comma;
|
||||||
comma = split(arg);
|
comma = split(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
new->val = newp;
|
new->val = p;
|
||||||
new->len = p - newp;
|
new->len = len;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
@@ -2233,7 +1971,7 @@ static char *one_opt(int option, char *arg, char *gen_prob, int command_line)
|
|||||||
case 'F': /* --dhcp-range */
|
case 'F': /* --dhcp-range */
|
||||||
{
|
{
|
||||||
int k, leasepos = 2;
|
int k, leasepos = 2;
|
||||||
char *cp, *a[5] = { NULL, NULL, NULL, NULL, NULL };
|
char *cp, *a[7] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
|
||||||
struct dhcp_context *new = opt_malloc(sizeof(struct dhcp_context));
|
struct dhcp_context *new = opt_malloc(sizeof(struct dhcp_context));
|
||||||
|
|
||||||
memset (new, 0, sizeof(*new));
|
memset (new, 0, sizeof(*new));
|
||||||
@@ -2284,7 +2022,7 @@ static char *one_opt(int option, char *arg, char *gen_prob, int command_line)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (k = 1; k < 5; k++)
|
for (k = 1; k < 7; k++)
|
||||||
if (!(a[k] = split(a[k-1])))
|
if (!(a[k] = split(a[k-1])))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -2294,17 +2032,12 @@ static char *one_opt(int option, char *arg, char *gen_prob, int command_line)
|
|||||||
{
|
{
|
||||||
new->next = daemon->dhcp;
|
new->next = daemon->dhcp;
|
||||||
daemon->dhcp = new;
|
daemon->dhcp = new;
|
||||||
|
new->end = new->start;
|
||||||
if (strcmp(a[1], "static") == 0)
|
if (strcmp(a[1], "static") == 0)
|
||||||
{
|
new->flags |= CONTEXT_STATIC;
|
||||||
new->end = new->start;
|
|
||||||
new->flags |= CONTEXT_STATIC;
|
|
||||||
}
|
|
||||||
else if (strcmp(a[1], "proxy") == 0)
|
else if (strcmp(a[1], "proxy") == 0)
|
||||||
{
|
new->flags |= CONTEXT_PROXY;
|
||||||
new->end = new->start;
|
else if (!inet_pton(AF_INET, a[1], &new->end))
|
||||||
new->flags |= CONTEXT_PROXY;
|
|
||||||
}
|
|
||||||
else if ((new->end.s_addr = inet_addr(a[1])) == (in_addr_t)-1)
|
|
||||||
option = '?';
|
option = '?';
|
||||||
|
|
||||||
if (ntohl(new->start.s_addr) > ntohl(new->end.s_addr))
|
if (ntohl(new->start.s_addr) > ntohl(new->end.s_addr))
|
||||||
@@ -2334,46 +2067,54 @@ static char *one_opt(int option, char *arg, char *gen_prob, int command_line)
|
|||||||
else if (inet_pton(AF_INET6, a[0], &new->start6))
|
else if (inet_pton(AF_INET6, a[0], &new->start6))
|
||||||
{
|
{
|
||||||
new->prefix = 64; /* default */
|
new->prefix = 64; /* default */
|
||||||
|
new->end6 = new->start6;
|
||||||
|
|
||||||
if (strcmp(a[1], "static") == 0)
|
for (leasepos = 1; leasepos < k; leasepos++)
|
||||||
{
|
{
|
||||||
memcpy(&new->end6, &new->start6, IN6ADDRSZ);
|
if (strcmp(a[leasepos], "static") == 0)
|
||||||
new->flags |= CONTEXT_STATIC;
|
new->flags |= CONTEXT_STATIC | CONTEXT_DHCP;
|
||||||
|
else if (strcmp(a[leasepos], "ra-only") == 0 || strcmp(a[leasepos], "slaac") == 0 )
|
||||||
|
new->flags |= CONTEXT_RA_ONLY;
|
||||||
|
else if (strcmp(a[leasepos], "ra-names") == 0)
|
||||||
|
new->flags |= CONTEXT_RA_NAME;
|
||||||
|
else if (strcmp(a[leasepos], "ra-stateless") == 0)
|
||||||
|
new->flags |= CONTEXT_RA_STATELESS | CONTEXT_DHCP;
|
||||||
|
else if (leasepos == 1 && inet_pton(AF_INET6, a[leasepos], &new->end6))
|
||||||
|
new->flags |= CONTEXT_DHCP;
|
||||||
|
else
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (strcmp(a[1], "ra-only") == 0)
|
|
||||||
{
|
|
||||||
memcpy(&new->end6, &new->start6, IN6ADDRSZ);
|
|
||||||
new->flags |= CONTEXT_RA_ONLY;
|
|
||||||
}
|
|
||||||
else if (!inet_pton(AF_INET6, a[1], &new->end6))
|
|
||||||
option = '?';
|
|
||||||
|
|
||||||
if (new->flags & CONTEXT_RA_ONLY)
|
if (new->flags & CONTEXT_DHCP)
|
||||||
{
|
|
||||||
new->next = daemon->ra_contexts;
|
|
||||||
daemon->ra_contexts = new;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
new->next = daemon->dhcp6;
|
new->next = daemon->dhcp6;
|
||||||
daemon->dhcp6 = new;
|
daemon->dhcp6 = new;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
new->next = daemon->ra_contexts;
|
||||||
|
daemon->ra_contexts = new;
|
||||||
|
}
|
||||||
|
|
||||||
/* bare integer < 128 is prefix value */
|
/* bare integer < 128 is prefix value */
|
||||||
if (option != '?' && k >= 3)
|
if (option != '?' && leasepos < k)
|
||||||
{
|
{
|
||||||
int pref;
|
int pref;
|
||||||
for (cp = a[2]; *cp; cp++)
|
for (cp = a[leasepos]; *cp; cp++)
|
||||||
if (!(*cp >= '0' && *cp <= '9'))
|
if (!(*cp >= '0' && *cp <= '9'))
|
||||||
break;
|
break;
|
||||||
if (!*cp && (pref = atoi(a[2])) <= 128)
|
if (!*cp && (pref = atoi(a[leasepos])) <= 128)
|
||||||
{
|
{
|
||||||
new->prefix = pref;
|
new->prefix = pref;
|
||||||
leasepos = 3;
|
leasepos++;
|
||||||
if (new->prefix < 64)
|
if ((new->flags & (CONTEXT_RA_ONLY | CONTEXT_RA_NAME | CONTEXT_RA_STATELESS)) &&
|
||||||
|
new->prefix != 64)
|
||||||
|
problem = _("prefix must be exactly 64 for RA subnets");
|
||||||
|
else if (new->prefix < 64)
|
||||||
problem = _("prefix must be at least 64");
|
problem = _("prefix must be at least 64");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!problem && !is_same_net6(&new->start6, &new->end6, new->prefix))
|
if (!problem && !is_same_net6(&new->start6, &new->end6, new->prefix))
|
||||||
problem = _("inconsistent DHCPv6 range");
|
problem = _("inconsistent DHCPv6 range");
|
||||||
else if (addr6part(&new->start6) > addr6part(&new->end6))
|
else if (addr6part(&new->start6) > addr6part(&new->end6))
|
||||||
@@ -2385,10 +2126,12 @@ static char *one_opt(int option, char *arg, char *gen_prob, int command_line)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (k >= leasepos+1)
|
if (leasepos < k)
|
||||||
{
|
{
|
||||||
if (strcmp(a[leasepos], "infinite") == 0)
|
if (strcmp(a[leasepos], "infinite") == 0)
|
||||||
new->lease_time = 0xffffffff;
|
new->lease_time = 0xffffffff;
|
||||||
|
else if (strcmp(a[leasepos], "deprecated") == 0)
|
||||||
|
new->flags |= CONTEXT_DEPRECATE;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int fac = 1;
|
int fac = 1;
|
||||||
@@ -2421,16 +2164,6 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3040,6 +2773,19 @@ static char *one_opt(int option, char *arg, char *gen_prob, int command_line)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
case LOPT_DUID: /* --dhcp-duid */
|
||||||
|
if (!(comma = split(arg)) || !atoi_check(arg, (int *)&daemon->duid_enterprise))
|
||||||
|
problem = _("bad DUID");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
daemon->duid_config_len = parse_hex(comma,(unsigned char *)comma, strlen(comma), NULL, NULL);
|
||||||
|
daemon->duid_config = opt_malloc(daemon->duid_config_len);
|
||||||
|
memcpy(daemon->duid_config, comma, daemon->duid_config_len);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case 'V': /* --alias */
|
case 'V': /* --alias */
|
||||||
{
|
{
|
||||||
char *dash, *a[3] = { NULL, NULL, NULL };
|
char *dash, *a[3] = { NULL, NULL, NULL };
|
||||||
@@ -3287,6 +3033,59 @@ static char *one_opt(int option, char *arg, char *gen_prob, int command_line)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case LOPT_HOST_REC: /* --host-record */
|
||||||
|
{
|
||||||
|
struct host_record *new = opt_malloc(sizeof(struct host_record));
|
||||||
|
memset(new, 0, sizeof(struct host_record));
|
||||||
|
|
||||||
|
if (!arg || !(comma = split(arg)))
|
||||||
|
problem = _("Bad host-record");
|
||||||
|
else
|
||||||
|
while (arg)
|
||||||
|
{
|
||||||
|
struct all_addr addr;
|
||||||
|
if (inet_pton(AF_INET, arg, &addr))
|
||||||
|
new->addr = addr.addr.addr4;
|
||||||
|
#ifdef HAVE_IPV6
|
||||||
|
else if (inet_pton(AF_INET6, arg, &addr))
|
||||||
|
new->addr6 = addr.addr.addr6;
|
||||||
|
#endif
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int nomem;
|
||||||
|
char *canon = canonicalise(arg, &nomem);
|
||||||
|
struct name_list *nl = opt_malloc(sizeof(struct name_list));
|
||||||
|
if (!canon)
|
||||||
|
{
|
||||||
|
problem = _("Bad name in host-record");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
nl->name = canon;
|
||||||
|
/* keep order, so that PTR record goes to first name */
|
||||||
|
nl->next = NULL;
|
||||||
|
if (!new->names)
|
||||||
|
new->names = nl;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
struct name_list *tmp;
|
||||||
|
for (tmp = new->names; tmp->next; tmp = tmp->next);
|
||||||
|
tmp->next = nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
arg = comma;
|
||||||
|
comma = split(arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Keep list order */
|
||||||
|
if (!daemon->host_records_tail)
|
||||||
|
daemon->host_records = new;
|
||||||
|
else
|
||||||
|
daemon->host_records_tail->next = new;
|
||||||
|
new->next = NULL;
|
||||||
|
daemon->host_records_tail = new;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return _("unsupported option (check that dnsmasq was compiled with DHCP/TFTP/DBus support)");
|
return _("unsupported option (check that dnsmasq was compiled with DHCP/TFTP/DBus support)");
|
||||||
|
|
||||||
|
|||||||
+8
-3
@@ -17,6 +17,13 @@
|
|||||||
#define ALL_HOSTS "FF02::1"
|
#define ALL_HOSTS "FF02::1"
|
||||||
#define ALL_ROUTERS "FF02::2"
|
#define ALL_ROUTERS "FF02::2"
|
||||||
|
|
||||||
|
struct ping_packet {
|
||||||
|
u8 type, code;
|
||||||
|
u16 checksum;
|
||||||
|
u16 identifier;
|
||||||
|
u16 sequence_no;
|
||||||
|
};
|
||||||
|
|
||||||
struct ra_packet {
|
struct ra_packet {
|
||||||
u8 type, code;
|
u8 type, code;
|
||||||
u16 checksum;
|
u16 checksum;
|
||||||
@@ -32,13 +39,11 @@ struct prefix_opt {
|
|||||||
struct in6_addr prefix;
|
struct in6_addr prefix;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ICMP6_ROUTER_SOLICIT 133
|
|
||||||
#define ICMP6_ROUTER_ADVERT 134
|
|
||||||
|
|
||||||
#define ICMP6_OPT_SOURCE_MAC 1
|
#define ICMP6_OPT_SOURCE_MAC 1
|
||||||
#define ICMP6_OPT_PREFIX 3
|
#define ICMP6_OPT_PREFIX 3
|
||||||
#define ICMP6_OPT_MTU 5
|
#define ICMP6_OPT_MTU 5
|
||||||
#define ICMP6_OPT_RDNSS 25
|
#define ICMP6_OPT_RDNSS 25
|
||||||
|
#define ICMP6_OPT_DNSSL 31
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+182
-82
@@ -27,8 +27,9 @@
|
|||||||
#include <netinet/icmp6.h>
|
#include <netinet/icmp6.h>
|
||||||
|
|
||||||
struct ra_param {
|
struct ra_param {
|
||||||
int ind, managed, found_context, first;
|
int ind, managed, other, found_context, first;
|
||||||
char *if_name;
|
char *if_name;
|
||||||
|
struct dhcp_netid *tags;
|
||||||
struct in6_addr link_local;
|
struct in6_addr link_local;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -50,22 +51,29 @@ void ra_init(time_t now)
|
|||||||
{
|
{
|
||||||
struct icmp6_filter filter;
|
struct icmp6_filter filter;
|
||||||
int fd;
|
int fd;
|
||||||
#if defined(IP_TOS) && defined(IPTOS_CLASS_CS6)
|
#if defined(IPV6_TCLASS) && defined(IPTOS_CLASS_CS6)
|
||||||
int class = IPTOS_CLASS_CS6;
|
int class = IPTOS_CLASS_CS6;
|
||||||
#endif
|
#endif
|
||||||
int val = 255; /* radvd uses this value */
|
int val = 255; /* radvd uses this value */
|
||||||
size_t len = sizeof(int);
|
socklen_t len = sizeof(int);
|
||||||
|
struct dhcp_context *context;
|
||||||
|
|
||||||
/* ensure this is around even if we're not doing DHCPv6 */
|
/* ensure this is around even if we're not doing DHCPv6 */
|
||||||
expand_buf(&daemon->outpacket, sizeof(struct dhcp_packet));
|
expand_buf(&daemon->outpacket, sizeof(struct dhcp_packet));
|
||||||
|
|
||||||
|
/* See if we're guessing SLAAC addresses, if so we need to recieve ping replies */
|
||||||
|
for (context = daemon->ra_contexts; context; context = context->next)
|
||||||
|
if ((context->flags & CONTEXT_RA_NAME))
|
||||||
|
break;
|
||||||
|
|
||||||
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);
|
if (context)
|
||||||
|
ICMP6_FILTER_SETPASS(ICMP6_ECHO_REPLY, &filter);
|
||||||
|
|
||||||
if ((fd = socket(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) == -1 ||
|
if ((fd = socket(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) == -1 ||
|
||||||
getsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &hop_limit, &len) ||
|
getsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &hop_limit, &len) ||
|
||||||
#if defined(IP_TOS) && defined(IPTOS_CLASS_CS6)
|
#if defined(IPV6_TCLASS) && defined(IPTOS_CLASS_CS6)
|
||||||
setsockopt(fd, IPPROTO_IPV6, IPV6_TCLASS, &class, sizeof(class)) == -1 ||
|
setsockopt(fd, IPPROTO_IPV6, IPV6_TCLASS, &class, sizeof(class)) == -1 ||
|
||||||
#endif
|
#endif
|
||||||
!fix_fd(fd) ||
|
!fix_fd(fd) ||
|
||||||
@@ -77,21 +85,21 @@ void ra_init(time_t now)
|
|||||||
|
|
||||||
daemon->icmp6fd = fd;
|
daemon->icmp6fd = fd;
|
||||||
|
|
||||||
ra_start_unsolicted(now);
|
ra_start_unsolicted(now, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ra_start_unsolicted(time_t now)
|
void ra_start_unsolicted(time_t now, struct dhcp_context *context)
|
||||||
{
|
{
|
||||||
struct dhcp_context *context;
|
/* init timers so that we do ra's for some/all soon. some ra_times will end up zeroed
|
||||||
|
|
||||||
/* init timers so that we do ra's for all soon. some ra_times will end up zeroed
|
|
||||||
if it's not appropriate to advertise those contexts.
|
if it's not appropriate to advertise those contexts.
|
||||||
This gets re-called on a netlink route-change to re-do the advertisement
|
This gets re-called on a netlink route-change to re-do the advertisement
|
||||||
and pick up new interfaces */
|
and pick up new interfaces */
|
||||||
|
|
||||||
/* range 0 - 5 */
|
if (context)
|
||||||
for (context = daemon->ra_contexts; context; context = context->next)
|
context->ra_time = now;
|
||||||
context->ra_time = now + (rand16()/13000);
|
else
|
||||||
|
for (context = daemon->ra_contexts; context; context = context->next)
|
||||||
|
context->ra_time = now + (rand16()/13000); /* range 0 - 5 */
|
||||||
|
|
||||||
/* re-do frequently for a minute or so, in case the first gets lost. */
|
/* re-do frequently for a minute or so, in case the first gets lost. */
|
||||||
ra_short_period_start = now;
|
ra_short_period_start = now;
|
||||||
@@ -109,8 +117,7 @@ void icmp6_packet(void)
|
|||||||
char control6[CMSG_SPACE(sizeof(struct in6_pktinfo))];
|
char control6[CMSG_SPACE(sizeof(struct in6_pktinfo))];
|
||||||
} control_u;
|
} control_u;
|
||||||
struct sockaddr_in6 from;
|
struct sockaddr_in6 from;
|
||||||
unsigned char *p;
|
unsigned char *packet;
|
||||||
char *mac = "";
|
|
||||||
struct iname *tmp;
|
struct iname *tmp;
|
||||||
struct dhcp_context *context;
|
struct dhcp_context *context;
|
||||||
|
|
||||||
@@ -126,6 +133,8 @@ void icmp6_packet(void)
|
|||||||
if ((sz = recv_dhcp_packet(daemon->icmp6fd, &msg)) == -1 || sz < 8)
|
if ((sz = recv_dhcp_packet(daemon->icmp6fd, &msg)) == -1 || sz < 8)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
packet = (unsigned char *)daemon->outpacket.iov_base;
|
||||||
|
|
||||||
for (cmptr = CMSG_FIRSTHDR(&msg); cmptr; cmptr = CMSG_NXTHDR(&msg, cmptr))
|
for (cmptr = CMSG_FIRSTHDR(&msg); cmptr; cmptr = CMSG_NXTHDR(&msg, cmptr))
|
||||||
if (cmptr->cmsg_level == IPPROTO_IPV6 && cmptr->cmsg_type == daemon->v6pktinfo)
|
if (cmptr->cmsg_level == IPPROTO_IPV6 && cmptr->cmsg_type == daemon->v6pktinfo)
|
||||||
{
|
{
|
||||||
@@ -153,24 +162,25 @@ void icmp6_packet(void)
|
|||||||
if (!context->interface || strcmp(context->interface, interface) == 0)
|
if (!context->interface || strcmp(context->interface, interface) == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!context)
|
if (!context || packet[1] != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p = (unsigned char *)daemon->outpacket.iov_base;
|
if (packet[0] == ICMP6_ECHO_REPLY)
|
||||||
|
lease_ping_reply(&from.sin6_addr, packet, interface);
|
||||||
if (p[0] != ICMP6_ROUTER_SOLICIT || p[1] != 0)
|
else if (packet[0] == ND_ROUTER_SOLICIT)
|
||||||
return;
|
|
||||||
|
|
||||||
/* look for link-layer address option for logging */
|
|
||||||
if (sz >= 16 && p[8] == ICMP6_OPT_SOURCE_MAC && (p[9] * 8) + 8 <= sz)
|
|
||||||
{
|
{
|
||||||
print_mac(daemon->namebuff, &p[10], (p[9] * 8) - 2);
|
char *mac = "";
|
||||||
mac = daemon->namebuff;
|
|
||||||
|
/* look for link-layer address option for logging */
|
||||||
|
if (sz >= 16 && packet[8] == ICMP6_OPT_SOURCE_MAC && (packet[9] * 8) + 8 <= sz)
|
||||||
|
{
|
||||||
|
print_mac(daemon->namebuff, &packet[10], (packet[9] * 8) - 2);
|
||||||
|
mac = daemon->namebuff;
|
||||||
|
}
|
||||||
|
|
||||||
|
my_syslog(MS_DHCP | LOG_INFO, "RTR-SOLICIT(%s) %s", interface, mac);
|
||||||
|
send_ra(if_index, interface, &from.sin6_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
my_syslog(MS_DHCP | LOG_INFO, "RTR-SOLICIT(%s) %s", interface, mac);
|
|
||||||
|
|
||||||
send_ra(if_index, interface, &from.sin6_addr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void send_ra(int iface, char *iface_name, struct in6_addr *dest)
|
static void send_ra(int iface, char *iface_name, struct in6_addr *dest)
|
||||||
@@ -180,26 +190,38 @@ static void send_ra(int iface, char *iface_name, struct in6_addr *dest)
|
|||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
struct sockaddr_in6 addr;
|
struct sockaddr_in6 addr;
|
||||||
struct dhcp_context *context;
|
struct dhcp_context *context;
|
||||||
|
struct dhcp_netid iface_id;
|
||||||
|
struct dhcp_opt *opt_cfg;
|
||||||
|
int done_dns = 0;
|
||||||
|
|
||||||
save_counter(0);
|
save_counter(0);
|
||||||
ra = expand(sizeof(struct ra_packet));
|
ra = expand(sizeof(struct ra_packet));
|
||||||
|
|
||||||
ra->type = ICMP6_ROUTER_ADVERT;
|
ra->type = ND_ROUTER_ADVERT;
|
||||||
ra->code = 0;
|
ra->code = 0;
|
||||||
ra->hop_limit = hop_limit;
|
ra->hop_limit = hop_limit;
|
||||||
ra->flags = 0;
|
ra->flags = 0x00;
|
||||||
ra->lifetime = htons(1800); /* AdvDefaultLifetime*/
|
ra->lifetime = htons(1800); /* AdvDefaultLifetime*/
|
||||||
ra->reachable_time = 0;
|
ra->reachable_time = 0;
|
||||||
ra->retrans_time = 0;
|
ra->retrans_time = 0;
|
||||||
|
|
||||||
parm.ind = iface;
|
parm.ind = iface;
|
||||||
parm.managed = 0;
|
parm.managed = 0;
|
||||||
|
parm.other = 0;
|
||||||
parm.found_context = 0;
|
parm.found_context = 0;
|
||||||
parm.if_name = iface_name;
|
parm.if_name = iface_name;
|
||||||
parm.first = 1;
|
parm.first = 1;
|
||||||
|
|
||||||
|
/* set tag with name == interface */
|
||||||
|
iface_id.net = iface_name;
|
||||||
|
iface_id.next = NULL;
|
||||||
|
parm.tags = &iface_id;
|
||||||
|
|
||||||
for (context = daemon->ra_contexts; context; context = context->next)
|
for (context = daemon->ra_contexts; context; context = context->next)
|
||||||
context->flags &= ~CONTEXT_RA_DONE;
|
{
|
||||||
|
context->flags &= ~CONTEXT_RA_DONE;
|
||||||
|
context->netid.next = &context->netid;
|
||||||
|
}
|
||||||
|
|
||||||
if (!iface_enumerate(AF_INET6, &parm, add_prefixes) ||
|
if (!iface_enumerate(AF_INET6, &parm, add_prefixes) ||
|
||||||
!parm.found_context)
|
!parm.found_context)
|
||||||
@@ -217,17 +239,68 @@ static void send_ra(int iface, char *iface_name, struct in6_addr *dest)
|
|||||||
|
|
||||||
iface_enumerate(AF_LOCAL, &iface, add_lla);
|
iface_enumerate(AF_LOCAL, &iface, add_lla);
|
||||||
|
|
||||||
/* RDNSS, RFC 6106 */
|
/* RDNSS, RFC 6106, use relevant DHCP6 options */
|
||||||
put_opt6_char(ICMP6_OPT_RDNSS);
|
(void)option_filter(parm.tags, NULL, daemon->dhcp_opts6);
|
||||||
put_opt6_char(3);
|
|
||||||
put_opt6_short(0);
|
|
||||||
put_opt6_long(1800); /* lifetime - twice RA retransmit */
|
|
||||||
put_opt6(&parm.link_local, IN6ADDRSZ);
|
|
||||||
|
|
||||||
|
for (opt_cfg = daemon->dhcp_opts6; opt_cfg; opt_cfg = opt_cfg->next)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* netids match and not encapsulated? */
|
||||||
|
if (!(opt_cfg->flags & DHOPT_TAGOK))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (opt_cfg->opt == OPTION6_DNS_SERVER)
|
||||||
|
{
|
||||||
|
struct in6_addr *a = (struct in6_addr *)opt_cfg->val;
|
||||||
|
|
||||||
|
done_dns = 1;
|
||||||
|
if (opt_cfg->len == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
put_opt6_char(ICMP6_OPT_RDNSS);
|
||||||
|
put_opt6_char((opt_cfg->len/8) + 1);
|
||||||
|
put_opt6_short(0);
|
||||||
|
put_opt6_long(1800); /* lifetime - twice RA retransmit */
|
||||||
|
/* zero means "self" */
|
||||||
|
for (i = 0; i < opt_cfg->len; i += IN6ADDRSZ, a++)
|
||||||
|
if (IN6_IS_ADDR_UNSPECIFIED(a))
|
||||||
|
put_opt6(&parm.link_local, IN6ADDRSZ);
|
||||||
|
else
|
||||||
|
put_opt6(a, IN6ADDRSZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opt_cfg->opt == OPTION6_DOMAIN_SEARCH && opt_cfg->len != 0)
|
||||||
|
{
|
||||||
|
int len = ((opt_cfg->len+7)/8);
|
||||||
|
|
||||||
|
put_opt6_char(ICMP6_OPT_DNSSL);
|
||||||
|
put_opt6_char(len + 1);
|
||||||
|
put_opt6_short(0);
|
||||||
|
put_opt6_long(1800); /* lifetime - twice RA retransmit */
|
||||||
|
put_opt6(opt_cfg->val, opt_cfg->len);
|
||||||
|
|
||||||
|
/* pad */
|
||||||
|
for (i = opt_cfg->len; i < len * 8; i++)
|
||||||
|
put_opt6_char(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!done_dns)
|
||||||
|
{
|
||||||
|
/* default == us. */
|
||||||
|
put_opt6_char(ICMP6_OPT_RDNSS);
|
||||||
|
put_opt6_char(3);
|
||||||
|
put_opt6_short(0);
|
||||||
|
put_opt6_long(1800); /* lifetime - twice RA retransmit */
|
||||||
|
put_opt6(&parm.link_local, IN6ADDRSZ);
|
||||||
|
}
|
||||||
|
|
||||||
/* set managed bits unless we're providing only RA on this link */
|
/* set managed bits unless we're providing only RA on this link */
|
||||||
if (parm.managed)
|
if (parm.managed)
|
||||||
ra->flags = 0xc0;
|
ra->flags |= 0x80; /* M flag, managed, */
|
||||||
|
if (parm.other)
|
||||||
|
ra->flags |= 0x40; /* O flag, other */
|
||||||
|
|
||||||
/* decide where we're sending */
|
/* decide where we're sending */
|
||||||
memset(&addr, 0, sizeof(addr));
|
memset(&addr, 0, sizeof(addr));
|
||||||
@@ -238,7 +311,7 @@ static void send_ra(int iface, char *iface_name, struct in6_addr *dest)
|
|||||||
addr.sin6_port = htons(IPPROTO_ICMPV6);
|
addr.sin6_port = htons(IPPROTO_ICMPV6);
|
||||||
if (dest)
|
if (dest)
|
||||||
{
|
{
|
||||||
memcpy(&addr.sin6_addr, dest, sizeof(struct in6_addr));
|
addr.sin6_addr = *dest;
|
||||||
if (IN6_IS_ADDR_LINKLOCAL(dest) ||
|
if (IN6_IS_ADDR_LINKLOCAL(dest) ||
|
||||||
IN6_IS_ADDR_MC_LINKLOCAL(dest))
|
IN6_IS_ADDR_MC_LINKLOCAL(dest))
|
||||||
addr.sin6_scope_id = iface;
|
addr.sin6_scope_id = iface;
|
||||||
@@ -254,9 +327,7 @@ static void send_ra(int iface, char *iface_name, struct in6_addr *dest)
|
|||||||
static int add_prefixes(struct in6_addr *local, int prefix,
|
static int add_prefixes(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 dhcp_context *context, *tmp;
|
|
||||||
struct ra_param *param = vparam;
|
struct ra_param *param = vparam;
|
||||||
struct prefix_opt *opt;
|
|
||||||
|
|
||||||
(void)scope; /* warning */
|
(void)scope; /* warning */
|
||||||
(void)dad;
|
(void)dad;
|
||||||
@@ -269,64 +340,92 @@ static int add_prefixes(struct in6_addr *local, int prefix,
|
|||||||
!IN6_IS_ADDR_LINKLOCAL(local) &&
|
!IN6_IS_ADDR_LINKLOCAL(local) &&
|
||||||
!IN6_IS_ADDR_MULTICAST(local))
|
!IN6_IS_ADDR_MULTICAST(local))
|
||||||
{
|
{
|
||||||
|
int do_prefix = 0;
|
||||||
|
int do_slaac = 0;
|
||||||
|
int deprecate = 0;
|
||||||
|
unsigned int time = 0xffffffff;
|
||||||
|
struct dhcp_context *context;
|
||||||
|
|
||||||
for (context = daemon->ra_contexts; context; context = context->next)
|
for (context = daemon->ra_contexts; context; context = context->next)
|
||||||
if (prefix == context->prefix &&
|
if (prefix == context->prefix &&
|
||||||
is_same_net6(local, &context->start6, prefix) &&
|
is_same_net6(local, &context->start6, 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 | CONTEXT_RA_NAME | CONTEXT_RA_STATELESS)))
|
||||||
|
{
|
||||||
|
do_slaac = 1;
|
||||||
|
if (context->flags & CONTEXT_DHCP)
|
||||||
|
{
|
||||||
|
param->other = 1;
|
||||||
|
if (!(context->flags & CONTEXT_RA_STATELESS))
|
||||||
|
param->managed = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
/* don't do RA for non-ra-only unless --enable-ra is set */
|
/* don't do RA for non-ra-only unless --enable-ra is set */
|
||||||
if (!option_bool(OPT_RA))
|
if (!option_bool(OPT_RA))
|
||||||
continue;
|
continue;
|
||||||
param->managed = 1;
|
param->managed = 1;
|
||||||
|
param->other = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context->flags & CONTEXT_RA_DONE)
|
/* find floor time */
|
||||||
continue;
|
if (time > context->lease_time)
|
||||||
|
time = context->lease_time;
|
||||||
|
|
||||||
/* subsequent prefixes on the same interface don't need timers */
|
if (context->flags & CONTEXT_DEPRECATE)
|
||||||
|
deprecate = 1;
|
||||||
|
|
||||||
|
/* subsequent prefixes on the same interface
|
||||||
|
and subsequent instances of this prefix don't need timers */
|
||||||
if (!param->first)
|
if (!param->first)
|
||||||
context->ra_time = 0;
|
context->ra_time = 0;
|
||||||
param->first = 0;
|
param->first = 0;
|
||||||
param->found_context = 1;
|
param->found_context = 1;
|
||||||
context->flags |= CONTEXT_RA_DONE;
|
|
||||||
|
|
||||||
/* mark this subnet and duplicates: as done. */
|
/* collect dhcp-range tags */
|
||||||
for (tmp = context->next; tmp; tmp = tmp->next)
|
if (context->netid.next == &context->netid && context->netid.net)
|
||||||
if (tmp->prefix == prefix &&
|
|
||||||
is_same_net6(local, &tmp->start6, prefix) &&
|
|
||||||
is_same_net6(local, &tmp->end6, prefix))
|
|
||||||
{
|
|
||||||
tmp->flags |= CONTEXT_RA_DONE;
|
|
||||||
context->ra_time = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((opt = expand(sizeof(struct prefix_opt))))
|
|
||||||
{
|
{
|
||||||
u64 addrpart = addr6part(&context->start6);
|
context->netid.next = param->tags;
|
||||||
u64 mask = (prefix == 64) ? (u64)-1LL : (1LLU << (128 - prefix)) - 1LLU;
|
param->tags = &context->netid;
|
||||||
unsigned int time = context->lease_time;
|
}
|
||||||
|
|
||||||
/* lifetimes must be min 2 hrs, by RFC 2462 */
|
if (!(context->flags & CONTEXT_RA_DONE))
|
||||||
if (time < 7200)
|
{
|
||||||
time = 7200;
|
context->flags |= CONTEXT_RA_DONE;
|
||||||
|
do_prefix = 1;
|
||||||
opt->type = ICMP6_OPT_PREFIX;
|
|
||||||
opt->len = 4;
|
|
||||||
opt->prefix_len = prefix;
|
|
||||||
/* autonomous only is we're not doing dhcp */
|
|
||||||
opt->flags = (context->flags & CONTEXT_RA_ONLY) ? 0xc0 : 0x00;
|
|
||||||
opt->valid_lifetime = opt->preferred_lifetime = htonl(time);
|
|
||||||
opt->reserved = 0;
|
|
||||||
|
|
||||||
opt->prefix = context->start6;
|
|
||||||
setaddr6part(&opt->prefix, addrpart & ~mask);
|
|
||||||
|
|
||||||
inet_ntop(AF_INET6, &opt->prefix, daemon->addrbuff, ADDRSTRLEN);
|
|
||||||
my_syslog(MS_DHCP | LOG_INFO, "RTR-ADVERT(%s) %s", param->if_name, daemon->addrbuff);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (do_prefix)
|
||||||
|
{
|
||||||
|
struct prefix_opt *opt;
|
||||||
|
|
||||||
|
if ((opt = expand(sizeof(struct prefix_opt))))
|
||||||
|
{
|
||||||
|
/* zero net part of address */
|
||||||
|
setaddr6part(local, addr6part(local) & ~((prefix == 64) ? (u64)-1LL : (1LLU << (128 - prefix)) - 1LLU));
|
||||||
|
|
||||||
|
/* lifetimes must be min 2 hrs, by RFC 2462 */
|
||||||
|
if (time < 7200)
|
||||||
|
time = 7200;
|
||||||
|
|
||||||
|
opt->type = ICMP6_OPT_PREFIX;
|
||||||
|
opt->len = 4;
|
||||||
|
opt->prefix_len = prefix;
|
||||||
|
/* autonomous only if we're not doing dhcp */
|
||||||
|
opt->flags = do_slaac ? 0x40 : 0x00;
|
||||||
|
opt->valid_lifetime = htonl(time);
|
||||||
|
opt->preferred_lifetime = htonl(deprecate ? 0 : time);
|
||||||
|
opt->reserved = 0;
|
||||||
|
opt->prefix = *local;
|
||||||
|
|
||||||
|
inet_ntop(AF_INET6, local, daemon->addrbuff, ADDRSTRLEN);
|
||||||
|
my_syslog(MS_DHCP | LOG_INFO, "RTR-ADVERT(%s) %s", param->if_name, daemon->addrbuff);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@@ -368,11 +467,11 @@ time_t periodic_ra(time_t now)
|
|||||||
for (next_event = 0, context = daemon->ra_contexts; context; context = context->next)
|
for (next_event = 0, context = daemon->ra_contexts; context; context = context->next)
|
||||||
if (context->ra_time != 0)
|
if (context->ra_time != 0)
|
||||||
{
|
{
|
||||||
if (difftime(context->ra_time, now) < 0.0)
|
if (difftime(context->ra_time, now) <= 0.0)
|
||||||
break; /* overdue */
|
break; /* overdue */
|
||||||
|
|
||||||
if (next_event == 0 || difftime(next_event, context->ra_time + 2) > 0.0)
|
if (next_event == 0 || difftime(next_event, context->ra_time) > 0.0)
|
||||||
next_event = context->ra_time + 2;
|
next_event = context->ra_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* none overdue */
|
/* none overdue */
|
||||||
@@ -406,7 +505,7 @@ static int iface_search(struct in6_addr *local, int prefix,
|
|||||||
if (prefix == context->prefix &&
|
if (prefix == context->prefix &&
|
||||||
is_same_net6(local, &context->start6, prefix) &&
|
is_same_net6(local, &context->start6, prefix) &&
|
||||||
is_same_net6(local, &context->end6, prefix))
|
is_same_net6(local, &context->end6, prefix))
|
||||||
if (context->ra_time != 0 && difftime(context->ra_time, param->now) < 0.0)
|
if (context->ra_time != 0 && difftime(context->ra_time, param->now) <= 0.0)
|
||||||
{
|
{
|
||||||
/* found an interface that's overdue for RA determine new
|
/* found an interface that's overdue for RA determine new
|
||||||
timeout value and zap other contexts on the same interface
|
timeout value and zap other contexts on the same interface
|
||||||
@@ -426,4 +525,5 @@ static int iface_search(struct in6_addr *local, int prefix,
|
|||||||
return 1; /* keep searching */
|
return 1; /* keep searching */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+1
-1
@@ -25,7 +25,7 @@ static int add_resource_record(struct dns_header *header, char *limit, int *trun
|
|||||||
((size_t)((pp) - (unsigned char *)(header) + (len)) <= (plen))
|
((size_t)((pp) - (unsigned char *)(header) + (len)) <= (plen))
|
||||||
|
|
||||||
#define ADD_RDLEN(header, pp, plen, len) \
|
#define ADD_RDLEN(header, pp, plen, len) \
|
||||||
(!CHECK_LEN(header, pp, plen, len) ? 0 : (long)((pp) += (len)), 1)
|
(!CHECK_LEN(header, pp, plen, len) ? 0 : (((pp) += (len)), 1))
|
||||||
|
|
||||||
static int extract_name(struct dns_header *header, size_t plen, unsigned char **pp,
|
static int extract_name(struct dns_header *header, size_t plen, unsigned char **pp,
|
||||||
char *name, int isExtract, int extrabytes)
|
char *name, int isExtract, int extrabytes)
|
||||||
|
|||||||
+7
-6
@@ -483,14 +483,14 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
{
|
{
|
||||||
logaddr = &mess->yiaddr;
|
logaddr = &mess->yiaddr;
|
||||||
|
|
||||||
lease_set_hwaddr(lease, mess->chaddr, NULL, mess->hlen, mess->htype, 0);
|
lease_set_hwaddr(lease, mess->chaddr, NULL, mess->hlen, mess->htype, 0, now);
|
||||||
if (hostname)
|
if (hostname)
|
||||||
lease_set_hostname(lease, hostname, 1, get_domain(lease->addr), domain);
|
lease_set_hostname(lease, hostname, 1, get_domain(lease->addr), domain);
|
||||||
/* infinite lease unless nailed in dhcp-host line. */
|
/* infinite lease unless nailed in dhcp-host line. */
|
||||||
lease_set_expires(lease,
|
lease_set_expires(lease,
|
||||||
have_config(config, CONFIG_TIME) ? config->lease_time : 0xffffffff,
|
have_config(config, CONFIG_TIME) ? config->lease_time : 0xffffffff,
|
||||||
now);
|
now);
|
||||||
lease_set_interface(lease, int_index);
|
lease_set_interface(lease, int_index, now);
|
||||||
|
|
||||||
clear_packet(mess, end);
|
clear_packet(mess, end);
|
||||||
do_options(context, mess, end, NULL, hostname, get_domain(mess->yiaddr),
|
do_options(context, mess, end, NULL, hostname, get_domain(mess->yiaddr),
|
||||||
@@ -1276,7 +1276,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
}
|
}
|
||||||
|
|
||||||
time = calc_time(context, config, option_find(mess, sz, OPTION_LEASE_TIME, 4));
|
time = calc_time(context, config, option_find(mess, sz, OPTION_LEASE_TIME, 4));
|
||||||
lease_set_hwaddr(lease, mess->chaddr, clid, mess->hlen, mess->htype, clid_len);
|
lease_set_hwaddr(lease, mess->chaddr, clid, mess->hlen, mess->htype, clid_len, now);
|
||||||
|
|
||||||
/* if all the netids in the ignore_name list are present, ignore client-supplied name */
|
/* if all the netids in the ignore_name list are present, ignore client-supplied name */
|
||||||
if (!hostname_auth)
|
if (!hostname_auth)
|
||||||
@@ -1310,7 +1310,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
lease_set_hostname(lease, hostname, hostname_auth, get_domain(lease->addr), domain);
|
lease_set_hostname(lease, hostname, hostname_auth, get_domain(lease->addr), domain);
|
||||||
|
|
||||||
lease_set_expires(lease, time, now);
|
lease_set_expires(lease, time, now);
|
||||||
lease_set_interface(lease, int_index);
|
lease_set_interface(lease, int_index, now);
|
||||||
|
|
||||||
if (override.s_addr != 0)
|
if (override.s_addr != 0)
|
||||||
lease->override = override;
|
lease->override = override;
|
||||||
@@ -1387,7 +1387,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
else
|
else
|
||||||
time = (unsigned int)difftime(lease->expires, now);
|
time = (unsigned int)difftime(lease->expires, now);
|
||||||
option_put(mess, end, OPTION_LEASE_TIME, 4, time);
|
option_put(mess, end, OPTION_LEASE_TIME, 4, time);
|
||||||
lease_set_interface(lease, int_index);
|
lease_set_interface(lease, int_index, now);
|
||||||
}
|
}
|
||||||
|
|
||||||
do_options(context, mess, end, req_options, hostname, get_domain(mess->ciaddr),
|
do_options(context, mess, end, req_options, hostname, get_domain(mess->ciaddr),
|
||||||
@@ -2095,7 +2095,8 @@ static void do_options(struct dhcp_context *context,
|
|||||||
struct dhcp_netid_list *id_list;
|
struct dhcp_netid_list *id_list;
|
||||||
|
|
||||||
/* filter options based on tags, those we want get DHOPT_TAGOK bit set */
|
/* filter options based on tags, those we want get DHOPT_TAGOK bit set */
|
||||||
context->netid.next = NULL;
|
if (context)
|
||||||
|
context->netid.next = NULL;
|
||||||
tagif = option_filter(netid, context && context->netid.net ? &context->netid : NULL, config_opts);
|
tagif = option_filter(netid, context && context->netid.net ? &context->netid : NULL, config_opts);
|
||||||
|
|
||||||
/* logging */
|
/* logging */
|
||||||
|
|||||||
+134
-63
@@ -23,6 +23,7 @@ static int dhcp6_maybe_relay(struct in6_addr *link_address, struct dhcp_netid **
|
|||||||
int interface, char *iface_name, struct in6_addr *fallback, void *inbuff, size_t sz, int is_unicast, time_t now);
|
int interface, char *iface_name, struct in6_addr *fallback, void *inbuff, size_t sz, int is_unicast, time_t now);
|
||||||
static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dhcp_netid *tags, struct dhcp_context *context,
|
static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dhcp_netid *tags, struct dhcp_context *context,
|
||||||
int interface, char *iface_name, struct in6_addr *fallback, void *inbuff, size_t sz, int is_unicast, time_t now);
|
int interface, char *iface_name, struct in6_addr *fallback, void *inbuff, size_t sz, int is_unicast, time_t now);
|
||||||
|
static void log6_opts(int nest, unsigned int xid, void *start_opts, void *end_opts);
|
||||||
static void log6_packet(char *type, unsigned char *clid, int clid_len, struct in6_addr *addr, int xid, char *iface, char *string);
|
static void log6_packet(char *type, unsigned char *clid, int clid_len, struct in6_addr *addr, int xid, char *iface, char *string);
|
||||||
|
|
||||||
static void *opt6_find (void *opts, void *end, unsigned int search, unsigned int minsize);
|
static void *opt6_find (void *opts, void *end, unsigned int search, unsigned int minsize);
|
||||||
@@ -34,11 +35,17 @@ static unsigned int opt6_uint(unsigned char *opt, int offset, int size);
|
|||||||
#define opt6_ptr(opt, i) ((void *)&(((unsigned char *)(opt))[4+(i)]))
|
#define opt6_ptr(opt, i) ((void *)&(((unsigned char *)(opt))[4+(i)]))
|
||||||
|
|
||||||
|
|
||||||
size_t dhcp6_reply(struct dhcp_context *context, int interface, char *iface_name,
|
unsigned short dhcp6_reply(struct dhcp_context *context, int interface, char *iface_name,
|
||||||
struct in6_addr *fallback, size_t sz, int is_unicast, time_t now)
|
struct in6_addr *fallback, size_t sz, int is_unicast, time_t now)
|
||||||
{
|
{
|
||||||
struct dhcp_netid *relay_tags = NULL;
|
struct dhcp_netid *relay_tags = NULL;
|
||||||
struct dhcp_vendor *vendor;
|
struct dhcp_vendor *vendor;
|
||||||
|
int msg_type;
|
||||||
|
|
||||||
|
if (sz <= 4)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
msg_type = *((unsigned char *)daemon->dhcp_packet.iov_base);
|
||||||
|
|
||||||
/* Mark these so we only match each at most once, to avoid tangled linked lists */
|
/* Mark these so we only match each at most once, to avoid tangled linked lists */
|
||||||
for (vendor = daemon->dhcp_vendors; vendor; vendor = vendor->next)
|
for (vendor = daemon->dhcp_vendors; vendor; vendor = vendor->next)
|
||||||
@@ -47,7 +54,7 @@ size_t dhcp6_reply(struct dhcp_context *context, int interface, char *iface_name
|
|||||||
save_counter(0);
|
save_counter(0);
|
||||||
|
|
||||||
if (dhcp6_maybe_relay(NULL, &relay_tags, context, interface, iface_name, fallback, daemon->dhcp_packet.iov_base, sz, is_unicast, now))
|
if (dhcp6_maybe_relay(NULL, &relay_tags, context, interface, iface_name, fallback, daemon->dhcp_packet.iov_base, sz, is_unicast, now))
|
||||||
return save_counter(0);
|
return msg_type == DHCP6RELAYFORW ? DHCPV6_SERVER_PORT : DHCPV6_CLIENT_PORT;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -283,6 +290,9 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (option_bool(OPT_LOG_OPTS) && (opt = opt6_find(packet_options, end, OPTION6_VENDOR_CLASS, 4)))
|
||||||
|
my_syslog(MS_DHCP | LOG_INFO, _("%u vendor class: %u"), xid, opt6_uint(opt, 0, 4));
|
||||||
|
|
||||||
/* dhcp-match. If we have hex-and-wildcards, look for a left-anchored match.
|
/* dhcp-match. If we have hex-and-wildcards, look for a left-anchored match.
|
||||||
Otherwise assume the option is an array, and look for a matching element.
|
Otherwise assume the option is an array, and look for a matching element.
|
||||||
If no data given, existance of the option is enough. This code handles
|
If no data given, existance of the option is enough. This code handles
|
||||||
@@ -339,28 +349,28 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
|
|||||||
|
|
||||||
if (len != 0 && len < 255)
|
if (len != 0 && len < 255)
|
||||||
{
|
{
|
||||||
unsigned char *pp, *op = opt6_ptr(opt, 1);
|
unsigned char *pp, *op = opt6_ptr(opt, 1);
|
||||||
char *pq = daemon->dhcp_buff;
|
char *pq = daemon->dhcp_buff;
|
||||||
|
|
||||||
pp = op;
|
pp = op;
|
||||||
while (*op != 0 && ((op + (*op) + 1) - pp) < len)
|
while (*op != 0 && ((op + (*op)) - pp) < len)
|
||||||
{
|
{
|
||||||
memcpy(pq, op+1, *op);
|
memcpy(pq, op+1, *op);
|
||||||
pq += *op;
|
pq += *op;
|
||||||
op += (*op)+1;
|
op += (*op)+1;
|
||||||
*(pq++) = '.';
|
*(pq++) = '.';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pq != daemon->dhcp_buff)
|
if (pq != daemon->dhcp_buff)
|
||||||
pq--;
|
pq--;
|
||||||
*pq = 0;
|
*pq = 0;
|
||||||
|
|
||||||
if (legal_hostname(daemon->dhcp_buff))
|
if (legal_hostname(daemon->dhcp_buff))
|
||||||
{
|
{
|
||||||
client_hostname = daemon->dhcp_buff;
|
client_hostname = daemon->dhcp_buff;
|
||||||
if (option_bool(OPT_LOG_OPTS))
|
if (option_bool(OPT_LOG_OPTS))
|
||||||
my_syslog(MS_DHCP | LOG_INFO, _("%u client provides name: %s"), xid, client_hostname);
|
my_syslog(MS_DHCP | LOG_INFO, _("%u client provides name: %s"), xid, client_hostname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -503,13 +513,13 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
|
|||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
struct in6_addr alloced_addr, *addrp = NULL;
|
struct in6_addr alloced_addr, *addrp = NULL;
|
||||||
u32 preferred_time = 0;
|
u32 requested_time = 0;
|
||||||
struct dhcp_lease *lease = NULL;
|
struct dhcp_lease *lease = NULL;
|
||||||
|
|
||||||
if (ia_option)
|
if (ia_option)
|
||||||
{
|
{
|
||||||
struct in6_addr *req_addr = opt6_ptr(ia_option, 0);
|
struct in6_addr *req_addr = opt6_ptr(ia_option, 0);
|
||||||
preferred_time = opt6_uint(ia_option, 16, 4);
|
requested_time = opt6_uint(ia_option, 16, 4);
|
||||||
|
|
||||||
if (!address6_available(context, req_addr, tags) &&
|
if (!address6_available(context, req_addr, tags) &&
|
||||||
(!have_config(config, CONFIG_ADDR6) || memcmp(&config->addr6, req_addr, IN6ADDRSZ) != 0))
|
(!have_config(config, CONFIG_ADDR6) || memcmp(&config->addr6, req_addr, IN6ADDRSZ) != 0))
|
||||||
@@ -611,10 +621,10 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
|
|||||||
|
|
||||||
if (ia_option)
|
if (ia_option)
|
||||||
{
|
{
|
||||||
if (preferred_time < 120u )
|
if (requested_time < 120u )
|
||||||
preferred_time = 120u; /* sanity */
|
requested_time = 120u; /* sanity */
|
||||||
if (lease_time == 0xffffffff || (preferred_time != 0xffffffff && preferred_time < lease_time))
|
if (lease_time == 0xffffffff || (requested_time != 0xffffffff && requested_time < lease_time))
|
||||||
lease_time = preferred_time;
|
lease_time = requested_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lease_time < min_time)
|
if (lease_time < min_time)
|
||||||
@@ -627,8 +637,8 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
|
|||||||
if (lease)
|
if (lease)
|
||||||
{
|
{
|
||||||
lease_set_expires(lease, lease_time, now);
|
lease_set_expires(lease, lease_time, now);
|
||||||
lease_set_hwaddr(lease, NULL, clid, 0, iaid, clid_len);
|
lease_set_hwaddr(lease, NULL, clid, 0, iaid, clid_len, now);
|
||||||
lease_set_interface(lease, interface);
|
lease_set_interface(lease, interface, now);
|
||||||
if (hostname && ia_type == OPTION6_IA_NA)
|
if (hostname && ia_type == OPTION6_IA_NA)
|
||||||
{
|
{
|
||||||
char *addr_domain = get_domain6(addrp);
|
char *addr_domain = get_domain6(addrp);
|
||||||
@@ -720,8 +730,9 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
|
|||||||
{
|
{
|
||||||
o1 = new_opt6(OPTION6_IAADDR);
|
o1 = new_opt6(OPTION6_IAADDR);
|
||||||
put_opt6(addrp, sizeof(*addrp));
|
put_opt6(addrp, sizeof(*addrp));
|
||||||
put_opt6_long(lease_time);
|
/* preferred lifetime */
|
||||||
put_opt6_long(lease_time);
|
put_opt6_long(this_context && (this_context->flags & CONTEXT_DEPRECATE) ? 0 : lease_time);
|
||||||
|
put_opt6_long(lease_time); /* valid lifetime */
|
||||||
end_opt6(o1);
|
end_opt6(o1);
|
||||||
|
|
||||||
log6_packet( make_lease ? "DHCPREPLY" : "DHCPADVERTISE",
|
log6_packet( make_lease ? "DHCPREPLY" : "DHCPADVERTISE",
|
||||||
@@ -737,6 +748,11 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
|
|||||||
{
|
{
|
||||||
if (address_assigned)
|
if (address_assigned)
|
||||||
{
|
{
|
||||||
|
o1 = new_opt6(OPTION6_STATUS_CODE);
|
||||||
|
put_opt6_short(DHCP6SUCCESS);
|
||||||
|
put_opt6_string("Oh hai from dnsmasq");
|
||||||
|
end_opt6(o1);
|
||||||
|
|
||||||
if (ia_type == OPTION6_IA_NA)
|
if (ia_type == OPTION6_IA_NA)
|
||||||
{
|
{
|
||||||
/* go back an fill in fields in IA_NA option */
|
/* go back an fill in fields in IA_NA option */
|
||||||
@@ -750,7 +766,7 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* no address, return erro */
|
/* no address, return error */
|
||||||
o1 = new_opt6(OPTION6_STATUS_CODE);
|
o1 = new_opt6(OPTION6_STATUS_CODE);
|
||||||
put_opt6_short(DHCP6NOADDRS);
|
put_opt6_short(DHCP6NOADDRS);
|
||||||
put_opt6_string("No addresses available");
|
put_opt6_string("No addresses available");
|
||||||
@@ -759,6 +775,15 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
|
|||||||
|
|
||||||
end_opt6(o);
|
end_opt6(o);
|
||||||
|
|
||||||
|
if (address_assigned)
|
||||||
|
{
|
||||||
|
/* If --dhcp-authoritative is set, we can tell client not to wait for
|
||||||
|
other possible servers */
|
||||||
|
o = new_opt6(OPTION6_PREFERENCE);
|
||||||
|
put_opt6_char(option_bool(OPT_AUTHORITATIVE) ? 255 : 0);
|
||||||
|
end_opt6(o);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -818,7 +843,7 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
|
|||||||
{
|
{
|
||||||
struct dhcp_lease *lease = NULL;
|
struct dhcp_lease *lease = NULL;
|
||||||
struct in6_addr *req_addr = opt6_ptr(ia_option, 0);
|
struct in6_addr *req_addr = opt6_ptr(ia_option, 0);
|
||||||
u32 preferred_time = opt6_uint(ia_option, 16, 4);
|
u32 requested_time = opt6_uint(ia_option, 16, 4);
|
||||||
unsigned int lease_time;
|
unsigned int lease_time;
|
||||||
struct dhcp_context *this_context;
|
struct dhcp_context *this_context;
|
||||||
struct dhcp_config *valid_config = config;
|
struct dhcp_config *valid_config = config;
|
||||||
@@ -849,7 +874,10 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
|
|||||||
|
|
||||||
if (!address6_available(context, req_addr, tagif) ||
|
if (!address6_available(context, req_addr, tagif) ||
|
||||||
!(this_context = narrow_context6(context, req_addr, tagif)))
|
!(this_context = narrow_context6(context, req_addr, tagif)))
|
||||||
lease_time = 0;
|
{
|
||||||
|
lease_time = 0;
|
||||||
|
this_context = NULL;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* get tags from context if we've not used it before */
|
/* get tags from context if we've not used it before */
|
||||||
@@ -871,10 +899,10 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
|
|||||||
|
|
||||||
lease_time = have_config(valid_config, CONFIG_TIME) ? valid_config->lease_time : this_context->lease_time;
|
lease_time = have_config(valid_config, CONFIG_TIME) ? valid_config->lease_time : this_context->lease_time;
|
||||||
|
|
||||||
if (preferred_time < 120u )
|
if (requested_time < 120u )
|
||||||
preferred_time = 120u; /* sanity */
|
requested_time = 120u; /* sanity */
|
||||||
if (lease_time == 0xffffffff || (preferred_time != 0xffffffff && preferred_time < lease_time))
|
if (lease_time == 0xffffffff || (requested_time != 0xffffffff && requested_time < lease_time))
|
||||||
lease_time = preferred_time;
|
lease_time = requested_time;
|
||||||
|
|
||||||
lease_set_expires(lease, lease_time, now);
|
lease_set_expires(lease, lease_time, now);
|
||||||
if (ia_type == OPTION6_IA_NA && hostname)
|
if (ia_type == OPTION6_IA_NA && hostname)
|
||||||
@@ -893,17 +921,23 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
|
|||||||
|
|
||||||
o1 = new_opt6(OPTION6_IAADDR);
|
o1 = new_opt6(OPTION6_IAADDR);
|
||||||
put_opt6(req_addr, sizeof(*req_addr));
|
put_opt6(req_addr, sizeof(*req_addr));
|
||||||
put_opt6_long(lease_time);
|
/* preferred lifetime */
|
||||||
put_opt6_long(lease_time);
|
put_opt6_long(this_context && (this_context->flags & CONTEXT_DEPRECATE) ? 0 : lease_time);
|
||||||
|
put_opt6_long(lease_time); /* valid lifetime */
|
||||||
end_opt6(o1);
|
end_opt6(o1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t1cntr != 0)
|
if (t1cntr != 0)
|
||||||
{
|
{
|
||||||
/* go back an fill in fields in IA_NA option */
|
/* go back an fill in fields in IA_NA option */
|
||||||
unsigned int t1 = min_time == 0xffffffff ? 0xffffffff : min_time/2;
|
|
||||||
unsigned int t2 = min_time == 0xffffffff ? 0xffffffff : (min_time/8) * 7;
|
|
||||||
int sav = save_counter(t1cntr);
|
int sav = save_counter(t1cntr);
|
||||||
|
unsigned int t1, t2, fuzz = rand16();
|
||||||
|
|
||||||
|
while (fuzz > (min_time/16))
|
||||||
|
fuzz = fuzz/2;
|
||||||
|
t1 = min_time == 0xffffffff ? 0xffffffff : min_time/2 - fuzz;
|
||||||
|
t2 = min_time == 0xffffffff ? 0xffffffff : ((min_time/8)*7) - fuzz;
|
||||||
|
|
||||||
put_opt6_long(t1);
|
put_opt6_long(t1);
|
||||||
put_opt6_long(t2);
|
put_opt6_long(t2);
|
||||||
save_counter(sav);
|
save_counter(sav);
|
||||||
@@ -1314,29 +1348,66 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
|
|||||||
log_tags(tagif, xid);
|
log_tags(tagif, xid);
|
||||||
|
|
||||||
if (option_bool(OPT_LOG_OPTS))
|
if (option_bool(OPT_LOG_OPTS))
|
||||||
{
|
log6_opts(0, xid, daemon->outpacket.iov_base + start_opts, daemon->outpacket.iov_base + save_counter(-1));
|
||||||
int end_opts = save_counter(-1);
|
|
||||||
|
|
||||||
/* must have created at least one option */
|
|
||||||
if (start_opts != end_opts)
|
|
||||||
for (opt = daemon->outpacket.iov_base + start_opts; opt; opt = opt6_next(opt, daemon->outpacket.iov_base + end_opts))
|
|
||||||
{
|
|
||||||
int offset = 0;
|
|
||||||
char *optname;
|
|
||||||
|
|
||||||
/* account for flag byte on FQDN */
|
|
||||||
if (opt6_type(opt) == OPTION6_FQDN)
|
|
||||||
offset = 1;
|
|
||||||
|
|
||||||
optname = option_string(AF_INET6, opt6_type(opt), opt6_ptr(opt, offset), opt6_len(opt) - offset, daemon->namebuff, MAXDNAME);
|
|
||||||
|
|
||||||
my_syslog(MS_DHCP | LOG_INFO, "%u sent size:%3d option:%3d %s %s",
|
|
||||||
xid, opt6_len(opt), opt6_type(opt), optname, daemon->namebuff);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void log6_opts(int nest, unsigned int xid, void *start_opts, void *end_opts)
|
||||||
|
{
|
||||||
|
void *opt;
|
||||||
|
char *desc = nest ? "nest" : "sent";
|
||||||
|
|
||||||
|
if (start_opts == end_opts)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (opt = start_opts; opt; opt = opt6_next(opt, end_opts))
|
||||||
|
{
|
||||||
|
int type = opt6_type(opt);
|
||||||
|
void *ia_options = NULL;
|
||||||
|
char *optname;
|
||||||
|
|
||||||
|
if (type == OPTION6_IA_NA)
|
||||||
|
{
|
||||||
|
sprintf(daemon->namebuff, "IAID=%u T1=%u T2=%u",
|
||||||
|
opt6_uint(opt, 0, 4), opt6_uint(opt, 4, 4), opt6_uint(opt, 8, 4));
|
||||||
|
optname = "ia-na";
|
||||||
|
ia_options = opt6_ptr(opt, 12);
|
||||||
|
}
|
||||||
|
else if (type == OPTION6_IA_TA)
|
||||||
|
{
|
||||||
|
sprintf(daemon->namebuff, "IAID=%u", opt6_uint(opt, 0, 4));
|
||||||
|
optname = "ia-ta";
|
||||||
|
ia_options = opt6_ptr(opt, 4);
|
||||||
|
}
|
||||||
|
else if (type == OPTION6_IAADDR)
|
||||||
|
{
|
||||||
|
inet_ntop(AF_INET6, opt6_ptr(opt, 0), daemon->addrbuff, ADDRSTRLEN);
|
||||||
|
sprintf(daemon->namebuff, "%s PL=%u VL=%u",
|
||||||
|
daemon->addrbuff, opt6_uint(opt, 16, 4), opt6_uint(opt, 20, 4));
|
||||||
|
optname = "iaaddr";
|
||||||
|
ia_options = opt6_ptr(opt, 24);
|
||||||
|
}
|
||||||
|
else if (type == OPTION6_STATUS_CODE)
|
||||||
|
{
|
||||||
|
int len = sprintf(daemon->namebuff, "%u ", opt6_uint(opt, 0, 2));
|
||||||
|
memcpy(daemon->namebuff + len, opt6_ptr(opt, 2), opt6_len(opt)-2);
|
||||||
|
daemon->namebuff[len + opt6_len(opt) - 2] = 0;
|
||||||
|
optname = "status";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* account for flag byte on FQDN */
|
||||||
|
int offset = type == OPTION6_FQDN ? 1 : 0;
|
||||||
|
optname = option_string(AF_INET6, type, opt6_ptr(opt, offset), opt6_len(opt) - offset, daemon->namebuff, MAXDNAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
my_syslog(MS_DHCP | LOG_INFO, "%u %s size:%3d option:%3d %s %s",
|
||||||
|
xid, desc, opt6_len(opt), type, optname, daemon->namebuff);
|
||||||
|
|
||||||
|
if (ia_options)
|
||||||
|
log6_opts(1, xid, ia_options, opt6_ptr(opt, opt6_len(opt)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void log6_packet(char *type, unsigned char *clid, int clid_len, struct in6_addr *addr, int xid, char *iface, char *string)
|
static void log6_packet(char *type, unsigned char *clid, int clid_len, struct in6_addr *addr, int xid, char *iface, char *string)
|
||||||
|
|||||||
+249
@@ -0,0 +1,249 @@
|
|||||||
|
/* dnsmasq is Copyright (c) 2000-2012 Simon Kelley
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; version 2 dated June, 1991, or
|
||||||
|
(at your option) version 3 dated 29 June, 2007.
|
||||||
|
|
||||||
|
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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "dnsmasq.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
|
||||||
|
#include <netinet/icmp6.h>
|
||||||
|
|
||||||
|
static int map_rebuild = 0;
|
||||||
|
static int ping_id = 0;
|
||||||
|
|
||||||
|
void slaac_add_addrs(struct dhcp_lease *lease, time_t now)
|
||||||
|
{
|
||||||
|
struct slaac_address *slaac, *old, **up;
|
||||||
|
struct dhcp_context *context;
|
||||||
|
|
||||||
|
if (!(lease->flags & LEASE_HAVE_HWADDR) ||
|
||||||
|
lease->last_interface == 0 ||
|
||||||
|
!lease->hostname)
|
||||||
|
return ;
|
||||||
|
|
||||||
|
old = lease->slaac_address;
|
||||||
|
lease->slaac_address = NULL;
|
||||||
|
|
||||||
|
for (context = daemon->ra_contexts; context; context = context->next)
|
||||||
|
if ((context->flags & CONTEXT_RA_NAME) && lease->last_interface == context->if_index)
|
||||||
|
{
|
||||||
|
struct in6_addr addr = context->start6;
|
||||||
|
if (lease->hwaddr_len == 6 &&
|
||||||
|
(lease->hwaddr_type == ARPHRD_ETHER || lease->hwaddr_type == ARPHRD_IEEE802))
|
||||||
|
{
|
||||||
|
/* convert MAC address to EUI-64 */
|
||||||
|
memcpy(&addr.s6_addr[8], lease->hwaddr, 3);
|
||||||
|
memcpy(&addr.s6_addr[13], &lease->hwaddr[3], 3);
|
||||||
|
addr.s6_addr[11] = 0xff;
|
||||||
|
addr.s6_addr[12] = 0xfe;
|
||||||
|
}
|
||||||
|
#if defined(ARPHRD_EUI64)
|
||||||
|
else if (lease->hwaddr_len == 8 &&
|
||||||
|
lease->hwaddr_type == ARPHRD_EUI64)
|
||||||
|
memcpy(&addr.s6_addr[8], lease->hwaddr, 8);
|
||||||
|
#endif
|
||||||
|
#if defined(ARPHRD_IEEE1394) && defined(ARPHRD_EUI64)
|
||||||
|
else if (lease->clid_len == 9 &&
|
||||||
|
lease->clid[0] == ARPHRD_EUI64 &&
|
||||||
|
lease->hwaddr_type == ARPHRD_IEEE1394)
|
||||||
|
/* firewire has EUI-64 identifier as clid */
|
||||||
|
memcpy(&addr.s6_addr[8], &lease->clid[1], 8);
|
||||||
|
#endif
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
|
||||||
|
addr.s6_addr[8] ^= 0x02;
|
||||||
|
|
||||||
|
/* check if we already have this one */
|
||||||
|
for (up = &old, slaac = old; slaac; slaac = slaac->next)
|
||||||
|
{
|
||||||
|
if (IN6_ARE_ADDR_EQUAL(&addr, &slaac->addr))
|
||||||
|
{
|
||||||
|
*up = slaac->next;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
up = &slaac->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* No, make new one */
|
||||||
|
if (!slaac && (slaac = whine_malloc(sizeof(struct slaac_address))))
|
||||||
|
{
|
||||||
|
slaac->ping_time = now;
|
||||||
|
slaac->backoff = 1;
|
||||||
|
slaac->addr = addr;
|
||||||
|
slaac->local = context->local6;
|
||||||
|
/* Do RA's to prod it */
|
||||||
|
ra_start_unsolicted(now, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (slaac)
|
||||||
|
{
|
||||||
|
slaac->next = lease->slaac_address;
|
||||||
|
lease->slaac_address = slaac;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Free any no reused */
|
||||||
|
for (; old; old = slaac)
|
||||||
|
{
|
||||||
|
slaac = old->next;
|
||||||
|
free(old);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
time_t periodic_slaac(time_t now, struct dhcp_lease *leases)
|
||||||
|
{
|
||||||
|
struct dhcp_context *context;
|
||||||
|
struct dhcp_lease *lease;
|
||||||
|
struct slaac_address *slaac;
|
||||||
|
time_t next_event = 0;
|
||||||
|
|
||||||
|
for (context = daemon->ra_contexts; context; context = context->next)
|
||||||
|
if ((context->flags & CONTEXT_RA_NAME))
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* nothing configured */
|
||||||
|
if (!context)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
while (ping_id == 0)
|
||||||
|
ping_id = rand16();
|
||||||
|
|
||||||
|
if (map_rebuild)
|
||||||
|
{
|
||||||
|
map_rebuild = 0;
|
||||||
|
build_subnet_map();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (lease = leases; lease; lease = lease->next)
|
||||||
|
for (slaac = lease->slaac_address; slaac; slaac = slaac->next)
|
||||||
|
{
|
||||||
|
/* confirmed or given up? */
|
||||||
|
if (slaac->backoff == 0 || slaac->ping_time == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (difftime(slaac->ping_time, now) <= 0.0)
|
||||||
|
{
|
||||||
|
struct ping_packet *ping;
|
||||||
|
struct sockaddr_in6 addr;
|
||||||
|
|
||||||
|
save_counter(0);
|
||||||
|
ping = expand(sizeof(struct ping_packet));
|
||||||
|
ping->type = ICMP6_ECHO_REQUEST;
|
||||||
|
ping->code = 0;
|
||||||
|
ping->identifier = ping_id;
|
||||||
|
ping->sequence_no = slaac->backoff;
|
||||||
|
|
||||||
|
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_port = htons(IPPROTO_ICMPV6);
|
||||||
|
addr.sin6_addr = slaac->addr;
|
||||||
|
|
||||||
|
if (sendto(daemon->icmp6fd, daemon->outpacket.iov_base, save_counter(0), 0,
|
||||||
|
(struct sockaddr *)&addr, sizeof(addr)) == -1 &&
|
||||||
|
errno == EHOSTUNREACH)
|
||||||
|
slaac->ping_time = 0; /* Give up */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
slaac->ping_time += (1 << (slaac->backoff - 1)) + (rand16()/21785); /* 0 - 3 */
|
||||||
|
if (slaac->backoff > 4)
|
||||||
|
slaac->ping_time += rand16()/4000; /* 0 - 15 */
|
||||||
|
if (slaac->backoff < 12)
|
||||||
|
slaac->backoff++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (slaac->ping_time != 0 &&
|
||||||
|
(next_event == 0 || difftime(next_event, slaac->ping_time) >= 0.0))
|
||||||
|
next_event = slaac->ping_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
return next_event;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slaac_ping_reply(struct in6_addr *sender, unsigned char *packet, char *interface, struct dhcp_lease *leases)
|
||||||
|
{
|
||||||
|
struct dhcp_lease *lease;
|
||||||
|
struct slaac_address *slaac;
|
||||||
|
struct ping_packet *ping = (struct ping_packet *)packet;
|
||||||
|
int gotone = 0;
|
||||||
|
|
||||||
|
if (ping->identifier == ping_id)
|
||||||
|
for (lease = leases; lease; lease = lease->next)
|
||||||
|
for (slaac = lease->slaac_address; slaac; slaac = slaac->next)
|
||||||
|
if (slaac->backoff != 0 && IN6_ARE_ADDR_EQUAL(sender, &slaac->addr))
|
||||||
|
{
|
||||||
|
slaac->backoff = 0;
|
||||||
|
gotone = 1;
|
||||||
|
inet_ntop(AF_INET6, sender, daemon->addrbuff, ADDRSTRLEN);
|
||||||
|
my_syslog(MS_DHCP | LOG_INFO, "SLAAC-CONFIRM(%s) %s %s", interface, daemon->addrbuff, lease->hostname);
|
||||||
|
}
|
||||||
|
|
||||||
|
lease_update_dns(gotone);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Build a map from ra-names subnets to corresponding interfaces. This
|
||||||
|
is used to go from DHCPv4 leases to SLAAC addresses,
|
||||||
|
interface->IPv6-subnet, IPv6-subnet + MAC address -> SLAAC.
|
||||||
|
*/
|
||||||
|
static int add_subnet(struct in6_addr *local, int prefix,
|
||||||
|
int scope, int if_index, int dad, void *vparam)
|
||||||
|
{
|
||||||
|
struct dhcp_context *context;
|
||||||
|
|
||||||
|
(void)scope;
|
||||||
|
(void)dad;
|
||||||
|
(void)vparam;
|
||||||
|
|
||||||
|
for (context = daemon->ra_contexts; context; context = context->next)
|
||||||
|
if ((context->flags & CONTEXT_RA_NAME) &&
|
||||||
|
prefix == context->prefix &&
|
||||||
|
is_same_net6(local, &context->start6, prefix) &&
|
||||||
|
is_same_net6(local, &context->end6, prefix))
|
||||||
|
{
|
||||||
|
context->if_index = if_index;
|
||||||
|
context->local6 = *local;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void build_subnet_map(void)
|
||||||
|
{
|
||||||
|
struct dhcp_context *context;
|
||||||
|
int ok = 0;
|
||||||
|
|
||||||
|
for (context = daemon->ra_contexts; context; context = context->next)
|
||||||
|
{
|
||||||
|
context->if_index = 0;
|
||||||
|
if ((context->flags & CONTEXT_RA_NAME))
|
||||||
|
ok = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ra-names configured */
|
||||||
|
if (ok)
|
||||||
|
iface_enumerate(AF_INET6, NULL, add_subnet);
|
||||||
|
}
|
||||||
|
|
||||||
|
void schedule_subnet_map(void)
|
||||||
|
{
|
||||||
|
map_rebuild = 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
+46
-13
@@ -57,7 +57,7 @@ void tftp_request(struct listener *listen, time_t now)
|
|||||||
int mtuflag = IP_PMTUDISC_DONT;
|
int mtuflag = IP_PMTUDISC_DONT;
|
||||||
#endif
|
#endif
|
||||||
char namebuff[IF_NAMESIZE];
|
char namebuff[IF_NAMESIZE];
|
||||||
char *name;
|
char *name = NULL;
|
||||||
char *prefix = daemon->tftp_prefix;
|
char *prefix = daemon->tftp_prefix;
|
||||||
struct tftp_prefix *pref;
|
struct tftp_prefix *pref;
|
||||||
struct interface_list *ir;
|
struct interface_list *ir;
|
||||||
@@ -95,9 +95,20 @@ void tftp_request(struct listener *listen, time_t now)
|
|||||||
|
|
||||||
if (option_bool(OPT_NOWILD))
|
if (option_bool(OPT_NOWILD))
|
||||||
{
|
{
|
||||||
addr = listen->iface->addr;
|
if (listen->iface)
|
||||||
mtu = listen->iface->mtu;
|
{
|
||||||
name = listen->iface->name;
|
addr = listen->iface->addr;
|
||||||
|
mtu = listen->iface->mtu;
|
||||||
|
name = listen->iface->name;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* we're listening on an address that doesn't appear on an interface,
|
||||||
|
ask the kernel what the socket is bound to */
|
||||||
|
socklen_t tcp_len = sizeof(union mysockaddr);
|
||||||
|
if (getsockname(listen->tftpfd, (struct sockaddr *)&addr, &tcp_len) == -1)
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -211,15 +222,18 @@ void tftp_request(struct listener *listen, time_t now)
|
|||||||
mtu = ifr.ifr_mtu;
|
mtu = ifr.ifr_mtu;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for per-interface prefix */
|
if (name)
|
||||||
for (pref = daemon->if_prefix; pref; pref = pref->next)
|
{
|
||||||
if (strcmp(pref->interface, name) == 0)
|
/* check for per-interface prefix */
|
||||||
prefix = pref->prefix;
|
for (pref = daemon->if_prefix; pref; pref = pref->next)
|
||||||
|
if (strcmp(pref->interface, name) == 0)
|
||||||
|
prefix = pref->prefix;
|
||||||
|
|
||||||
/* wierd TFTP interfaces disable special options. */
|
/* wierd TFTP interfaces disable special options. */
|
||||||
for (ir = daemon->tftp_interfaces; ir; ir = ir->next)
|
for (ir = daemon->tftp_interfaces; ir; ir = ir->next)
|
||||||
if (strcmp(ir->interface, name) == 0)
|
if (strcmp(ir->interface, name) == 0)
|
||||||
special = 1;
|
special = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (listen->family == AF_INET)
|
if (listen->family == AF_INET)
|
||||||
{
|
{
|
||||||
@@ -571,7 +585,9 @@ void check_tftp_listeners(fd_set *rset, time_t now)
|
|||||||
my_syslog(MS_TFTP | LOG_INFO, _("sent %s to %s"), transfer->file->filename, daemon->addrbuff);
|
my_syslog(MS_TFTP | LOG_INFO, _("sent %s to %s"), transfer->file->filename, daemon->addrbuff);
|
||||||
/* unlink */
|
/* unlink */
|
||||||
*up = tmp;
|
*up = tmp;
|
||||||
free_transfer(transfer);
|
/* put on queue to be sent to script and deleted */
|
||||||
|
transfer->next = daemon->tftp_done_trans;
|
||||||
|
daemon->tftp_done_trans = transfer;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -709,4 +725,21 @@ static ssize_t get_block(char *packet, struct tftp_transfer *transfer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int do_tftp_script_run(void)
|
||||||
|
{
|
||||||
|
struct tftp_transfer *transfer;
|
||||||
|
|
||||||
|
if ((transfer = daemon->tftp_done_trans))
|
||||||
|
{
|
||||||
|
daemon->tftp_done_trans = transfer->next;
|
||||||
|
#ifdef HAVE_SCRIPT
|
||||||
|
queue_tftp(transfer->file->size, transfer->file->filename, &transfer->peer);
|
||||||
|
#endif
|
||||||
|
free_transfer(transfer);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
Reference in new issue
Block a user