Sha256: a3ddd4282311e105c0d932af2bf9d04267369ef8debfd8a0a8e548f540e6df1b

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

# -*- coding: utf-8 -*-

module Dcmgr
  module VNet
    module Tasks
    
      # Explicitely allows ARP traffic between "friend" instances
      # Friends are decided by an Isolator class
      class AcceptARPFromFriends < Task
        include Dcmgr::VNet::Netfilter
        attr_reader :inst_ip
        attr_reader :friend_ips
        attr_reader :enable_logging
        attr_reader :log_prefix
        
        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
      end
    
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
wakame-vdc-agents-11.12.0 lib/dcmgr/vnet/tasks/accept_arp_from_friends.rb
wakame-vdc-dcmgr-11.12.0 lib/dcmgr/vnet/tasks/accept_arp_from_friends.rb