ndp: improve error checking Improve error checking; fixes resource leak detected by Coverity in CID 1430925 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
odhcpd: Replace strerror(errno) with %m format Saves a few bytes. Signed-off-by: Rosen Penev <rosenp@gmail.com>
ndp: add switch/case fallthrough comments Fixes gcc 7 build errors Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
treewide: rework handling of netlink events 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>
treewide: add netlink file 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>
treewide: align function naming Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
dhcpv4: force renew nonce authentication support 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>
ndp: detect ifindex changes via interface netlink events Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
treewide: replace RELAYD prefix naming in macros Remove the unfortunate RELAYD naming in the different macros Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
ndp: use IPv4 address list when comparing IPv4 addresses 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>
treewide: rework IPv4 address logic 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>
ndp: optimize check_addr6_updates code Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
ndp: fix syslog tracing for netlink neigbor and address events Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
treewide: rework logic to retrieve IPv6 interface addresses 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>
treewide: rework code to get rid of fixed IPv6 address arrays 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>
ndp.c: add switch/case fallthrough comments Fixes gcc 7 build errors Signed-off-by: Felix Fietkau <nbd@nbd.name>
ndp: don't trigger IPv6 ping when neighbor entry is invalid 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>
ndp: fix adding proxy neighbor entries 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>
ndp: fix wrong interface name in syslog message Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
ndp: keep an exact copy of IPv6 interface addresses 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>