Import dhcpcd-7.1.0 with the following changes:
* NetBSD: sets SO_RERROR on to detect receive socket overflow * BSD: route improvements to avoid listening for own changes * IP6: implement IP6 address sharing * BSD: catch UP/DOWN events when interfaces does support media changes * IPv4LL: remember old address when carrier is lost
This commit is contained in:
parent
2084d65025
commit
da2c316c5d
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -91,6 +91,7 @@ for x do
|
|||
--without-sha256) SHA2=no;;
|
||||
--without-hmac) HMAC=no;;
|
||||
--without-dev) DEV=no;;
|
||||
--with-udev) DEV=yes; UDEV=yes;;
|
||||
--without-udev) UDEV=no;;
|
||||
--with-poll) POLL="$var";;
|
||||
--serviceexists) SERVICEEXISTS=$var;;
|
||||
|
@ -98,7 +99,7 @@ for x do
|
|||
--servicestatus) SERVICESTATUS=$var;;
|
||||
--small) SMALL=yes;;
|
||||
--statusarg) STATUSARG=$var;;
|
||||
--infodir|--includedir) ;; # ignore autotools
|
||||
--infodir) ;; # ignore autotools
|
||||
--disable-maintainer-mode|--disable-dependency-tracking) ;;
|
||||
--disable-silent-rules) ;;
|
||||
-V|--version)
|
||||
|
@ -1344,6 +1345,10 @@ EOF
|
|||
rm -f _udev.c _udev
|
||||
elif [ "$DEV" != no -a "$UDEV" != no ]; then
|
||||
echo "no"
|
||||
if [ -n "$UDEV" ]; then
|
||||
echo "udev has been explicity requested ... aborting" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$DEV" = yes ]; then
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - ARP handler
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd: BPF arp and bootp filtering
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -28,7 +28,7 @@
|
|||
#define CONFIG_H
|
||||
|
||||
#define PACKAGE "dhcpcd"
|
||||
#define VERSION "7.0.8"
|
||||
#define VERSION "7.1.0"
|
||||
|
||||
#ifndef CONFIG
|
||||
# define CONFIG SYSCONFDIR "/" PACKAGE ".conf"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -232,6 +232,7 @@ ssize_t dhcp6_env(char **, const char *, const struct interface *,
|
|||
void dhcp6_free(struct interface *);
|
||||
void dhcp6_handleifa(int, struct ipv6_addr *, pid_t);
|
||||
int dhcp6_dadcompleted(const struct interface *);
|
||||
void dhcp6_abort(struct interface *);
|
||||
void dhcp6_drop(struct interface *, const char *);
|
||||
void dhcp6_dropnondelegates(struct interface *ifp);
|
||||
int dhcp6_dump(struct interface *);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" Copyright (c) 2006-2018 Roy Marples
|
||||
.\" Copyright (c) 2006-2019 Roy Marples
|
||||
.\" All rights reserved
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
|
@ -22,7 +22,7 @@
|
|||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd June 5, 2018
|
||||
.Dd January 2, 2019
|
||||
.Dt DHCPCD 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -54,7 +54,7 @@
|
|||
.Op Fl v , Fl Fl vendor Ar code , Ar value
|
||||
.Op Fl W , Fl Fl whitelist Ar address Ns Op Ar /cidr
|
||||
.Op Fl w
|
||||
.Op Fl Fl waitip Op 4 | 6
|
||||
.Op Fl Fl waitip Ns = Ns Op 4 | 6
|
||||
.Op Fl y , Fl Fl reboot Ar seconds
|
||||
.Op Fl X , Fl Fl blacklist Ar address Ns Op Ar /cidr
|
||||
.Op Fl Z , Fl Fl denyinterfaces Ar pattern
|
||||
|
@ -102,7 +102,7 @@ sets the hostname to the one supplied by the DHCP server.
|
|||
.Nm
|
||||
then daemonises and waits for the lease renewal time to lapse.
|
||||
It will then attempt to renew its lease and reconfigure if the new lease
|
||||
changes when the lease beings to expire or the DHCP server sends message
|
||||
changes when the lease begins to expire or the DHCP server sends a message
|
||||
to renew early.
|
||||
.Pp
|
||||
If any interface reports a working carrier then
|
||||
|
@ -187,8 +187,8 @@ Using a single interface also affects the
|
|||
.Fl n
|
||||
and
|
||||
.Fl x
|
||||
options where the same interface will need to be specified as a lack of an
|
||||
interafce will imply Master mode which this is not.
|
||||
options, where the same interface will need to be specified, as a lack of an
|
||||
interface will imply Master mode which this is not.
|
||||
To force starting in Master mode with only one interface, the
|
||||
.Fl M , Fl Fl master
|
||||
option can be used.
|
||||
|
@ -272,10 +272,10 @@ If
|
|||
cannot obtain a lease, then try to use the last lease acquired for the
|
||||
interface.
|
||||
.It Fl Fl lastleaseextend
|
||||
Same as the above, but he lease will be retained even if it expires.
|
||||
Same as the above, but the lease will be retained even if it expires.
|
||||
.Nm
|
||||
will give it up if any other host tries to claim it for their own via ARP.
|
||||
This is does violate RFC2131 section 3.7 which states the lease should be
|
||||
This violates RFC 2131, section 3.7, which states the lease should be
|
||||
dropped once it has expired.
|
||||
.It Fl e , Fl Fl env Ar value
|
||||
Push
|
||||
|
@ -307,7 +307,7 @@ are disable, none, ptr and both.
|
|||
itself never does any DNS updates.
|
||||
.Nm
|
||||
encodes the FQDN hostname as specified in
|
||||
.Li RFC1035 .
|
||||
.Li RFC 1035 .
|
||||
.It Fl f , Fl Fl config Ar file
|
||||
Specify a config to load instead of
|
||||
.Pa @SYSCONFDIR@/dhcpcd.conf .
|
||||
|
@ -322,7 +322,7 @@ If
|
|||
is an empty string then the current system hostname is sent.
|
||||
If
|
||||
.Ar hostname
|
||||
is a FQDN (ie, contains a .) then it will be encoded as such.
|
||||
is a FQDN (i.e., contains a .) then it will be encoded as such.
|
||||
.It Fl I , Fl Fl clientid Ar clientid
|
||||
Send the
|
||||
.Ar clientid .
|
||||
|
@ -483,7 +483,7 @@ then
|
|||
will not attempt to obtain a lease and just use the value for the address with
|
||||
an infinite lease time.
|
||||
.Pp
|
||||
Here is an example which configures a static address, routes and dns.
|
||||
Here is an example which configures a static address, routes and DNS.
|
||||
.D1 dhcpcd -S ip_address=192.168.0.10/24 \e
|
||||
.D1 -S routers=192.168.0.1 \e
|
||||
.D1 -S domain_name_servers=192.168.0.1 \e
|
||||
|
@ -538,7 +538,7 @@ then exits before doing any configuration.
|
|||
.It Fl w
|
||||
Wait for an address to be assigned before forking to the background.
|
||||
Does not take an argument, unlike the below option.
|
||||
.It Fl Fl waitip Op 4 | 6
|
||||
.It Fl Fl waitip Ns = Ns Op 4 | 6
|
||||
Wait for an address to be assigned before forking to the background.
|
||||
4 means wait for an IPv4 address to be assigned.
|
||||
6 means wait for an IPv6 address to be assigned.
|
||||
|
@ -628,7 +628,7 @@ Use the last four bytes of the hardware address as the DHCP xid instead
|
|||
of a randomly generated number.
|
||||
.It Fl J , Fl Fl broadcast
|
||||
Instructs the DHCP server to broadcast replies back to the client.
|
||||
Normally this is only set for non Ethernet interfaces,
|
||||
Normally this is only set for non-Ethernet interfaces,
|
||||
such as FireWire and InfiniBand.
|
||||
In most instances,
|
||||
.Nm
|
||||
|
@ -788,11 +788,11 @@ Text file that holds a secret key known only to the host.
|
|||
.It Pa @DBDIR@/ Ns Ar interface Ns Ar -ssid Ns .lease
|
||||
The actual DHCP message sent by the server.
|
||||
We use this when reading the last
|
||||
lease and use the files mtime as when it was issued.
|
||||
lease and use the file's mtime as when it was issued.
|
||||
.It Pa @DBDIR@/ Ns Ar interface Ns Ar -ssid Ns .lease6
|
||||
The actual DHCPv6 message sent by the server.
|
||||
We use this when reading the last
|
||||
lease and use the files mtime as when it was issued.
|
||||
lease and use the file's mtime as when it was issued.
|
||||
.It Pa @DBDIR@/rdm_monotonic
|
||||
Stores the monotonic counter used in the
|
||||
.Ar replay
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" Copyright (c) 2006-2018 Roy Marples
|
||||
.\" Copyright (c) 2006-2019 Roy Marples
|
||||
.\" All rights reserved
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
|
@ -22,7 +22,7 @@
|
|||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd June 5, 2018
|
||||
.Dd September 15, 2018
|
||||
.Dt DHCPCD.CONF 5
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -61,7 +61,7 @@ which is a space or comma separated list of patterns passed to
|
|||
.Nm dhcpcd
|
||||
will arping each address in order before attempting DHCP.
|
||||
If an address is found, we will select the replying hardware address as the
|
||||
profile, otherwise the ip address.
|
||||
profile, otherwise the IP address.
|
||||
Example:
|
||||
.Pp
|
||||
.D1 interface bge0
|
||||
|
@ -110,7 +110,7 @@ then it means that
|
|||
.Nm dhcpcd
|
||||
could not find the correct authentication token in your configuration.
|
||||
.It Ic background
|
||||
Background immediately.
|
||||
Fork to the background immediately.
|
||||
This is useful for startup scripts which don't disable link messages for
|
||||
carrier status.
|
||||
.It Ic blacklist Ar address Ns Op /cidr
|
||||
|
@ -130,7 +130,7 @@ interact with a BOOTP server.
|
|||
All other DHCP options still work.
|
||||
.It Ic broadcast
|
||||
Instructs the DHCP server to broadcast replies back to the client.
|
||||
Normally this is only set for non Ethernet interfaces,
|
||||
Normally this is only set for non-Ethernet interfaces,
|
||||
such as FireWire and InfiniBand.
|
||||
In most cases,
|
||||
.Nm dhcpcd
|
||||
|
@ -164,7 +164,7 @@ should use with
|
|||
.Va wpa_supplicant_driver=nl80211
|
||||
.Pp
|
||||
If the hostname is set, it will be will set to the FQDN if possible as per
|
||||
RFC 4702 section 3.1.
|
||||
RFC 4702, section 3.1.
|
||||
If the FQDN option is missing,
|
||||
.Nm dhcpcd
|
||||
will still try and set a FQDN from the hostname and domain options for
|
||||
|
@ -172,7 +172,9 @@ consistency.
|
|||
To override this, set
|
||||
.Ic env
|
||||
.Va hostname_fqdn=[YES|NO|SERVER] .
|
||||
A value of server means just what the server says, don't manipulate it.
|
||||
A value of
|
||||
.Va SERVER
|
||||
means just what the server says, don't manipulate it.
|
||||
This could lead to an inconsistent hostname on a DHCPv4 and DHCPv6 network
|
||||
where the DHCPv4 hostname is short and the DHCPv6 has an FQDN.
|
||||
DHCPv6 has no hostname option.
|
||||
|
@ -252,11 +254,11 @@ back on IPv4LL.
|
|||
.It Ic inform6
|
||||
Performs a DHCPv6 Information Request.
|
||||
No address is requested or specified, but all other DHCPv6 options are allowed.
|
||||
This is normally performed automatically when the IPv6 Router Advertises
|
||||
that the client should perform this operation.
|
||||
This is normally performed automatically when an IPv6 Router Advertisement
|
||||
indicates that the client should perform this operation.
|
||||
This option is only needed when
|
||||
.Nm dhcpcd
|
||||
is not processing IPv6RA messages and the need for DHCPv6 Information Request
|
||||
is not processing IPv6 RA messages and the need for a DHCPv6 Information Request
|
||||
exists.
|
||||
.It Ic persistent
|
||||
.Nm dhcpcd
|
||||
|
@ -266,7 +268,7 @@ NFS or SSH clients connect to this host and they need to be notified of
|
|||
the host shutting down.
|
||||
You can use this option to stop this from happening.
|
||||
.It Ic fallback Ar profile
|
||||
Fallback to using this profile if DHCP fails.
|
||||
Fall back to using this profile if DHCP fails.
|
||||
This allows you to configure a static profile instead of using ZeroConf.
|
||||
.It Ic hostname Ar name
|
||||
Sends the hostname
|
||||
|
@ -277,7 +279,7 @@ If
|
|||
is an empty string then the current system hostname is sent.
|
||||
If
|
||||
.Ar name
|
||||
is a FQDN (ie, contains a .) then it will be encoded as such.
|
||||
is a FQDN (i.e., contains a .) then it will be encoded as such.
|
||||
.It Ic hostname_short
|
||||
Sends the short hostname to the DHCP server instead of the FQDN.
|
||||
This is useful because DHCP servers will not register the FQDN in their
|
||||
|
@ -327,10 +329,10 @@ Each assigned address will have a
|
|||
defaulting to 1.
|
||||
If the
|
||||
.Ar suffix
|
||||
is 0 then a slaac address is assigned.
|
||||
is 0 then a SLAAC address is assigned.
|
||||
You cannot assign a prefix to the requesting interface unless the
|
||||
DHCPv6 server supports
|
||||
.Li RFC6603
|
||||
DHCPv6 server supports the
|
||||
.Li RFC 6603
|
||||
Prefix Exclude Option.
|
||||
.Nm dhcpcd
|
||||
has to be running for all the interfaces it is delegating to.
|
||||
|
@ -385,21 +387,27 @@ Only configure IPv4.
|
|||
.It Ic ipv6only
|
||||
Only configure IPv6.
|
||||
.It Ic fqdn Op disable | none | ptr | both
|
||||
none will not ask the DHCP server to update DNS.
|
||||
ptr just asks the DHCP server to update the PTR
|
||||
record of the host in DNS whereas both also updates the A record.
|
||||
disable will disable the FQDN option.
|
||||
The default is both.
|
||||
.Ar none
|
||||
will not ask the DHCP server to update DNS.
|
||||
.Ar ptr
|
||||
just asks the DHCP server to update the PTR
|
||||
record of the host in DNS, whereas
|
||||
.Ar both
|
||||
also updates the A record.
|
||||
.Ar disable
|
||||
will disable the FQDN option.
|
||||
The default is
|
||||
.Ar both .
|
||||
.Nm dhcpcd
|
||||
itself never does any DNS updates.
|
||||
.Nm dhcpcd
|
||||
encodes the FQDN hostname as specified in
|
||||
.Li RFC1035 .
|
||||
.Li RFC 1035 .
|
||||
.It Ic interface Ar interface
|
||||
Subsequent options are only parsed for this
|
||||
.Ar interface .
|
||||
.It Ic ipv6ra_autoconf
|
||||
Generate SLAAC addresses for each Prefix advertised by a
|
||||
Generate SLAAC addresses for each Prefix advertised by an IPv6
|
||||
Router Advertisement message with the Auto flag set.
|
||||
On by default.
|
||||
.It Ic ipv6ra_noautoconf
|
||||
|
@ -407,7 +415,7 @@ Disables the above option.
|
|||
.It Ic ipv6ra_fork
|
||||
By default, when
|
||||
.Nm dhcpcd
|
||||
receives an IPv6 RA,
|
||||
receives an IPv6 Router Advertisement,
|
||||
.Nm dhcpcd
|
||||
will only fork to the background if the RA contains at least one unexpired
|
||||
RDNSS option and a valid prefix or no DHCPv6 instruction.
|
||||
|
@ -440,13 +448,13 @@ will supply a default metric of 200 +
|
|||
.Xr if_nametoindex 3 .
|
||||
An extra 100 will be added for wireless interfaces.
|
||||
.It Ic mudurl Ar url
|
||||
Specifies the URL for a manufacturer usage description (MUD).
|
||||
Specifies the URL for a Manufacturer Usage Description (MUD).
|
||||
The description is used by upstream network devices to instantiate any
|
||||
desired access lists.
|
||||
See draft-ietf-opsawg-mud for more information.
|
||||
.It Ic noalias
|
||||
Any pre-existing IPv4 addresses existing address will be removed from the
|
||||
interface when adding a new IPv4 address.
|
||||
Any pre-existing IPv4 addresses will be removed from the interface when
|
||||
adding a new IPv4 address.
|
||||
.It Ic noarp
|
||||
Don't send any ARP requests.
|
||||
This also disables IPv4LL.
|
||||
|
@ -464,7 +472,8 @@ Don't start DHCP or listen to DHCP messages.
|
|||
This is only useful when allowing IPv4LL.
|
||||
.It Ic nodhcp6
|
||||
Don't start DHCPv6 or listen to DHCPv6 messages.
|
||||
Normally DHCPv6 is started by a RA instruction or configuration.
|
||||
Normally DHCPv6 is started by an IPv6 Router Advertisement instruction or
|
||||
configuration.
|
||||
.It Ic nogateway
|
||||
Don't install any default routes.
|
||||
.It Ic gateway
|
||||
|
@ -513,7 +522,6 @@ You can specify more
|
|||
separated by commas, spaces or more
|
||||
.Ic option
|
||||
lines.
|
||||
.Ar option
|
||||
Prepend dhcp6_ to
|
||||
.Ar option
|
||||
to request a DHCPv6 option.
|
||||
|
@ -545,7 +553,7 @@ To enforce that
|
|||
only responds to DHCP servers and not BOOTP servers, you can
|
||||
.Ic require
|
||||
.Ar dhcp_message_type .
|
||||
This isn't an exact science though because a BOOTP server can send DHCP like
|
||||
This isn't an exact science though because a BOOTP server can send DHCP-like
|
||||
options.
|
||||
.It Ic reject Ar option
|
||||
Reject a message that contains the
|
||||
|
@ -594,7 +602,7 @@ Subsequent options are only parsed for this wireless
|
|||
Selects the interface identifier used for SLAAC generated IPv6 addresses.
|
||||
If
|
||||
.Ar private
|
||||
is used, a RFC7217 address is generated.
|
||||
is used, an RFC 7217 address is generated.
|
||||
.It Ic static Ar value
|
||||
Configures a static
|
||||
.Ar value .
|
||||
|
@ -602,8 +610,8 @@ If you set
|
|||
.Ic ip_address
|
||||
then
|
||||
.Nm dhcpcd
|
||||
will not attempt to obtain a lease and just use the value for the address with
|
||||
an infinite lease time.
|
||||
will not attempt to obtain a lease and will just use the value for the address
|
||||
with an infinite lease time.
|
||||
If you set
|
||||
.Ic ip6_address ,
|
||||
.Nm dhcpcd
|
||||
|
@ -626,13 +634,15 @@ option instead of setting a static address.
|
|||
.D1 static domain_name_servers=192.168.0.1 fd51:42f8:caae:d92e::1
|
||||
.Pp
|
||||
Here is an example for PPP which gives the destination a default route.
|
||||
It uses the special destination keyword to insert the destination address
|
||||
It uses the special
|
||||
.Ar destination
|
||||
keyword to insert the destination address
|
||||
into the value.
|
||||
.D1 interface ppp0
|
||||
.D1 static ip_address=
|
||||
.D1 destination routers
|
||||
.It Ic timeout Ar seconds
|
||||
Timeout after
|
||||
Time out after
|
||||
.Ar seconds ,
|
||||
instead of the default 30.
|
||||
A setting of 0
|
||||
|
@ -673,7 +683,7 @@ Set un-encapsulated vendor option to hello world.
|
|||
.D1 vendor ,"hello world"
|
||||
.It Ic vendorclassid Ar string
|
||||
Set the DHCP Vendor Class.
|
||||
DHCPv6 has it's own option as shown below.
|
||||
DHCPv6 has its own option as shown below.
|
||||
The default is
|
||||
dhcpcd-<version>:<os>:<machine>:<platform>.
|
||||
For example
|
||||
|
@ -706,12 +716,14 @@ Use the last four bytes of the hardware address as the DHCP xid instead
|
|||
of a randomly generated number.
|
||||
.El
|
||||
.Ss Defining new options
|
||||
DHCP, ND and DHCPv6 allow for the use of custom options.
|
||||
DHCP, ND and DHCPv6 allow for the use of custom options, and RFC 3925 vendor
|
||||
options for DHCP can also be supplied.
|
||||
Each option needs to be started with the
|
||||
.Ic define ,
|
||||
.If definend
|
||||
or
|
||||
.Ic definend,
|
||||
.Ic define6
|
||||
or
|
||||
.Ic vendopt
|
||||
directive.
|
||||
This can optionally be followed by both
|
||||
.Ic embed
|
||||
|
@ -797,12 +809,12 @@ You can use more than one, but they must appear in the order listed below.
|
|||
.Bl -tag -width -indent
|
||||
.It Ic request
|
||||
Requests the option by default without having to be specified in user
|
||||
configuration
|
||||
configuration.
|
||||
.It Ic norequest
|
||||
This option cannot be requested, regardless of user configuration
|
||||
This option cannot be requested, regardless of user configuration.
|
||||
.It Ic optional
|
||||
This option is optional.
|
||||
Only makes sense for embedded options where like the client FQDN option where
|
||||
Only makes sense for embedded options like the client FQDN option, where
|
||||
the FQDN string itself is optional.
|
||||
.It Ic index
|
||||
The option can appear more than once and will be indexed.
|
||||
|
@ -842,9 +854,9 @@ An unsigned 32bit integer, 4 bytes.
|
|||
.It Ic flag
|
||||
A fixed value (1) to indicate that the option is present, 0 bytes.
|
||||
.It Ic domain
|
||||
A RFC 3397 encoded string.
|
||||
An RFC 3397 encoded string.
|
||||
.It Ic dname
|
||||
A RFC 1035 validated string.
|
||||
An RFC 1035 validated string.
|
||||
.It Ic binhex Op : Ic length
|
||||
Binary data expressed as hexadecimal.
|
||||
.It Ic embed
|
||||
|
@ -855,14 +867,14 @@ Contains encapsulated options (implies embed as well).
|
|||
References an option from the global definition.
|
||||
.El
|
||||
.Ss Example definition
|
||||
.D1 # DHCP option 81, Fully Qualified Domain Name, RFC4702
|
||||
.D1 # DHCP option 81, Fully Qualified Domain Name, RFC 4702
|
||||
.D1 define 81 embed fqdn
|
||||
.D1 embed byte flags
|
||||
.D1 embed byte rcode1
|
||||
.D1 embed byte rcode2
|
||||
.D1 embed domain fqdn
|
||||
.Pp
|
||||
.D1 # DHCP option 125, Vendor Specific Information Option, RFC3925
|
||||
.D1 # DHCP option 125, Vendor Specific Information Option, RFC 3925
|
||||
.D1 define 125 encap vsio
|
||||
.D1 embed uint32 enterprise_number
|
||||
.D1 # Options defined for the enterprise number
|
||||
|
@ -872,8 +884,10 @@ References an option from the global definition.
|
|||
.It Ic token
|
||||
Sends a plain text token the server expects and matches a token sent by
|
||||
the server.
|
||||
The tokens to not have to be the same.
|
||||
If unspecified, the token with secretid of 0 will be used in sending messages
|
||||
The tokens do not have to be the same.
|
||||
If unspecified, the token with a
|
||||
.Ar secretid
|
||||
of 0 will be used in sending messages
|
||||
and validating received messages.
|
||||
.It Ic delayedrealm
|
||||
Delayed Authentication.
|
||||
|
@ -886,7 +900,10 @@ and
|
|||
.Ar secretid
|
||||
in it.
|
||||
.Nm dhcpcd
|
||||
will then look for a non-expired token with a matching realm and secretid.
|
||||
will then look for an unexpired token with a matching
|
||||
.Ar realm
|
||||
and
|
||||
.Ar secretid .
|
||||
This token is used to authenticate all other messages.
|
||||
.It Ic delayed
|
||||
Same as above, but without a realm.
|
||||
|
@ -903,8 +920,8 @@ If none specified,
|
|||
.Ic monotonic
|
||||
is the default.
|
||||
If this is changed from what was previously used,
|
||||
or the means of calculating or storing it is broken then the DHCP server
|
||||
will probably have to have its notion of the clients Replay Detection Value
|
||||
or the means of calculating or storing it is broken, then the DHCP server
|
||||
will probably have to have its notion of the client's Replay Detection Value
|
||||
reset.
|
||||
.Bl -tag -width -indent
|
||||
.It Ic monocounter
|
||||
|
@ -912,7 +929,7 @@ Read the number in the file
|
|||
.Pa @DBDIR@/dhcpcd-rdm.monotonic
|
||||
and add one to it.
|
||||
.It Ic monotime
|
||||
Create a NTP timestamp from the system time.
|
||||
Create an NTP timestamp from the system time.
|
||||
.It Ic monotonic
|
||||
Same as
|
||||
.Ic monotime .
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -166,13 +166,6 @@ struct dhcpcd_ctx {
|
|||
|
||||
char *randomstate; /* original state */
|
||||
|
||||
/* Used to track the last routing message,
|
||||
* so we can ignore messages the parent process sent
|
||||
* but the child receives when forking.
|
||||
* getppid(2) is unreliable because we detach. */
|
||||
pid_t ppid; /* parent pid */
|
||||
int pseq; /* last seq in parent */
|
||||
|
||||
#ifdef INET
|
||||
struct dhcp_opt *dhcp_opts;
|
||||
size_t dhcp_opts_len;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -88,7 +88,7 @@ duid_machineuuid(char *uuid, size_t uuid_len)
|
|||
}
|
||||
len = strlen(uuid) + 1;
|
||||
fclose(fp);
|
||||
r = 0;
|
||||
r = len == 1 ? -1 : 0;
|
||||
#else
|
||||
r = -1;
|
||||
errno = ENOSYS;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* eloop - portable event based main loop.
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved.
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2009-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2009-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Linux interface driver for dhcpcd
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -294,6 +294,9 @@ if_opensockets_os(struct dhcpcd_ctx *ctx)
|
|||
struct priv *priv;
|
||||
struct sockaddr_nl snl;
|
||||
socklen_t len;
|
||||
#ifdef NETLINK_BROADCAST_ERROR
|
||||
int on = 1;
|
||||
#endif
|
||||
|
||||
/* Open the link socket first so it gets pid() for the socket.
|
||||
* Then open our persistent route socket so we get a unique
|
||||
|
@ -311,6 +314,10 @@ if_opensockets_os(struct dhcpcd_ctx *ctx)
|
|||
ctx->link_fd = _open_link_socket(&snl, NETLINK_ROUTE);
|
||||
if (ctx->link_fd == -1)
|
||||
return -1;
|
||||
#ifdef NETLINK_BROADCAST_ERROR
|
||||
setsockopt(ctx->link_fd, SOL_NETLINK, NETLINK_BROADCAST_ERROR,
|
||||
&on, sizeof(on));
|
||||
#endif
|
||||
|
||||
if ((priv = calloc(1, sizeof(*priv))) == NULL)
|
||||
return -1;
|
||||
|
@ -847,7 +854,6 @@ send_netlink(struct dhcpcd_ctx *ctx, struct interface *ifp,
|
|||
struct priv *priv;
|
||||
|
||||
priv = (struct priv *)ctx->priv;
|
||||
ctx->sseq = ctx->seq;
|
||||
r = get_netlink(ctx, priv->sndrcv_iov, ifp, s, 0, callback);
|
||||
} else
|
||||
r = -1;
|
||||
|
@ -1750,4 +1756,18 @@ ip6_temp_valid_lifetime(const char *ifname)
|
|||
return val < 0 ? TEMP_VALID_LIFETIME : val;
|
||||
}
|
||||
#endif /* IPV6_MANAGETEMPADDR */
|
||||
|
||||
int
|
||||
ip6_forwarding(const char *ifname)
|
||||
{
|
||||
char path[256];
|
||||
int val;
|
||||
|
||||
if (ifname == NULL)
|
||||
ifname = "all";
|
||||
snprintf(path, sizeof(path), "%s/%s/forwarding", prefix, ifname);
|
||||
val = check_proc_int(path);
|
||||
return val == -1 ? 0 : val;
|
||||
}
|
||||
|
||||
#endif /* INET6 */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -109,7 +109,7 @@
|
|||
#define DHCPCD_DHCP6 (1ULL << 50)
|
||||
#define DHCPCD_IF_UP (1ULL << 51)
|
||||
#define DHCPCD_INFORM6 (1ULL << 52)
|
||||
#define DHCPCD_RTM_PPID (1ULL << 53)
|
||||
// unused (1ULL << 53)
|
||||
#define DHCPCD_IPV6RA_AUTOCONF (1ULL << 54)
|
||||
#define DHCPCD_ROUTER_HOST_ROUTE_WARNED (1ULL << 55)
|
||||
#define DHCPCD_LASTLEASE_EXTEND (1ULL << 56)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Solaris interface driver for dhcpcd
|
||||
* Copyright (c) 2016-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2016-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -114,6 +114,7 @@ int
|
|||
if_opensockets_os(struct dhcpcd_ctx *ctx)
|
||||
{
|
||||
struct priv *priv;
|
||||
int n;
|
||||
|
||||
if ((priv = malloc(sizeof(*priv))) == NULL)
|
||||
return -1;
|
||||
|
@ -128,11 +129,21 @@ if_opensockets_os(struct dhcpcd_ctx *ctx)
|
|||
|
||||
ctx->link_fd = socket(PF_ROUTE,
|
||||
SOCK_RAW | SOCK_CLOEXEC | SOCK_NONBLOCK, 0);
|
||||
#ifdef INET
|
||||
if (ctx->link_fd == -1)
|
||||
|
||||
if (ctx->link_fd == -1) {
|
||||
free(ctx->priv);
|
||||
#endif
|
||||
return ctx->link_fd == -1 ? -1 : 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Ignore our own route(4) messages.
|
||||
* Sadly there is no way of doing this for route(4) messages
|
||||
* generated from addresses we add/delete. */
|
||||
n = 0;
|
||||
if (setsockopt(ctx->link_fd, SOL_SOCKET, SO_USELOOPBACK,
|
||||
&n, sizeof(n)) == -1)
|
||||
logerr("%s: SO_USELOOPBACK", __func__);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -537,27 +548,6 @@ if_rtm(struct dhcpcd_ctx *ctx, const struct rt_msghdr *rtm)
|
|||
const struct sockaddr *sa;
|
||||
struct rt rt;
|
||||
|
||||
/* Ignore messages generated by us */
|
||||
if (rtm->rtm_pid == getpid()) {
|
||||
ctx->options &= ~DHCPCD_RTM_PPID;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ignore messages sent by the parent after forking */
|
||||
if ((ctx->options &
|
||||
(DHCPCD_RTM_PPID | DHCPCD_DAEMONISED)) ==
|
||||
(DHCPCD_RTM_PPID | DHCPCD_DAEMONISED) &&
|
||||
rtm->rtm_pid == ctx->ppid)
|
||||
{
|
||||
/* If this is the last successful message sent,
|
||||
* clear the check flag as it's possible another
|
||||
* process could re-use the same pid and also
|
||||
* manipulate therouting table. */
|
||||
if (rtm->rtm_seq == ctx->pseq)
|
||||
ctx->options &= ~DHCPCD_RTM_PPID;
|
||||
return;
|
||||
}
|
||||
|
||||
sa = (const void *)(rtm + 1);
|
||||
switch (sa->sa_family) {
|
||||
#ifdef INET6
|
||||
|
@ -989,10 +979,6 @@ if_route(unsigned char cmd, const struct rt *rt)
|
|||
* This includes subnet/prefix routes. */
|
||||
|
||||
ctx = rt->rt_ifp->ctx;
|
||||
if ((cmd == RTM_ADD || cmd == RTM_DELETE || cmd == RTM_CHANGE) &&
|
||||
ctx->options & DHCPCD_DAEMONISE &&
|
||||
!(ctx->options & DHCPCD_DAEMONISED))
|
||||
ctx->options |= DHCPCD_RTM_PPID;
|
||||
|
||||
#define ADDSA(sa) do { \
|
||||
l = RT_ROUNDUP(salen((sa))); \
|
||||
|
@ -1069,7 +1055,6 @@ if_route(unsigned char cmd, const struct rt *rt)
|
|||
rtm->rtm_msglen = (unsigned short)(bp - (char *)rtm);
|
||||
if (write(ctx->link_fd, rtm, rtm->rtm_msglen) == -1)
|
||||
return -1;
|
||||
ctx->sseq = ctx->seq;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -790,6 +790,9 @@ xsocket(int domain, int type, int protocol)
|
|||
#if !defined(HAVE_SOCK_CLOEXEC) || !defined(HAVE_SOCK_NONBLOCK)
|
||||
int xflags, xtype = type;
|
||||
#endif
|
||||
#ifdef SO_RERROR
|
||||
int on;
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SOCK_CLOEXEC
|
||||
if (xtype & SOCK_CLOEXEC)
|
||||
|
@ -814,6 +817,13 @@ xsocket(int domain, int type, int protocol)
|
|||
goto out;
|
||||
#endif
|
||||
|
||||
#ifdef SO_RERROR
|
||||
/* Tell recvmsg(2) to return ENOBUFS if the receiving socket overflows. */
|
||||
on = 1;
|
||||
if (setsockopt(s, SOL_SOCKET, SO_RERROR, &on, sizeof(on)) == -1)
|
||||
logerr("%s: SO_RERROR", __func__);
|
||||
#endif
|
||||
|
||||
return s;
|
||||
|
||||
#if !defined(HAVE_SOCK_CLOEXEC) || !defined(HAVE_SOCK_NONBLOCK)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -197,6 +197,7 @@ int ip6_temp_valid_lifetime(const char *ifname);
|
|||
#else
|
||||
#define ip6_use_tempaddr(a) (0)
|
||||
#endif
|
||||
int ip6_forwarding(const char *ifname);
|
||||
|
||||
int if_address6(unsigned char, const struct ipv6_addr *);
|
||||
int if_addrflags6(const struct interface *, const struct in6_addr *,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -880,6 +880,9 @@ ipv4_handleifa(struct dhcpcd_ctx *ctx,
|
|||
case RTM_DELADDR:
|
||||
if (ia == NULL)
|
||||
return;
|
||||
if (mask->s_addr != INADDR_ANY &&
|
||||
mask->s_addr != ia->mask.s_addr)
|
||||
return;
|
||||
TAILQ_REMOVE(&state->addrs, ia, next);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -318,7 +318,8 @@ ipv4ll_conflicted(struct arp_state *astate, const struct arp_msg *amsg)
|
|||
if (++state->conflicts == MAX_CONFLICTS)
|
||||
logerr("%s: failed to acquire an IPv4LL address",
|
||||
ifp->name);
|
||||
astate->addr.s_addr = ipv4ll_pickaddr(astate);
|
||||
state->pickedaddr.s_addr = ipv4ll_pickaddr(astate);
|
||||
astate->addr = state->pickedaddr;
|
||||
eloop_timeout_add_sec(ifp->ctx->eloop,
|
||||
state->conflicts >= MAX_CONFLICTS ?
|
||||
RATE_LIMIT_INTERVAL : PROBE_WAIT,
|
||||
|
@ -331,7 +332,7 @@ ipv4ll_arpfree(struct arp_state *astate)
|
|||
struct ipv4ll_state *state;
|
||||
|
||||
state = IPV4LL_STATE(astate->iface);
|
||||
if (state->arp == astate)
|
||||
if (state != NULL && state->arp == astate)
|
||||
state->arp = NULL;
|
||||
}
|
||||
|
||||
|
@ -353,14 +354,11 @@ ipv4ll_start(void *arg)
|
|||
}
|
||||
}
|
||||
|
||||
if (state->arp != NULL)
|
||||
return;
|
||||
|
||||
/* RFC 3927 Section 2.1 states that the random number generator
|
||||
* SHOULD be seeded with a value derived from persistent information
|
||||
* such as the IEEE 802 MAC address so that it usually picks
|
||||
* the same address without persistent storage. */
|
||||
if (state->conflicts == 0) {
|
||||
if (!state->seeded) {
|
||||
unsigned int seed;
|
||||
char *orig;
|
||||
|
||||
|
@ -380,8 +378,11 @@ ipv4ll_start(void *arg)
|
|||
|
||||
/* Set back the original state until we need the seeded one. */
|
||||
setstate(ifp->ctx->randomstate);
|
||||
state->seeded = true;
|
||||
}
|
||||
|
||||
if (state->arp != NULL)
|
||||
return;
|
||||
if ((astate = arp_new(ifp, NULL)) == NULL)
|
||||
return;
|
||||
|
||||
|
@ -391,8 +392,15 @@ ipv4ll_start(void *arg)
|
|||
astate->conflicted_cb = ipv4ll_conflicted;
|
||||
astate->free_cb = ipv4ll_arpfree;
|
||||
|
||||
/* Find the previosuly used address. */
|
||||
if (state->pickedaddr.s_addr != INADDR_ANY)
|
||||
ia = ipv4_iffindaddr(ifp, &state->pickedaddr, NULL);
|
||||
else
|
||||
ia = NULL;
|
||||
|
||||
/* Find an existing IPv4LL address and ensure we can work with it. */
|
||||
ia = ipv4_iffindlladdr(ifp);
|
||||
if (ia == NULL)
|
||||
ia = ipv4_iffindlladdr(ifp);
|
||||
|
||||
#ifdef IN_IFF_TENTATIVE
|
||||
if (ia != NULL && ia->addr_flags & IN_IFF_DUPLICATED) {
|
||||
|
@ -402,7 +410,7 @@ ipv4ll_start(void *arg)
|
|||
#endif
|
||||
|
||||
if (ia != NULL) {
|
||||
astate->addr = ia->addr;
|
||||
state->pickedaddr = astate->addr = ia->addr;
|
||||
#ifdef IN_IFF_TENTATIVE
|
||||
if (ia->addr_flags & (IN_IFF_TENTATIVE | IN_IFF_DETACHED)) {
|
||||
loginfox("%s: waiting for DAD to complete on %s",
|
||||
|
@ -416,7 +424,9 @@ ipv4ll_start(void *arg)
|
|||
}
|
||||
|
||||
loginfox("%s: probing for an IPv4LL address", ifp->name);
|
||||
astate->addr.s_addr = ipv4ll_pickaddr(astate);
|
||||
if (state->pickedaddr.s_addr == INADDR_ANY)
|
||||
state->pickedaddr.s_addr = ipv4ll_pickaddr(astate);
|
||||
astate->addr = state->pickedaddr;
|
||||
#ifdef IN_IFF_TENTATIVE
|
||||
ipv4ll_probed(astate);
|
||||
#else
|
||||
|
@ -424,56 +434,83 @@ ipv4ll_start(void *arg)
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
ipv4ll_freedrop(struct interface *ifp, int drop)
|
||||
static void
|
||||
ipv4ll_freearp(struct interface *ifp)
|
||||
{
|
||||
struct ipv4ll_state *state;
|
||||
int dropped;
|
||||
|
||||
state = IPV4LL_STATE(ifp);
|
||||
if (state == NULL || state->arp == NULL)
|
||||
return;
|
||||
|
||||
eloop_timeout_delete(ifp->ctx->eloop, NULL, state->arp);
|
||||
arp_free(state->arp);
|
||||
state->arp = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
ipv4ll_drop(struct interface *ifp)
|
||||
{
|
||||
struct ipv4ll_state *state;
|
||||
bool dropped = false;
|
||||
struct ipv4_state *istate;
|
||||
|
||||
assert(ifp != NULL);
|
||||
state = IPV4LL_STATE(ifp);
|
||||
dropped = 0;
|
||||
|
||||
/* Free ARP state first because ipv4_deladdr might also ... */
|
||||
if (state && state->arp) {
|
||||
eloop_timeout_delete(ifp->ctx->eloop, NULL, state->arp);
|
||||
arp_free(state->arp);
|
||||
state->arp = NULL;
|
||||
ipv4ll_freearp(ifp);
|
||||
|
||||
#ifndef IN_IFF_TENATIVE
|
||||
if ((ifp->options->options & DHCPCD_NODROP) == DHCPCD_NODROP)
|
||||
#endif
|
||||
return;
|
||||
|
||||
state = IPV4LL_STATE(ifp);
|
||||
if (state && state->addr != NULL) {
|
||||
ipv4_deladdr(state->addr, 1);
|
||||
state->addr = NULL;
|
||||
dropped = true;
|
||||
}
|
||||
|
||||
if (drop && (ifp->options->options & DHCPCD_NODROP) != DHCPCD_NODROP) {
|
||||
struct ipv4_state *istate;
|
||||
/* Free any other link local addresses that might exist. */
|
||||
if ((istate = IPV4_STATE(ifp)) != NULL) {
|
||||
struct ipv4_addr *ia, *ian;
|
||||
|
||||
if (state && state->addr != NULL) {
|
||||
ipv4_deladdr(state->addr, 1);
|
||||
state->addr = NULL;
|
||||
dropped = 1;
|
||||
}
|
||||
|
||||
/* Free any other link local addresses that might exist. */
|
||||
if ((istate = IPV4_STATE(ifp)) != NULL) {
|
||||
struct ipv4_addr *ia, *ian;
|
||||
|
||||
TAILQ_FOREACH_SAFE(ia, &istate->addrs, next, ian) {
|
||||
if (IN_LINKLOCAL(ntohl(ia->addr.s_addr))) {
|
||||
ipv4_deladdr(ia, 0);
|
||||
dropped = 1;
|
||||
}
|
||||
TAILQ_FOREACH_SAFE(ia, &istate->addrs, next, ian) {
|
||||
if (IN_LINKLOCAL(ntohl(ia->addr.s_addr))) {
|
||||
ipv4_deladdr(ia, 0);
|
||||
dropped = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state) {
|
||||
free(state);
|
||||
ifp->if_data[IF_DATA_IPV4LL] = NULL;
|
||||
|
||||
if (dropped) {
|
||||
rt_build(ifp->ctx, AF_INET);
|
||||
script_runreason(ifp, "IPV4LL");
|
||||
}
|
||||
if (dropped) {
|
||||
rt_build(ifp->ctx, AF_INET);
|
||||
script_runreason(ifp, "IPV4LL");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ipv4ll_reset(struct interface *ifp)
|
||||
{
|
||||
struct ipv4ll_state *state = IPV4LL_STATE(ifp);
|
||||
|
||||
if (state == NULL)
|
||||
return;
|
||||
state->pickedaddr.s_addr = INADDR_ANY;
|
||||
state->seeded = false;
|
||||
}
|
||||
|
||||
void
|
||||
ipv4ll_free(struct interface *ifp)
|
||||
{
|
||||
|
||||
assert(ifp != NULL);
|
||||
|
||||
ipv4ll_freearp(ifp);
|
||||
free(IPV4LL_STATE(ifp));
|
||||
ifp->if_data[IF_DATA_IPV4LL] = NULL;
|
||||
}
|
||||
|
||||
/* This may cause issues in BSD systems, where running as a single dhcpcd
|
||||
* daemon would solve this issue easily. */
|
||||
#ifdef HAVE_ROUTE_METRIC
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -40,11 +40,13 @@
|
|||
#include "arp.h"
|
||||
|
||||
struct ipv4ll_state {
|
||||
struct in_addr pickedaddr;
|
||||
struct ipv4_addr *addr;
|
||||
struct arp_state *arp;
|
||||
unsigned int conflicts;
|
||||
struct timespec defend;
|
||||
char randomstate[128];
|
||||
bool seeded;
|
||||
uint8_t down;
|
||||
};
|
||||
|
||||
|
@ -66,9 +68,9 @@ void ipv4ll_handle_failure(void *);
|
|||
int ipv4ll_recvrt(int, const struct rt *);
|
||||
#endif
|
||||
|
||||
#define ipv4ll_free(ifp) ipv4ll_freedrop((ifp), 0);
|
||||
#define ipv4ll_drop(ifp) ipv4ll_freedrop((ifp), 1);
|
||||
void ipv4ll_freedrop(struct interface *, int);
|
||||
void ipv4ll_reset(struct interface *);
|
||||
void ipv4ll_drop(struct interface *);
|
||||
void ipv4ll_free(struct interface *);
|
||||
#else
|
||||
#define IPV4LL_STATE_RUNNING(ifp) (0)
|
||||
#define ipv4ll_subnetroute(route, ifp) (0)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -626,32 +626,19 @@ ipv6_deleteaddr(struct ipv6_addr *ia)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Advertise the address if it exists on another interface. */
|
||||
ipv6nd_advertise(ia);
|
||||
}
|
||||
|
||||
static int
|
||||
ipv6_addaddr1(struct ipv6_addr *ia, const struct timespec *now)
|
||||
{
|
||||
struct interface *ifp;
|
||||
struct ipv6_state *state;
|
||||
struct ipv6_addr *ia2;
|
||||
uint32_t pltime, vltime;
|
||||
bool vltime_was_zero;
|
||||
__printflike(1, 2) void (*logfunc)(const char *, ...);
|
||||
|
||||
/* Ensure no other interface has this address */
|
||||
TAILQ_FOREACH(ifp, ia->iface->ctx->ifaces, next) {
|
||||
if (ifp == ia->iface)
|
||||
continue;
|
||||
state = IPV6_STATE(ifp);
|
||||
if (state == NULL)
|
||||
continue;
|
||||
TAILQ_FOREACH(ia2, &state->addrs, next) {
|
||||
if (IN6_ARE_ADDR_EQUAL(&ia2->addr, &ia->addr)) {
|
||||
ipv6_deleteaddr(ia2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Remember the interface of the address. */
|
||||
ifp = ia->iface;
|
||||
|
||||
|
@ -714,7 +701,7 @@ ipv6_addaddr1(struct ipv6_addr *ia, const struct timespec *now)
|
|||
" seconds",
|
||||
ifp->name, ia->prefix_pltime, ia->prefix_vltime);
|
||||
|
||||
|
||||
vltime_was_zero = ia->prefix_vltime == 0;
|
||||
if (if_address6(RTM_NEWADDR, ia) == -1) {
|
||||
logerr(__func__);
|
||||
/* Restore real pltime and vltime */
|
||||
|
@ -778,6 +765,10 @@ ipv6_addaddr1(struct ipv6_addr *ia, const struct timespec *now)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Re-advertise the preferred address to be safe. */
|
||||
if (!vltime_was_zero)
|
||||
ipv6nd_advertise(ia);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -909,7 +900,7 @@ ipv6_findaddr(struct dhcpcd_ctx *ctx, const struct in6_addr *addr, unsigned int
|
|||
ssize_t
|
||||
ipv6_addaddrs(struct ipv6_addrhead *addrs)
|
||||
{
|
||||
struct ipv6_addr *ap, *apn, *apf;
|
||||
struct ipv6_addr *ap, *apn;
|
||||
ssize_t i;
|
||||
struct timespec now;
|
||||
|
||||
|
@ -935,27 +926,6 @@ ipv6_addaddrs(struct ipv6_addrhead *addrs)
|
|||
} else if (!(ap->flags & IPV6_AF_STALE) &&
|
||||
!IN6_IS_ADDR_UNSPECIFIED(&ap->addr))
|
||||
{
|
||||
apf = ipv6_findaddr(ap->iface->ctx,
|
||||
&ap->addr, IPV6_AF_ADDED);
|
||||
if (apf && apf->iface != ap->iface) {
|
||||
if (apf->iface->metric <= ap->iface->metric) {
|
||||
loginfox("%s: preferring %s on %s",
|
||||
ap->iface->name,
|
||||
ap->saddr,
|
||||
apf->iface->name);
|
||||
continue;
|
||||
}
|
||||
loginfox("%s: preferring %s on %s",
|
||||
apf->iface->name,
|
||||
ap->saddr,
|
||||
ap->iface->name);
|
||||
if (if_address6(RTM_DELADDR, apf) == -1 &&
|
||||
errno != EADDRNOTAVAIL && errno != ENXIO)
|
||||
logerr(__func__);
|
||||
apf->flags &=
|
||||
~(IPV6_AF_ADDED | IPV6_AF_DADCOMPLETED);
|
||||
} else if (apf)
|
||||
apf->flags &= ~IPV6_AF_ADDED;
|
||||
if (ap->flags & IPV6_AF_NEW)
|
||||
i++;
|
||||
if (!timespecisset(&now))
|
||||
|
@ -989,6 +959,7 @@ ipv6_freeaddr(struct ipv6_addr *ia)
|
|||
}
|
||||
|
||||
eloop_q_timeout_delete(ia->iface->ctx->eloop, 0, NULL, ia);
|
||||
free(ia->na);
|
||||
free(ia);
|
||||
}
|
||||
|
||||
|
@ -1108,6 +1079,9 @@ ipv6_handleifa(struct dhcpcd_ctx *ctx,
|
|||
case RTM_DELADDR:
|
||||
if (ia != NULL) {
|
||||
TAILQ_REMOVE(&state->addrs, ia, next);
|
||||
/* Advertise the address if it exists on
|
||||
* another interface. */
|
||||
ipv6nd_advertise(ia);
|
||||
/* We'll free it at the end of the function. */
|
||||
}
|
||||
break;
|
||||
|
@ -2177,13 +2151,11 @@ inet6_makeprefix(struct interface *ifp, const struct ra *rap,
|
|||
}
|
||||
|
||||
/* There is no point in trying to manage a /128 prefix,
|
||||
* ones without a lifetime or ones not on link or delegated */
|
||||
if (addr->prefix_len == 128 ||
|
||||
addr->prefix_vltime == 0 ||
|
||||
!(addr->flags & (IPV6_AF_ONLINK | IPV6_AF_DELEGATEDPFX)))
|
||||
* ones without a lifetime. */
|
||||
if (addr->prefix_len == 128 || addr->prefix_vltime == 0)
|
||||
return NULL;
|
||||
|
||||
/* Don't install a reject route when not creating bigger prefixes */
|
||||
/* Don't install a reject route when not creating bigger prefixes. */
|
||||
if (addr->flags & IPV6_AF_NOREJECT)
|
||||
return NULL;
|
||||
|
||||
|
@ -2215,7 +2187,9 @@ inet6_makeprefix(struct interface *ifp, const struct ra *rap,
|
|||
#ifndef __linux__
|
||||
sa_in6_init(&rt->rt_gateway, &in6addr_loopback);
|
||||
#endif
|
||||
} else
|
||||
} else if (!(addr->flags & IPV6_AF_ONLINK))
|
||||
sa_in6_init(&rt->rt_gateway, &rap->from);
|
||||
else
|
||||
rt->rt_gateway.sa_family = AF_UNSPEC;
|
||||
sa_in6_init(&rt->rt_ifa, &addr->addr);
|
||||
return rt;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -44,7 +44,8 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#define ALLROUTERS "ff02::2"
|
||||
#define ALLNODES "ff02::1"
|
||||
#define ALLROUTERS "ff02::2"
|
||||
|
||||
#define EUI64_GBIT 0x01
|
||||
#define EUI64_UBIT 0x02
|
||||
|
@ -169,6 +170,10 @@ struct ipv6_addr {
|
|||
void (*dadcallback)(void *);
|
||||
int dadcounter;
|
||||
|
||||
struct nd_neighbor_advert *na;
|
||||
size_t na_len;
|
||||
int na_count;
|
||||
|
||||
#ifdef ALIAS_ADDR
|
||||
char alias[IF_NAMESIZE];
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - IPv6 ND handling
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -58,9 +58,11 @@ struct rs_state {
|
|||
struct nd_router_solicit *rs;
|
||||
size_t rslen;
|
||||
int rsprobes;
|
||||
uint32_t retrans;
|
||||
};
|
||||
|
||||
#define RS_STATE(a) ((struct rs_state *)(ifp)->if_data[IF_DATA_IPV6ND])
|
||||
#define RS_CSTATE(a) ((const struct rs_state *)(ifp)->if_data[IF_DATA_IPV6ND])
|
||||
#define RS_STATE_RUNNING(a) (ipv6nd_hasra((a)) && ipv6nd_dadcompleted((a)))
|
||||
|
||||
#ifndef MAX_RTR_SOLICITATION_DELAY
|
||||
|
@ -68,6 +70,7 @@ struct rs_state {
|
|||
#define MAX_UNICAST_SOLICIT 3 /* 3 transmissions */
|
||||
#define RTR_SOLICITATION_INTERVAL 4 /* seconds */
|
||||
#define MAX_RTR_SOLICITATIONS 3 /* times */
|
||||
#define MAX_NEIGHBOR_ADVERTISEMENT 3 /* 3 transmissions */
|
||||
#endif
|
||||
|
||||
/* On carrier up, expire known routers after RTR_CARRIER_EXPIRE seconds. */
|
||||
|
@ -99,6 +102,7 @@ int ipv6nd_hasra(const struct interface *);
|
|||
int ipv6nd_hasradhcp(const struct interface *);
|
||||
void ipv6nd_handleifa(int, struct ipv6_addr *, pid_t);
|
||||
int ipv6nd_dadcompleted(const struct interface *);
|
||||
void ipv6nd_advertise(struct ipv6_addr *);
|
||||
void ipv6nd_expire(struct interface *, uint32_t);
|
||||
void ipv6nd_drop(struct interface *);
|
||||
void ipv6nd_neighbour(struct dhcpcd_ctx *, struct in6_addr *, int);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* logerr: errx with logging
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* logerr: errx with logging
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - route management
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - route management
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* rEDISTRIBUTION AND USE IN SOURCE AND BINARY FORMS, WITH OR WITHOUT
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Socket Address handling for dhcpcd
|
||||
* Copyright (c) 2015-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2015-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Socket Address handling for dhcpcd
|
||||
* Copyright (c) 2015-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2015-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* dhcpcd - DHCP client daemon
|
||||
* Copyright (c) 2006-2018 Roy Marples <roy@marples.name>
|
||||
* Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
Loading…
Reference in New Issue