From: <abe...@us...> - 2015-10-30 22:06:16
|
Revision: 7296 http://sourceforge.net/p/astlinux/code/7296 Author: abelbeck Date: 2015-10-30 22:06:14 +0000 (Fri, 30 Oct 2015) Log Message: ----------- Add DHCPv6 Client, including Prefix Delegation. Enable with DHCPV6_CLIENT_ENABLE="yes" and reboot, needs testing Modified Paths: -------------- branches/1.0/astlinux-ast11.config branches/1.0/astlinux-ast13.config branches/1.0/astlinux18.config branches/1.0/package/dnsmasq/dnsmasq.init branches/1.0/project/astlinux/target_skeleton/etc/ifplugd/udhcpc.action branches/1.0/project/astlinux/target_skeleton/etc/init.d/network branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf Added Paths: ----------- branches/1.0/package/arnofw/arnofw-do-not-reset-accept_ra.patch Modified: branches/1.0/astlinux-ast11.config =================================================================== --- branches/1.0/astlinux-ast11.config 2015-10-30 12:43:29 UTC (rev 7295) +++ branches/1.0/astlinux-ast11.config 2015-10-30 22:06:14 UTC (rev 7296) @@ -799,7 +799,7 @@ # BR2_PACKAGE_VPNC is not set BR2_PACKAGE_VSFTPD=y # BR2_PACKAGE_VTUN is not set -# BR2_PACKAGE_WIDE_DHCPV6 is not set +BR2_PACKAGE_WIDE_DHCPV6=y # BR2_PACKAGE_WIRELESS_TOOLS is not set # BR2_PACKAGE_WPA_SUPPLICANT is not set Modified: branches/1.0/astlinux-ast13.config =================================================================== --- branches/1.0/astlinux-ast13.config 2015-10-30 12:43:29 UTC (rev 7295) +++ branches/1.0/astlinux-ast13.config 2015-10-30 22:06:14 UTC (rev 7296) @@ -799,7 +799,7 @@ # BR2_PACKAGE_VPNC is not set BR2_PACKAGE_VSFTPD=y # BR2_PACKAGE_VTUN is not set -# BR2_PACKAGE_WIDE_DHCPV6 is not set +BR2_PACKAGE_WIDE_DHCPV6=y # BR2_PACKAGE_WIRELESS_TOOLS is not set # BR2_PACKAGE_WPA_SUPPLICANT is not set Modified: branches/1.0/astlinux18.config =================================================================== --- branches/1.0/astlinux18.config 2015-10-30 12:43:29 UTC (rev 7295) +++ branches/1.0/astlinux18.config 2015-10-30 22:06:14 UTC (rev 7296) @@ -799,7 +799,7 @@ # BR2_PACKAGE_VPNC is not set BR2_PACKAGE_VSFTPD=y # BR2_PACKAGE_VTUN is not set -# BR2_PACKAGE_WIDE_DHCPV6 is not set +BR2_PACKAGE_WIDE_DHCPV6=y # BR2_PACKAGE_WIRELESS_TOOLS is not set # BR2_PACKAGE_WPA_SUPPLICANT is not set Added: branches/1.0/package/arnofw/arnofw-do-not-reset-accept_ra.patch =================================================================== --- branches/1.0/package/arnofw/arnofw-do-not-reset-accept_ra.patch (rev 0) +++ branches/1.0/package/arnofw/arnofw-do-not-reset-accept_ra.patch 2015-10-30 22:06:14 UTC (rev 7296) @@ -0,0 +1,11 @@ +--- arno-iptables-firewall_2.0.1f/bin/arno-iptables-firewall.orig 2015-10-30 15:52:23.000000000 -0500 ++++ arno-iptables-firewall_2.0.1f/bin/arno-iptables-firewall 2015-10-30 16:00:37.000000000 -0500 +@@ -495,7 +495,7 @@ + sysctl_set_all "net.ipv6.conf" "forwarding" 1 + echo " Disabling Local IPv6 Auto-Configuration" + sysctl_set_all "net.ipv6.conf" "autoconf" 0 +- sysctl_set_all "net.ipv6.conf" "accept_ra" 0 ++ ## Setting accept_ra=0 is not needed with forwarding=1, don't overwrite any existing accept_ra=2 values + fi + elif [ "$IP_FORWARDING" = "0" ]; then + echo " DISABLING packet forwarding" Modified: branches/1.0/package/dnsmasq/dnsmasq.init =================================================================== --- branches/1.0/package/dnsmasq/dnsmasq.init 2015-10-30 12:43:29 UTC (rev 7295) +++ branches/1.0/package/dnsmasq/dnsmasq.init 2015-10-30 22:06:14 UTC (rev 7296) @@ -119,7 +119,7 @@ addIPV6net() { # args: IF, tag - local interface="$1" tag="$2" prefix="" iname IFS + local interface="$1" tag="$2" dhcpv6="" prefix="" iname IFS if [ "$IPV6" != "yes" ]; then return 2 @@ -130,24 +130,28 @@ case $iname in INTIF) if [ "$tag" = "lan" ]; then + dhcpv6="$DHCPV6_CLIENT_ENABLE" prefix="$(addr_to_prefix64 "$INTIPV6")" break fi ;; INT2IF) if [ "$tag" = "lan2" ]; then + dhcpv6="$DHCPV6_CLIENT_ENABLE" prefix="$(addr_to_prefix64 "$INT2IPV6")" break fi ;; INT3IF) if [ "$tag" = "lan3" ]; then + dhcpv6="$DHCPV6_CLIENT_ENABLE" prefix="$(addr_to_prefix64 "$INT3IPV6")" break fi ;; DMZIF) if [ "$tag" = "dmz" ]; then + dhcpv6="$DHCPV6_CLIENT_ENABLE" prefix="$(addr_to_prefix64 "$DMZIPV6")" break fi @@ -155,8 +159,12 @@ esac done - if [ -n "$prefix" ]; then + if [ "$dhcpv6" = "yes" -a "$DHCPV6_CLIENT_REQUEST_PREFIX" != "no" ]; then echo " +dhcp-range=$tag,::1,constructor:$interface,ra-only,24h" + return 0 + elif [ -n "$prefix" ]; then + echo " dhcp-range=$tag,$prefix,ra-only,64,24h" return 0 fi Modified: branches/1.0/project/astlinux/target_skeleton/etc/ifplugd/udhcpc.action =================================================================== --- branches/1.0/project/astlinux/target_skeleton/etc/ifplugd/udhcpc.action 2015-10-30 12:43:29 UTC (rev 7295) +++ branches/1.0/project/astlinux/target_skeleton/etc/ifplugd/udhcpc.action 2015-10-30 22:06:14 UTC (rev 7296) @@ -4,6 +4,14 @@ action="$2" +kill_dhcp6c() +{ + if [ -f "/var/run/dhcp6c-${interface}.pid" ]; then + kill $(cat "/var/run/dhcp6c-${interface}.pid") 2>/dev/null + sleep 1 + fi +} + kill_udhcpc() { if [ -f "/var/run/udhcpc-${interface}.pid" ]; then @@ -15,11 +23,16 @@ case $action in up) + if [ -f "/etc/wide-dhcpv6/dhcp6c-${interface}.conf" ]; then + kill_dhcp6c + dhcp6c -c /etc/wide-dhcpv6/dhcp6c-${interface}.conf -p /var/run/dhcp6c-${interface}.pid ${interface} + fi kill_udhcpc udhcpc -b -T2 -t6 -S -s /etc/udhcpc.script -H $(uname -n) -p /var/run/udhcpc-${interface}.pid -i ${interface} ;; down) + kill_dhcp6c kill_udhcpc ;; Modified: branches/1.0/project/astlinux/target_skeleton/etc/init.d/network =================================================================== --- branches/1.0/project/astlinux/target_skeleton/etc/init.d/network 2015-10-30 12:43:29 UTC (rev 7295) +++ branches/1.0/project/astlinux/target_skeleton/etc/init.d/network 2015-10-30 22:06:14 UTC (rev 7296) @@ -54,6 +54,97 @@ return 0 } +gen_dhcp6c_conf() +{ + local interface="$1" len id iname int IFS + + len="${DHCPV6_CLIENT_PREFIX_LEN:-60}" + + # Sanity check the prefix length + if [ $len -lt 8 -o $len -gt 64 ]; then + len="60" + fi + + echo "# Autogenerated. Do not edit. +interface $interface {" + if [ "$DHCPV6_CLIENT_REQUEST_ADDRESS" != "no" ]; then + echo " send ia-na 1;" + fi + if [ "$DHCPV6_CLIENT_REQUEST_PREFIX" != "no" ]; then + echo " send ia-pd 1;" + fi + echo " send rapid-commit;" + echo "};" + + if [ "$DHCPV6_CLIENT_REQUEST_ADDRESS" != "no" ]; then + echo " +id-assoc na 1 { };" + fi + + if [ "$DHCPV6_CLIENT_REQUEST_PREFIX" != "no" ]; then + echo " +id-assoc pd 1 {" + if [ "$DHCPV6_CLIENT_PREFIX_HINT" != "no" ]; then + echo " prefix ::/$len infinity;" + fi + + id=0 + unset IFS + for iname in $IPV6_AUTOCONF; do + int="" + case $iname in + INTIF) + if [ -n "$INTIF" -a "$INTIF" != "none" -a -n "$INTIP" -a -n "$INTNM" ]; then + int="$INTIF" + fi + ;; + INT2IF) + if [ -n "$INT2IF" -a "$INT2IF" != "none" -a -n "$INT2IP" -a -n "$INT2NM" ]; then + int="$INT2IF" + fi + ;; + INT3IF) + if [ -n "$INT3IF" -a "$INT3IF" != "none" -a -n "$INT3IP" -a -n "$INT3NM" ]; then + int="$INT3IF" + fi + ;; + DMZIF) + if [ -n "$DMZIF" -a "$DMZIF" != "none" -a -n "$DMZIP" -a -n "$DMZNM" ]; then + int="$DMZIF" + fi + ;; + esac + if [ -n "$int" ]; then + echo " prefix-interface $int { + sla-id $id; + sla-len $((64-len)); + ifid 1; + };" + id=$((id+1)) + fi + + # Only assign one interface given only a /64 prefix + if [ $len -eq 64 ]; then + break + fi + done + + echo "};" + fi +} + +init_dhcp6c() +{ + local interface="$1" + + sysctl -w net/ipv6/conf/${interface}/accept_ra=2 >/dev/null + + # Make DUID persistant + ln -sf /mnt/kd/dhcp6c_duid /var/db/dhcp6c_duid + + gen_dhcp6c_conf $interface > /etc/wide-dhcpv6/dhcp6c-${interface}.conf +} + ipv6_tunnel() { local action="$1" type local_addr remote_addr endpoint_addr @@ -135,6 +226,8 @@ init () { + mkdir -p /tmp/etc/wide-dhcpv6 + if [ -n "$IFRENAME" ]; then #clear existing iftabs @@ -514,11 +607,15 @@ if [ -n "$EXTIF" -a -z "$EXTIP" ] && ! isextppp extif; then ip link set dev $EXTIF up sleep 4 + if [ "$IPV6" = "yes" -a "$DHCPV6_CLIENT_ENABLE" = "yes" ]; then + init_dhcp6c $EXTIF + dhcp6c -c /etc/wide-dhcpv6/dhcp6c-$EXTIF.conf -p /var/run/dhcp6c-$EXTIF.pid $EXTIF + fi udhcpc -b -T2 -t6 -S -s /etc/udhcpc.script -H $HOSTNAME -p /var/run/udhcpc-$EXTIF.pid -i $EXTIF 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" ]; then + if [ "$IPV6" = "yes" -a "$DHCPV6_CLIENT_ENABLE" != "yes" -a -n "$EXTIPV6" -a -n "$EXTGWIPV6" ]; then ip -6 addr add $EXTIPV6 dev $EXTIF ip -6 route add default via $EXTGWIPV6 dev $EXTIF metric 1 fi @@ -555,6 +652,11 @@ kill $(cat "$PID") done + for PID in $(ls -1 /var/run/dhcp6c-*.pid 2>/dev/null); do + echo "Stopping dhcp6c..." + kill $(cat "$PID") + done + for PID in $(ls -1 /var/run/udhcpc-*.pid 2>/dev/null); do echo "Stopping udhcpc..." kill $(cat "$PID") Modified: branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf =================================================================== --- branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf 2015-10-30 12:43:29 UTC (rev 7295) +++ branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf 2015-10-30 22:06:14 UTC (rev 7296) @@ -234,13 +234,21 @@ ## DMZ IPv6 address #DMZIPV6="2001:db8:20::1/64" -## Configure IPv6 Router Advertisement Daemon (radvd) +## Configure IPv6 Router Advertisement Daemon ## Define: Interface_Name, space separated for multiple ## Interface_Name is "INTIF" for 1st, "INT2IF" for 2nd, and "INT3IF" for 3rd Internal Interface ## "DMZIF" for DMZ Interface ## Note: the autoconf prefix is derived from the IPv6 address on the interface, which must be defined. #IPV6_AUTOCONF="INTIF" +## DHCPv6 Client +## Enable DHCPv6 client by setting DHCPV6_CLIENT_ENABLE="yes" +#DHCPV6_CLIENT_ENABLE="yes" +#DHCPV6_CLIENT_REQUEST_ADDRESS="yes" # Request IPv6 Address, disable with "no", defaults to "yes" +#DHCPV6_CLIENT_REQUEST_PREFIX="yes" # Request Prefix Delegation, disable with "no", defaults to "yes" +#DHCPV6_CLIENT_PREFIX_LEN="60" # Prefix Delegation Length, defaults to "60" +#DHCPV6_CLIENT_PREFIX_HINT="yes" # Request the Prefix Delegation Length, disable with "no", defaults to "yes" + ## Configure IPv6 tunnel gateway for 6in4 and 6to4 ## Supported Types: "6in4-static" "6to4-relay" ## Define 3 ~ (tilde) separated arguments This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |