summaryrefslogtreecommitdiffhomepage
path: root/src/dhcpv6-ia.c
AgeCommit message (Collapse)Author
2018-02-20dhcpv6-ia: don't always send reconf accept option (FS#1377)Hans Dedecker
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>
2017-11-09treewide: rework handling of netlink eventsHans Dedecker
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>
2017-10-16treewide: add netlink fileHans Dedecker
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>
2017-10-13treewide: align function namingHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-09-13dhcpv4: force renew nonce authentication supportHans Dedecker
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>
2017-09-06treewide: replace RELAYD prefix naming in macrosHans Dedecker
Remove the unfortunate RELAYD naming in the different macros Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-08-10dhcpv6-ia: rework reconfigure accept logicHans Dedecker
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>
2017-08-03dhcpv6: assign all viable DHCPv6 addresses by default (FS#402, FS#524)Hans Dedecker
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>
2017-08-02treewide: reflect managed mode is related to RAHans Dedecker
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>
2017-07-03treewide: rework logic to retrieve IPv6 interface addressesHans Dedecker
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>
2017-06-27treewide: use angle-brackets to include libubox header filesHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-04-26dhcpv6-ia: Fix segfault when writing DHCPv4 leases in state fileHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-04-21dhcpv6-ia: simplify logic to write statefile and dhcpv6 loggingHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-04-13dhcpv6-ia: create assignment for unknown IA in rebind messagesHans Dedecker
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>
2017-03-29ndp: keep an exact copy of IPv6 interface addressesHans Dedecker
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>
2017-03-04dhcpv6-ia: Check lockf return valueFlorian Fainelli
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>
2017-02-19treewide: simplify dhcp leasetime checkingHans Dedecker
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>
2017-02-01dhcpv6-ia: apply lease delete based on assignment bound stateHans Dedecker
Make adding and removing of routes via apply_lease dependant on the assignment bound state as it makes no sense to delete routes for an assignment which is not bound. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-01-06dhcpv6-ia: filter out prefixes having invalid lengthHans Dedecker
Function append_reply filters out addresses having invalid prefix length when constructing prefixes being delegated to a client. Now also filter out addresses with an invalid prefix length when writing the delegated prefixes in the statefile and during logging of the delegated prefixes. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-01-05dhcpv6-ia: fix dereference after freeing assignmentHans Dedecker
Fix assignment dereference by dhcpv6_log in case the assignment is freed when nothing has been assigned. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-01-05dhcpv6-ia: log only IPv6 addresses which are effectively assigned to a ↵Hans Dedecker
DHCPv6 client Fix displaying IPv6 addresses which were not assigned to a DHCPv6 client Clean up the code by using macro ADDR_ENTRY_VALID_IA_ADDR on different places to align the checks. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-01-03dhcpv6-ia: fix static assignment checkHans Dedecker
Fix static assignment check failure which was introduced in commit 561890e Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-01-02dhcpv6-ia: coding style fixesHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-01-02dhcpv6-ia: update valid_until only for non static DHCPv6 leasesHans Dedecker
Update valid_until lifetime only for non static DHCPv6 leases otherwise the lifetime of a static lease is not infinite anymore Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-12-30dhcpv6-ia: fix invalid IPv6/hostname entries in statefileHans Dedecker
Statefull IPv6 addresses are assigned to DHCPv6 clients from a local prefix based on criteria which need to be fulfilled. One of those criteria requires the IPv6 address still having preferred lifetime which was not checked when constructing the contents of the statefile. Another criteria requires the prefix length not being smaller than or equal to 64 when ra_management equals 0 or 1 which was neither correctly checked when constructing the statefile. This can lead to invalid hostname/IPv6 entries in the statefile and thus possible connectivity issues when using DNS resolving. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-12-30dhcpv6-ia: fix delete logic of an assignment in reconf_timerHans Dedecker
Function free_dhcpv6_assignment already removes the assignment in the list so there's no need to call list_del in reconf_timer Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-12-30dhcpv6-ia : code style fixesHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-12-28dhcpv6-ia: use free_dhcpv6_assignment where neededHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-12-28dhcpv6-ia: make free_dhcpv6_assignment staticHans Dedecker
Further align coding style Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-12-28dhcpv4: fix DHCPv4 hostname handlingHans Dedecker
Fix hostname not being reported as "-" in the DHCP statefile in case no hostname is reported by the DHCPv4 client (https://:wqgithub.com/openwrt/odhcpd/issues/94) Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-12-27Limit lifetime of non-static leases in case of release and declineHans Dedecker
In case infinite leasetime is assigned to a non static DHCPv4/v6 lease override the infinite lifetime of the lease when either a DHCPv4/v6 decline or release is received. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-12-15Don't print non bound assignments in the state fileHans Dedecker
Set bound flag for DHCPv4 and DHCPv6 assignments when the IPv6/IPv4 address is leased to a client. This will prevent the printing of leases and hostname/IPv4/IPv6 address combinations in the state file for for which the IPv4/6 address has not been assigned. Also this will fix the printing of assignments which have been declined by the clients Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-12-01dhcpv6-ia : Fix static DHCPv6 assignments becoming non staticHans Dedecker
The valid_until parameter which is set to 0 for static DHCPv6 assignments was overwritten depending on the received DHCPv6 message which turned the assignment into having a finite lifetime and thus not static anymore. Fix this by checking if the valid_until parameter holds infinite lifetime before updating it. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-12-01dhcpv6-ia: Fix assignment of static DHCPv6 leasesHans Dedecker
Fix assignment of static DHCPv6 leases which was broken by commit 6c3bc0141dacc88992583d6f2cdc8a360df7422d. At the same time fix lifetime check of existing assignments having a finite lifetime Fixes FS#309 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-12-01odhcpd: Display infinite valid lifetime as -1Hans Dedecker
Display infinite valid lifetime as -1 both in ubus and statefile Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-11-21dhcpv6-ia: Display infinite lifetime as INT32_MAX in state fileHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-11-21config: Support infinite as DHCP pool leasetime valueHans Dedecker
Add support for infinite leasetime value; this can be done by specifying "infinite" as leasetime value which is similar to dnsmasq infinite leasetime support. Specifying "infinite" as leasetime is valid for both the host and dhcp uci sections. A DHCPv4/DHCPv6 assignment is now considered infinite if valid_unil holds the value 0. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-05-19Add per-host leasetime supportSteven Barth
Patch by Daniel Dickinson Signed-off-by: Steven Barth <steven@midlink.org>
2015-09-07dhcpv6: use correct length when copying duidSteven Barth
2015-09-07dhcpv6: fix mac-handlingSteven Barth
2015-09-01Fixup RAs/DHCPv6 announcing incorrect addressesSteven Barth
2015-08-13router: Fix compile issuesHans Dedecker
Fix compile issue due to comparison between signed and unsigned integers
2015-07-27ra/dhcpv6: unify address change handlingSteven Barth
2015-07-14ndp: fixup relaySteven Barth
2015-05-21dhcpv6: fix typoSteven Barth
2015-05-13dhcpv6-pd: ignore /64 on interfaceSteven Barth
2015-04-20dhcpv6: don't initialize IA-handing when turning down interfaceSteven Barth
2015-04-20remove leftover fallout from prefix class supportSteven Barth
2015-04-14Fix logic inversionSteven Barth
Signed-off-by: Steven Barth <steven@midlink.org>
2015-04-14Fix potential invalid memory accessSteven Barth