Merge pull request #668 from turon/build/doxygen
[build] add 'make docdist' to build doxygen.
diff --git a/configure.ac b/configure.ac
index a9f05fa..998d7f0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2044,13 +2044,17 @@
if test "${nl_with_nlfaultinjection}" = "internal"; then
AC_CONFIG_SUBDIRS([third_party/nlfaultinjection/repo])
-AC_SUBST(NLFAULTINJECTION_FOREIGN_SUBDIR_DEPENDENCY,["${ac_pwd}/third_party/nlfaultinjection/repo"/src])
+AC_SUBST(NLFAULTINJECTION_FOREIGN_SUBDIR_DEPENDENCY,["${ac_pwd}/third_party/nlfaultinjection/repo/src"])
fi
if test "${nl_with_mbedtls}" = "internal"; then
AC_CONFIG_SUBDIRS([third_party/mbedtls/repo])
fi
+if test "${nl_with_lwip}" = "internal"; then
+AC_SUBST(LWIP_FOREIGN_SUBDIR_DEPENDENCY,["${ac_pwd}/src/lwip"])
+fi
+
#
# Identify the various makefiles and auto-generated files for the package
#
@@ -2155,6 +2159,7 @@
LwIP compile flags : ${LWIP_CPPFLAGS:--}
LwIP link flags : ${LWIP_LDFLAGS:--}
LwIP link libraries : ${LWIP_LIBS:--}
+ LwIP foreign subdirectory dependency : ${LWIP_FOREIGN_SUBDIR_DEPENDENCY:--}
mbedTLS source : ${nl_with_mbedtls:--}
mbedTLS compile flags : ${MBEDTLS_CPPFLAGS:--}
mbedTLS link flags : ${MBEDTLS_LDFLAGS:--}
diff --git a/scripts/build/bootstrap.sh b/scripts/build/bootstrap.sh
index df107f3..f6a2b88 100755
--- a/scripts/build/bootstrap.sh
+++ b/scripts/build/bootstrap.sh
@@ -1,11 +1,9 @@
#!/bin/bash
-# if [[ ! -f build/default/config.status ]]; then mkdir -p build/default; (cd build/default && ../../bootstrap-configure --enable-debug --enable-coverage); else ./bootstrap -w make; fi
-
if [[ ! -f build/default/config.status ]]; then
mkdir -p build/default
(cd build/default &&
- ../../bootstrap-configure --enable-debug --enable-coverage)
+ ../../bootstrap-configure -C --enable-debug --enable-coverage)
elif [[ configure.ac -nt configure ]]; then
./bootstrap
else
diff --git a/scripts/build/bootstrap_mbedtls.sh b/scripts/build/bootstrap_mbedtls.sh
index 2bf526f..e9558cd 100755
--- a/scripts/build/bootstrap_mbedtls.sh
+++ b/scripts/build/bootstrap_mbedtls.sh
@@ -2,4 +2,4 @@
git clean -xdf
mkdir -p build/default
-(cd build/default && ../../bootstrap-configure --enable-debug --enable-coverage --with-crypto=mbedtls)
+(cd build/default && ../../bootstrap-configure -C --enable-debug --enable-coverage --with-crypto=mbedtls)
diff --git a/src/Makefile.am b/src/Makefile.am
index 0147a56..dae592f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -55,11 +55,11 @@
DIST_SUBDIRS = \
include \
+ lwip \
system \
$(BLE_SUBDIRS) \
inet \
lib \
- lwip \
setup_payload \
crypto \
$(PLATFORM_SUBDIRS) \
@@ -69,12 +69,12 @@
SUBDIRS = \
include \
+ lwip \
lib/support \
system \
$(MAYBE_BLE_SUBDIRS) \
inet \
lib \
- lwip \
setup_payload \
crypto \
$(MAYBE_PLATFORM_SUBDIRS) \
diff --git a/src/ble/tests/Makefile.am b/src/ble/tests/Makefile.am
index 4b587c4..a6dd4f0 100644
--- a/src/ble/tests/Makefile.am
+++ b/src/ble/tests/Makefile.am
@@ -111,6 +111,7 @@
$(NULL)
NLFOREIGN_SUBDIR_DEPENDENCIES = \
+ $(LWIP_FOREIGN_SUBDIR_DEPENDENCY) \
$(NLUNIT_TEST_FOREIGN_SUBDIR_DEPENDENCY) \
$(NULL)
diff --git a/src/crypto/Makefile.am b/src/crypto/Makefile.am
index 7be04c9..7886279 100644
--- a/src/crypto/Makefile.am
+++ b/src/crypto/Makefile.am
@@ -30,6 +30,7 @@
libChipCrypto_adir = $(includedir)/crypto
libChipCrypto_a_CPPFLAGS = \
+ $(LWIP_CPPFLAGS) \
$(NLASSERT_CPPFLAGS) \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/lib \
diff --git a/src/crypto/tests/Makefile.am b/src/crypto/tests/Makefile.am
index 88e29d1..71d33ad 100644
--- a/src/crypto/tests/Makefile.am
+++ b/src/crypto/tests/Makefile.am
@@ -63,6 +63,7 @@
-I$(top_srcdir)/src/system \
-I$(top_srcdir)/src/include/ \
-I$(top_srcdir)/src/crypto \
+ $(LWIP_CPPFLAGS) \
$(NLASSERT_CPPFLAGS) \
$(NLUNIT_TEST_CPPFLAGS) \
$(NULL)
diff --git a/src/inet/tests/Makefile.am b/src/inet/tests/Makefile.am
index 4571c84..2760a93 100644
--- a/src/inet/tests/Makefile.am
+++ b/src/inet/tests/Makefile.am
@@ -27,6 +27,7 @@
# since they are not part of the package.
#
noinst_HEADERS = \
+ TapAddrAutoconf.h \
TestInetCommon.h \
TestInetCommonOptions.h \
TestInetLayerCommon.hpp \
@@ -77,6 +78,7 @@
$(NULL)
libTestInetCommon_a_SOURCES = \
+ TapAddrAutoconf.cpp \
TestInetCommon.cpp \
TestInetCommonOptions.cpp \
TestInetLayerCommon.cpp \
@@ -89,7 +91,7 @@
$(NULL)
COMMON_LDADD = \
- libInetLayerTests.a \
+ libInetLayerTests.a \
$(COMMON_LDFLAGS) \
$(CHIP_LDADD) \
$(NLFAULTINJECTION_LDFLAGS) $(NLFAULTINJECTION_LIBS)\
@@ -186,6 +188,7 @@
$(NULL)
NLFOREIGN_SUBDIR_DEPENDENCIES = \
+ $(LWIP_FOREIGN_SUBDIR_DEPENDENCY) \
$(NLFAULTINJECTION_FOREIGN_SUBDIR_DEPENDENCY) \
$(NLUNIT_TEST_FOREIGN_SUBDIR_DEPENDENCY) \
$(NULL)
diff --git a/src/inet/tests/TapAddrAutoconf.cpp b/src/inet/tests/TapAddrAutoconf.cpp
new file mode 100644
index 0000000..1ae6569
--- /dev/null
+++ b/src/inet/tests/TapAddrAutoconf.cpp
@@ -0,0 +1,74 @@
+/*
+ *
+ * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2019 Google LLC.
+ * All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TapAddrAutoconf.h"
+
+#include <ifaddrs.h>
+#include <inttypes.h>
+#include <signal.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+
+int CollectTapAddresses(std::vector<char *> & addresses, const char * ifName)
+{
+ struct ifaddrs *addrsList, *curAddr;
+ const int err = getifaddrs(&addrsList);
+
+ if (err == 0)
+ {
+ curAddr = addrsList;
+
+ while (curAddr)
+ {
+ if (strcmp(ifName, curAddr->ifa_name) == 0)
+ {
+ char buf[INET6_ADDRSTRLEN];
+ const char * rv;
+ char * tmp;
+ rv = inet_ntop(curAddr->ifa_addr->sa_family,
+ curAddr->ifa_addr->sa_family == AF_INET6
+ ? (const void *) &(((sockaddr_in6 *) curAddr->ifa_addr)->sin6_addr)
+ : (const void *) &(((sockaddr_in *) curAddr->ifa_addr)->sin_addr),
+ buf, sizeof(buf));
+ if (rv != NULL)
+ {
+ tmp = (char *) malloc(strlen(buf));
+ strcpy(tmp, buf);
+ addresses.push_back(tmp);
+ }
+ }
+ curAddr = curAddr->ifa_next;
+ }
+ freeifaddrs(addrsList);
+ }
+ else
+ {
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/src/inet/tests/TapAddrAutoconf.h b/src/inet/tests/TapAddrAutoconf.h
new file mode 100644
index 0000000..2a51c94
--- /dev/null
+++ b/src/inet/tests/TapAddrAutoconf.h
@@ -0,0 +1,29 @@
+/*
+ *
+ * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2019 Google LLC.
+ * All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * This file defines functions for taking configuration for the LwIP stack
+ * from the corresponding configuration on the tap interface.
+ */
+
+#include <new>
+#include <vector>
+
+int CollectTapAddresses(std::vector<char *> & addresses, const char * ifName);
diff --git a/src/inet/tests/TestInetCommon.cpp b/src/inet/tests/TestInetCommon.cpp
index c721590..7d6908b 100644
--- a/src/inet/tests/TestInetCommon.cpp
+++ b/src/inet/tests/TestInetCommon.cpp
@@ -320,19 +320,19 @@
ip4AddrLwIP = ip4Addr.ToIPv4();
IP4_ADDR(&ip4NetmaskLwIP, 255, 255, 255, 0);
ip4GatewayLwIP = ip4Gateway.ToIPv4();
- netif_add(&(netIFs[j]), &ip4AddrLwIP, &ip4NetmaskLwIP, &ip4GatewayLwIP, &(sTapIFs[j]), TapInterface_SetupNetif,
+ netif_add(&(sNetIFs[j]), &ip4AddrLwIP, &ip4NetmaskLwIP, &ip4GatewayLwIP, &(sTapIFs[j]), TapInterface_SetupNetif,
tcpip_input);
}
#endif // INET_CONFIG_ENABLE_IPV4
- netif_create_ip6_linklocal_address(&(netIFs[j]), 1);
+ netif_create_ip6_linklocal_address(&(sNetIFs[j]), 1);
if (j < gNetworkOptions.LocalIPv6Addr.size())
{
ip6_addr_t ip6addr = gNetworkOptions.LocalIPv6Addr[j].ToIPv6();
s8_t index;
- netif_add_ip6_address_with_route(&(netIFs[j]), &ip6addr, 64, &index);
+ netif_add_ip6_address_with_route(&(sNetIFs[j]), &ip6addr, 64, &index);
// add ipv6 route for ipv6 address
if (j < gNetworkOptions.IPv6GatewayAddr.size())
{
@@ -340,11 +340,11 @@
struct ip6_prefix ip6_prefix;
ip6_prefix.addr = Inet::IPAddress::Any.ToIPv6();
ip6_prefix.prefix_len = 0;
- ip6_add_route_entry(&ip6_prefix, &netIFs[j], &br_ip6_addr, NULL);
+ ip6_add_route_entry(&ip6_prefix, &sNetIFs[j], &br_ip6_addr, NULL);
}
if (index >= 0)
{
- netif_ip6_addr_set_state(&(netIFs[j]), index, IP6_ADDR_PREFERRED);
+ netif_ip6_addr_set_state(&(sNetIFs[j]), index, IP6_ADDR_PREFERRED);
}
}
for (size_t n = 0; n < addrsVec.size(); n++)
@@ -358,19 +358,19 @@
continue; // skip over the LLA addresses, LwIP is aready adding those
if (auto_addr.IsIPv6Multicast())
continue; // skip over the multicast addresses from host for now.
- netif_add_ip6_address_with_route(&(netIFs[j]), &ip6addr, 64, &index);
+ netif_add_ip6_address_with_route(&(sNetIFs[j]), &ip6addr, 64, &index);
if (index >= 0)
{
- netif_ip6_addr_set_state(&(netIFs[j]), index, IP6_ADDR_PREFERRED);
+ netif_ip6_addr_set_state(&(sNetIFs[j]), index, IP6_ADDR_PREFERRED);
}
}
}
- netif_set_up(&(netIFs[j]));
- netif_set_link_up(&(netIFs[j]));
+ netif_set_up(&(sNetIFs[j]));
+ netif_set_link_up(&(sNetIFs[j]));
}
- netif_set_default(&(netIFs[0]));
+ netif_set_default(&(sNetIFs[0]));
// UnLock LwIP stack
UNLOCK_TCPIP_CORE();
@@ -390,11 +390,11 @@
{
if (j < gNetworkOptions.LocalIPv6Addr.size())
{
- netif_ip6_addr_set_state(&(netIFs[j]), 2, 0x30);
+ netif_ip6_addr_set_state(&(sNetIFs[j]), 2, 0x30);
}
else
{
- netif_ip6_addr_set_state(&(netIFs[j]), 1, 0x30);
+ netif_ip6_addr_set_state(&(sNetIFs[j]), 1, 0x30);
}
}
@@ -544,7 +544,7 @@
{
for (int i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++)
{
- if (!ip6_addr_isany(netif_ip6_addr(&(netIFs[j]), i)) && ip6_addr_istentative(netif_ip6_addr_state(&(netIFs[j]), i)))
+ if (!ip6_addr_isany(netif_ip6_addr(&(sNetIFs[j]), i)) && ip6_addr_istentative(netif_ip6_addr_state(&(sNetIFs[j]), i)))
{
ready = false;
break;
diff --git a/src/lib/core/tests/Makefile.am b/src/lib/core/tests/Makefile.am
index 8c5ce68..b7c5d31 100644
--- a/src/lib/core/tests/Makefile.am
+++ b/src/lib/core/tests/Makefile.am
@@ -118,6 +118,7 @@
$(NULL)
NLFOREIGN_SUBDIR_DEPENDENCIES = \
+ $(LWIP_FOREIGN_SUBDIR_DEPENDENCY) \
$(NLFAULTINJECTION_FOREIGN_SUBDIR_DEPENDENCY) \
$(NLUNIT_TEST_FOREIGN_SUBDIR_DEPENDENCY) \
$(NULL)
diff --git a/src/lib/core/tests/TestCHIPTLVDriver.cpp b/src/lib/core/tests/TestCHIPTLVDriver.cpp
index a307e60..3b311b6 100644
--- a/src/lib/core/tests/TestCHIPTLVDriver.cpp
+++ b/src/lib/core/tests/TestCHIPTLVDriver.cpp
@@ -24,10 +24,20 @@
#include "TestCore.h"
+#include <core/CHIPConfig.h>
+
+#if CHIP_SYSTEM_CONFIG_USE_LWIP
+#include <lwip/tcpip.h>
+#endif // CHIP_SYSTEM_CONFIG_USE_LWIP
+
#include <nlunit-test.h>
int main(void)
{
+#if CHIP_SYSTEM_CONFIG_USE_LWIP
+ tcpip_init(NULL, NULL);
+#endif // CHIP_SYSTEM_CONFIG_USE_LWIP
+
// Generate machine-readable, comma-separated value (CSV) output.
nlTestSetOutputStyle(OUTPUT_CSV);
diff --git a/src/lib/support/Makefile.am b/src/lib/support/Makefile.am
index 3bc2b8f..af43e9a 100644
--- a/src/lib/support/Makefile.am
+++ b/src/lib/support/Makefile.am
@@ -35,6 +35,7 @@
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/include \
+ $(LWIP_CPPFLAGS) \
$(NLASSERT_CPPFLAGS) \
$(NLFAULTINJECTION_CPPFLAGS) \
$(NULL)
diff --git a/src/lib/support/tests/Makefile.am b/src/lib/support/tests/Makefile.am
index b3d4672..4ce565c 100644
--- a/src/lib/support/tests/Makefile.am
+++ b/src/lib/support/tests/Makefile.am
@@ -129,6 +129,7 @@
$(NULL)
NLFOREIGN_SUBDIR_DEPENDENCIES = \
+ $(LWIP_FOREIGN_SUBDIR_DEPENDENCY) \
$(NLUNIT_TEST_FOREIGN_SUBDIR_DEPENDENCY) \
$(NULL)
diff --git a/src/lib/support/tests/TestCHIPCounter.cpp b/src/lib/support/tests/TestCHIPCounter.cpp
index 33c5def..da107f5 100644
--- a/src/lib/support/tests/TestCHIPCounter.cpp
+++ b/src/lib/support/tests/TestCHIPCounter.cpp
@@ -94,4 +94,4 @@
nlTestRunner(&theSuite, NULL);
return nlTestRunnerStats(&theSuite);
-}
\ No newline at end of file
+}
diff --git a/src/setup_payload/Makefile.am b/src/setup_payload/Makefile.am
index 087b500..e2567c6 100644
--- a/src/setup_payload/Makefile.am
+++ b/src/setup_payload/Makefile.am
@@ -33,7 +33,8 @@
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/system \
- -I$(top_srcdir)/src/include/ \
+ -I$(top_srcdir)/src/include \
+ $(LWIP_CPPFLAGS) \
$(NULL)
libSetupPayload_a_SOURCES = \
diff --git a/src/setup_payload/tests/Makefile.am b/src/setup_payload/tests/Makefile.am
index 234253d..69081a4 100644
--- a/src/setup_payload/tests/Makefile.am
+++ b/src/setup_payload/tests/Makefile.am
@@ -59,6 +59,7 @@
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/system \
-I$(top_srcdir)/src/setup_payload \
+ $(LWIP_CPPFLAGS) \
$(NULL)
COMMON_LDADD = \
diff --git a/src/system/tests/Makefile.am b/src/system/tests/Makefile.am
index e2e7fc6..9e3c293 100644
--- a/src/system/tests/Makefile.am
+++ b/src/system/tests/Makefile.am
@@ -131,6 +131,7 @@
$(NULL)
NLFOREIGN_SUBDIR_DEPENDENCIES = \
+ $(LWIP_FOREIGN_SUBDIR_DEPENDENCY) \
$(NLFAULTINJECTION_FOREIGN_SUBDIR_DEPENDENCY) \
$(NLUNIT_TEST_FOREIGN_SUBDIR_DEPENDENCY) \
$(NULL)
diff --git a/src/system/tests/TestSystemPacketBufferDriver.cpp b/src/system/tests/TestSystemPacketBufferDriver.cpp
index 2dc3efe..b52a5ea 100644
--- a/src/system/tests/TestSystemPacketBufferDriver.cpp
+++ b/src/system/tests/TestSystemPacketBufferDriver.cpp
@@ -25,6 +25,8 @@
#include "TestSystemLayer.h"
+#include <system/SystemConfig.h>
+
#if CHIP_SYSTEM_CONFIG_USE_LWIP
#include <lwip/tcpip.h>
#endif // CHIP_SYSTEM_CONFIG_USE_LWIP
diff --git a/third_party/lwip/Makefile.am b/third_party/lwip/Makefile.am
index a0b7b34..3d11212 100644
--- a/third_party/lwip/Makefile.am
+++ b/third_party/lwip/Makefile.am
@@ -26,75 +26,6 @@
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
-lib_LIBRARIES = liblwip.a
-
-liblwip_API_SOURCES = \
- repo/lwip/src/api/api_lib.c \
- repo/lwip/src/api/api_msg.c \
- repo/lwip/src/api/err.c \
- repo/lwip/src/api/netbuf.c \
- repo/lwip/src/api/netdb.c \
- repo/lwip/src/api/netifapi.c \
- repo/lwip/src/api/sockets.c \
- repo/lwip/src/api/tcpip.c \
- $(NULL)
-
-liblwip_CORE_SOURCES = \
- repo/lwip/src/core/def.c \
- repo/lwip/src/core/dns.c \
- repo/lwip/src/core/inet_chksum.c \
- repo/lwip/src/core/init.c \
- repo/lwip/src/core/ipv4/autoip.c \
- repo/lwip/src/core/ipv4/icmp.c \
- repo/lwip/src/core/ipv4/igmp.c \
- repo/lwip/src/core/ipv4/ip4.c \
- repo/lwip/src/core/ipv4/ip4_addr.c \
- repo/lwip/src/core/ipv4/etharp.c \
- repo/lwip/src/core/ipv4/ip4_frag.c \
- repo/lwip/src/core/ipv4/dhcp.c \
- repo/lwip/src/core/ipv6/ip6_route_table.c \
- repo/lwip/src/core/ipv6/dhcp6.c \
- repo/lwip/src/core/ipv6/ethip6.c \
- repo/lwip/src/core/ipv6/icmp6.c \
- repo/lwip/src/core/ipv6/inet6.c \
- repo/lwip/src/core/ipv6/ip6.c \
- repo/lwip/src/core/ipv6/ip6_addr.c \
- repo/lwip/src/core/ipv6/ip6_frag.c \
- repo/lwip/src/core/ipv6/mld6.c \
- repo/lwip/src/core/ipv6/nd6.c \
- repo/lwip/src/core/mem.c \
- repo/lwip/src/core/memp.c \
- repo/lwip/src/core/netif.c \
- repo/lwip/src/core/pbuf.c \
- repo/lwip/src/core/raw.c \
- repo/lwip/src/core/stats.c \
- repo/lwip/src/core/sys.c \
- repo/lwip/src/core/tcp.c \
- repo/lwip/src/core/tcp_in.c \
- repo/lwip/src/core/tcp_out.c \
- repo/lwip/src/core/udp.c \
- repo/lwip/src/core/ip.c \
- repo/lwip/src/core/timeouts.c \
- $(NULL)
-
-liblwip_NETIF_SOURCES = \
- repo/lwip/src/netif/ethernet.c \
- $(NULL)
-
-liblwip_a_SOURCES = \
- $(liblwip_API_SOURCES) \
- $(liblwip_CORE_SOURCES) \
- $(liblwip_NETIF_SOURCES) \
- $(liblwip_TARGET_SOURCES) \
- $(NULL)
-
-liblwip_a_CPPFLAGS = \
- -I$(top_srcdir)/third_party/lwip/repo/lwip/src/include \
- -I$(top_srcdir)/src/lwip/standalone \
- $(LWIP_CPPFLAGS) \
- $(NULL)
-
-
EXTRA_DIST = \
repo/lwip.url \
repo/lwip.version \