summaryrefslogtreecommitdiffhomepage
path: root/src/odhcpd.h
AgeCommit message (Collapse)Author
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-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-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-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-11dhcpv6-ia: move function definitions to odhcpd.hHans Dedecker
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-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-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-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-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-05-28router: improve error checkingHans Dedecker
Improve error checking fixing resource leak detected by Coverity in CID 1430880. Further fix unchecked return value reported by Coverity in CIDs 1430872, 1430839, 1430831 and 1412382 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-04-23dhcpv6-ia: make assignment lookup more strictHans Dedecker
Whe doing an assignment lookup do a strict match between the assignment IAID and the IAID received form the client in case the BOUND or TENTATIVE assignment flags are set. This fixes a wrong assignment being returned for a client which uses a different IAID than the IAID used in a previous DHCPv6 exchange. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-12-08Support muliple RAs on single interfacePierre Pfister
IETF is moving toward implementing IPv6 multihoming by sending multiple RAs on a single interface: - draft-ietf-intarea-provisioning-domains-00 - draft-ietf-rtgwg-enterprise-pa-multihoming-02 odhcpd supports configuration of multiple software interfaces on the same physical interface, which already advertises multiple RAs, but had two issues: - Each RA includes all the prefixes available on the interface. - Replies to sollicits with a single RA. This patch introduces the prefix_filter configuration parameter which allows filtering prefixes that are sent in a given RA, and fixes the sollicit code in order to reply with all the RAs that are configured on a given interface. Signed-off-by: Pierre Pfister <ppfister@cisco.com>
2017-12-06dhcpv4: notify DHCP ACK and RELEASE via ubusHans Dedecker
If the ubus object has any subscription notify DHCP ACK and DHCP RELEASE events using ubus notifications. Signed-off-by: Borja Salazar <borja.salazar@fon.com> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-11-09dhcpv4: make DHCPv4 support compiletime configurableHans Dedecker
Make DHCPv4 support compile time configurable; avoids DHCPv4 functionality overlap with other packages. 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-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-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-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-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-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-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-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-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-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-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-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-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-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-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.