# include <bluetooth/sco.h>
#endif
-#ifdef HAVE_IF_INDEXTONAME
-/* <linux/if.h> used to conflict with <net/if.h> */
-extern unsigned int if_nametoindex(const char *);
-#endif
-
static void
check_un(void)
{
ntohs(in6->sin6_port), h_addr,
ntohl(in6->sin6_flowinfo), in6->sin6_scope_id, len, ret);
-#ifdef HAVE_IF_INDEXTONAME
- in6->sin6_scope_id = if_nametoindex("lo");
+ in6->sin6_scope_id = ifindex_lo();
if (in6->sin6_scope_id) {
ret = connect(-1, (void *) in6, len);
printf("connect(-1, {sa_family=AF_INET6, sin6_port=htons(%hu)"
", inet_pton(AF_INET6, \"%s\", &sin6_addr)"
", sin6_flowinfo=htonl(%u)"
- ", sin6_scope_id=if_nametoindex(\"lo\")}, %u)"
+ ", sin6_scope_id=%s}, %u)"
" = %d EBADF (%m)\n",
- ntohs(in6->sin6_port), h_addr,
- ntohl(in6->sin6_flowinfo), len, ret);
+ ntohs(in6->sin6_port), h_addr, ntohl(in6->sin6_flowinfo),
+ IFINDEX_LO_STR, len, ret);
}
-#endif
}
static void
", sll_pkttype=PACKET_HOST, sll_halen=0}, %u)"
" = %d EBADF (%m)\n", c_ll.sll_ifindex, len, ret);
-#ifdef HAVE_IF_INDEXTONAME
- const int id = if_nametoindex("lo");
- if (id) {
- ((struct sockaddr_ll *) ll)->sll_ifindex = id;
+ ((struct sockaddr_ll *) ll)->sll_ifindex = ifindex_lo();
+ if (((struct sockaddr_ll *) ll)->sll_ifindex) {
ret = connect(-1, ll, len);
printf("connect(-1, {sa_family=AF_PACKET"
", sll_protocol=htons(ETH_P_ALL)"
- ", sll_ifindex=if_nametoindex(\"lo\")"
+ ", sll_ifindex=%s"
", sll_hatype=ARPHRD_ETHER"
", sll_pkttype=PACKET_HOST, sll_halen=0}, %u)"
- " = %d EBADF (%m)\n", len, ret);
+ " = %d EBADF (%m)\n", IFINDEX_LO_STR, len, ret);
}
-#endif
}
#ifdef HAVE_BLUETOOTH_BLUETOOTH_H