summaryrefslogtreecommitdiffhomepage
path: root/src
AgeCommit message (Collapse)Author
2017-08-17dhcpv4: fix possible segfault when lease is not createdHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-08-17dhcpv4: dhcpv4: move interface lease list insertion out of dhcpv4_assignHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-08-16ndp: use IPv4 address list when comparing IPv4 addressesHans Dedecker
Use IPv4 address list in check_addr_updates which fixes possible segfault as IPv6 address list was used by mistake. 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-07treewide: rework IPv4 address logicHans Dedecker
Align IPv4 address logic with IPv6 by caching per interface the assigned IPv4 addresses. This allows to get rid of different ioctl calls in the DHCPv4 logic to retrieve the IPv4 address and netmask in use by an interface. 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-04ndp: optimize check_addr6_updates codeHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-07-04ndp: fix syslog tracing for netlink neigbor and address eventsHans Dedecker
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-29router: use enum to specify order and index of iov structHans Dedecker
Improve code maintainability by using enum to order and index iov struct Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-06-29treewide: rework code to get rid of fixed IPv6 address arraysHans Dedecker
Rework code to get rid of RELAYD_MAX_PREFIXES and RELAYD_MAX_ADDRS by using dynamic IPv6 address array allocation. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-06-27config: rework code to get rid of IFNAMSIZ usageHans Dedecker
Get rid of IFNAMSIZE usage for interface name and ifname variables 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-05-15config: fix invalid hoplimit in RA messageHans Dedecker
Don't send an invalid hoplimit in RA message when the interface is shutdown due to a invalid configured ra_hoplimit. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-05-15config: fix invalid retranstime in RA messageHans Dedecker
Don't send an invalid retranstime in RA message when the interface is shutdown due to a invalid configured ra_retranstime. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-05-15config: fix invalid reachabletime in RA messageHans Dedecker
Don't send an invalid reachabletime in RA message when the interface is shutdown due to a invalid configured ra_reachabletime. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-05-15config: limit ra_mtu to 65535Hans Dedecker
Limit the maximum ra_mtu to 65535 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-05-15router: fix interface mtu read errorHans Dedecker
Use integer type for mtu variable as odhcpd_get_interface_config returns -1 when it fails to read the interface mtu. This allows to set the mtu to a meaningfull value of 1280 in case of interface mtu read failure. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-05-15config: limit ra_retranstime to 60000Hans Dedecker
Limit the maximum ra_retranstime value to 60000 milliseconds as described in RFC7048. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-05-12dhcpv4: display two hex digits per octet in syslogLeon M. George
Signed-off-by: Leon M. George <leon@georgemail.eu>
2017-05-12config: make RA retransTime configurable via uciHans Dedecker
Allow to specify the router advertisement retrans time via the uci parameter ra_retranstime. If retransmit time is not configured the value is set to 0 in RA message meaning undefined.
2017-05-11config: make RA reachableTime configurable via uciHans Dedecker
Allow to specify the router advertisement reachable time via the uci parameter ra_reachabletime. If reachable time is not configured the value is set to 0 in RA message meaning undefined. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-05-11config: make RA curHopLimit configurable via uciHans Dedecker
Allow to specify the router advertisement current hop limit via the uci parameter ra_hoplimit. If hoplimit is not configured the hoplimit is taken from the interface as before. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-05-11config: make RA mtu configurable via UCIHans Dedecker
Allow to specify the router advertisement mtu via the uci parameter ra_mtu. In case the config parameter is not set the MTU is taken from the interface as before. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-05-11config: fix dhcpv4 server being startedHans Dedecker
In case maindhcp is set to disabled in global config one expect the DHCPv4 server not being started irrespective if the dhcpv4 interface config is set to server. Fix this by keeping maindhcp config apart from the legacy config parameter as already documented in the README. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-05-04ndp.c: add switch/case fallthrough commentsFelix Fietkau
Fixes gcc 7 build errors Signed-off-by: Felix Fietkau <nbd@nbd.name>
2017-04-28ndp: don't trigger IPv6 ping when neighbor entry is invalidHans Dedecker
A ping for an IPv6 address not present on an interface will generate a netlink neighbor message with as status fail; launching again an IPv6 ping on other proxy enabled interfaces will create a cascade effect of netlink neighbor messages with as status fail which in its turn will again trigger an IPv6 ping on proxy enabled interfaces ... Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-04-28ndp: fix adding proxy neighbor entriesHans Dedecker
Proxy neighbor entries were not created for proxy enabled interfaces if the first interface was not enabled Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
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>