Age | Commit message (Collapse) | Author |
|
The prefix_filter allows to select which prefix should be assigned
to clients if you have multiple prefixes on an interface.
Currently, the filter only applies to RAs and does work with
a dhcpv6 server.
This commit enables the filter also on dhcpv6.
Signed-off-by: Nick Hainke <vincent@systemli.org>
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
"valid_lft" and "preferred_lft" are different. If the "preferred_lft"
is expired the prefix should be avoided in source prefix selection.
However, the interface is allowed to still receive downstream traffic.
preferred_lfetime:
Limit for preferred lifetime of a prefix
If you want the old behavior, you have to set preferred_lifetime to
the same value as leasetime.
Signed-off-by: Nick Hainke <vincent@systemli.org>
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Remove the checks as they're leftovers of the old static lease
implementation which created assigments with assigned equal to 0
whihc is not the case anymore in the reworked static lease
implementation
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Make sure IA_PD prefixes for which no preferred and valid lifetimes
can be returned are included in the reply with a preferred and valid
lifetime to 0.
Therefore exclude IPv6 prefixes with an invalid prefix length as
well so IA_PD prefixes for which not a preferred/valid lifetime is
returned are included with a preferred and valid lifetime set to 0
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
When an IPv6 address change is triggered each PD assignment is checked
if it is still consistent with the updated IPv6 prefix list.
If not consistent anymore a reconfigure is triggered for the assignment
and a best effort is made to assign a new IA_PD prefix.
If it not possible anymore to assign an IA_PD prefix delete the PD
assignment now so it will result into a NO BINDING status code for the
given IA_PD in the DHCPv6 reply when the client tries to renew the IA_PD prefix.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Applications (e.g. unbound) need a consistent view of the statefile;
therefore write all the lease info to a temporary file which is later
renamed to the configured statefile name
Suggested-by : John Fremlin <john@fremlin.org>
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Since commit 6db312a698e920ff61505ef1f42469880829774d the preferred and
valid lifetimes of the addresses/prefixes is based on the configured leasetime;
as a result the displayed preferred and valid lifetimes need to be
calculated based on the assignment lifetime as this is set to the lowest
valid lifetime of the addresses/prefixes.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
SYS_clock_gettime is gone with musl 1.2.0. Switched to the function.
Also fixed two format strings that fail as time_t is 64-bit with 1.2.0.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
|
|
Further align the code to use DHCPv6 assignment flags to distinguish
between prefix delegation and non temporary address assignments
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Don't set the valid lifetime to infinite for static assignments
but rather set it to the IA lifetime given to the client.
This makes it possible to display the leasetime for static assigments
and simplifies the code in several places
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
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>
|