From: <abe...@us...> - 2017-03-20 23:58:24
|
Revision: 8218 http://sourceforge.net/p/astlinux/code/8218 Author: abelbeck Date: 2017-03-20 23:58:21 +0000 (Mon, 20 Mar 2017) Log Message: ----------- network, If a Static IPv6 external interface is defined with an undefined IPv6 Gateway entry, automatically it will use Router Advertisements to set the default route Modified Paths: -------------- branches/1.0/project/astlinux/target_skeleton/etc/init.d/network branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf Modified: branches/1.0/project/astlinux/target_skeleton/etc/init.d/network =================================================================== --- branches/1.0/project/astlinux/target_skeleton/etc/init.d/network 2017-03-18 18:04:21 UTC (rev 8217) +++ branches/1.0/project/astlinux/target_skeleton/etc/init.d/network 2017-03-20 23:58:21 UTC (rev 8218) @@ -610,9 +610,10 @@ if [ -n "$EXTIP_ALIAS" ]; then alias_interface add $EXTIF "$EXTIP_ALIAS" fi - if [ "$IPV6" = "yes" -a -n "$EXTIPV6" ] && \ - [ "$DHCPV6_CLIENT_ENABLE" != "yes" -o "$DHCPV6_CLIENT_REQUEST_ADDRESS" = "no" ]; then - ip -6 addr add $EXTIPV6 dev $EXTIF + if [ "$IPV6" = "yes" ] && [ "$DHCPV6_CLIENT_ENABLE" != "yes" -o "$DHCPV6_CLIENT_REQUEST_ADDRESS" = "no" ]; then + if [ -n "$EXTIPV6" ]; then + ip -6 addr add $EXTIPV6 dev $EXTIF + fi fi ip link set dev $EXTIF up if [ "$IPV6" = "yes" -a "$DHCPV6_CLIENT_ENABLE" = "yes" ]; then @@ -628,9 +629,15 @@ if [ -n "$EXTGW" ]; then ip route add default via $EXTGW dev $EXTIF fi - if [ "$IPV6" = "yes" -a -n "$EXTGWIPV6" ] && \ - [ "$DHCPV6_CLIENT_ENABLE" != "yes" -o "$DHCPV6_CLIENT_REQUEST_ADDRESS" = "no" ]; then - ip -6 route add default via $EXTGWIPV6 dev $EXTIF metric 1 + if [ "$IPV6" = "yes" ] && [ "$DHCPV6_CLIENT_ENABLE" != "yes" -o "$DHCPV6_CLIENT_REQUEST_ADDRESS" = "no" ]; then + if [ -n "$EXTIPV6" ]; then + if [ -n "$EXTGWIPV6" ]; then + ip -6 route add default via $EXTGWIPV6 dev $EXTIF metric 1 + else + # Use Router Advertisements to set the default route + sysctl -w net/ipv6/conf/${EXTIF}/accept_ra=2 >/dev/null + fi + fi fi #end static IP fi @@ -669,10 +676,16 @@ ifplugd -apq -t2 -u3 -d3 -i $EXTIF -r /etc/ifplugd/udhcpc.action # No DHCPv6 - Static IPv6 if defined - if [ "$IPV6" = "yes" -a -n "$EXTIPV6" -a -n "$EXTGWIPV6" ] && \ - [ "$DHCPV6_CLIENT_ENABLE" != "yes" -o "$DHCPV6_CLIENT_REQUEST_ADDRESS" = "no" ]; then - ip -6 addr add $EXTIPV6 dev $EXTIF - ip -6 route add default via $EXTGWIPV6 dev $EXTIF metric 1 + if [ "$IPV6" = "yes" ] && [ "$DHCPV6_CLIENT_ENABLE" != "yes" -o "$DHCPV6_CLIENT_REQUEST_ADDRESS" = "no" ]; then + if [ -n "$EXTIPV6" ]; then + ip -6 addr add $EXTIPV6 dev $EXTIF + if [ -n "$EXTGWIPV6" ]; then + ip -6 route add default via $EXTGWIPV6 dev $EXTIF metric 1 + else + # Use Router Advertisements to set the default route + sysctl -w net/ipv6/conf/${EXTIF}/accept_ra=2 >/dev/null + fi + fi fi fi Modified: branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf =================================================================== --- branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf 2017-03-18 18:04:21 UTC (rev 8217) +++ branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf 2017-03-20 23:58:21 UTC (rev 8218) @@ -232,6 +232,7 @@ ## Do not use the example addresses shown, they are for documentation use only! ## ## Static External IPv6 address and gateway address +## Note: If EXTIPV6 is defined but EXTGWIPV6 is not, Router Advertisements will set the default route #EXTIPV6="2001:db8:1::1/64" #EXTGWIPV6="2001:db8:100::1" #EXT2IPV6="2001:db8:2::1/64" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |