summaryrefslogtreecommitdiffhomepage
path: root/src
AgeCommit message (Collapse)Author
2017-04-27ndp: fix wrong interface name in syslog messageHans 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-25ubus: don't segfault when there're no leasesHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-04-21ubus: rework dumping IPv6 and IPv4 leasesHans 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-30rework IPv6 dns address selection (FS#635)Hans Dedecker
Don't return anymore the link local IPv6 address as DNS IPv6 address since different OS implementations (e.g. android, ...) cannot handle a link local IPv6 address as DNS address. IPv6 DNS address selection is reworked as follows : -Consider all global/ULA IPv6 address having a valid lifetime -Give preference to global/ULA IPv6 addresses being not deprecated -Give preference to ULA IPv6 addresses over IPv6 global addresses -Give preference to the IPv6 address with the longest preferred lifetime in its selected category (ULA or global) -If no global/ULA IPv6 address is present use the IPv6 link local address 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-29ndp: code cleanupHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-03-29rework IPv6 address dump logicHans Dedecker
Make the code more logical by moving the IPv6 address dump logic into the different protocol interface enable handlers so it's clear which protocols require interface IPv6 address tracking. At the same time restructure the IPv6 address dump logic so less IPv6 address netlink dumps are created. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-03-13ndp: add syslog debug tracingHans Dedecker
Add extra LOG_DEBUG syslog tracing for trouble shooting 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-21router: don't announce prefixes with valid lifetime equal to 0Hans Dedecker
Don't set prefix valid lifetime to 0 in case the preferred lifetime equals 0 and valid lifetime gets smaller than 7200. In corner cases it leads to router lifetime being set although no prefixes are announced with a valid lifetime different from 0. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-02-20router: fix arithmetic exception faultHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-02-20router: allow RA prefix lifetime being set to leasetime value (FS#397)Hans Dedecker
Add config option ra_useleasetime which allows the RA prefix lifetime being set to the leasetime in case the valid and/or preferred prefix lifetime is bigger than the configured leasetime. Signed-off-by: Hans Dedecker <dedeckeh@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-16router: support ra_mininterval and ra_lifetime uci parameters (FS#397)Hans Dedecker
Add support for uci parameters ra_mininterval and ra_lifetime as described in RFC4861 paragraph 6.2.1. Variable ra_mininterval allows to configure the minimum interval time between unsolicited router advertisement messages; default value is 200 seconds. The minimum allowed value is 4 seconds while the maximum value is limited to 0.75 of the maximum interval time. The calculation of the maximum interval time between unsolicited router advertisement messages has been reworked. The default value is 600 seconds as specified in RFC4861; if the maximum interval time exceeds 0.33 * the minimal valid lifetime of all IPv6 prefixes it will be limited to 0.33 * the minimal valid lifetime of all IPv6 prefixes Variable ra_lifetime allows to configure the Router Lifetime field in the router advertisement messages; the value is either 0 or a value between the maximum interval time and 9000 seconds. If the router lifetime is smaller than the RA maximum interval it will be set equal to the RA maximum interval time. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-02-15router.h: fix alignment styleHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-02-15Revert "odhcpd.h: fix alignment style"Hans Dedecker
This reverts commit 62ea54f5db4c636710781056541c4b85d043bef8.
2017-02-15odhcpd.h: fix alignment styleHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-02-14config: make loglevel configurable via uci (FS#481)Hans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-02-13odhcpd: display correct default log level in usage textHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-02-10treewide: define and use macro IN6_IS_ADDR_ULAHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-02-10ndp: deregister netlink event socket for non recoverable errorsHans Dedecker
Deregister netlink event socket in case of error different from ENOBUFS or failure to set netlink rx buffer size Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-02-10odhcpd: fix white space errorsHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-02-09ndp: harden netlink event socket error handlingHans Dedecker
Start with a netlink receive buffersize of 130k for the netlink event socket; double the netlink receive buffer size in case an ENOBUFS is reported. Also align function naming and its parameters. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-02-09ndp: close proc file descriptor also during error handlingHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-02-09npd: rework IPv6 relay logic (FS#396)Hans Dedecker
Rework the IPv6 relay logic to make it more robust by making use of libnltiny to process netlink messages. At the same time reimplement the IPv6 relay finite state machine to make the relay logic less error prone Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-02-09config: restore interface defaults when cleaning interfaceHans Dedecker
Interface defaults are whiped when clean interface is executed resulting into loss of default behavior for the ndproxy_routing and ra_management uci parameters 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-31odhcpd: properly handle netlink messages (FS#388)Hans Dedecker
Use libnl-tiny to construct and process netlink messages when manipulating IPv6 routes and fetching IPv6 addresses. This fixes lingering netlink error messages on the netlink socket in case route deletion failed causing fetching of IPv6 addresses to be aborted and odhcpd faultly assuming no IPv6 addresses being present on the interface.
2017-01-31odhcpd: fix coding styleHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-01-26odhcpd: decrease default log level to LOG_INFOHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-01-26odhcpd: rework IPv6 interface address dumpHans Dedecker
Rework the IPv6 address dump logic to make it more robust and generate syslog traces in case of error situations Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-01-26odhcpd: extra syslog tracingHans Dedecker
Add extra syslog tracing for trouble shooting and make some syslog traces more self explaining Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-01-24router: fix compile issue on 64 bit systemsHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-01-24Revert "router: fix compile issue on 64 targets"Hans Dedecker
This reverts commit 70fbf936839e02d526929be06ecba3059f78be3c.
2017-01-24router: fix compile issue on 64 targetsHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-01-23router: convert syslog lifetime traces into LOG_INFO prioHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-01-23treewide: rework prio of syslog messagesHans Dedecker
Rework prio of syslog messages allowing to filter out the relevant messages by setting the correct log level Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-01-23ndp: code cleanupHans Dedecker
ia_reconf is only set but nowhere used; so let's remove it ... Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-01-21router: add syslog debug tracing for trouble shootingHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-01-21treewide: use RELAYD_MAX_ADDRS as address array sizeHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-01-21ndp: don't scan netlink attributes in case of netlink route eventHans Dedecker
In case a netlink route event is received for a default route netlink data attributes were faulty processed as neigbor netlink data. Fix this by not processing any netlink attribute for any route event. 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-05config: respect ignore uci optionJo-Philipp Wich
The odhcpd documentation currently implies that "option ignore 1" in a section of type "dhcp" will disable any services on the referenced interface while the code actually ignores the setting when initializing referenced interfaces. This commonly leads to situations where users think that "option disabled" will prevent any server activity on a given interface while in reality odhcpd effectively acts as rogue DHCPv6 server in its default configuration. To fully inhibit any activity, one has to specify both "option ignore 1" as well as "option ra disabled", "option ndp disabled" and "option dhcpv6 disabled" which is highly counter intuitive at best. A previous commit (5f425ed Respect interface "ignore" settings as documented.) attempted to address the problem by observing the value of i->ignore instead of unconditionally enabling all protocols but broke the ability to use DHCPv6 relay mode while having DHCPv4 disabled. This patch changes ... - the enabling of services on an interface to use the value of the ignore option as default choice instead of hardcoding "true" - the options "ra", "ndp", "dhcpv4" and "dhcpv6" to take precedence over the default "ignore" state to allow selectively enabling services on ignored interfaces - the README to clarify the fact that "ra", "ndp", "dhcpv4" and "dhcpv6" can now override "option ignore" Signed-off-by: Jo-Philipp Wich <jo@mein.io> Acked-by: Karl Palsson <karlp@etactica.com> Tested-by: Stijn Tintel <stijn@linux-ipv6.be> Tested-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>