netoptions revision 197646
1100280Sgordon#!/bin/sh 225184Sjkh# 350472Speter# $FreeBSD: head/etc/rc.d/netoptions 197646 2009-09-30 14:58:10Z ume $ 466830Sobrien# 525184Sjkh 6117019Smtm# PROVIDE: netoptions 7169215Smtm# REQUIRE: FILESYSTEMS 8197143Shrs# BEFORE: netif 9136224Smtm# KEYWORD: nojail 1025184Sjkh 11100280Sgordon. /etc/rc.subr 12197646Sume. /etc/network.subr 1325184Sjkh 14197143Shrsname="netoptions" 15197143Shrsstart_cmd="netoptions_start" 16197143Shrsstop_cmd=: 17197143Shrs 18179940Smtm_netoptions_initdone= 19179940Smtmnetoptions_init() 20179940Smtm{ 21179940Smtm if [ -z "${_netoptions_initdone}" ]; then 22179940Smtm echo -n 'Additional TCP/IP options:' 23179940Smtm _netoptions_initdone=yes 24179940Smtm fi 25179940Smtm} 26179940Smtm 27197143Shrsnetoptions_start() 28197143Shrs{ 29197143Shrs if checkyesno log_in_vain; then 30197143Shrs netoptions_init 31197143Shrs echo -n " log_in_vain=${log_in_vain}" 32197143Shrs ${SYSCTL_W} net.inet.tcp.log_in_vain="${log_in_vain}" >/dev/null 33197143Shrs ${SYSCTL_W} net.inet.udp.log_in_vain="${log_in_vain}" >/dev/null 34197143Shrs fi 3585831Sdes 36197143Shrs if checkyesno tcp_extensions; then 37197143Shrs netoptions_init 38197143Shrs echo -n ' rfc1323 extensions=NO' 39197143Shrs ${SYSCTL_W} net.inet.tcp.rfc1323=0 >/dev/null 40197143Shrs fi 4165532Snectar 42197143Shrs if ! checkyesno tcp_keepalive; then 43197143Shrs netoptions_init 44197143Shrs echo -n ' TCP keepalive=NO' 45197143Shrs ${SYSCTL_W} net.inet.tcp.always_keepalive=0 >/dev/null 46197143Shrs fi 47169217Smtm 48197143Shrs if checkyesno tcp_drop_synfin; then 49197143Shrs netoptions_init 50197143Shrs echo -n ' drop SYN+FIN packets=YES' 51197143Shrs ${SYSCTL_W} net.inet.tcp.drop_synfin=1 >/dev/null 52197143Shrs fi 53169217Smtm 54197143Shrs case ${ip_portrange_first} in 55197143Shrs [0-9]*) 56197143Shrs netoptions_init 57197143Shrs echo -n " ip_portrange_first=$ip_portrange_first" 58197143Shrs ${SYSCTL_W} net.inet.ip.portrange.first=$ip_portrange_first >/dev/null 59197143Shrs ;; 60197143Shrs esac 61169217Smtm 62197143Shrs case ${ip_portrange_last} in 63197143Shrs [0-9]*) 64197143Shrs netoptions_init 65197143Shrs echo -n " ip_portrange_last=$ip_portrange_last" 66197143Shrs ${SYSCTL_W} net.inet.ip.portrange.last=$ip_portrange_last >/dev/null 67197143Shrs ;; 68197143Shrs esac 69169217Smtm 70197646Sume if afexists inet6; then 71197646Sume if checkyesno ipv6_ipv4mapping; then 72197646Sume ${SYSCTL_W} net.inet6.ip6.v6only=0 >/dev/null 73197646Sume else 74197646Sume echo -n " no-ipv4-mapped-ipv6" 75197646Sume ${SYSCTL_W} net.inet6.ip6.v6only=1 >/dev/null 76197646Sume fi 77197143Shrs fi 78169217Smtm 79197143Shrs [ -n "${_netoptions_initdone}" ] && echo '.' 80197143Shrs} 81169217Smtm 82197143Shrsload_rc_config $name 83197143Shrsrun_rc_command $1 84