Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
1206b9b7
Commit
1206b9b7
authored
Jan 09, 2016
by
Manuel Faux
Committed by
Franco Fichtner
Jan 10, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Firewall: added tooltip to used aliases
Tooltip shows description of alias.
parent
0b6f42c5
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
173 additions
and
39 deletions
+173
-39
util.inc
src/etc/inc/util.inc
+22
-0
firewall_nat.php
src/www/firewall_nat.php
+56
-13
firewall_nat_1to1.php
src/www/firewall_nat_1to1.php
+18
-4
firewall_nat_out.php
src/www/firewall_nat_out.php
+33
-12
firewall_rules.php
src/www/firewall_rules.php
+44
-10
No files found.
src/etc/inc/util.inc
View file @
1206b9b7
...
...
@@ -1004,6 +1004,28 @@ function alias_expand($name) {
}
}
/* get description of alias */
function
get_alias_description
(
$name
)
{
global
$config
;
if
(
is_alias
(
$name
))
{
if
(
isset
(
$config
[
'aliases'
][
'alias'
]))
{
foreach
(
$config
[
'aliases'
][
'alias'
]
as
$alias
)
{
if
(
$alias
[
'name'
]
==
$name
)
{
return
(
isset
(
$alias
[
'descr'
]))
?
$alias
[
'descr'
]
:
""
;
}
}
return
null
;
}
}
}
function
subnet_size
(
$subnet
)
{
if
(
is_subnetv4
(
$subnet
))
{
list
(
$ip
,
$bits
)
=
explode
(
"/"
,
$subnet
);
...
...
src/www/firewall_nat.php
View file @
1206b9b7
...
...
@@ -323,36 +323,70 @@ $( document ).ready(function() {
<td>
<?=strtoupper(
$natent['protocol']
);?>
</td>
<td class="
hidden
-
xs
hidden
-
sm
">
<?=htmlspecialchars(pprint_address(
$natent['source']
));?>
<?php if (isset(
$natent['source']['address']
) && is_alias(
$natent['source']['address']
)): ?>
<a href="
/
firewall_aliases_edit
.
php
?
name
=<?=
htmlspecialchars
(
$natent
[
'source'
][
'address'
]);
?>
">
<i
class=
"fa fa-list"
></i>
</a>
<span title="
<?=
htmlspecialchars
(
get_alias_description
(
$natent
[
'source'
][
'address'
]));
?>
" data-toggle="tooltip">
<?=
htmlspecialchars
(
pprint_address
(
$natent
[
'source'
]));
?>
</span>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$natent
[
'source'
][
'address'
]);
?>
"
title=
"
<?=
gettext
(
"edit alias"
);
?>
"
data-toggle=
"tooltip"
>
<i
class=
"fa fa-list"
></i>
</a>
<?php
else
:
?>
<?=
htmlspecialchars
(
pprint_address
(
$natent
[
'source'
]));
?>
<?php
endif
;
?>
</td>
<td
class=
"hidden-xs hidden-sm"
>
<?=
htmlspecialchars
(
pprint_port
(
$natent
[
'source'
][
'port'
]));
?>
<?php
if
(
is_alias
(
$natent
[
'source'
][
'port'
]))
:
?>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$natent
[
'source'
][
'port'
]);
?>
"
><i
class=
"fa fa-list"
></i>
</a>
<?php
if
(
isset
(
$natent
[
'source'
][
'port'
])
&&
is_alias
(
$natent
[
'source'
][
'port'
]))
:
?>
<span
title=
"
<?=
htmlspecialchars
(
get_alias_description
(
$natent
[
'source'
][
'port'
]));
?>
"
data-toggle=
"tooltip"
>
<?=
htmlspecialchars
(
pprint_port
(
$natent
[
'source'
][
'port'
]));
?>
</span>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$natent
[
'source'
][
'port'
]);
?>
"
title=
"
<?=
gettext
(
"edit alias"
);
?>
"
data-toggle=
"tooltip"
>
<i
class=
"fa fa-list"
></i>
</a>
<?php
else
:
?>
<?=
htmlspecialchars
(
pprint_port
(
isset
(
$natent
[
'source'
][
'port'
])
?
$natent
[
'source'
][
'port'
]
:
null
));
?>
<?php
endif
;
?>
</td>
<td
class=
"hidden-xs hidden-sm"
>
<?=
htmlspecialchars
(
pprint_address
(
$natent
[
'destination'
]));
?>
<?php
if
(
isset
(
$natent
[
'destination'
][
'address'
])
&&
is_alias
(
$natent
[
'destination'
][
'address'
]))
:
?>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$natent
[
'destination'
][
'address'
]);
?>
"
><i
class=
"fa fa-list"
></i>
</a>
<span
title=
"
<?=
htmlspecialchars
(
get_alias_description
(
$natent
[
'destination'
][
'address'
]));
?>
"
data-toggle=
"tooltip"
>
<?=
htmlspecialchars
(
pprint_address
(
$natent
[
'destination'
]));
?>
</span>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$natent
[
'destination'
][
'address'
]);
?>
"
title=
"
<?=
gettext
(
"edit alias"
);
?>
"
data-toggle=
"tooltip"
>
<i
class=
"fa fa-list"
></i>
</a>
<?php
else
:
?>
<?=
htmlspecialchars
(
pprint_address
(
$natent
[
'destination'
]));
?>
<?php
endif
;
?>
</td>
<td
class=
"hidden-xs hidden-sm"
>
<?=
htmlspecialchars
(
pprint_port
(
$natent
[
'destination'
][
'port'
]));
?>
<?php
if
(
is_alias
(
$natent
[
'destination'
][
'port'
]))
:
?>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$natent
[
'destination'
][
'port'
]);
?>
"
><i
class=
"fa fa-list"
></i>
</a>
<?php
if
(
isset
(
$natent
[
'destination'
][
'port'
])
&&
is_alias
(
$natent
[
'destination'
][
'port'
]))
:
?>
<span
title=
"
<?=
htmlspecialchars
(
get_alias_description
(
$natent
[
'destination'
][
'port'
]));
?>
"
data-toggle=
"tooltip"
>
<?=
htmlspecialchars
(
pprint_port
(
$natent
[
'destination'
][
'port'
]));
?>
</span>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$natent
[
'destination'
][
'port'
]);
?>
"
title=
"
<?=
gettext
(
"edit alias"
);
?>
"
data-toggle=
"tooltip"
>
<i
class=
"fa fa-list"
></i>
</a>
<?php
else
:
?>
<?=
htmlspecialchars
(
pprint_port
(
isset
(
$natent
[
'destination'
][
'port'
])
?
$natent
[
'destination'
][
'port'
]
:
null
));
?>
<?php
endif
;
?>
</td>
<td>
<?=
$natent
[
'target'
];
?>
<?php
if
(
is_alias
(
$natent
[
'target'
]))
:
?>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
$natent
[
'target'
];
?>
"
><i
class=
"fa fa-list"
></i>
</a>
<?php
endif
;
?>
</td>
<td>
<?php
$localport
=
$natent
[
'local-port'
];
...
...
@@ -362,11 +396,19 @@ $( document ).ready(function() {
$localport
.=
'-'
.
$localendport
;
}
?>
<?php
if
(
isset
(
$natent
[
'destination'
][
'port'
])
&&
is_alias
(
$natent
[
'destination'
][
'port'
]))
:
?>
<span
title=
"
<?=
htmlspecialchars
(
get_alias_description
(
$localport
));
?>
"
data-toggle=
"tooltip"
>
<?=
htmlspecialchars
(
pprint_port
(
$localport
));
?>
</span>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$localport
);
?>
"
title=
"
<?=
gettext
(
"edit alias"
);
?>
"
data-toggle=
"tooltip"
>
<i
class=
"fa fa-list"
></i>
</a>
<?php
else
:
?>
<?=
htmlspecialchars
(
pprint_port
(
$localport
));
?>
<?php
if
(
is_alias
(
$localport
))
:
?>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$localport
);
?>
"
><i
class=
"fa fa-list"
></i>
</a>
<?php
endif
;
?>
</td>
<td>
<?=
$natent
[
'descr'
];
?>
</td>
...
...
@@ -388,6 +430,7 @@ $( document ).ready(function() {
</tr>
<?php
$nnats
++
;
endforeach
;
?>
<tr>
<td
colspan=
"8"
></td>
<td
class=
"hidden-xs hidden-sm"
colspan=
"4"
>
</td>
<td>
...
...
src/www/firewall_nat_1to1.php
View file @
1206b9b7
...
...
@@ -231,15 +231,29 @@ $main_buttons = array(
<?php
endif
;
?>
</td>
<td>
<?=
pprint_address
(
$natent
[
'source'
]);
?>
<?php
if
(
isset
(
$natent
[
'source'
][
'address'
])
&&
is_alias
(
$natent
[
'source'
][
'address'
]))
:
?>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$natent
[
'source'
][
'address'
]);
?>
"
><i
class=
"fa fa-list"
></i>
</a>
<span
title=
"
<?=
htmlspecialchars
(
get_alias_description
(
$natent
[
'source'
][
'address'
]));
?>
"
data-toggle=
"tooltip"
>
<?=
htmlspecialchars
(
pprint_address
(
$natent
[
'source'
]));
?>
</span>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$natent
[
'source'
][
'address'
]);
?>
"
title=
"
<?=
gettext
(
"edit alias"
);
?>
"
data-toggle=
"tooltip"
>
<i
class=
"fa fa-list"
></i>
</a>
<?php
else
:
?>
<?=
htmlspecialchars
(
pprint_address
(
$natent
[
'source'
]));
?>
<?php
endif
;
?>
</td>
<td>
<?=
pprint_address
(
$natent
[
'destination'
]);
?>
<?php
if
(
isset
(
$natent
[
'destination'
][
'address'
])
&&
is_alias
(
$natent
[
'destination'
][
'address'
]))
:
?>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$natent
[
'destination'
][
'address'
]);
?>
"
><i
class=
"fa fa-list"
></i>
</a>
<span
title=
"
<?=
htmlspecialchars
(
get_alias_description
(
$natent
[
'destination'
][
'address'
]));
?>
"
data-toggle=
"tooltip"
>
<?=
htmlspecialchars
(
pprint_address
(
$natent
[
'destination'
]));
?>
</span>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$natent
[
'destination'
][
'address'
]);
?>
"
title=
"
<?=
gettext
(
"edit alias"
);
?>
"
data-toggle=
"tooltip"
>
<i
class=
"fa fa-list"
></i>
</a>
<?php
else
:
?>
<?=
htmlspecialchars
(
pprint_address
(
$natent
[
'destination'
]));
?>
<?php
endif
;
?>
</td>
<td>
...
...
src/www/firewall_nat_out.php
View file @
1206b9b7
...
...
@@ -363,9 +363,16 @@ include("head.inc");
<?=
htmlspecialchars
(
convert_friendly_interface_to_friendly_descr
(
$natent
[
'interface'
]));
?>
</td>
<td
class=
"hidden-xs hidden-sm"
>
<?=
$natent
[
'source'
][
'network'
]
==
"(self)"
?
"This Firewall"
:
$natent
[
'source'
][
'network'
];
?>
<?php
if
(
isset
(
$natent
[
'source'
][
'network'
])
&&
is_alias
(
$natent
[
'source'
][
'network'
]))
:
?>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$natent
[
'source'
][
'network'
]);
?>
"
><i
class=
"fa fa-list"
></i>
</a>
<span
title=
"
<?=
htmlspecialchars
(
get_alias_description
(
$natent
[
'source'
][
'network'
]));
?>
"
data-toggle=
"tooltip"
>
<?=
htmlspecialchars
(
$natent
[
'source'
][
'network'
]);
?>
</span>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$natent
[
'source'
][
'network'
]);
?>
"
title=
"
<?=
gettext
(
"edit alias"
);
?>
"
data-toggle=
"tooltip"
>
<i
class=
"fa fa-list"
></i>
</a>
<?php
else
:
?>
<?=
$natent
[
'source'
][
'network'
]
==
"(self)"
?
gettext
(
"This Firewall"
)
:
htmlspecialchars
(
$natent
[
'source'
][
'network'
]);
?>
<?php
endif
;
?>
</td>
<td
class=
"hidden-xs hidden-sm"
>
...
...
@@ -374,9 +381,16 @@ include("head.inc");
</td>
<td
class=
"hidden-xs hidden-sm"
>
<?=
isset
(
$natent
[
'destination'
][
'not'
])
?
"! "
:
""
;
?>
<?=
isset
(
$natent
[
'destination'
][
'any'
])
?
"*"
:
$natent
[
'destination'
][
'address'
]
;
?>
<?php
if
(
isset
(
$natent
[
'destination'
][
'address'
])
&&
is_alias
(
$natent
[
'destination'
][
'address'
]))
:
?>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$natent
[
'destination'
][
'address'
]);
?>
"
><i
class=
"fa fa-list"
></i>
</a>
<span
title=
"
<?=
htmlspecialchars
(
get_alias_description
(
$natent
[
'destination'
][
'address'
]));
?>
"
data-toggle=
"tooltip"
>
<?=
htmlspecialchars
(
$natent
[
'destination'
][
'address'
]);
?>
</span>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$natent
[
'destination'
][
'address'
]);
?>
"
title=
"
<?=
gettext
(
"edit alias"
);
?>
"
data-toggle=
"tooltip"
>
<i
class=
"fa fa-list"
></i>
</a>
<?php
else
:
?>
<?=
isset
(
$natent
[
'destination'
][
'any'
])
?
"*"
:
htmlspecialchars
(
$natent
[
'destination'
][
'address'
]);
?>
<?php
endif
;
?>
</td>
<td
class=
"hidden-xs hidden-sm"
>
...
...
@@ -395,9 +409,16 @@ include("head.inc");
else
$nat_address
=
$natent
[
'target'
];
?>
<?=
htmlspecialchars
(
$nat_address
);
?>
<?php
if
(
isset
(
$natent
[
'target'
])
&&
is_alias
(
$natent
[
'target'
]))
:
?>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$natent
[
'target'
]);
?>
"
><i
class=
"fa fa-list"
></i>
</a>
<span
title=
"
<?=
htmlspecialchars
(
get_alias_description
(
$natent
[
'target'
]));
?>
"
data-toggle=
"tooltip"
>
<?=
htmlspecialchars
(
$nat_address
);
?>
</span>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$natent
[
'target'
]);
?>
"
title=
"
<?=
gettext
(
"edit alias"
);
?>
"
data-toggle=
"tooltip"
>
<i
class=
"fa fa-list"
></i>
</a>
<?php
else
:
?>
<?=
htmlspecialchars
(
$nat_address
);
?>
<?php
endif
;
?>
</td>
<td
class=
"hidden-xs hidden-sm"
>
...
...
src/www/firewall_rules.php
View file @
1206b9b7
...
...
@@ -446,6 +446,7 @@ $( document ).ready(function() {
<
span
class
="
glyphicon
glyphicon
-
info
-
sign
<?=!
empty
(
$filterent
[
'disabled'
])
?
"text-muted"
:
""
?>
">
</span>
<?php
endif
;
?>
</td>
<td>
<?=
$record_ipprotocol
;
?>
<?php
...
...
@@ -479,30 +480,63 @@ $( document ).ready(function() {
<?php
endif
;
?>
</td>
<td>
<?=
htmlspecialchars
(
pprint_address
(
$filterent
[
'source'
]));
?>
<?php
if
(
isset
(
$filterent
[
'source'
][
'address'
])
&&
is_alias
(
$filterent
[
'source'
][
'address'
]))
:
?>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$filterent
[
'source'
][
'address'
]);
?>
"
><i
class=
"fa fa-list"
></i>
</a>
<span
title=
"
<?=
htmlspecialchars
(
get_alias_description
(
$filterent
[
'source'
][
'address'
]));
?>
"
data-toggle=
"tooltip"
>
<?=
htmlspecialchars
(
pprint_address
(
$filterent
[
'source'
]));
?>
</span>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$filterent
[
'source'
][
'address'
]);
?>
"
title=
"
<?=
gettext
(
"edit alias"
);
?>
"
data-toggle=
"tooltip"
>
<i
class=
"fa fa-list"
></i>
</a>
<?php
else
:
?>
<?=
htmlspecialchars
(
pprint_address
(
$filterent
[
'source'
]));
?>
<?php
endif
;
?>
</td>
<td
class=
"hidden-xs hidden-sm"
>
<?=
htmlspecialchars
(
pprint_port
(
isset
(
$filterent
[
'source'
][
'port'
])
?
$filterent
[
'source'
][
'port'
]
:
null
));
?>
<?php
if
(
isset
(
$filterent
[
'source'
][
'port'
])
&&
is_alias
(
$filterent
[
'source'
][
'port'
]))
:
?>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$filterent
[
'source'
][
'port'
]);
?>
"
><i
class=
"fa fa-list"
></i>
</a>
<span
title=
"
<?=
htmlspecialchars
(
get_alias_description
(
$filterent
[
'source'
][
'port'
]));
?>
"
data-toggle=
"tooltip"
>
<?=
htmlspecialchars
(
pprint_port
(
$filterent
[
'source'
][
'port'
]));
?>
</span>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$filterent
[
'source'
][
'port'
]);
?>
"
title=
"
<?=
gettext
(
"edit alias"
);
?>
"
data-toggle=
"tooltip"
>
<i
class=
"fa fa-list"
></i>
</a>
<?php
else
:
?>
<?=
htmlspecialchars
(
pprint_port
(
isset
(
$filterent
[
'source'
][
'port'
])
?
$filterent
[
'source'
][
'port'
]
:
null
));
?>
<?php
endif
;
?>
</td>
<td
class=
"hidden-xs hidden-sm"
>
<?=
htmlspecialchars
(
pprint_address
(
$filterent
[
'destination'
]));
?>
<?php
if
(
isset
(
$filterent
[
'destination'
][
'address'
])
&&
is_alias
(
$filterent
[
'destination'
][
'address'
]))
:
?>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$filterent
[
'destination'
][
'address'
]);
?>
"
><i
class=
"fa fa-list"
></i>
</a>
<span
title=
"
<?=
htmlspecialchars
(
get_alias_description
(
$filterent
[
'destination'
][
'address'
]));
?>
"
data-toggle=
"tooltip"
>
<?=
htmlspecialchars
(
pprint_address
(
$filterent
[
'destination'
]));
?>
</span>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$filterent
[
'destination'
][
'address'
]);
?>
"
title=
"
<?=
gettext
(
"edit alias"
);
?>
"
data-toggle=
"tooltip"
>
<i
class=
"fa fa-list"
></i>
</a>
<?php
else
:
?>
<?=
htmlspecialchars
(
pprint_address
(
$filterent
[
'destination'
]));
?>
<?php
endif
;
?>
</td>
<td
class=
"hidden-xs hidden-sm"
>
<?=
htmlspecialchars
(
pprint_port
(
isset
(
$filterent
[
'destination'
][
'port'
])
?
$filterent
[
'destination'
][
'port'
]
:
null
));
?>
<?php
if
(
isset
(
$filterent
[
'destination'
][
'port'
])
&&
is_alias
(
$filterent
[
'destination'
][
'port'
]))
:
?>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$filterent
[
'destination'
][
'port'
]);
?>
"
><i
class=
"fa fa-list"
></i>
</a>
<span
title=
"
<?=
htmlspecialchars
(
get_alias_description
(
$filterent
[
'destination'
][
'port'
]));
?>
"
data-toggle=
"tooltip"
>
<?=
htmlspecialchars
(
pprint_port
(
$filterent
[
'destination'
][
'port'
]));
?>
</span>
<a
href=
"/firewall_aliases_edit.php?name=
<?=
htmlspecialchars
(
$filterent
[
'destination'
][
'port'
]);
?>
"
title=
"
<?=
gettext
(
"edit alias"
);
?>
"
data-toggle=
"tooltip"
>
<i
class=
"fa fa-list"
></i>
</a>
<?php
else
:
?>
<?=
htmlspecialchars
(
pprint_port
(
isset
(
$filterent
[
'destination'
][
'port'
])
?
$filterent
[
'destination'
][
'port'
]
:
null
));
?>
<?php
endif
;
?>
</td>
<td
class=
"hidden-xs hidden-sm"
>
<?php
if
(
isset
(
$filterent
[
'gateway'
]))
:?>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment