summaryrefslogtreecommitdiffhomepage
path: root/src
AgeCommit message (Collapse)Author
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>
2019-01-16dhcpv6-ia: fix onlink IA check (FS#2060)Hans Dedecker
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>
2019-01-15dhcpv6: add setting to choose IA_NA, IA_PD or bothMatija Amidzic
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>
2019-01-02router: add syslog tracing for skipped routesHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-01-02router: filter route information optionHans Dedecker
Commit 750e457e3000187b85906814a2529ede24775325 added the capability to filter out prefixes in RAs; however routes were not filtered out based on the prefixes. This commit fixes this by taking into account the prefix_filter when constructing the RA route info option Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-01-01router: make announcing DNS info configurable (FS#2020)Hans Dedecker
Make announcing options Recursive DNS server and DNS search list configurable via the ra_dns config option. This allows to disable sending RA based DNS info if such info is already provided by DHCPv6. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-12-31router: check return code of odhcpd_get_interface_dns_addr()Hans Dedecker
Check if odhcpd_get_interface_dns_addr() returns a valid DNS address. While at it restructure the DNS RA code to make it more readable Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-12-31config: check for invalid DNS addressesHans Dedecker
Don't accept 0.0.0.0 and :: as DNS addresses. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-12-12odhcpd: switch to libubox container_of implementationHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-12-12treewide: switch to libubox ARRAY_SIZE immplementationHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-11-27netlink: fix triggering of NETEV_ADDR6LIST_CHANGE eventHans Dedecker
Generate a NETEV_ADDR6LIST_CHANGE event in case the preferred lifetime makes a transition from deprecated (preferred lifetime not greater than current timestamp) to not deprecated (preferred lifetime greater than current timestamp) Reported-by: Tian Hao <haotia@gmail.com> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-11-23config: correctly break string for prefix filterHamster Tian
This if statement does the following: 1. Copy the value of "config prefix_filter" 2. Break the string at "/" 3. Save the number after / as prefix length 4. Convert the address before / into in6_addr However the extraneous "=" broke the second step and inet_pton failed with addresses with mask. This commit removes the = thus fixes the feature. Signed-off-by: Tian Hao <haotia@gmail.com>
2018-10-07odhcpd: make DHCPv6/RA/NDP support optionalHans Dedecker
In case IPv6 is not enabled don't try to init DHCPv6/RA and NDP but only init DHCPv4. This allows odhcpd to start up in absence of IPv6 support. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-09-23dhcpv6: check return code of dhcpv6_ia_init()Hans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-09-23router: don't leak RA message in relay mode (FS#1853)Hans Dedecker
In relay mode don't send RA message with router lifetime equal to 0 when interface gets disabled as router Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-09-05odhcpd: detect broken hostnamesHans Dedecker
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>
2018-09-03config: fix odhcpd_attrs array sizeHans Dedecker
Use ODHCPD_ATTR_MAX as array size of odhcpd_attrs Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-07-26ubus: avoid dumping interface state with NULL messageJo-Philipp Wich
Invoking ubus methods with NULL message is not supported anymore, so make sure that network.interface/dump is called with an empty blob buffer argument. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-09dhcpv4: improve error checking in handle_dhcpv4()Hans Dedecker
Check ioctl return value as reported by Coverity in CID1437659 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-07-05odhcpd: Check if open the ioctl socket failedHyeonsik Song
Signed-off-by: Hyeonsik Song <blogcin@naver.com>
2018-06-26dhcpv6-ia: fix border assignment size settingHans Dedecker
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>
2018-06-26dhcpv6-ia: fix status code for not on link IAsHans Dedecker
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>