Blame SOURCES/glibc-rh1472832.patch

147e83
commit c1f86a33ca32e26a9d6e29fc961e5ecb5e2e5eb4
147e83
Author: Daniel Alvarez <dalvarez@redhat.com>
147e83
Date:   Fri Jun 29 09:44:55 2018 +0200
147e83
147e83
    getifaddrs: Don't return ifa entries with NULL names [BZ #21812]
147e83
    
147e83
    A lookup operation in map_newlink could turn into an insert because of
147e83
    holes in the interface part of the map.  This leads to incorrectly set
147e83
    the name of the interface to NULL when the interface is not present
147e83
    for the address being processed (most likely because the interface was
147e83
    added between the RTM_GETLINK and RTM_GETADDR calls to the kernel).
147e83
    When such changes are detected by the kernel, it'll mark the dump as
147e83
    "inconsistent" by setting NLM_F_DUMP_INTR flag on the next netlink
147e83
    message.
147e83
    
147e83
    This patch checks this condition and retries the whole operation.
147e83
    Hopes are that next time the interface corresponding to the address
147e83
    entry is present in the list and correct name is returned.
147e83
147e83
diff --git a/sysdeps/unix/sysv/linux/ifaddrs.c b/sysdeps/unix/sysv/linux/ifaddrs.c
147e83
index c87e594e30a314fe..b1329dc4d4c63529 100644
147e83
--- a/sysdeps/unix/sysv/linux/ifaddrs.c
147e83
+++ b/sysdeps/unix/sysv/linux/ifaddrs.c
147e83
@@ -369,6 +369,14 @@ getifaddrs_internal (struct ifaddrs **ifap)
147e83
 	  if ((pid_t) nlh->nlmsg_pid != nh.pid || nlh->nlmsg_seq != nlp->seq)
147e83
 	    continue;
147e83
 
147e83
+	  /* If the dump got interrupted, we can't rely on the results
147e83
+	     so try again. */
147e83
+	  if (nlh->nlmsg_flags & NLM_F_DUMP_INTR)
147e83
+	    {
147e83
+	      result = -EAGAIN;
147e83
+	      goto exit_free;
147e83
+	    }
147e83
+
147e83
 	  if (nlh->nlmsg_type == NLMSG_DONE)
147e83
 	    break;		/* ok */
147e83