|
From: <abe...@us...> - 2017-06-02 21:25:03
|
Revision: 8367
http://sourceforge.net/p/astlinux/code/8367
Author: abelbeck
Date: 2017-06-02 21:25:01 +0000 (Fri, 02 Jun 2017)
Log Message:
-----------
network, add IPV6_PREFIX_DELEGATION rc.conf variable to select which interfaces get Prefix Delegation
web interface, Network tab, IPv6 Autoconfig, add selectable interfaces for Prefix Delegation by selecting 'Assign GUA Prefix'
Modified Paths:
--------------
branches/1.0/package/dnsmasq/dnsmasq.init
branches/1.0/package/webinterface/altweb/admin/network.php
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/package/dnsmasq/dnsmasq.init
===================================================================
--- branches/1.0/package/dnsmasq/dnsmasq.init 2017-06-01 22:08:01 UTC (rev 8366)
+++ branches/1.0/package/dnsmasq/dnsmasq.init 2017-06-02 21:25:01 UTC (rev 8367)
@@ -5,6 +5,23 @@
. /etc/init.d/functions.d/network
. /etc/init.d/functions.d/misc
+is_prefix_delegation()
+{
+ local dhcpv6_pd="" x IFS
+
+ if [ "$DHCPV6_CLIENT_ENABLE" = "yes" ]; then
+ unset IFS
+ for x in $IPV6_PREFIX_DELEGATION; do
+ if [ "$x" = "$1" ]; then
+ dhcpv6_pd="yes"
+ break
+ fi
+ done
+ fi
+
+ echo "$dhcpv6_pd"
+}
+
addr_to_prefix64()
{
local cnt=1 prefix="" next
@@ -118,7 +135,7 @@
addIPV6net()
{
# args: IF, tag, leasetime
- local interface="$1" tag="$2" leasetime="$3" dhcpv6="" prefix="" iname IFS
+ local interface="$1" tag="$2" leasetime="$3" dhcpv6_pd="" prefix="" iname IFS
if [ "$IPV6" != "yes" ]; then
return 2
@@ -129,7 +146,7 @@
case $iname in
INTIF)
if [ "$tag" = "lan" ]; then
- dhcpv6="$DHCPV6_CLIENT_ENABLE"
+ dhcpv6_pd="$(is_prefix_delegation "$iname")"
prefix="$(addr_to_prefix64 "$INTIPV6")"
break
fi
@@ -136,7 +153,7 @@
;;
INT2IF)
if [ "$tag" = "lan2" ]; then
- dhcpv6="$DHCPV6_CLIENT_ENABLE"
+ dhcpv6_pd="$(is_prefix_delegation "$iname")"
prefix="$(addr_to_prefix64 "$INT2IPV6")"
break
fi
@@ -143,7 +160,7 @@
;;
INT3IF)
if [ "$tag" = "lan3" ]; then
- dhcpv6="$DHCPV6_CLIENT_ENABLE"
+ dhcpv6_pd="$(is_prefix_delegation "$iname")"
prefix="$(addr_to_prefix64 "$INT3IPV6")"
break
fi
@@ -150,7 +167,7 @@
;;
INT4IF)
if [ "$tag" = "lan4" ]; then
- dhcpv6="$DHCPV6_CLIENT_ENABLE"
+ dhcpv6_pd="$(is_prefix_delegation "$iname")"
prefix="$(addr_to_prefix64 "$INT4IPV6")"
break
fi
@@ -157,7 +174,7 @@
;;
DMZIF)
if [ "$tag" = "dmz" ]; then
- dhcpv6="$DHCPV6_CLIENT_ENABLE"
+ dhcpv6_pd="$(is_prefix_delegation "$iname")"
prefix="$(addr_to_prefix64 "$DMZIPV6")"
break
fi
@@ -165,7 +182,7 @@
esac
done
- if [ "$dhcpv6" = "yes" -a "$DHCPV6_CLIENT_REQUEST_PREFIX" != "no" -a -z "$prefix" ]; then
+ if [ "$dhcpv6_pd" = "yes" -a "$DHCPV6_CLIENT_REQUEST_PREFIX" != "no" ]; then
echo "
dhcp-range=$tag,::1,constructor:$interface,ra-only,$leasetime"
return 0
Modified: branches/1.0/package/webinterface/altweb/admin/network.php
===================================================================
--- branches/1.0/package/webinterface/altweb/admin/network.php 2017-06-01 22:08:01 UTC (rev 8366)
+++ branches/1.0/package/webinterface/altweb/admin/network.php 2017-06-02 21:25:01 UTC (rev 8367)
@@ -43,6 +43,7 @@
// 01-22-2017, Removed Dynamic DNS 'getip.krisk.org', map to default
// 01-29-2017, Added DDGETIPV6 support
// 02-16-2017, Added Restart FTP Server support
+// 06-02-2017, Added selectable Prefix Delegation interfaces
//
// System location of rc.conf file
$CONFFILE = '/etc/rc.conf';
@@ -382,15 +383,29 @@
$value = 'NODHCP="'.getNODHCP_value().'"';
fwrite($fp, "### No DHCP on interfaces\n".$value."\n");
-
- $x_value = $_POST['int_autoconf'];
- $x_value .= $_POST['int2_autoconf'];
- $x_value .= $_POST['int3_autoconf'];
- $x_value .= $_POST['int4_autoconf'];
- $x_value .= $_POST['dmz_autoconf'];
+
+ $tokens = explode('~', $_POST['int_autoconf']);
+ $x_value = $tokens[0];
+ $y_value = $tokens[1];
+ $tokens = explode('~', $_POST['int2_autoconf']);
+ $x_value .= $tokens[0];
+ $y_value .= $tokens[1];
+ $tokens = explode('~', $_POST['int3_autoconf']);
+ $x_value .= $tokens[0];
+ $y_value .= $tokens[1];
+ $tokens = explode('~', $_POST['int4_autoconf']);
+ $x_value .= $tokens[0];
+ $y_value .= $tokens[1];
+ $tokens = explode('~', $_POST['dmz_autoconf']);
+ $x_value .= $tokens[0];
+ $y_value .= $tokens[1];
+
$value = 'IPV6_AUTOCONF="'.trim($x_value).'"';
fwrite($fp, "### IPv6 Autoconfig\n".$value."\n");
-
+
+ $value = 'IPV6_PREFIX_DELEGATION="'.trim($y_value).'"';
+ fwrite($fp, "### IPv6 Prefix Delegation\n".$value."\n");
+
$value = 'FWVERS="'.$_POST['firewall'].'"';
fwrite($fp, "### Firewall Type\n".$value."\n");
@@ -1564,8 +1579,15 @@
putHtml(' IPv6 Autoconfig:');
putHtml('<select name="int_autoconf">');
putHtml('<option value="">disabled</option>');
- $sel = isVARtype('IPV6_AUTOCONF', $db, $cur_db, 'INTIF') ? ' selected="selected"' : '';
- putHtml('<option value=" INTIF"'.$sel.'>enabled</option>');
+ if (isVARtype('IPV6_PREFIX_DELEGATION', $db, $cur_db, 'INTIF')) {
+ $sel1 = '';
+ $sel2 = ' selected="selected"';
+ } else {
+ $sel1 = isVARtype('IPV6_AUTOCONF', $db, $cur_db, 'INTIF') ? ' selected="selected"' : '';
+ $sel2 = '';
+ }
+ putHtml('<option value=" INTIF~"'.$sel1.'>enabled</option>');
+ putHtml('<option value=" INTIF~ INTIF"'.$sel2.'>Assign GUA Prefix</option>');
putHtml('</select>');
$value = getVARdef($db, 'INTIPV6', $cur_db);
putHtml('– IPv6/nn:<input type="text" size="45" maxlength="43" value="'.$value.'" name="int_ipv6" />');
@@ -1596,8 +1618,15 @@
putHtml(' IPv6 Autoconfig:');
putHtml('<select name="int2_autoconf">');
putHtml('<option value="">disabled</option>');
- $sel = isVARtype('IPV6_AUTOCONF', $db, $cur_db, 'INT2IF') ? ' selected="selected"' : '';
- putHtml('<option value=" INT2IF"'.$sel.'>enabled</option>');
+ if (isVARtype('IPV6_PREFIX_DELEGATION', $db, $cur_db, 'INT2IF')) {
+ $sel1 = '';
+ $sel2 = ' selected="selected"';
+ } else {
+ $sel1 = isVARtype('IPV6_AUTOCONF', $db, $cur_db, 'INT2IF') ? ' selected="selected"' : '';
+ $sel2 = '';
+ }
+ putHtml('<option value=" INT2IF~"'.$sel1.'>enabled</option>');
+ putHtml('<option value=" INT2IF~ INT2IF"'.$sel2.'>Assign GUA Prefix</option>');
putHtml('</select>');
$value = getVARdef($db, 'INT2IPV6', $cur_db);
putHtml('– IPv6/nn:<input type="text" size="45" maxlength="43" value="'.$value.'" name="int2_ipv6" />');
@@ -1628,8 +1657,15 @@
putHtml(' IPv6 Autoconfig:');
putHtml('<select name="int3_autoconf">');
putHtml('<option value="">disabled</option>');
- $sel = isVARtype('IPV6_AUTOCONF', $db, $cur_db, 'INT3IF') ? ' selected="selected"' : '';
- putHtml('<option value=" INT3IF"'.$sel.'>enabled</option>');
+ if (isVARtype('IPV6_PREFIX_DELEGATION', $db, $cur_db, 'INT3IF')) {
+ $sel1 = '';
+ $sel2 = ' selected="selected"';
+ } else {
+ $sel1 = isVARtype('IPV6_AUTOCONF', $db, $cur_db, 'INT3IF') ? ' selected="selected"' : '';
+ $sel2 = '';
+ }
+ putHtml('<option value=" INT3IF~"'.$sel1.'>enabled</option>');
+ putHtml('<option value=" INT3IF~ INT3IF"'.$sel2.'>Assign GUA Prefix</option>');
putHtml('</select>');
$value = getVARdef($db, 'INT3IPV6', $cur_db);
putHtml('– IPv6/nn:<input type="text" size="45" maxlength="43" value="'.$value.'" name="int3_ipv6" />');
@@ -1660,8 +1696,15 @@
putHtml(' IPv6 Autoconfig:');
putHtml('<select name="int4_autoconf">');
putHtml('<option value="">disabled</option>');
- $sel = isVARtype('IPV6_AUTOCONF', $db, $cur_db, 'INT4IF') ? ' selected="selected"' : '';
- putHtml('<option value=" INT4IF"'.$sel.'>enabled</option>');
+ if (isVARtype('IPV6_PREFIX_DELEGATION', $db, $cur_db, 'INT4IF')) {
+ $sel1 = '';
+ $sel2 = ' selected="selected"';
+ } else {
+ $sel1 = isVARtype('IPV6_AUTOCONF', $db, $cur_db, 'INT4IF') ? ' selected="selected"' : '';
+ $sel2 = '';
+ }
+ putHtml('<option value=" INT4IF~"'.$sel1.'>enabled</option>');
+ putHtml('<option value=" INT4IF~ INT4IF"'.$sel2.'>Assign GUA Prefix</option>');
putHtml('</select>');
$value = getVARdef($db, 'INT4IPV6', $cur_db);
putHtml('– IPv6/nn:<input type="text" size="45" maxlength="43" value="'.$value.'" name="int4_ipv6" />');
@@ -1692,8 +1735,15 @@
putHtml(' IPv6 Autoconfig:');
putHtml('<select name="dmz_autoconf">');
putHtml('<option value="">disabled</option>');
- $sel = isVARtype('IPV6_AUTOCONF', $db, $cur_db, 'DMZIF') ? ' selected="selected"' : '';
- putHtml('<option value=" DMZIF"'.$sel.'>enabled</option>');
+ if (isVARtype('IPV6_PREFIX_DELEGATION', $db, $cur_db, 'DMZIF')) {
+ $sel1 = '';
+ $sel2 = ' selected="selected"';
+ } else {
+ $sel1 = isVARtype('IPV6_AUTOCONF', $db, $cur_db, 'DMZIF') ? ' selected="selected"' : '';
+ $sel2 = '';
+ }
+ putHtml('<option value=" DMZIF~"'.$sel1.'>enabled</option>');
+ putHtml('<option value=" DMZIF~ DMZIF"'.$sel2.'>Assign GUA Prefix</option>');
putHtml('</select>');
$value = getVARdef($db, 'DMZIPV6', $cur_db);
putHtml('– IPv6/nn:<input type="text" size="45" maxlength="43" value="'.$value.'" name="dmz_ipv6" />');
Modified: branches/1.0/project/astlinux/target_skeleton/etc/init.d/network
===================================================================
--- branches/1.0/project/astlinux/target_skeleton/etc/init.d/network 2017-06-01 22:08:01 UTC (rev 8366)
+++ branches/1.0/project/astlinux/target_skeleton/etc/init.d/network 2017-06-02 21:25:01 UTC (rev 8367)
@@ -105,31 +105,31 @@
id=0
unset IFS
- for iname in $IPV6_AUTOCONF; do
+ for iname in $IPV6_PREFIX_DELEGATION; do
int=""
case $iname in
INTIF)
- if [ -n "$INTIF" -a "$INTIF" != "none" -a -n "$INTIP" -a -n "$INTNM" -a -z "$INTIPV6" ]; then
+ 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" -a -z "$INT2IPV6" ]; then
+ 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" -a -z "$INT3IPV6" ]; then
+ if [ -n "$INT3IF" -a "$INT3IF" != "none" -a -n "$INT3IP" -a -n "$INT3NM" ]; then
int="$INT3IF"
fi
;;
INT4IF)
- if [ -n "$INT4IF" -a "$INT4IF" != "none" -a -n "$INT4IP" -a -n "$INT4NM" -a -z "$INT4IPV6" ]; then
+ if [ -n "$INT4IF" -a "$INT4IF" != "none" -a -n "$INT4IP" -a -n "$INT4NM" ]; then
int="$INT4IF"
fi
;;
DMZIF)
- if [ -n "$DMZIF" -a "$DMZIF" != "none" -a -n "$DMZIP" -a -n "$DMZNM" -a -z "$DMZIPV6" ]; then
+ if [ -n "$DMZIF" -a "$DMZIF" != "none" -a -n "$DMZIP" -a -n "$DMZNM" ]; then
int="$DMZIF"
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-06-01 22:08:01 UTC (rev 8366)
+++ branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf 2017-06-02 21:25:01 UTC (rev 8367)
@@ -255,6 +255,9 @@
## "DMZIF" for DMZ Interface
## Note: the autoconf prefix is derived from the IPv6 address on the interface, which must be defined.
#IPV6_AUTOCONF="INTIF"
+## Specify what Interface_Name is given a DHCPv6-Prefix Delegation, same format as with IPV6_AUTOCONF
+## Note: DHCPv6 Client must be enabled for this to apply
+#IPV6_PREFIX_DELEGATION="INTIF"
## DHCPv6 Client
## Enable DHCPv6 client on EXTIF by setting DHCPV6_CLIENT_ENABLE="yes"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|