routing (298514) | routing (300882) |
---|---|
1#!/bin/sh 2# 3# Configure routing and miscellaneous network tunables 4# | 1#!/bin/sh 2# 3# Configure routing and miscellaneous network tunables 4# |
5# $FreeBSD: head/etc/rc.d/routing 298514 2016-04-23 16:10:54Z lme $ | 5# $FreeBSD: head/etc/rc.d/routing 300882 2016-05-27 22:40:40Z asomers $ |
6# 7 8# PROVIDE: routing 9# REQUIRE: netif ppp stf 10# KEYWORD: nojailvnet 11 12. /etc/rc.subr 13. /etc/network.subr --- 107 unchanged lines hidden (view full) --- 121 done 122} 123 124routing_stop_atm() 125{ 126 return 0 127} 128 | 6# 7 8# PROVIDE: routing 9# REQUIRE: netif ppp stf 10# KEYWORD: nojailvnet 11 12. /etc/rc.subr 13. /etc/network.subr --- 107 unchanged lines hidden (view full) --- 121 done 122} 123 124routing_stop_atm() 125{ 126 return 0 127} 128 |
129get_fibmod() 130{ 131 local _fibs 132 133 _fibs=$((`${SYSCTL_N} net.fibs` - 1)) 134 if [ ${_fibs} -gt 0 ]; then 135 echo "-fib 0-${_fibs}" 136 else 137 echo 138 fi 139} 140 |
|
129static_inet() 130{ | 141static_inet() 142{ |
131 local _action _if _skip | 143 local _action _if _skip _fibmod |
132 _action=$1 133 _if=$2 134 | 144 _action=$1 145 _if=$2 146 |
147 _fibmod=`get_fibmod` 148 149 # Provide loopback route in all routing tables. This has to come 150 # first so that any following routes can be added. 151 static_routes="_loopback ${static_routes}" 152 route__loopback="-inet 127.0.0.1 -iface lo0 ${_fibmod}" 153 |
|
135 # Add default route. 136 case ${defaultrouter} in 137 [Nn][Oo] | '') 138 ;; 139 *) 140 static_routes="${static_routes} _default" 141 route__default="default ${defaultrouter}" 142 ;; --- 18 unchanged lines hidden (view full) --- 161 fi 162 fi 163 done 164 fi 165} 166 167static_inet6() 168{ | 154 # Add default route. 155 case ${defaultrouter} in 156 [Nn][Oo] | '') 157 ;; 158 *) 159 static_routes="${static_routes} _default" 160 route__default="default ${defaultrouter}" 161 ;; --- 18 unchanged lines hidden (view full) --- 180 fi 181 fi 182 done 183 fi 184} 185 186static_inet6() 187{ |
169 local _action _if _skip fibmod fibs allfibs | 188 local _action _if _skip fibmod allfibs |
170 _action=$1 171 _if=$2 172 | 189 _action=$1 190 _if=$2 191 |
173 # get the number of FIBs supported. 174 fibs=$((`${SYSCTL_N} net.fibs` - 1)) 175 allfibs=`${SYSCTL_N} net.add_addr_allfibs` 176 if [ "$fibs" -gt 0 ] && [ "$allfibs" -ne 0 ]; then 177 fibmod="-fib 0-$fibs" 178 else 179 fibmod= 180 fi | 192 fibmod=`get_fibmod` |
181 182 # Add pre-defined static routes first. 183 ipv6_static_routes="_v4mapped _v4compat ${ipv6_static_routes}" 184 ipv6_static_routes="_lla _llma ${ipv6_static_routes}" | 193 194 # Add pre-defined static routes first. 195 ipv6_static_routes="_v4mapped _v4compat ${ipv6_static_routes}" 196 ipv6_static_routes="_lla _llma ${ipv6_static_routes}" |
197 ipv6_static_routes="_loopback ${ipv6_static_routes}" |
|
185 186 # disallow "internal" addresses to appear on the wire 187 ipv6_route__v4mapped="::ffff:0.0.0.0 -prefixlen 96 ::1 -reject ${fibmod}" 188 ipv6_route__v4compat="::0.0.0.0 -prefixlen 96 ::1 -reject ${fibmod}" 189 | 198 199 # disallow "internal" addresses to appear on the wire 200 ipv6_route__v4mapped="::ffff:0.0.0.0 -prefixlen 96 ::1 -reject ${fibmod}" 201 ipv6_route__v4compat="::0.0.0.0 -prefixlen 96 ::1 -reject ${fibmod}" 202 |
203 # Create a loopback route in every fib 204 ipv6_route__loopback="::1 -prefixlen 128 -iface lo0 ${fibmod}" 205 |
|
190 # Disallow link-local unicast packets without outgoing scope 191 # identifiers. However, if you set "ipv6_default_interface", 192 # for the host case, you will allow to omit the identifiers. 193 # Under this configuration, the packets will go to the default 194 # interface. 195 ipv6_route__lla="fe80:: -prefixlen 10 ::1 -reject ${fibmod}" 196 ipv6_route__llma="ff02:: -prefixlen 16 ::1 -reject ${fibmod}" 197 --- 184 unchanged lines hidden --- | 206 # Disallow link-local unicast packets without outgoing scope 207 # identifiers. However, if you set "ipv6_default_interface", 208 # for the host case, you will allow to omit the identifiers. 209 # Under this configuration, the packets will go to the default 210 # interface. 211 ipv6_route__lla="fe80:: -prefixlen 10 ::1 -reject ${fibmod}" 212 ipv6_route__llma="ff02:: -prefixlen 16 ::1 -reject ${fibmod}" 213 --- 184 unchanged lines hidden --- |