+ if (ifc.ifc_req[i].ifr_addr.sa_family != AF_INET) {
+ continue;
+ }
+ if (ioctl(rpc_get_fd(rpc), SIOCGIFFLAGS, &ifc.ifc_req[i]) < 0) {
+ printf("ioctl DRBADDR failed\n");
+ exit(10);
+ }
+ if (!(ifc.ifc_req[i].ifr_flags & IFF_UP)) {
+ continue;
+ }
+ if (ifc.ifc_req[i].ifr_flags & IFF_LOOPBACK) {
+ continue;
+ }
+ if (!(ifc.ifc_req[i].ifr_flags & IFF_BROADCAST)) {
+ continue;
+ }
+ if (ioctl(rpc_get_fd(rpc), SIOCGIFBRDADDR, &ifc.ifc_req[i]) < 0) {
+ printf("ioctl DRBADDR failed\n");
+ exit(10);
+ }
+ if (getnameinfo(&ifc.ifc_req[i].ifr_broadaddr, sizeof(struct sockaddr_in), &bcdd[0], sizeof(bcdd), NULL, 0, NI_NUMERICHOST) < 0) {
+ printf("getnameinfo failed\n");
+ exit(10);
+ }
+ if (rpc_set_udp_destination(rpc, bcdd, 111, 1) < 0) {
+ printf("failed to set udp destination %s\n", rpc_get_error(rpc));
+ exit(10);
+ }
+
+ if (rpc_pmap_callit_async(rpc, MOUNT_PROGRAM, 2, 0, NULL, 0, pm_cb, &data) < 0) {
+ printf("Failed to set up callit function\n");
+ exit(10);
+ }
+ }
+ free(ifc.ifc_buf);
+
+ gettimeofday(&tv_start, NULL);