Class: Dcmgr::VNet::Tasks::AcceptARPFromFriends

Inherits:
Dcmgr::VNet::Task show all
Includes:
Netfilter
Defined in:
lib/dcmgr/vnet/tasks/accept_arp_from_friends.rb

Overview

Explicitely allows ARP traffic between “friend” instances Friends are decided by an Isolator class

Instance Attribute Summary collapse

Attributes inherited from Dcmgr::VNet::Task

#rules

Instance Method Summary collapse

Constructor Details

#initialize(inst_ip, friend_ips, enable_logging, log_prefix) ⇒ AcceptARPFromFriends

Returns a new instance of AcceptARPFromFriends.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/dcmgr/vnet/tasks/accept_arp_from_friends.rb', line 16

def initialize(inst_ip,friend_ips,enable_logging,log_prefix)
  super()
  
  @enable_logging = enable_logging
  @log_prefix = log_prefix
  @inst_ip = inst_ip
  @friend_ips = friend_ips
  
  friend_ips.each { |friend_ip|
    # Log traffic
    self.rules << EbtablesRule.new(:filter,:forward,:arp,:incoming,"--protocol arp --arp-ip-src #{friend_ip} --arp-ip-dst #{self.inst_ip} --log-ip --log-arp --log-prefix '#{self.log_prefix}'       -j CONTINUE") if self.enable_logging
    self.rules << EbtablesRule.new(:filter,:forward,:arp,:incoming,"--protocol arp --arp-ip-src #{friend_ip} --arp-ip-dst #{self.inst_ip} -j ACCEPT")
  }
end

Instance Attribute Details

#enable_loggingObject (readonly)

Returns the value of attribute enable_logging.



13
14
15
# File 'lib/dcmgr/vnet/tasks/accept_arp_from_friends.rb', line 13

def enable_logging
  @enable_logging
end

#friend_ipsObject (readonly)

Returns the value of attribute friend_ips.



12
13
14
# File 'lib/dcmgr/vnet/tasks/accept_arp_from_friends.rb', line 12

def friend_ips
  @friend_ips
end

#inst_ipObject (readonly)

Returns the value of attribute inst_ip.



11
12
13
# File 'lib/dcmgr/vnet/tasks/accept_arp_from_friends.rb', line 11

def inst_ip
  @inst_ip
end

#log_prefixObject (readonly)

Returns the value of attribute log_prefix.



14
15
16
# File 'lib/dcmgr/vnet/tasks/accept_arp_from_friends.rb', line 14

def log_prefix
  @log_prefix
end