CC: | mbr [...] cipherdyne.org |
Subject: | PATCH - IPTables::ChainMgr - 'mac_source' support |
Date: | Fri, 21 Nov 2008 17:03:56 -0500 |
To: | bug-IPTables-ChainMgr [...] rt.cpan.org |
From: | "Darien Kindlund" <darien [...] kindlund.com> |
Hello,
This is patch adds a 'mac_source' option to the %extended_info segment
for the applicable API functions. Please include in your next
release.
Thanks,
-- Darien
--- ChainMgr.pm.orig 2008-11-17 17:23:06.000000000 -0500
+++ ChainMgr.pm 2008-11-21 16:58:46.000000000 -0500
@@ -155,7 +155,7 @@
if ($extended_href) {
$msg = "Table: $table, chain: $chain, $normalized_src -> " .
"$normalized_dst ";
- for my $key qw(protocol s_port d_port) {
+ for my $key qw(protocol s_port d_port mac_source) {
$msg .= "$key $extended_href->{$key} "
if defined $extended_href->{$key};
}
@@ -182,11 +182,13 @@
$ipt_cmd .= "-d $normalized_dst ";
$ipt_cmd .= "--dport $extended_href->{'d_port'} "
if defined $extended_href->{'d_port'};
+ $ipt_cmd .= "-m mac --mac-source $extended_href->{'mac_source'} "
+ if defined $extended_href->{'mac_source'};
$ipt_cmd .= "-j $target";
$msg = "Table: $table, chain: $chain, added $normalized_src " .
"-> $normalized_dst ";
- for my $key qw(protocol s_port d_port) {
+ for my $key qw(protocol s_port d_port mac_source) {
$msg .= "$key $extended_href->{$key} "
if defined $extended_href->{$key};
}
@@ -242,7 +244,7 @@
if ($extended_href) {
$msg = "Table: $table, chain: $chain, $normalized_src -> " .
"$normalized_dst ";
- for my $key qw(protocol s_port d_port) {
+ for my $key qw(protocol s_port d_port mac_source) {
$msg .= "$key $extended_href->{$key} "
if defined $extended_href->{$key};
}
@@ -279,11 +281,13 @@
$ipt_cmd .= "-d $normalized_dst ";
$ipt_cmd .= "--dport $extended_href->{'d_port'} "
if defined $extended_href->{'d_port'};
+ $ipt_cmd .= "-m mac --mac-source $extended_href->{'mac_source'} "
+ if defined $extended_href->{'mac_source'};
$ipt_cmd .= "-j $target";
$msg = "Table: $table, chain: $chain, added $normalized_src " .
"-> $normalized_dst ";
- for my $key qw(protocol s_port d_port) {
+ for my $key qw(protocol s_port d_port mac_source) {
$msg .= "$key $extended_href->{$key} "
if defined $extended_href->{$key};
}
@@ -340,7 +344,7 @@
my $extended_msg = '';
if ($extended_href) {
- for my $key qw(protocol s_port d_port) {
+ for my $key qw(protocol s_port d_port mac_source) {
$extended_msg .= "$key: $extended_href->{$key} "
if defined $extended_href->{$key};
}