Class: Dcmgr::VNet::Netfilter::EbtablesRule
- Defined in:
- lib/dcmgr/vnet/netfilter/ebtables_rule.rb
Instance Attribute Summary collapse
-
#bound ⇒ Object
Should be either :incoming or :outgoing.
-
#chain ⇒ Object
Override the chain getter to allow us to handle premade chains with symbols instead of all caps strings.
-
#protocol ⇒ Object
Returns the value of attribute protocol.
-
#rule ⇒ Object
Returns the value of attribute rule.
-
#table ⇒ Object
Returns the value of attribute table.
Class Method Summary collapse
-
.log_arp(prefix) ⇒ Object
Little static method that returns the part of an ebtables rule required for logging arp.
-
.protocols ⇒ Object
Getter for a hashmap of ebtables protocols.
Instance Method Summary collapse
-
#initialize(table = nil, chain = nil, protocol = nil, bound = nil, rule = nil) ⇒ EbtablesRule
constructor
A new instance of EbtablesRule.
Constructor Details
#initialize(table = nil, chain = nil, protocol = nil, bound = nil, rule = nil) ⇒ EbtablesRule
Returns a new instance of EbtablesRule.
15 16 17 18 19 20 21 22 23 |
# File 'lib/dcmgr/vnet/netfilter/ebtables_rule.rb', line 15 def initialize(table = nil, chain = nil, protocol = nil, bound = nil, rule = nil) super() raise ArgumentError, "table does not exist: #{table}" unless EbtablesChain.pre_made.keys.member?(table) self.table = table self.chain = chain self.protocol = protocol self.bound = bound self.rule = rule end |
Instance Attribute Details
#bound ⇒ Object
Should be either :incoming or :outgoing
12 13 14 |
# File 'lib/dcmgr/vnet/netfilter/ebtables_rule.rb', line 12 def bound @bound end |
#chain ⇒ Object
Override the chain getter to allow us to handle premade chains with symbols instead of all caps strings. ie, :forward instead of “FORWARD”
27 28 29 |
# File 'lib/dcmgr/vnet/netfilter/ebtables_rule.rb', line 27 def chain @chain end |
#protocol ⇒ Object
Returns the value of attribute protocol.
13 14 15 |
# File 'lib/dcmgr/vnet/netfilter/ebtables_rule.rb', line 13 def protocol @protocol end |
#rule ⇒ Object
Returns the value of attribute rule.
10 11 12 |
# File 'lib/dcmgr/vnet/netfilter/ebtables_rule.rb', line 10 def rule @rule end |
#table ⇒ Object
Returns the value of attribute table.
8 9 10 |
# File 'lib/dcmgr/vnet/netfilter/ebtables_rule.rb', line 8 def table @table end |
Class Method Details
.log_arp(prefix) ⇒ Object
Little static method that returns the part of an ebtables rule required for logging arp
36 37 38 |
# File 'lib/dcmgr/vnet/netfilter/ebtables_rule.rb', line 36 def self.log_arp(prefix) "--log-ip --log-arp --log-prefix '#{prefix}'" end |
.protocols ⇒ Object
Getter for a hashmap of ebtables protocols
41 42 43 44 45 46 47 48 |
# File 'lib/dcmgr/vnet/netfilter/ebtables_rule.rb', line 41 def self.protocols { 'ip4' => 'ip4', 'arp' => 'arp', #'ip6' => 'ip6', #'rarp' => '0x8035', } end |