]> granicus.if.org Git - strace/commitdiff
tests/msg_control: use ifindex_lo and IFINDEX_LO_STR
authorDmitry V. Levin <ldv@altlinux.org>
Sun, 13 Aug 2017 20:28:28 +0000 (20:28 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 15 Aug 2017 20:08:39 +0000 (20:08 +0000)
* tests/msg_control.c (test_ip_pktinfo): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.

tests/msg_control.c

index b63f2d04e13e572d7f3a35431f5945bf43d1b4d7..48b7347a850ef5374560a3ed7c3724b06816c522 100644 (file)
@@ -544,11 +544,7 @@ test_ip_pktinfo(struct msghdr *const mh, void *const page,
        cmsg->cmsg_type = cmsg_type;
 
        struct in_pktinfo *const info = (struct in_pktinfo *) CMSG_DATA(cmsg);
-#ifdef HAVE_IF_INDEXTONAME
-       info->ipi_ifindex = if_nametoindex("lo");
-#else
-       info->ipi_ifindex = 1;
-#endif
+       info->ipi_ifindex = ifindex_lo();
        info->ipi_spec_dst.s_addr = inet_addr("1.2.3.4");
        info->ipi_addr.s_addr = inet_addr("5.6.7.8");
 
@@ -563,12 +559,7 @@ test_ip_pktinfo(struct msghdr *const mh, void *const page,
               ", ipi_addr=inet_addr(\"%s\")}}]"
               ", msg_controllen=%u, msg_flags=0}, 0) = %d %s (%m)\n",
               (unsigned) cmsg->cmsg_len, cmsg_type_str,
-#ifdef HAVE_IF_INDEXTONAME
-              "if_nametoindex(\"lo\")",
-#else
-              "1",
-#endif
-              "1.2.3.4", "5.6.7.8", len, rc, errno2name());
+              IFINDEX_LO_STR, "1.2.3.4", "5.6.7.8", len, rc, errno2name());
 }
 
 static void