To me programming is more than an important practical art. It is also a gigantic undertaking in the foundations of knowledge. — Grace Hopper(格蕾丝·赫柏,美国计算机科学家、海军准将,创造了现代第一个编译器A-0系统,以及第一个高级商用计算机程序语言“COBOL”,被誉为“COBOL之母”)
STM1:/# find . -name "*lib*2.23*" | xargs ls -alh -rwxr-xr-x 1 root root 9.6K Jan 1 1970 ./lib/libanl-2.23.so -rwxr-xr-x 1 root root 1.1M Jan 1 1970 ./lib/libc-2.23.so -rwxr-xr-x 1 root root 177.5K Jan 1 1970 ./lib/libcidn-2.23.so -rwxr-xr-x 1 root root 29.5K Jan 1 1970 ./lib/libcrypt-2.23.so -rwxr-xr-x 1 root root 9.5K Jan 1 1970 ./lib/libdl-2.23.so -rwxr-xr-x 1 root root 429.4K Jan 1 1970 ./lib/libm-2.23.so -rwxr-xr-x 1 root root 65.8K Jan 1 1970 ./lib/libnsl-2.23.so -rwxr-xr-x 1 root root 17.5K Jan 1 1970 ./lib/libnss_dns-2.23.so -rwxr-xr-x 1 root root 33.6K Jan 1 1970 ./lib/libnss_files-2.23.so -rwxr-xr-x 1 root root 90.5K Jan 1 1970 ./lib/libpthread-2.23.so -rwxr-xr-x 1 root root 65.7K Jan 1 1970 ./lib/libresolv-2.23.so -rwxr-xr-x 1 root root 25.9K Jan 1 1970 ./lib/librt-2.23.so -rwxr-xr-x 1 root root 9.5K Jan 1 1970 ./lib/libutil-2.23.so
STM2:/# find . -name "*lib*0.9.33*" | xargs ls -alh -rwxr-xr-x 1 root root 28.0K Jan 1 1970 ./lib/ld-uClibc-0.9.33.2.so -rwxr-xr-x 1 root root 36.1K Jan 1 1970 ./lib/libcrypt-0.9.33.2.so -rwxr-xr-x 1 root root 16.2K Jan 1 1970 ./lib/libdl-0.9.33.2.so -rwxr-xr-x 1 root root 72.1K Jan 1 1970 ./lib/libm-0.9.33.2.so -rwxr-xr-x 1 root root 116.4K Jan 1 1970 ./lib/libpthread-0.9.33.2.so -rwxr-xr-x 1 root root 16.2K Jan 1 1970 ./lib/librt-0.9.33.2.so -rwxr-xr-x 1 root root 28.3K Jan 1 1970 ./lib/libthread_db-0.9.33.2.so -rwxr-xr-x 1 root root 621.4K Jan 1 1970 ./lib/libuClibc-0.9.33.2.so -rwxr-xr-x 1 root root 8.1K Jan 1 1970 ./lib/libubacktrace-0.9.33.2.so -rwxr-xr-x 1 root root 4.1K Jan 1 1970 ./lib/libutil-0.9.33.2.so
IPv6和接口API
随着IPv6的使用量稳步增长,为嵌入式系统添加IPv6协议栈支持已经成为必需。在一个为使用uClibc的设备加入IPv4/IPv6双栈功能的软件项目中,发现出现应用程序链接错误——undefined reference to getifaddrs。getifaddrs()是一个非常有用的函数,我们可以调用它得到系统所有的网络接口的地址信息。查询Linux编程手册:
intgetifaddrs(struct ifaddrs **ifap); ... DESCRIPTION The getifaddrs() function creates a linked list of structures describing the network interfaces of the local system, and stores the address of the first item of the list in *ifap. ... VERSIONS The getifaddrs() function first appeared in glibc 2.3, but before glibc 2.3.3, the implementation supported only IPv4 addresses; IPv6 support was added in glibc 2.3.3. Support of address families other than IPv4 is available only on kernels that support netlink. ...
... #if __ASSUME_NETLINK_SUPPORT #ifdef __UCLIBC_SUPPORT_AI_ADDRCONFIG__ /* struct to hold the data for one ifaddrs entry, so we can allocate everything at once. */ structifaddrs_storage { structifaddrsifa; union { /* Save space for the biggest of the four used sockaddr types and avoid a lot of casts. */ structsockaddrsa; structsockaddr_llsl; structsockaddr_ins4; #ifdef __UCLIBC_HAS_IPV6__ structsockaddr_in6s6; #endif } addr, netmask, broadaddr; char name[IF_NAMESIZE + 1]; }; #endif/* __UCLIBC_SUPPORT_AI_ADDRCONFIG__ */ ... #ifdef __UCLIBC_SUPPORT_AI_ADDRCONFIG__ ... int getifaddrs(struct ifaddrs **ifap) ... #endif/* __UCLIBC_SUPPORT_AI_ADDRCONFIG__ */ ... #endif/* __ASSUME_NETLINK_SUPPORT */
--- a/toolchain/uClibc/config-0.9.33.2/common +++ b/toolchain/uClibc/config-0.9.33.2/common @@ -147,7 +147,8 @@ UCLIBC_HAS_RPC=y UCLIBC_HAS_FULL_RPC=y -# UCLIBC_HAS_IPV6 is not set +UCLIBC_HAS_IPV6=y -# UCLIBC_USE_NETLINK is not set +UCLIBC_USE_NETLINK=y +UCLIBC_SUPPORT_AI_ADDRCONFIG=y UCLIBC_HAS_BSD_RES_CLOSE=y
--- a/toolchain/uClibc/config-0.9.33.2/common +++ b/toolchain/uClibc/config-0.9.33.2/common @@ -151,8 +151,8 @@ UCLIBC_HAS_REGEX_OLD=y UCLIBC_HAS_RESOLVER_SUPPORT=y -# UCLIBC_HAS_SHA256_CRYPT_IMPL is not set -# UCLIBC_HAS_SHA512_CRYPT_IMPL is not set +UCLIBC_HAS_SHA256_CRYPT_IMPL=y +UCLIBC_HAS_SHA512_CRYPT_IMPL=y UCLIBC_HAS_SHADOW=y