summaryrefslogtreecommitdiff
path: root/lib/Vyatta
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@io.vyatta.com>2009-02-13 18:24:12 -0800
committerStig Thormodsrud <stig@io.vyatta.com>2009-02-13 18:24:12 -0800
commitf638fad8d8550624c2ea2928f562fb953a27456c (patch)
tree6aa5acee2371477ea55f7aa28b5db586824be118 /lib/Vyatta
parent95aa4b58d430551ec0087f1951f4a2d7e18a2497 (diff)
downloadvyatta-cfg-firewall-f638fad8d8550624c2ea2928f562fb953a27456c.tar.gz
vyatta-cfg-firewall-f638fad8d8550624c2ea2928f562fb953a27456c.zip
Add description and references to "show firewall group".
Diffstat (limited to 'lib/Vyatta')
-rwxr-xr-xlib/Vyatta/IpTables/IpSet.pm40
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/Vyatta/IpTables/IpSet.pm b/lib/Vyatta/IpTables/IpSet.pm
index 1f8e25b..5689f0a 100755
--- a/lib/Vyatta/IpTables/IpSet.pm
+++ b/lib/Vyatta/IpTables/IpSet.pm
@@ -259,6 +259,46 @@ sub delete_member {
return; # undef
}
+sub get_description {
+ my ($self) = @_;
+
+ return if ! $self->exists();
+ my $config = new Vyatta::Config;
+ my $group_type = "$self->{_type}-group";
+ $config->setLevel("firewall group $group_type $self->{_name}");
+ return $config->returnOrigValue('description');
+}
+
+sub get_firewall_references {
+ my ($self) = @_;
+
+ return if ! $self->exists();
+ my @fw_refs = ();
+ my $config = new Vyatta::Config;
+ foreach my $tree ('name', 'modify') {
+ my $path = "firewall $tree ";
+ $config->setLevel($path);
+ my @names = $config->listOrigNodes();
+ foreach my $name (@names) {
+ my $name_path = "$path $name rule ";
+ $config->setLevel($name_path);
+ my @rules = $config->listOrigNodes();
+ foreach my $rule (@rules) {
+ foreach my $dir ('source', 'destination') {
+ my $rule_path .= "$name_path $rule $dir group";
+ $config->setLevel($rule_path);
+ my $group_type = "$self->{_type}-group";
+ my $value = $config->returnOrigValue($group_type);
+ if (defined $value and $self->{_name} eq $value) {
+ push @fw_refs, "$name-$rule-$dir";
+ }
+ } # foreach $dir
+ } # foreach $rule
+ } # foreach $name
+ } # foreach $tree
+ return @fw_refs;
+}
+
sub rule {
my ($self, $direction) = @_;