summaryrefslogtreecommitdiffhomepage
path: root/src/odhcpd.c
AgeCommit message (Collapse)Author
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-04-16treewide: align syslog loglevelsHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-04-11treewide: fix compiler warningsHans 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>
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-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-07-05odhcpd: Check if open the ioctl socket failedHyeonsik Song
Signed-off-by: Hyeonsik Song <blogcin@naver.com>
2018-06-13odhcpd: call handle_error when socket error can be retrievedHans Dedecker
Detected by Coverity in CID1412300 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-06-04odhcpd: fix passing possible negative parameterHans Dedecker
Prevent passing negative argument to read; detected by Coverity in CID1412381 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-05-28treewide: switch to C-code style commentsHans Dedecker
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-05-03odhcpd: fix strncpy boundsHans Dedecker
Fix strncpy bounds as reported by Coverity in CID 1412278 and 1412293 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-12-17odhcpd: Replace strerror(errno) with %m formatRosen Penev
Saves a few bytes. Signed-off-by: Rosen Penev <rosenp@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-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-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-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-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-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.
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>
2016-11-21enable loglevel setting via command lineKarl Palsson
Currently the loglevel is hardcoded to LOG_WARNING, even though there is debug log messages. Allow setting the loglevel via cli option. Include basic help text because we're adding command line options. Signed-off-by: Karl Palsson <karlp@etactica.com>
2016-09-27odhcpd: remove superfluous log output.Karl Palsson
Drop pointless syslog. The single line just doubles the amount of lines logged to syslog without adding any value. Signed-off-by: Karl Palsson <karlp@etactica.com>
2015-11-17fall through in error case to clear congestionSteven Barth
2015-11-16Handle netlink ENOBUFS eventsSteven Barth
2015-08-20router/dhcpv6: use link-local addresses for DNSSteven Barth
2015-07-14Remove unsolicited unicast RAs, adjust intervalsSteven Barth
2015-07-14ndp: fixup relaySteven Barth
2015-07-13odhcpd: remove old workaroundSteven Barth
2015-07-07main: fix missing parameter while iterating neighborsSteven Barth
2015-07-07router: also send RAs to every known neighborSteven Barth
2015-04-10ra: always send current hop limitSteven Barth
2015-03-30properly handle return codesJohn Crispin
Signed-off-by: John Crispin <blogic@openwrt.org>