#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>

#include <unistd.h>
#include <err.h>

int main(void) {
	int s;
	int enable = 1;
	u_char ttl = 4;

	if ((s = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP)) < 0)
		err(1, "socket");

	if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &enable, sizeof(enable)) < 0){
		err(1, "setsockopt SO_BROADCAST");
	}

	if (setsockopt(s, IPPROTO_IP, IP_MULTICAST_TTL,
		(u_char *) &ttl, sizeof(ttl)) < 0){
		err(1, "setsockopt IP_MULTICAST_TTL");
	}

	return 0;
}
