The call to bind, thoug working fine under GNU/Linux, seems not to work under
other operating systems. It didn't work under FreeBSD and Mac OS X with the
`bind' call but without.
I think `bind' may only be neccessary if we want to bind to a specific
interface. It might be a good idea to add the possibility later, so I only
commented the code for now.
continue;
}
+/*
+ * The majority vote of operating systems has decided that you don't need to
+ * bind here. This code should be reactivated to bind to a specific address,
+ * though. See the `-I' option of `ping(1)' (GNU). -octo
+ */
+#if 0
if (bind (ph->fd, (struct sockaddr *) &sockaddr, sockaddr_len) == -1)
{
dprintf ("bind: %s\n", strerror (errno));
ph->fd = -1;
continue;
}
+#endif
assert (sizeof (struct sockaddr_storage) >= ai_ptr->ai_addrlen);
memset (ph->addr, '\0', sizeof (struct sockaddr_storage));