Age | Commit message (Collapse) | Author |
|
Allow to set the preferred/valid lifetimes of IA_NA/IA_PD options based
on the configured dhcp leasetime.
DHCP leqasetime will be used to set the preferred/valid lifetimes in the
IA_NA/IA_PD options unless the preferred/valid lifetimes of the IPv6
address are smaller then the DHCP leasetime.
This will avoid IA_NA/IA_PD options being sent with infinite lifetimes
due to the IPv6 address having infinite preferred/valid lifetimes
like IPv6 ULA addresses.
While at it rename dhcpv4_leasetime into dhcp_leasetime as the leasetime
is used both for DHCPv4 and DHCPv6
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Simplify the code by using specific flags which identify the assignment
either as a DHCPv6 PD or NA assignment. This allows to remove implicit
checks for PD and NA assignments based on the value of the assignment
length parameter.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Remove prefix delegation routes as well in free_dhcpv6_assignment when
cleaning up the assignment resources
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
As the assignment struct holds a pointer to the interface struct
use this one in apply_lease iso passing interface as a parameter
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Currently only assignments with prefixes larger than the largest
available one will be re-assigned on addrlist change events.
Previously failed PD assignments are not taken into account, and these
assignments will never have a chance to recover even if the address just
added to the interface could satisfy them.
Failed PD assignments could be very common when upstream prefix is obtained
from a PPPoE WAN, as ISPs tend to terminate the PPPoE session after a fixed
time period. Addresses on LAN could disappear and re-appear during WAN redial,
and all existing PD assignments to clients in LAN will become failed when the
addresses disappear. These assignments will not be recovered after WAN has been
brought back up, and clients in LAN could no longer receive any PD prefix.
This commit fixes the issue by including failed PD assignments in the
re-assign list on addrlist change event, so that newly added prefixes can be
put into use right after they are added to the interface.
Signed-off-by: Tian Hao <haotia@gmail.com>
|
|
In case clid_len is set free assignment when validity timer expires
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Replace the config option ra_management by the config options ra_flags
and ra_slaac. The latter allows to configure the autonomous-address
config flag used for stateless address configuration while the former
allows to configure the RA flags in the form of a list.
The list can hold the following values :
managed-config
other-config
home-agent
none
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
1. Remove 'ignore' config option for interface. Interface is still used if
any of 'ra', 'ndp', 'dhcpv4' or 'dhcpv6' options are different from
default 'disabled' mode. In config_parse_interface() update runtime
ignore value according to all mode values.
2. Reset ignore, ra, ndp, dhcpv4 and dhcpv6 values in set_interface_defaults().
Otherwise if option is deleted from config file and config is reloaded,
it will use the value from old config, potentiallly not turning services off.
3. Do not use implicit checks that 0 server mode means MODE_DISABLED.
4. Simplify code of all service setup functions if passed enabled = true
argument, but service mode is disabled.
Signed-off-by: Dainis Jonitis <dainis.jonitis@ubnt.com>
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
When allocating an assignment in alloc_assignment; init the circular head
and lease_list circular lists. Avoids checking NULL pointer when freeing
the assignment in free_assignment.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
When allocating interface, init dhcpv4_assignments, dhcpv4_fr_ips
and ia_assignments circular list heads to point to self. Avoids
checking whether next pointer is not null all over the place.
Signed-off-by: Dainis Jonitis <dainis.jonitis@ubnt.com>
|
|
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Replace the separate dhcpv4/dhcpv6 assignment free functions by
the function free_assignment which calls the dhcp specific
free function via a callback
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Rework the static lease logic as the existing logic had different issues.
Static leases are now added in a vlist tree which makes it easier to handle
static lease config changes.
For both DHCPv4 and DHCPv6 static assignments are now created upon the
receival of DHCPv4/DHCPv6 messages as before the static assignment was
created even if the client was not physically present.
In case a hostname is specified in a static lease it won't be overriden
anymore by the hostname received from the client.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Add support for rapid commit according to RFC8415 18.3.1
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Store the interfaces in an avl tree iso a linear linked list
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Use the logical OpenWrt interface name in syslog printing as multiple
logical interfaces can be defined on top of the same device
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Add CONFIRM support as specified in RFC8415 paragraph 18.3.3
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Fixes :
src/dhcpv6-ia.c:1117:22: warning: variable 'onlink' set but not used [-Wunused-but-set-variable]
for (size_t i = 0, onlink = false; i < addrlen; ++i) {
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Some DHCPv6 clients start sending SOLICIT messages without including either
an IA_NA or IA_PD and only start including an IA_NA or IA_PD in the REQUEST
message without including an IA_PREFIX or IA_ADDR as suboption. As a result
the check to verify if an IA_ADDR and/or IA_PREFIX is onlink fails.
Fix this by returning notonlink if an IA_PREFIX or IA_ADDR suboption is
present having an address/prefix not matching any of the addresses
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Adds the config options to set if DHCPv6 'stateful addresing' hands out
IA_NA (Internet Address - Network Address), IA_PD (Internet Address -
Prefix Delegation), both or none.
Signed-off-by: Matija Amidzic <matija.amidzic@sartura.hr>
|
|
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Check hostnames contain valid characters as defined in RFC 952 and RFC 1123.
Invalid hostnames in uci configured host entries will result into a refusal
to create the static lease.
In case a client received hostname contains an invalid character no
<hostname> <IP address> entry will be added to the lease file.
In such case the leaseinfo description in the lease file will still contain
the hostname but preceded by the string broken\x20
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
The border assignment size is not updated by address list change events if
the interface is not configured as DHCPv6 server; therefore set the border
assignment size when an interface is enabled and configured as a DHCPv6
server in order to keep the assignment size in sync with the available
prefix sizes
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Set status code not on link for IAs in DHCPv6 request messages carrying
prefixes/addresses not matching the link prefix(es) to which the client
is connected
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Detected by Coverity in CID1412267
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
As the odhcpd log verbosity is configurable log renew messages as well.
Fixes logically dead code reported by Coverity in CID1412318
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Assign tentative assignments a lifetime of 60 seconds; this will assure
the assignment is seen as valid during lookup when receiving a later
REQUEST from the DHCPv6 client.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Whe doing an assignment lookup do a strict match between the assignment
IAID and the IAID received form the client in case the BOUND or TENTATIVE
assignment flags are set.
This fixes a wrong assignment being returned for a client which uses a
different IAID than the IAID used in a previous DHCPv6 exchange.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Send reconfigure accept and reconfigure key authentication protocol options
only if the client indicates it supports reconfigure accept as descibed
in RFC3315 paragraph 21.5.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Rework the handling of netlink events by letting the different
modules ndp, ra, dhcpv6 and dhcpv4 install netevent handlers.
The installed netevent handlers are called by the netlink logic
passing an event indication together with event data.
Each netevent handler implements its own event logic; this
makes the code more modular and less complex by moving all
netlink code to netlink.c
While at it rename ia_addr and ia_addr_len into addr6 and
addr6_len respectively
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
First step in moving netlink code to netlink.c by
moving netlink code from odhcpd.c to netlink.c
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Support force renew nonce authentication support in the DHCPv4 server as
described in RFC3203 and RFC6704.
The interface uci arameter dhcpv4_forcereconf allows to supports DHCPv4
clients which support force renew without authentication.
While at it align network byte order logic for simplicity.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Remove the unfortunate RELAYD naming in the different macros
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Rework reconfigure accept retransmission logic; every DHCPv6 assignment
has its own reconfigure accept timer now making sure the timeout and
retransmission behavior is in line with RFC3315 paragraph 19.1.2.
While at it rename the original reconf_timer into valid_until_timeout as
it will only check now the lifetime of the assignments.
Set reconf_cnt to INT_MAX for every assignment which belongs to the same
client identifier; before the reconf_cnt of the first handled assignment
was set by mistake breaking the retransmission logic.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Some client implementations expect DHCPv6 addresses to be assigned for
every prefix present in a RA as reported in FS#524; if not done the
client implementations spam the DHCPv6 server with SOLICIT messages
trying to get an DHCPv6 address for every prefix.
When ra_managed is set to 1 and an ULA prefix is configured; the DHCPv6
server will only assign an ULA DHCPv6 addresses which possibly leads to
DNS issues.
Fix these problems by providing dhcpv6_assignall config option which
assigns all viable DHCPv6 addresses to a client by default.
This is a trade off as it means client implementations will be assigned
more IPv6 addresses and lose the ability to quickly renumber clients
which don't support reconfigure accept in case of wan prefix change
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Improve code readability by renaming managed into ra_managed and
define the according ra_managed flags.
This will help to better understand the ra_managed logic as defined
in the README file.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Retrieve IPv6 interface addresses when the interface gets created; this
allows to get rid of the IPv6 address dump logic in ndp.c.
Add IPv4 address support in odhcp_ipaddr struct.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Create assignment for unknown identity association in rebind messages which is
equivalent to the handling of identity association for solicit/request messages.
However don't consider identity associations in rebind messages as a request so
that addresses/prefixes which are not apropriate for the link are returned with
lifetimes of 0.
This aligns with the behavior of the ISC DHCPv6 server.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Don't reset the final 32 bit IPv6 host suffix when storing the IPv6 addresses
in the interface structure. This will allow exact lookup aand return of IPv6
addresses stored in the interface structure when needed.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Check the lockf return value to fix the following warning/error:
/home/fainelli/dev/openwrt/trunk/build_dir/target-mipsel-linux-gnu_glibc/odhcpd-2017-02-21-1b630f8b/src/dhcpv6-ia.c: In function 'dhcpv6_write_statefile':
/home/fainelli/dev/openwrt/trunk/build_dir/target-mipsel-linux-gnu_glibc/odhcpd-2017-02-21-1b630f8b/src/dhcpv6-ia.c:246:8: error: ignoring return value of 'lockf', declared with attribute warn_unused_result [-Werror=unused-result]
lockf(fd, F_LOCK, 0);
^
cc1: all warnings being treated as errors
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
|
|
Set dhcp leasetim to 43200 seconds for all interfaces independant
if dhcpv4 is enabled for an interface. Minimum allowed leasetime
is 60 seconds when parsing leastime configuration; this allows to
clean up the awkward leasetime checks on different places in the code
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|