summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)Author
2019-05-15treewide: init assignment lists headHans Dedecker
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>
2019-05-14config: use list safe iterator in lease_deleteHans Dedecker
As the current assignment is freed in lease_delete use list_for_each_entry_safe Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-05-03dhcpv4: fix lease ordering by ip addressDainis Jonitis
1. Maintaining of sorted list was wrong for static lease case. Add dhcpv4_insert_assignment() helper function and use it from all places. 2. Add ip4toa() helper function to print ipv4 address that is stored as network byte-order uint32_t. Signed-off-by: Dainis Jonitis <dainis.jonitis@ubnt.com> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-05-03config: use multi-stage parsing of uci sectionsDainis Jonitis
When loading uci sections from config file, in one pass do not mix sections from different types. First load odhcpd global settings, then all interface sections and finally static leases. It ensures that section order in file can't affect what information is already parsed. For example static lease section may need information about all interfaces, to decide whether ip address belongs to any of currently defined interfaces/address pools. Signed-off-by: Dainis Jonitis <dainis.jonitis@ubnt.com>
2019-05-03treewide: always init interface list heads during initializationDainis Jonitis
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>
2019-05-03dhcpv4: do not allow pool end address to overlap with broadcast addressDainis Jonitis
Signed-off-by: Dainis Jonitis <dainis.jonitis@ubnt.com>
2019-05-03treewide: give file descriptors safe initial valueDainis Jonitis
Since main problem of assuming that fd==0 is invalid value was fixed in upstream odhcpd by e7b1d4bf3a2297192638b9c84208b3dcb306ecd8 then what is left are minor problems of static initialization of some global fd variables. Signed-off-by: Dainis Jonitis <dainis.jonitis@ubnt.com>
2019-05-03dhcpv4: DHCP pool size is off-by-oneDainis Jonitis
1. "limit" option should specify the size of dynamic pool. The dhcpv4_end includes the last valid pool address. 2. Also handle 7 bit host addresses when not directly specified in config file. 3. Make sure code does what documentation says and default 'start'/'limit' pool options to 100 and 150 respectively. Signed-off-by: Dainis Jonitis <dainis.jonitis@ubnt.com> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-05-02dhcpv4: add support for Parameter Request List option 55Dainis Jonitis
Add client "reqopts" in ubus "ipv4leases" output. Signed-off-by: Roman Yeryomin <roman.yeryomin@ubnt.com> Signed-off-by: Dainis Jonitis <dainis.jonitis@ubnt.com>
2019-04-26dhcpv4: fix DHCP packet sizeHans Dedecker
Calculate the DHCP packet size based on the number of DHCP options in the message. Make sure the DHCP packet size does not go lower than 300 bytes as some clients ignore DHCP messages smaller than 300 bytes. Based on a patch by Dainis Jonitis <dainis.jonitis@ubnt.com> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-04-23ndp: fix syslog flooding (FS#2242)Hans Dedecker
Only log a syslog error in case adding of a proxy neighbor fails as a delete failure cannot be considered as a syslog error for all cases. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-04-23config: set default loglevel to LOG_WARNINGHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-04-19router: fix dns search list optionHans Dedecker
Fix regression issue introduced in commit 0523bdd as empty DNS search list option was sent making the RA message invalid Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-04-17router: use ra_lifetime as lifetime for RA options (FS#2206)Hans Dedecker
Use the RA lifetime as lifetime for the recursive DNS and DNS search options For the route options use as lifetime the smallest value of either the valid lifetime of the address associated with the route or the RA lifetime. This avoids routes having infinite lifetime being installed in downstream clients which can results into routes pointing to a removed router. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-04-17router: improve code readibilityHans Dedecker
No functional changes; just improve code readibilty in send_router_advert() Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-04-16Revert "router:"Hans Dedecker
This reverts commit f1d7da9801adc0a77c1a35363e4242544c4915e7.
2019-04-16treewide: align syslog loglevelsHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-04-12router:Hans Dedecker
2019-04-11treewide: fix compiler warningsHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-04-11CMakeList.txt: enable extra compiler checksHans Dedecker
Enforce additional compiler checks in order to catch possible errors during compilation Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-04-05ndp: create ICMPv6 socket per interfaceHans Dedecker
Get rid of the global raw ICMPv6 socket by creating a raw ICMPv6 ping socket per interface. This fixes an open raw ICMPv6 socket in case all ndp interfaces are configured as disabled. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-04-05router: create ICMPv6 socket per interfaceHans Dedecker
Get rid of the global raw ICMPv6 socket by creating a raw ICMPv6 socket per interface. This fixes an open raw ICMPv6 socket in case all ra interfaces are configured as disabled. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-04-04treewide: initialize properly file descriptorsHans Dedecker
Initialzie properly the dhcpv6, dhcpv4 and ndp ffile descriptors when creating an interface. As such the check for a valid descriptor can be done correct now in the different modules Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-03-29netlink: rework IPv4 address refresh logicHans Dedecker
Rework logic to refresh IPv4 addresses so we can get rid of the second for loop Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-03-29netlink: rework IPv6 address refresh logicHans Dedecker
Rework logic to refresh IPv6 addresses so we can get rid of the second for loop Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-03-27netlink: fix IPv6 address updates (FS#2204)Hans Dedecker
Keep the valid and preferred lifetimes in sync with the kernel by always updating the cached IPv6 addresses in refesh_iface_addr6(). This fixes invalid preferred and valid IA lifetimes in DHCPv6 reply messages due to the cached preferred and valid lifetimes not being in sync with the preferred and valid kernel lifetimes Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-03-21dhcpv6: extra syslog tracingHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-03-21dhcpv6/router: add support for mutiple master interfacesHans Dedecker
Support multiple master interfaces for dhcpv6 and ra; it allows to forward dhcpv6 mesaages and RS on multiple upstream links Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-03-21ndp: fix adding proxy neighbor entriesHans Dedecker
In case multiple logical OpenWrt interfaces are stacked on the same device and one of the interfaces is configured in relay and the other not; adding a proxy neighbor entry will result into it immediately being deleted if the interface in non relay mode comes last. Fix this by not doing a delete on the interface which is not configured in relay mode. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-03-21router: add extra syslog tracingHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-03-21netlink: fix neighbor event handling (FS#2160)Hans Dedecker
Commit a54cee0 introduced a regression in the handling of netlink neighbor events as it did not set the interface pointer in the netevent_handler_info struct resulting into a breakage of ndp relay mode Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-02-27ubus: always trigger an update if interface is not foundHans Dedecker
Commit 9f25dd8af76dc30e54ddcbb4a284058e598951d5 changed the logic of handle_update by only triggering an update if the interface is found in the interface list and is not set as to be ignored. However this breaks the behavior of loading the dhcp config for interfaces which were previously not yet known by netifd and as result were not yet created in the interface list. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-02-25dhcpv4: fix adding assignment in list (FS#2142)Hans Dedecker
Add assignment to the tail of the list in case the last element is not bigger Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-02-25dhcpv4: fix static lease lookupHans Dedecker
Function config_find_lease_by_ip_addr expects IP address in network byte order Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-02-19dhcp: rework assignment free logicHans Dedecker
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>
2019-02-18config: fix build failure in case DHCPv4 support is disabledHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-02-18dhcpv4: fix assignment of requested IP addressHans Dedecker
Fix assignment of requested IP address by a client in case the assignment list is empty. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-02-18dhcp: rework static lease logicHans Dedecker
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>
2019-02-13dhcpv6: rapid commit supportHans Dedecker
Add support for rapid commit according to RFC8415 18.3.1 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-02-13dhcpv6: fix parsing of DHCPv6 relay messagesHans Dedecker
Commit 0db69b0b85c83fedd74ac77e850669a17c4e6617 broke parsing of DHCPv6 relay messages as the DHCPv6 client header pointer was not updated after parsing the nested relay forward message(s). Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-02-12dhcpv4: fix compile issueHans Dedecker
Fix compile issue introduced in commit 671ccaabc893b53be8a1891aaf2236b657d6ce06 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-02-11dhcpv6-ia: move function definitions to odhcpd.hHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-02-11dhcpv6: improve code readibilityHans Dedecker
Use struct dhcpv6_client_header hdr to access fixed DHCPv6 header fields Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-02-08treewide: unify dhcpv6 and dhcpv4 assignmentsHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-02-07netlink: rework handling of netlink messagesHans Dedecker
Multiple logical OpenWrt interfaces can be stacked on top of the same Linux device. As such netlink events for addresses/routes/ifindex changes need to be propagated to the different logical OpenWrt interfaces which use the Linux device as reported in the netlink message. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-02-05treewide: use avl tree to store interfacesHans Dedecker
Store the interfaces in an avl tree iso a linear linked list Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-02-03treewide: align syslog tracingHans Dedecker
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>
2019-02-01dhcpv6-ia: add full CONFIRM supportHans Dedecker
Add CONFIRM support as specified in RFC8415 paragraph 18.3.3 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-01-31dhcpv6-ia: rework append_reply()Hans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-01-16dhcpv6-ia: fix compiler warningHans Dedecker
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>