From e72d776a77aac015a862f71d58fc5079a34e6990 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Sun, 13 Aug 2017 20:28:28 +0000 Subject: [PATCH] tests/msg_control: use ifindex_lo and IFINDEX_LO_STR * 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 | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/tests/msg_control.c b/tests/msg_control.c index b63f2d04..48b7347a 100644 --- a/tests/msg_control.c +++ b/tests/msg_control.c @@ -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 -- 2.40.0