summaryrefslogtreecommitdiffhomepage
path: root/src/ndp.c
AgeCommit message (Collapse)Author
2019-09-15ndp: answer global-addressed NS manuallysfan5
An upstream router may address solicits to the global address of the target, these will not be answered by the kernel and not routed either due to link-local source. The NS will eventually be retried as multicast, but we want to avoid this. see also https://forum.archive.openwrt.org/viewtopic.php?id=40871 Signed-off-by: Stefan Alfers <sfan5@live.de>
2019-05-15config: remove 'ignore' config optionbpDainis Jonitis
1. Remove 'ignore' config option for interface. Interface is still used if any of 'ra', 'ndp', 'dhcpv4' or 'dhcpv6' options are different from default 'disabled' mode. In config_parse_interface() update runtime ignore value according to all mode values. 2. Reset ignore, ra, ndp, dhcpv4 and dhcpv6 values in set_interface_defaults(). Otherwise if option is deleted from config file and config is reloaded, it will use the value from old config, potentiallly not turning services off. 3. Do not use implicit checks that 0 server mode means MODE_DISABLED. 4. Simplify code of all service setup functions if passed enabled = true argument, but service mode is disabled. Signed-off-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-16treewide: align syslog loglevelsHans Dedecker
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-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-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-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-05-28treewide: switch to C-code style commentsHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-05-16ndp: improve error checkingHans Dedecker
Improve error checking; fixes resource leak detected by Coverity in CID 1430925 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-11-21ndp: add switch/case fallthrough commentsHans Dedecker
Fixes gcc 7 build errors 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-13ndp: detect ifindex changes via interface netlink eventsHans Dedecker
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-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-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-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-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-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-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-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-09ndp: close proc file descriptor also during error handlingHans Dedecker
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-23treewide: rework prio of syslog messagesHans Dedecker
Rework prio of syslog messages allowing to filter out the relevant messages by setting the correct log level Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-01-23ndp: code cleanupHans Dedecker
ia_reconf is only set but nowhere used; so let's remove it ... Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-01-21router: add syslog debug tracing for trouble shootingHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-01-21treewide: use RELAYD_MAX_ADDRS as address array sizeHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-01-21ndp: don't scan netlink attributes in case of netlink route eventHans Dedecker
In case a netlink route event is received for a default route netlink data attributes were faulty processed as neigbor netlink data. Fix this by not processing any netlink attribute for any route event. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2015-11-16Handle netlink ENOBUFS eventsSteven Barth
2015-07-27ra/dhcpv6: unify address change handlingSteven Barth
2015-07-14ndp: reintroduce address replaySteven Barth
2015-07-14Remove unsolicited unicast RAs, adjust intervalsSteven Barth
2015-07-14ndp: fixup relaySteven Barth
2015-07-14ndp: remove bindtodevice workaroundSteven Barth