Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipv6 address support #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conf/ext/thebrig/extensions_thebrig.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function()
<td class="<?=$enable?"listr":"listrd";?>"><?=htmlspecialchars($jail['jailname']);?>&nbsp;</td>
<td class="<?=$enable?"listr":"listrd";?>"><?=htmlspecialchars(empty($jail['if']) ? "*" : $jail['if']);?>&nbsp;</td>
<td class="<?=$enable?"listlr":"listlrd";?>"><?=htmlspecialchars(isset($jail['enable']) ? "YES" : "NO");?></td>
<td class="<?=$enable?"listr":"listrd";?>"><?=htmlspecialchars($jail['ipaddr'] . " / " . $jail['subnet']) ;?>&nbsp;</td>
<td class="<?=$enable?"listr":"listrd";?>"><?=htmlspecialchars($jail['ipaddr'] . " / " . $jail['subnet'] . (isset($jail['ip6addr']) ? (",".$jail['ip6addr']."/".$jail['subnet6']) : "")) ;?>&nbsp;</td>
<td class="<?=$enable?"listrc":"listrcd";?>"><?=htmlspecialchars($jail['jailname'] . "." . $config['system']['domain']);?>&nbsp;</td>
<td class="<?=$enable?"listr":"listrd";?>"><?=htmlspecialchars($jail['jailpath']);?>&nbsp;</td>
<td class="listbg"><?=htmlspecialchars($jail['desc']);?>&nbsp;</td>
Expand Down
16 changes: 14 additions & 2 deletions conf/ext/thebrig/extensions_thebrig_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -470,7 +481,8 @@ function source_change() {
<?php html_combobox("jail_type", gettext("Jail Type"), $pconfig['type'], array('slim' =>'Slim','full'=> 'Full'), gettext("Choose jail type"), true,isset($uuid) && (FALSE !== $cnid),"type_change()");?>
<?php $a_interface = array(get_ifname($config['interfaces']['lan']['if']) => "LAN"); for ($i = 1; isset($config['interfaces']['opt' . $i]); ++$i) { $a_interface[$config['interfaces']['opt' . $i]['if']] = $config['interfaces']['opt' . $i]['descr']; }?>
<?php html_combobox("if", gettext("Jail Interface"), $pconfig['if'], $a_interface, gettext("Choose jail interface"), true);?>
<?php html_ipv4addrbox("ipaddr", "subnet", gettext("Jail IP address"), $pconfig['ipaddr'], $pconfig['subnet'], "", true);?>
<?php html_ipv4addrbox("ipaddr", "subnet", gettext("Jail IPv4 address"), $pconfig['ipaddr'], $pconfig['subnet'], "", true);?>
<?php html_ipv6addrbox("ip6addr", "subnet6", gettext("Jail IPv6 address"), $pconfig['ip6addr'], $pconfig['subnet6'], "", true);?>
<?php html_checkbox("enable", gettext("Jail start on boot"), !empty($pconfig['enable']) ? true : false, gettext("Enable"), "");?>
<?php html_inputbox("jailpath", gettext("Jail Location"), $pconfig['jailpath'], gettext("Sets an alternate location for the jail. Default is {$config['thebrig']['rootfolder']}{jail_name}/."), false, 40,isset($uuid) && (FALSE !== $cnid) && $path_ro);?>
<?php html_separator();?>
Expand Down
2 changes: 1 addition & 1 deletion conf/ext/thebrig/extensions_thebrig_tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));){
Expand Down
5 changes: 4 additions & 1 deletion conf/ext/thebrig/functions.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down