Import dhcpcd-5.0.3
Changes from 5.0.2 * Fix crash when ifa_addr from getifaddrs(3) is NULL
This commit is contained in:
parent
53e60c8761
commit
cd5cb024ed
|
@ -28,7 +28,7 @@
|
|||
#define CONFIG_H
|
||||
|
||||
#define PACKAGE "dhcpcd"
|
||||
#define VERSION "5.0.2"
|
||||
#define VERSION "5.0.3"
|
||||
|
||||
/* Some systems do not have a working fork. */
|
||||
/* #define THERE_IS_NO_FORK */
|
||||
|
|
|
@ -272,13 +272,16 @@ discover_interfaces(int argc, char * const *argv)
|
|||
|
||||
ifs = ifl = NULL;
|
||||
for (ifa = ifaddrs; ifa; ifa = ifa->ifa_next) {
|
||||
if (ifa->ifa_addr != NULL) {
|
||||
#ifdef AF_LINK
|
||||
if (ifa->ifa_addr->sa_family != AF_LINK)
|
||||
continue;
|
||||
if (ifa->ifa_addr->sa_family != AF_LINK)
|
||||
continue;
|
||||
#elif AF_PACKET
|
||||
if (ifa->ifa_addr->sa_family != AF_PACKET)
|
||||
continue;
|
||||
if (ifa->ifa_addr->sa_family != AF_PACKET)
|
||||
continue;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* It's possible for an interface to have >1 AF_LINK.
|
||||
* For our purposes, we use the first one. */
|
||||
for (ifp = ifs; ifp; ifp = ifp->next)
|
||||
|
@ -325,7 +328,7 @@ discover_interfaces(int argc, char * const *argv)
|
|||
free_interface(ifp);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
} else if (ifa->ifa_addr != NULL) {
|
||||
#ifdef AF_LINK
|
||||
sdl = (const struct sockaddr_dl *)(void *)ifa->ifa_addr;
|
||||
switch(sdl->sdl_type) {
|
||||
|
@ -372,7 +375,8 @@ do_address(const char *ifname,
|
|||
|
||||
retval = 0;
|
||||
for (ifa = ifaddrs; ifa; ifa = ifa->ifa_next) {
|
||||
if (ifa->ifa_addr->sa_family != AF_INET ||
|
||||
if (ifa->ifa_addr == NULL ||
|
||||
ifa->ifa_addr->sa_family != AF_INET ||
|
||||
strcmp(ifa->ifa_name, ifname) != 0)
|
||||
continue;
|
||||
a = (const struct sockaddr_in *)(void *)ifa->ifa_addr;
|
||||
|
|
Loading…
Reference in New Issue