netoptions revision 197702
1#!/bin/sh 2# 3# $FreeBSD: head/etc/rc.d/netoptions 197702 2009-10-02 06:51:39Z hrs $ 4# 5 6# PROVIDE: netoptions 7# REQUIRE: FILESYSTEMS 8# BEFORE: netif 9# KEYWORD: nojail 10 11. /etc/rc.subr 12. /etc/network.subr 13 14name="netoptions" 15start_cmd="netoptions_start" 16stop_cmd=: 17 18_netoptions_initdone= 19netoptions_init() 20{ 21 if [ -z "${_netoptions_initdone}" ]; then 22 echo -n 'Additional TCP/IP options:' 23 _netoptions_initdone=yes 24 fi 25} 26 27netoptions_start() 28{ 29 local _af 30 31 for _af in inet inet6; do 32 afexists ${_af} && eval netoptions_${_af} 33 done 34 [ -n "${_netoptions_initdone}" ] && echo '.' 35} 36 37netoptions_inet() 38{ 39 case ${log_in_vain} in 40 [12]) 41 netoptions_init 42 echo -n " log_in_vain=${log_in_vain}" 43 ${SYSCTL_W} net.inet.tcp.log_in_vain=${log_in_vain} >/dev/null 44 ${SYSCTL_W} net.inet.udp.log_in_vain=${log_in_vain} >/dev/null 45 ;; 46 *) 47 ${SYSCTL_W} net.inet.tcp.log_in_vain=0 >/dev/null 48 ${SYSCTL_W} net.inet.udp.log_in_vain=0 >/dev/null 49 ;; 50 esac 51 52 if checkyesno tcp_extensions; then 53 ${SYSCTL_W} net.inet.tcp.rfc1323=1 >/dev/null 54 else 55 netoptions_init 56 echo -n ' rfc1323 extensions=${tcp_extensions}' 57 ${SYSCTL_W} net.inet.tcp.rfc1323=0 >/dev/null 58 fi 59 60 if checkyesno tcp_keepalive; then 61 ${SYSCTL_W} net.inet.tcp.always_keepalive=1 >/dev/null 62 else 63 netoptions_init 64 echo -n ' TCP keepalive=${tcp_keepalive}' 65 ${SYSCTL_W} net.inet.tcp.always_keepalive=0 >/dev/null 66 fi 67 68 if checkyesno tcp_drop_synfin; then 69 netoptions_init 70 echo -n ' drop SYN+FIN packets=${tcp_drop_synfin}' 71 ${SYSCTL_W} net.inet.tcp.drop_synfin=1 >/dev/null 72 else 73 ${SYSCTL_W} net.inet.tcp.drop_synfin=0 >/dev/null 74 fi 75 76 case ${ip_portrange_first} in 77 [0-9]*) 78 netoptions_init 79 echo -n " ip_portrange_first=$ip_portrange_first" 80 ${SYSCTL_W} net.inet.ip.portrange.first=$ip_portrange_first >/dev/null 81 ;; 82 esac 83 84 case ${ip_portrange_last} in 85 [0-9]*) 86 netoptions_init 87 echo -n " ip_portrange_last=$ip_portrange_last" 88 ${SYSCTL_W} net.inet.ip.portrange.last=$ip_portrange_last >/dev/null 89 ;; 90 esac 91} 92 93netoptions_inet6() 94{ 95 if checkyesno ipv6_ipv4mapping; then 96 netoptions_init 97 echo -n " ipv4-mapped-ipv6=${ipv6_ipv4mapping}" 98 ${SYSCTL_W} net.inet6.ip6.v6only=0 >/dev/null 99 else 100 ${SYSCTL_W} net.inet6.ip6.v6only=1 >/dev/null 101 fi 102} 103 104load_rc_config $name 105run_rc_command $1 106