FreeBSD/contrib/netbsd-tests/net/icmp/t_forward.c
/*
 * Since our maxttl is in our private namespace, we don't need raw packet
 * construction like traceroute(8) -- we can just use the global maxttl.
 */
Since our maxttl is in our private namespace, we don't need raw packet
construction like traceroute(8) -- we can just use the global maxttl.
Since our maxttl is in our private namespace we don ' t need raw packet construction like traceroute ( 8 ) -- we can just use the global maxttl .
static void
sendttl(void)
{
	struct sockaddr_in sin;
	char payload[1024];
	char ifname[IFNAMSIZ];
	int mib[4] = { CTL_NET, PF_INET, IPPROTO_IP, IPCTL_DEFTTL };
	int nv;
	int s;
	netcfg_rump_makeshmif("bus1", ifname);
	netcfg_rump_if(ifname, "1.0.0.1", "255.255.255.0");
	netcfg_rump_route("0.0.0.0", "0.0.0.0", "1.0.0.2"); 
	nv = 1;
	if (rump_sys___sysctl(mib, 4, NULL, NULL, &nv, sizeof(nv)) == -1)
		atf_tc_fail_errno("set ttl");
	s = rump_sys_socket(PF_INET, SOCK_DGRAM, 0);
	if (s == -1)
		atf_tc_fail_errno("create send socket");
	memset(&sin, 0, sizeof(sin));
	sin.sin_len = sizeof(sin);
	sin.sin_family = AF_INET;
	sin.sin_port = htons(33434);
	sin.sin_addr.s_addr = inet_addr("9.9.9.9");
	if (rump_sys_sendto(s, payload, sizeof(payload), 0,
	    (struct sockaddr *)&sin, sizeof(sin)) == -1)
		atf_tc_fail_errno("sendto");
}
static void sendttl ( void ) { struct sockaddr_in sin ; char payload [ 1024 ] ; char ifname [ IFNAMSIZ ] ; int mib [ 4 ] = { CTL_NET , PF_INET , IPPROTO_IP , IPCTL_DEFTTL } ; int nv ; int s ; netcfg_rump_makeshmif ( " " , ifname ) ; netcfg_rump_if ( ifname , " " , " " ) ; netcfg_rump_route ( " " , " " , " " ) ; nv = 1 ; if ( rump_sys___sysctl ( mib , 4 , NULL , NULL , & nv , sizeof ( nv ) ) == -1 ) atf_tc_fail_errno ( " " ) ; s = rump_sys_socket ( PF_INET , SOCK_DGRAM , 0 ) ; if ( s == -1 ) atf_tc_fail_errno ( " " ) ; memset ( & sin , 0 , sizeof ( sin ) ) ; sin . sin_len = sizeof ( sin ) ; sin . sin_family = AF_INET ; sin . sin_port = htons ( 33434 ) ; sin . sin_addr . s_addr = inet_addr ( " " ) ; if ( rump_sys_sendto ( s , payload , sizeof ( payload ) , 0 , ( struct sockaddr * ) & sin , sizeof ( sin ) ) == -1 ) atf_tc_fail_errno ( " " ) ; }
Since our maxttl is in our private namespace, we don't need raw packet
 construction like traceroute(8) -- we can just use the global maxttl.
Since our maxttl is in our private namespace we don ' t need raw packet construction like traceroute ( 8 ) -- we can just use the global maxttl .
/* default router */ /* set global ttl to 1 */ /* send udp datagram with ttl == 1 */