From 227b0329eb57b965c6d05ff2d62bbe9833df4066 Mon Sep 17 00:00:00 2001 From: Nicolas REBIERRE Date: Sat, 30 Nov 2013 21:51:24 +0100 Subject: [PATCH 1/2] initial update for ipv6 support --- conf/ext/thebrig/extensions_thebrig.php | 2 +- conf/ext/thebrig/extensions_thebrig_edit.php | 16 ++++++++++++++-- conf/ext/thebrig/extensions_thebrig_tools.php | 2 +- conf/ext/thebrig/functions.inc | 5 ++++- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/conf/ext/thebrig/extensions_thebrig.php b/conf/ext/thebrig/extensions_thebrig.php index 4cec05b..bc57942 100644 --- a/conf/ext/thebrig/extensions_thebrig.php +++ b/conf/ext/thebrig/extensions_thebrig.php @@ -207,7 +207,7 @@ function() ">  ">  "> - ">  + ">  ">  ">    diff --git a/conf/ext/thebrig/extensions_thebrig_edit.php b/conf/ext/thebrig/extensions_thebrig_edit.php index 645e85f..0e3435e 100644 --- a/conf/ext/thebrig/extensions_thebrig_edit.php +++ b/conf/ext/thebrig/extensions_thebrig_edit.php @@ -68,6 +68,8 @@ $pconfig['if'] = $a_jail[$cnid]['if']; $pconfig['ipaddr'] = $a_jail[$cnid]['ipaddr']; $pconfig['subnet'] = $a_jail[$cnid]['subnet']; + $pconfig['ip6addr'] = $a_jail[$cnid]['ip6addr']; + $pconfig['subnet6'] = $a_jail[$cnid]['subnet6']; $pconfig['jailpath'] = $a_jail[$cnid]['jailpath']; $pconfig['jail_mount'] = isset($a_jail[$cnid]['jail_mount']); $pconfig['devfs_enable'] = isset($a_jail[$cnid]['devfs_enable']); @@ -117,6 +119,8 @@ $pconfig['if'] = ""; $pconfig['ipaddr'] = ""; $pconfig['subnet'] = "32"; + $pconfig['ip6addr'] = ""; + $pconfig['subnet6'] = "64"; $pconfig['jailpath']=""; $pconfig['jail_mount'] = true; $pconfig['devfs_enable'] = true; @@ -184,7 +188,12 @@ // Check to see if duplicate ip addresses: $index = array_search_ex($pconfig['ipaddr'], $a_jail, "ipaddr"); - if ( FALSE !== $index ) { + if(isset($pconfig['ip6addr'])) + $index6 = array_search_ex($pconfig['ip6addr'], $a_jail, "ip6addr"); + else + $index6= FALSE; + + if ( FALSE !== $index || FALSE !== $index6 ) { // If $index is not null, then there is a name conflict if (!(isset($uuid) && (FALSE !== $cnid ))) // This means we are not editing an existing jail - we are creating a new one @@ -314,6 +323,8 @@ $jail['if'] = $pconfig['if']; $jail['ipaddr'] = $pconfig['ipaddr']; $jail['subnet'] = $pconfig['subnet']; + $jail['ip6addr'] = $pconfig['ip6addr']; + $jail['subnet6'] = $pconfig['subnet6']; $jail['jailpath'] = $pconfig['jailpath']; $jail['devfsrules'] = $pconfig['dst']; $jail['jail_mount'] = isset($pconfig['jail_mount']) ? true : false; @@ -470,7 +481,8 @@ function source_change() { 'Slim','full'=> 'Full'), gettext("Choose jail type"), true,isset($uuid) && (FALSE !== $cnid),"type_change()");?> "LAN"); for ($i = 1; isset($config['interfaces']['opt' . $i]); ++$i) { $a_interface[$config['interfaces']['opt' . $i]['if']] = $config['interfaces']['opt' . $i]['descr']; }?> - + + diff --git a/conf/ext/thebrig/extensions_thebrig_tools.php b/conf/ext/thebrig/extensions_thebrig_tools.php index 86f70b6..c70a2bd 100644 --- a/conf/ext/thebrig/extensions_thebrig_tools.php +++ b/conf/ext/thebrig/extensions_thebrig_tools.php @@ -148,7 +148,7 @@ $prsconfig['thebrig'] = array ("0" =>"uuid", "1" => "enable", "2"=>"jailno", "3"=>"jailname", "4"=>"if", "5"=>"ipaddr", "6"=>"subnet", "7"=>"jailpath", "8"=>"dst", "9"=>"jail_mount", "10"=> "devfs_enable", "11"=> "proc_enable", "12"=> "fdescfs_enable", "13"=>"fstab", "14"=>"exec_start", "15"=>"afterstart0", "16"=>"afterstart1", "17"=>"exec_stop", "18"=>"extraoptions", "19"=>"desc", "20"=>"base_ver", "21"=>"lib_ver", "22"=>"src_ver", "23"=>"doc_ver", "24"=>"image", "25"=>"image_type", "26"=>"attach_params", "27"=>"attach_blocking", - "28"=>"force_blocking", "29"=>"zfs_datasets", "30"=>"fib", "31"=>"type", ); + "28"=>"force_blocking", "29"=>"zfs_datasets", "30"=>"fib", "31"=>"type", "32"=>"ip6addr", "33"=>"subnet6"); // add array startonboot for ($j=0; $j<(count($matches1));){ diff --git a/conf/ext/thebrig/functions.inc b/conf/ext/thebrig/functions.inc index 9db3eb6..7c90c78 100644 --- a/conf/ext/thebrig/functions.inc +++ b/conf/ext/thebrig/functions.inc @@ -721,7 +721,10 @@ foreach ($testarray as $out_jail ) { fwrite ($handle, "jail_{$out_jail['jailname']}_rootdir=\"{$out_jail['jailpath']}\"\n"); fwrite ($handle, "jail_{$out_jail['jailname']}_hostname=\"{$out_jail['jailname']}.{$config['system']['domain']}\"\n"); fwrite ($handle, "jail_{$out_jail['jailname']}_interface=\"{$out_jail['if']}\"\n"); - fwrite ($handle, "jail_{$out_jail['jailname']}_ip=\"{$out_jail['ipaddr']}/{$out_jail['subnet']}\"\n"); + $ipstring=$out_jail['ipaddr']."/".$out_jail['subnet']; + if(isset($out_jail['ip6addr'])) + $ipstring .= $out_jail['ip6addr']."/".$out_jail['subnet6']; + fwrite ($handle, "jail_{$out_jail['jailname']}_ip=\"{$ipstring}\"\n"); fwrite ($handle, "jail_{$out_jail['jailname']}_exec_start=\"{$out_jail['exec_start']}\"\n"); fwrite ($handle, "jail_{$out_jail['jailname']}_exec_afterstart0=\"{$out_jail['afterstart0']}\"\n"); fwrite ($handle, "jail_{$out_jail['jailname']}_exec_afterstart1=\"{$out_jail['afterstart1']}\"\n"); From e8c00594a94a0ed056d022c660b196d65db7b049 Mon Sep 17 00:00:00 2001 From: Nicolas REBIERRE Date: Sun, 1 Dec 2013 00:14:05 +0100 Subject: [PATCH 2/2] bugfix: missing coma before ipv6 address in /etc/rc.conf.local --- conf/ext/thebrig/extensions_thebrig.php | 2 +- conf/ext/thebrig/functions.inc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/ext/thebrig/extensions_thebrig.php b/conf/ext/thebrig/extensions_thebrig.php index bc57942..02b4b88 100644 --- a/conf/ext/thebrig/extensions_thebrig.php +++ b/conf/ext/thebrig/extensions_thebrig.php @@ -207,7 +207,7 @@ function() ">  ">  "> - ">  + ">  ">  ">    diff --git a/conf/ext/thebrig/functions.inc b/conf/ext/thebrig/functions.inc index 7c90c78..3a045d9 100644 --- a/conf/ext/thebrig/functions.inc +++ b/conf/ext/thebrig/functions.inc @@ -723,7 +723,7 @@ foreach ($testarray as $out_jail ) { fwrite ($handle, "jail_{$out_jail['jailname']}_interface=\"{$out_jail['if']}\"\n"); $ipstring=$out_jail['ipaddr']."/".$out_jail['subnet']; if(isset($out_jail['ip6addr'])) - $ipstring .= $out_jail['ip6addr']."/".$out_jail['subnet6']; + $ipstring .= ",".$out_jail['ip6addr']."/".$out_jail['subnet6']; fwrite ($handle, "jail_{$out_jail['jailname']}_ip=\"{$ipstring}\"\n"); fwrite ($handle, "jail_{$out_jail['jailname']}_exec_start=\"{$out_jail['exec_start']}\"\n"); fwrite ($handle, "jail_{$out_jail['jailname']}_exec_afterstart0=\"{$out_jail['afterstart0']}\"\n");